45#include "hydrodynamics/CompositeShape.hpp"
47#include "hydrodynamics/HydrodynamicsModel.hpp"
49#include "utils/simError.h"
53 CompositeShape::CompositeShape() { origin_ = V3Zero; }
55 CompositeShape::~CompositeShape() { Utils::deletePointers(shapes_); }
57 bool CompositeShape::isInterior(Vector3d pos) {
59 std::vector<Shape*>::iterator iter;
60 for (iter = shapes_.begin(); iter != shapes_.end(); ++iter) {
61 if ((*iter)->isInterior(pos)) {
70 template<
class Cont,
class Predict>
71 void swap_if(Cont& b1, Cont& b2, Predict predict) {
72 unsigned int size = b1.size();
73 assert(size == b2.size());
74 for (
unsigned int i = 0; i < size; ++i) {
75 if (predict(b1[i], b2[i])) std::swap(b1[i], b2[i]);
79 std::pair<Vector3d, Vector3d> CompositeShape::getBoundingBox() {
80 std::vector<Shape*>::iterator iter = shapes_.begin();
81 std::pair<Vector3d, Vector3d> boundary = (*iter)->getBoundingBox();
82 for (++iter; iter != shapes_.end(); ++iter) {
83 std::pair<Vector3d, Vector3d> currBoundary = (*iter)->getBoundingBox();
84 swap_if(boundary.first, currBoundary.first, std::greater<RealType>());
85 swap_if(boundary.second, currBoundary.second, std::less<RealType>());
91 HydroProp* CompositeShape::getHydroProp(RealType viscosity) {
92 HydroProp* props =
new HydroProp();
93 props->setCenterOfResistance(V3Zero);
94 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
95 "CompositeShape was asked to return an analytic HydroProps.\n");
96 painCave.severity = OPENMD_ERROR;
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.