11#ifndef GEOM_COMPLEXGEOMOBJECTS_H
12#define GEOM_COMPLEXGEOMOBJECTS_H
125 if (pivot ==
nullptr) {
144 double volume()
const override;
154 std::pair<util::Point, util::Point>
box()
const override;
159 std::pair<util::Point, util::Point>
160 box(
const double &tol)
const override;
197 const bool &within)
const override;
217 const std::pair<util::Point, util::Point> &
box)
const override;
225 const std::pair<util::Point, util::Point> &
box)
const override;
231 bool isNear(
const std::pair<util::Point, util::Point> &
box,
232 const double &tol)
const override;
239 const std::pair<util::Point, util::Point> &
box)
const override;
246 std::string
printStr(
int nt,
int lvl)
const override;
251 void print(
int nt,
int lvl)
const override {
268 std::vector<std::shared_ptr<GeomObject> >
d_obj;
303 std::vector<std::shared_ptr<GeomObject> > &obj,
304 std::vector<std::string> obj_flag, std::string description =
"")
315 else if (s ==
"minus")
318 throw std::invalid_argument(
320 <<
"Error: Check object flag " + s +
321 " passed to create ComplexGeomObject\n");
338 for (
const auto& obj : other.
d_obj) {
343 d_obj.push_back(std::shared_ptr<GeomObject>(raw_copy));
345 d_obj.push_back(
nullptr);
356 if (
this != &other) {
368 for (
const auto& obj : other.
d_obj) {
373 d_obj.push_back(std::shared_ptr<GeomObject>(raw_copy));
375 d_obj.push_back(
nullptr);
390 if (pivot ==
nullptr) {
394 for (
auto &obj :
d_obj) {
395 if (obj) obj->transform(translation, scale, angle, axis, pivot);
402 double volume()
const override;
412 std::pair<util::Point, util::Point>
box()
const override;
417 std::pair<util::Point, util::Point>
418 box(
const double &tol)
const override;
455 const bool &within)
const override;
475 const std::pair<util::Point, util::Point> &
box)
const override;
483 const std::pair<util::Point, util::Point> &
box)
const override;
489 bool isNear(
const std::pair<util::Point, util::Point> &
box,
490 const double &tol)
const override;
497 const std::pair<util::Point, util::Point> &
box)
const override;
504 std::string
printStr(
int nt,
int lvl)
const override;
509 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.
Collects a message with stream syntax for use in an exception.
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.