1
/////////////////////////////////////////////////////////////
3
// Copyright (c) 2007-2011 by The University of Queensland //
4
// Earth Systems Science Computational Centre (ESSCC) //
5
// http://www.uq.edu.au/esscc //
7
// Primary Business: Brisbane, Queensland, Australia //
8
// Licensed under the Open Software License version 3.0 //
9
// http://www.opensource.org/licenses/osl-3.0.php //
11
/////////////////////////////////////////////////////////////
13
#include "ShapeList.h"
14
#include "HexAggregateShape.h"
16
void ShapeList::addHexShape(int bias, int random) {
17
HexAggregateShape shape;
19
shape.makeOrientationRandom(random);
20
shapeList.push_back(&shape);
23
void ShapeList::insertShape(Vector3 pos, double radius, MNTable3D* ntable, int tag, int id) {
24
std::vector<int> biasList;
27
// at all bias values.
28
for(i=0; i < shapeList.size() ; i++) {
29
int currBias = shapeList[i]->bias();
30
biasTotal = biasTotal + currBias;
31
biasList.push_back ( currBias );
34
if ( biasTotal == 0 ) {
38
// at a random value to select a shape
39
int randomValue = rand() % biasTotal;
41
// Find appropriate shape in list.
42
while ( randomValue > shapeList[i]->bias() ) {
43
randomValue = randomValue - shapeList[i]->bias();
45
if (i == shapeList.size() ) {
46
std::cerr << "Error in ShapeList::insertShape :> randomValue too high\n";
50
shapeList[i]->insert(pos, radius, ntable, tag,id);
54
void ShapeList::addGenericShape(string db, string name, int bias, int random,
55
int particleTag, int bondTag) {
56
shapeList.push_back(new GenericShape(db,name));
57
Shape *shape = shapeList[shapeList.size()-1];
59
shape->makeOrientationRandom(random);
60
shape->setParticleTag(particleTag);
61
shape->setBondTag(bondTag);