11#ifndef GEOM_COMPLEXGEOMOBJECTS_H
12#define GEOM_COMPLEXGEOMOBJECTS_H
124 if (pivot ==
nullptr) {
143 double volume()
const override;
153 std::pair<util::Point, util::Point>
box()
const override;
158 std::pair<util::Point, util::Point>
159 box(
const double &tol)
const override;
196 const bool &within)
const override;
216 const std::pair<util::Point, util::Point> &
box)
const override;
224 const std::pair<util::Point, util::Point> &
box)
const override;
230 bool isNear(
const std::pair<util::Point, util::Point> &
box,
231 const double &tol)
const override;
238 const std::pair<util::Point, util::Point> &
box)
const override;
245 std::string
printStr(
int nt,
int lvl)
const override;
250 void print(
int nt,
int lvl)
const override {
267 std::vector<std::shared_ptr<GeomObject> >
d_obj;
302 std::vector<std::shared_ptr<GeomObject> > &obj,
303 std::vector<std::string> obj_flag, std::string description =
"")
314 else if (s ==
"minus")
318 <<
"Error: Check object flag " + s +
319 " passed to create ComplexGeomObject\n";
337 for (
const auto& obj : other.
d_obj) {
342 d_obj.push_back(std::shared_ptr<GeomObject>(raw_copy));
344 d_obj.push_back(
nullptr);
355 if (
this != &other) {
367 for (
const auto& obj : other.
d_obj) {
372 d_obj.push_back(std::shared_ptr<GeomObject>(raw_copy));
374 d_obj.push_back(
nullptr);
389 if (pivot ==
nullptr) {
393 for (
auto &obj :
d_obj) {
394 if (obj) obj->transform(translation, scale, angle, axis, pivot);
401 double volume()
const override;
411 std::pair<util::Point, util::Point>
box()
const override;
416 std::pair<util::Point, util::Point>
417 box(
const double &tol)
const override;
454 const bool &within)
const override;
474 const std::pair<util::Point, util::Point> &
box)
const override;
482 const std::pair<util::Point, util::Point> &
box)
const override;
488 bool isNear(
const std::pair<util::Point, util::Point> &
box,
489 const double &tol)
const override;
496 const std::pair<util::Point, util::Point> &
box)
const override;
503 std::string
printStr(
int nt,
int lvl)
const override;
508 void print(
int nt,
int lvl)
const override {
Defines annulus rectangle.
void print() const override
Prints the information about the object.
std::string printStr(int nt, int lvl) const override
Returns the string containing printable information about the object.
AnnulusGeomObject(GeomObject *in, GeomObject *out, std::string description="")
Constructor.
bool doesIntersect(const util::Point &x) const override
Checks if point lies exactly on the boundary.
AnnulusGeomObject & operator=(const AnnulusGeomObject &other)
Assignment operator.
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.
AnnulusGeomObject()
Constructor.
~AnnulusGeomObject()
Destructor.
AnnulusGeomObject(const AnnulusGeomObject &other)
Copy constructor.
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.
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
size_t d_dim
Dimension objects live in.
void print(int nt, int lvl) const override
Prints the information about the object.
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
Defines complex geometrical object.
void print() const override
Prints the information about the object.
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.
ComplexGeomObject(const ComplexGeomObject &other)
Copy constructor.
std::vector< int > d_objFlagInt
Object integer flags. Here, +1 means object is filling and -1 means object is void.
void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint) override
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.
ComplexGeomObject & operator=(const ComplexGeomObject &other)
Assignment operator.
bool isNearBoundary(const util::Point &x, const double &tol, const bool &within) const override
cons
void print(int nt, int lvl) const override
Prints the information about the object.
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.
ComplexGeomObject(std::vector< std::shared_ptr< GeomObject > > &obj, std::vector< std::string > obj_flag, std::string description="")
Constructor.
ComplexGeomObject()
Constructor.
Defines abstract geometrical domain.
virtual void transform(const util::Point &translation, const double &scale, const double &angle, const util::Point &axis, const util::Point *rotationPoint=nullptr)
Similarity about pivot (default: old center d_x), then rigid displacement = translation: ....
std::vector< std::string > d_tags
Tags/attributes about the object.
virtual util::Point center() const
Computes the center of object.
const std::string d_name
name of object
const std::string d_description
Further description of object.
GeomObject * createGeomDeepCopy(GeomObject *obj)
Creates a deep copy of a geometric object.
size_t getGeomTypeToDim(std::string type)
Returns list of acceptable geometries for PeriDEM simulation.
A structure to represent 3d vectors.