45#include "hydrodynamics/RoughShell.hpp"
48#include "hydrodynamics/ShapeBuilder.hpp"
58 struct ExteriorFunctor {
59 bool operator()(
const BeadLattice& bead) {
return !bead.interior; }
62 struct InteriorFunctor {
63 bool operator()(
const BeadLattice& bead) {
return bead.interior; }
66 std::size_t RoughShell::assignElements() {
67 std::pair<Vector3d, Vector3d> boxBoundary = shape_->getBoundingBox();
68 RealType firstMin = std::min(
69 std::min(floor(boxBoundary.first[0]), floor(boxBoundary.first[1])),
70 floor(boxBoundary.first[2]));
71 RealType secondMax = std::max(
72 std::max(ceil(boxBoundary.second[0]), ceil(boxBoundary.second[1])),
73 ceil(boxBoundary.second[2]));
76 int len = secondMax - firstMin;
81 int numLattices = ceil(len / sigma_) + 2;
86 Grid3D<BeadLattice> grid(numLattices, numLattices, numLattices);
89 for (
int i = 0; i < numLattices; ++i) {
90 for (
int j = 0; j < numLattices; ++j) {
91 for (
int k = 0; k < numLattices; ++k) {
92 BeadLattice& currentBead = grid(i, j, k);
94 Vector3d((i - 1) * sigma_ + floor(boxBoundary.first[0]),
95 (j - 1) * sigma_ + floor(boxBoundary.first[1]),
96 (k - 1) * sigma_ + floor(boxBoundary.first[2]));
97 currentBead.radius = sigma_ / 2.0;
98 currentBead.interior = shape_->isInterior(grid(i, j, k).origin);
105 for (
int i = 0; i < numLattices; ++i) {
106 for (
int j = 0; j < numLattices; ++j) {
107 for (
int k = 0; k < numLattices; ++k) {
108 std::vector<BeadLattice> neighborCells =
109 grid.getAllNeighbors(i, j, k);
113 if (grid(i, j, k).interior) {
114 bool allNeighborsAreInterior =
true;
115 for (std::vector<BeadLattice>::iterator l = neighborCells.begin();
116 l != neighborCells.end(); ++l) {
118 allNeighborsAreInterior =
false;
123 if (allNeighborsAreInterior)
128 HydrodynamicsElement surfaceBead;
131 surfaceBead.name =
"H";
132 surfaceBead.pos = grid(i, j, k).origin;
135 surfaceBead.radius = grid(i, j, k).radius;
136 elements_.push_back(surfaceBead);
141 return elements_.size();
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.