48#include "hydrodynamics/RoughShell.hpp"
51#include "hydrodynamics/ShapeBuilder.hpp"
61 struct ExteriorFunctor {
62 bool operator()(
const BeadLattice& bead) {
return !bead.interior; }
65 struct InteriorFunctor {
66 bool operator()(
const BeadLattice& bead) {
return bead.interior; }
69 std::size_t RoughShell::assignElements() {
70 std::pair<Vector3d, Vector3d> boxBoundary = shape_->getBoundingBox();
71 RealType firstMin = std::min(
72 std::min(floor(boxBoundary.first[0]), floor(boxBoundary.first[1])),
73 floor(boxBoundary.first[2]));
74 RealType secondMax = std::max(
75 std::max(ceil(boxBoundary.second[0]), ceil(boxBoundary.second[1])),
76 ceil(boxBoundary.second[2]));
79 int len = secondMax - firstMin;
84 int numLattices = ceil(len / sigma_) + 2;
89 Grid3D<BeadLattice> grid(numLattices, numLattices, numLattices);
92 for (
int i = 0; i < numLattices; ++i) {
93 for (
int j = 0; j < numLattices; ++j) {
94 for (
int k = 0; k < numLattices; ++k) {
95 BeadLattice& currentBead = grid(i, j, k);
97 Vector3d((i - 1) * sigma_ + floor(boxBoundary.first[0]),
98 (j - 1) * sigma_ + floor(boxBoundary.first[1]),
99 (k - 1) * sigma_ + floor(boxBoundary.first[2]));
100 currentBead.radius = sigma_ / 2.0;
101 currentBead.interior = shape_->isInterior(grid(i, j, k).origin);
108 for (
int i = 0; i < numLattices; ++i) {
109 for (
int j = 0; j < numLattices; ++j) {
110 for (
int k = 0; k < numLattices; ++k) {
111 std::vector<BeadLattice> neighborCells =
112 grid.getAllNeighbors(i, j, k);
116 if (grid(i, j, k).interior) {
117 bool allNeighborsAreInterior =
true;
118 for (std::vector<BeadLattice>::iterator l = neighborCells.begin();
119 l != neighborCells.end(); ++l) {
121 allNeighborsAreInterior =
false;
126 if (allNeighborsAreInterior)
131 HydrodynamicsElement surfaceBead;
134 surfaceBead.name =
"H";
135 surfaceBead.pos = grid(i, j, k).origin;
138 surfaceBead.radius = grid(i, j, k).radius;
139 elements_.push_back(surfaceBead);
144 return elements_.size();
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.