45#include "hydrodynamics/AtomicBeadModel.hpp"
47#include "hydrodynamics/CompositeShape.hpp"
48#include "hydrodynamics/Sphere.hpp"
52 std::size_t AtomicBeadModel::assignElements() {
54 if (shape_->isComposite()) {
55 createBeads(
dynamic_cast<CompositeShape*
>(shape_));
57 if (shape_->isSpherical()) {
58 createSingleBead(
dynamic_cast<Sphere*
>(shape_));
61 painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
62 "AtomicBeadModel::assignElements Error: GayBerne and other "
64 "\tatoms should use the RoughShell or BoundaryElement models\n");
65 painCave.severity = OPENMD_ERROR;
70 return elements_.size();
75 void AtomicBeadModel::createBeads(Shape* shape) {
77 if (shape->isComposite()) {
78 std::vector<Shape*> shapes =
79 dynamic_cast<CompositeShape*
>(shape)->getShapes();
80 for (std::vector<Shape*>::iterator i = shapes.begin();
81 i != shapes.end(); ++i) {
82 if ((*i)->isComposite()) {
83 createBeads(
dynamic_cast<CompositeShape*
>((*i)));
85 if ((*i)->isSpherical()) {
86 createSingleBead(
dynamic_cast<Sphere*
>((*i)));
88 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
89 "AtomicBeadModel::createBeads Error: GayBerne and other "
91 "\tatoms should use the RoughShell or BoundaryElement "
93 painCave.severity = OPENMD_ERROR;
100 if (shape->isSpherical()) {
101 createSingleBead(
dynamic_cast<Sphere*
>(shape_));
104 painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
105 "AtomicBeadModel::createBeads Error: GayBerne and other "
107 "\tatoms should use the RoughShell or BoundaryElement models\n");
108 painCave.severity = OPENMD_ERROR;
109 painCave.isFatal = 1;
116 bool AtomicBeadModel::createSingleBead(Sphere* sphere) {
117 HydrodynamicsElement currBead;
118 currBead.name = sphere->getName();
119 currBead.pos = sphere->getOrigin();
120 currBead.radius = sphere->getRadius();
121 elements_.push_back(currBead);
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.