21 const std::vector<double> ¶ms,
22 const std::vector<size_t> &num_params_needed) {
24 std::ostringstream oss;
26 oss <<
"Error: Number of parameters needed to create geometry = "
27 << geom_type <<
" are "
29 <<
". But the number of parameters provided are "
31 <<
" and the parameters are "
68 (
const double &tol)
const {
95 const double &tol)
const {
116 const std::pair<util::Point, util::Point> &box)
const {
126 const std::pair<util::Point, util::Point> &box)
const {
128 bool intersect =
false;
136 const std::pair<util::Point, util::Point> &box,
137 const double &tol)
const {
143 const std::pair<util::Point, util::Point> &box)
const {
158 std::ostringstream oss;
160 oss << tabS <<
"------- AnnulusGeomObject --------" << std::endl
162 oss << tabS <<
"Name = " <<
d_name << std::endl;
164 oss << tabS <<
"Inner object info:" << std::endl;
166 oss << tabS <<
"Outer object info:" << std::endl;
170 oss << tabS <<
"Bounding box: "
188 for (
size_t i = 0; i <
d_objFlag.size(); i++)
200 for (
size_t i = 0; i <
d_objFlag.size(); i++)
208 std::vector<double> vol_vec(
d_obj.size());
209 for (
size_t i = 0; i <
d_obj.size(); i++)
213 return d_obj[max_vol_obj]->center();
224 (
const double &tol)
const {
226 auto p1 =
d_obj[0]->box(tol).first;
227 auto p2 =
d_obj[0]->box(tol).second;
229 for (
size_t i = 1; i <
d_objFlag.size(); i++) {
231 auto q1 =
d_obj[i]->box(tol).first;
232 auto q2 =
d_obj[i]->box(tol).second;
234 for (
size_t i = 0; i < 3; i++) {
242 return std::make_pair(p1, p2);
248 return 0.5 * (
box.first -
box.second).length();
254 return 0.5 * (
box.first -
box.second).length();
262 bool point_inside =
d_obj[0]->isInside(x);
263 for (
size_t i = 1; i <
d_objFlag.size(); i++) {
265 const auto &obj_i =
d_obj[i];
267 point_inside = point_inside and !obj_i->isInside(x);
269 point_inside = point_inside or obj_i->isInside(x);
281 const double &tol)
const {
283 bool is_near =
d_obj[0]->isNear(x, tol);
284 for (
size_t i = 1; i <
d_objFlag.size(); i++) {
286 const auto &obj_i =
d_obj[i];
287 is_near = is_near or obj_i->isNear(x, tol);
298 bool is_near =
d_obj[0]->isNearBoundary(x, tol, within);
299 for (
size_t i = 1; i <
d_objFlag.size(); i++) {
301 const auto &obj_i =
d_obj[i];
302 is_near = is_near or obj_i->isNearBoundary(x, tol, within);
315 const std::pair<util::Point, util::Point> &box)
const {
325 const std::pair<util::Point, util::Point> &box)
const {
327 bool intersect =
false;
335 const std::pair<util::Point, util::Point> &box,
336 const double &tol)
const {
338 bool is_near =
d_obj[0]->isNear(
box, tol);
339 for (
size_t i = 1; i <
d_objFlag.size(); i++) {
341 const auto &obj_i =
d_obj[i];
342 is_near = is_near or obj_i->isNear(
box, tol);
349 const std::pair<util::Point, util::Point> &box)
const {
364 std::ostringstream oss;
366 oss << tabS <<
"------- ComplexGeomObject --------" << std::endl
368 oss << tabS <<
"Name = " <<
d_name << std::endl;
370 oss << tabS <<
"Object info:" << std::endl;
372 for (
const auto &p:
d_obj) {
373 oss << tabS <<
"Object id: " << ocount << std::endl;
374 oss << tabS <<
"Object flag: " <<
d_objFlag[ocount] << std::endl;
375 oss << tabS <<
"Object int flag: " <<
d_objFlagInt[ocount] << std::endl;
376 oss << p->printStr(nt + 1, lvl);
381 oss << tabS <<
"Bounding box: "
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
GeomObject * d_outObj_p
Outer object.
util::Point center() const override
Computes the center of object.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
size_t d_dim
Dimension objects live in.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
GeomObject * d_inObj_p
Inner object.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
bool isNear(const util::Point &x, const double &tol) const override
Checks if point is within given distance of this object.
bool isOutside(const util::Point &x) const override
Checks if point is outside of this object.
bool isInside(const util::Point &x) const override
Checks if point is inside this object.
double boundingRadius() const override
Computes the radius of smallest circle/sphere such that object can be fit into it.
std::vector< int > d_objFlagInt
Object integer flags. Here, +1 means object is filling and -1 means object is void.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
size_t d_dim
Dimension objects live in.
double inscribedRadius() const override
Computes the radius of biggest circle/sphere completely within the object.
double volume() const override
Computes the volume (area in 2d, length in 1d) of object.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
std::pair< util::Point, util::Point > box() const override
Computes the bounding box of object.
util::Point center() const override
Computes the center of object.
std::vector< std::string > d_objFlag
Object flag.
std::vector< std::shared_ptr< GeomObject > > d_obj
Object.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
virtual std::pair< util::Point, util::Point > box() const
Computes the bounding box of object.
virtual bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const
Checks if point is within given distance of this object.
virtual bool isNear(const util::Point &x, const double &tol) const
Checks if point is within given distance of this object.
virtual std::string printStr(int nt, int lvl) const
Returns the string containing printable information about the object.
virtual bool isInside(const util::Point &x) const
Checks if point is inside this object.
virtual double volume() const
Computes the volume (area in 2d, length in 1d) of object.
virtual util::Point center() const
Computes the center of object.
const std::string d_name
name of object
virtual double boundingRadius() const
Computes the radius of smallest circle/sphere such that object can be fit into it.
virtual double inscribedRadius() const
Computes the radius of biggest circle/sphere completely within the object.
std::string printErrMsg(const std::string &geom_type, const std::vector< double > ¶ms, const std::vector< size_t > &num_params_needed)
std::vector< util::Point > getCornerPoints(size_t dim, const std::pair< util::Point, util::Point > &box)
Returns all corner points in the box.
std::string printBoxStr(const std::pair< util::Point, util::Point > &box, int nt=print_default_tab)
Returns formatted string for output.
std::string getTabS(int nt)
Returns tab spaces of a given size.
std::string printStr(const T &msg, int nt=print_default_tab)
Returns formatted string for output.
size_t maxIndex(const std::vector< T > &data)
Returns the index corresponding to maximum from list of data.
bool isGreater(const double &a, const double &b)
Returns true if a > b.
A structure to represent 3d vectors.
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.