| 40 | 
  | 
 */ | 
| 41 | 
  | 
 | 
| 42 | 
  | 
#include "applications/hydrodynamics/RoughShell.hpp" | 
| 43 | 
< | 
 | 
| 43 | 
> | 
#include "applications/hydrodynamics/ShapeBuilder.hpp" | 
| 44 | 
> | 
#include "brains/SimInfo.hpp" | 
| 45 | 
  | 
namespace oopse { | 
| 46 | 
  | 
 | 
| 47 | 
< | 
RoughShell::RoughShell(StuntDouble* sd, const DynamicProperty& extraParams) : HydrodynamicsModel(sd, extraParams), sdShape_(sd){ | 
| 48 | 
< | 
    DynamicProperty::const_iterator iter = extraParams.find("Sigma"); | 
| 49 | 
< | 
    if (iter != extraParams.end()) { | 
| 50 | 
< | 
        boost::any param = iter->second; | 
| 51 | 
< | 
        sigma_ = boost::any_cast<double>(param); | 
| 47 | 
> | 
RoughShell::RoughShell(StuntDouble* sd, SimInfo* info) : ApproximationModel(sd, info){ | 
| 48 | 
> | 
    shape_=ShapeBuilder::createShape(sd); | 
| 49 | 
> | 
    Globals* simParams = info->getSimParams(); | 
| 50 | 
> | 
    if (simParams->haveBeadSize()) { | 
| 51 | 
> | 
        sigma_ = simParams->getBeadSize(); | 
| 52 | 
  | 
    }else { | 
| 53 | 
< | 
        std::cout << "RoughShell Model Error\n" ; | 
| 53 | 
> | 
 | 
| 54 | 
  | 
    } | 
| 55 | 
  | 
} | 
| 56 | 
  | 
 | 
| 76 | 
  | 
 | 
| 77 | 
  | 
}; | 
| 78 | 
  | 
bool RoughShell::createBeads(std::vector<BeadParam>& beads) { | 
| 79 | 
< | 
    std::pair<Vector3d, Vector3d> boxBoundary = sdShape_.getBox(); | 
| 79 | 
> | 
    std::pair<Vector3d, Vector3d> boxBoundary = shape_->getBox(); | 
| 80 | 
  | 
    double len = boxBoundary.second[0] - boxBoundary.first[0]; | 
| 81 | 
  | 
    int numLattices = static_cast<int>(len/sigma_) + 1; | 
| 82 | 
  | 
    Grid3D<BeadLattice>  grid(numLattices, numLattices, numLattices); | 
| 88 | 
  | 
                BeadLattice& currentBead = grid(i, j, k); | 
| 89 | 
  | 
                currentBead.origin = Vector3d(i*sigma_ + boxBoundary.first[0], j *sigma_ + boxBoundary.first[1], k*sigma_+ boxBoundary.first[2]); | 
| 90 | 
  | 
                currentBead.radius = sigma_; | 
| 91 | 
< | 
                currentBead.interior = sdShape_.isInterior(grid(i, j, k).origin);                 | 
| 91 | 
> | 
                currentBead.interior = shape_->isInterior(grid(i, j, k).origin);                 | 
| 92 | 
  | 
            } | 
| 93 | 
  | 
        } | 
| 94 | 
  | 
    } |