PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
geom::GeomObject Class Reference

Defines abstract geometrical domain. More...

#include <geomObjects.h>

Inheritance diagram for geom::GeomObject:
Collaboration diagram for geom::GeomObject:

Public Member Functions

 GeomObject (std::string name="", std::string description="")
 Constructor.
 
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.
 
virtual std::pair< util::Point, util::Pointbox () const
 Computes the bounding box of object.
 
virtual std::pair< util::Point, util::Pointbox (const double &tol) const
 Computes the bounding box of object.
 
virtual double inscribedRadius () const
 Computes the radius of biggest circle/sphere completely within the object.
 
virtual double boundingRadius () const
 Computes the radius of smallest circle/sphere such that object can be fit into it.
 
virtual std::string printStr (int nt, int lvl) const
 Returns the string containing printable information about the object.
 
virtual void print (int nt, int lvl) const
 Prints the information about the object.
 
virtual void print () const
 Prints the information about the object.
 
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 \(\mathbf p\) (default: old center d_x), then rigid displacement \(\mathbf t\) = translation: \(\mathbf y = \mathbf p + s\,\mathbf R(\mathbf x-\mathbf p) + \mathbf t\). When \(\theta=0\) and \(s=1\), \(\mathbf y = \mathbf x + \mathbf t\) for every point and the center.
 
virtual bool wallContactQuery (const util::Point &x, WallContactHit &hit) const
 Closest-point / signed-gap query for analytical wall contact. Default: unsupported (returns false, clears hit).
 
Interaction with point
virtual bool isInside (const util::Point &x) const
 Checks if point is inside this object.
 
virtual bool isOutside (const util::Point &x) const
 Checks if point is outside 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 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 doesIntersect (const util::Point &x) const
 Checks if point lies exactly on the boundary.
 
Interaction with box
virtual bool isInside (const std::pair< util::Point, util::Point > &box) const
 Checks if box is completely inside.
 
virtual bool isOutside (const std::pair< util::Point, util::Point > &box) const
 Checks if box is outside of the object.
 
virtual bool isNear (const std::pair< util::Point, util::Point > &box, const double &tol) const
 Checks if box is within given distance of this object.
 
virtual bool doesIntersect (const std::pair< util::Point, util::Point > &box) const
 Checks if box intersects this object.
 

Data Fields

const std::string d_name
 name of object
 
const std::string d_description
 Further description of object.
 
std::vector< std::string > d_tags
 Tags/attributes about the object.
 

Detailed Description

Defines abstract geometrical domain.

Definition at line 122 of file geomObjects.h.

Constructor & Destructor Documentation

◆ GeomObject()

geom::GeomObject::GeomObject ( std::string  name = "",
std::string  description = "" 
)
inlineexplicit

Constructor.

Parameters
nameName of the geometric object
descriptionDescription of object (e.g., further classification or any tag)

Definition at line 140 of file geomObjects.h.

142 : d_name(name), d_description(description) {
143 };
const std::string d_name
name of object
const std::string d_description
Further description of object.

Member Function Documentation

◆ boundingRadius()

virtual double geom::GeomObject::boundingRadius ( ) const
inlinevirtual

Computes the radius of smallest circle/sphere such that object can be fit into it.

Returns
Radius Radius of bounding circle/sphere

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::Plane, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 187 of file geomObjects.h.

187{ return 0.; };

Referenced by geom::AnnulusGeomObject::boundingRadius().

Here is the caller graph for this function:

◆ box() [1/2]

virtual std::pair< util::Point, util::Point > geom::GeomObject::box ( ) const
inlinevirtual

Computes the bounding box of object.

Returns
Pair Left-bottom-back and right-top-front corner points of box

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::Plane, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 161 of file geomObjects.h.

161 {
162 return {util::Point(), util::Point()};
163 };
A structure to represent 3d vectors.
Definition point.h:30

Referenced by geom::AnnulusGeomObject::box(), geom::AnnulusGeomObject::box(), and mesh_gen::anonymous_namespace{builtinGmshGeometry.cpp}::buildOccBoxFromAabb().

Here is the caller graph for this function:

◆ box() [2/2]

virtual std::pair< util::Point, util::Point > geom::GeomObject::box ( const double &  tol) const
inlinevirtual

Computes the bounding box of object.

Parameters
tolTolerance/padding used in creating bounding box
Returns
Pair Left-bottom-back and right-top-front corner points of box

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::Plane, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 171 of file geomObjects.h.

171 {
172 return {util::Point(), util::Point()};
173 };

◆ center()

virtual util::Point geom::GeomObject::center ( ) const
inlinevirtual

Computes the center of object.

Returns
Point Coordinates of center

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::Plane, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 155 of file geomObjects.h.

155{ return {}; };

Referenced by geom::AnnulusGeomObject::center(), and geom::AnnulusGeomObject::transform().

Here is the caller graph for this function:

◆ doesIntersect() [1/2]

virtual bool geom::GeomObject::doesIntersect ( const std::pair< util::Point, util::Point > &  box) const
inlinevirtual

Checks if box intersects this object.

Parameters
boxBox
Returns
True True if intersects

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 281 of file geomObjects.h.

282 {
283 return false;
284 };

◆ doesIntersect() [2/2]

virtual bool geom::GeomObject::doesIntersect ( const util::Point x) const
inlinevirtual

Checks if point lies exactly on the boundary.

Parameters
xPoint
Returns
True True if it lies on the boundary

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::Plane, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 236 of file geomObjects.h.

236{ return false; };

◆ inscribedRadius()

virtual double geom::GeomObject::inscribedRadius ( ) const
inlinevirtual

Computes the radius of biggest circle/sphere completely within the object.

Returns
Radius Radius of inscribed circle/sphere

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::Plane, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 180 of file geomObjects.h.

180{ return 0.; };

Referenced by geom::AnnulusGeomObject::inscribedRadius().

Here is the caller graph for this function:

◆ isInside() [1/2]

virtual bool geom::GeomObject::isInside ( const std::pair< util::Point, util::Point > &  box) const
inlinevirtual

Checks if box is completely inside.

Parameters
boxBox
Returns
True True if box lies inside

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 250 of file geomObjects.h.

250 {
251 return false;
252 };

◆ isInside() [2/2]

virtual bool geom::GeomObject::isInside ( const util::Point x) const
inlinevirtual

Checks if point is inside this object.

Parameters
xPoint
Returns
True If point lies inside

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::Plane, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 198 of file geomObjects.h.

198{ return false; };

Referenced by geom::AnnulusGeomObject::isInside().

Here is the caller graph for this function:

◆ isNear() [1/2]

virtual bool geom::GeomObject::isNear ( const std::pair< util::Point, util::Point > &  box,
const double &  tol 
) const
inlinevirtual

Checks if box is within given distance of this object.

Parameters
boxBox
tolTolerance used in checking the nearness
Returns
True True if box is inside within the tol distance

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 270 of file geomObjects.h.

271 {
272 return false;
273 };

◆ isNear() [2/2]

virtual bool geom::GeomObject::isNear ( const util::Point x,
const double &  tol 
) const
inlinevirtual

Checks if point is within given distance of this object.

Parameters
xPoint
tolTolerance used in checking the nearness
Returns
True True if within the tol distance

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::Plane, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 214 of file geomObjects.h.

214 {
215 return false;
216 };

Referenced by geom::AnnulusGeomObject::isNear(), and geom::AnnulusGeomObject::isNear().

Here is the caller graph for this function:

◆ isNearBoundary()

virtual bool geom::GeomObject::isNearBoundary ( const util::Point x,
const double &  tol,
const bool &  within 
) const
inlinevirtual

Checks if point is within given distance of this object.

Parameters
xPoint
tolTolerance used in checking the nearness
withinCheck if the point is within (inside) the object
Returns
True True if it is near within tol distance

Reimplemented in geom::Plane, geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 225 of file geomObjects.h.

226 {
227 return false;
228 };

Referenced by geom::AnnulusGeomObject::isNearBoundary().

Here is the caller graph for this function:

◆ isOutside() [1/2]

virtual bool geom::GeomObject::isOutside ( const std::pair< util::Point, util::Point > &  box) const
inlinevirtual

Checks if box is outside of the object.

Parameters
boxBox
Returns
True True if box lies outside

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 260 of file geomObjects.h.

260 {
261 return false;
262 };

◆ isOutside() [2/2]

virtual bool geom::GeomObject::isOutside ( const util::Point x) const
inlinevirtual

Checks if point is outside of this object.

Parameters
xPoint
Returns
True If point lies outside

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::Plane, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 206 of file geomObjects.h.

206{ return false; };

◆ print() [1/2]

virtual void geom::GeomObject::print ( ) const
inlinevirtual

Prints the information about the object.

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::NullGeomObject, geom::Plane, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 321 of file geomObjects.h.

321{ print(0, 0); };
virtual void print() const
Prints the information about the object.

References print().

Referenced by print().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print() [2/2]

virtual void geom::GeomObject::print ( int  nt,
int  lvl 
) const
inlinevirtual

Prints the information about the object.

Parameters
ntNumber of tabs to append before printing
lvlInformation level (higher means more information)

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::NullGeomObject, geom::Plane, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 316 of file geomObjects.h.

316 {
317 std::cout << printStr(nt, lvl);
318 };
virtual std::string printStr(int nt, int lvl) const
Returns the string containing printable information about the object.

References printStr().

Here is the call graph for this function:

◆ printStr()

virtual std::string geom::GeomObject::printStr ( int  nt,
int  lvl 
) const
inlinevirtual

Returns the string containing printable information about the object.

Parameters
ntNumber of tabs to append before printing
lvlInformation level (higher means more information)
Returns
string String containing printable information about the object

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::NullGeomObject, geom::Plane, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 295 of file geomObjects.h.

295 {
296 auto tabS = util::io::getTabS(nt);
297 std::ostringstream oss;
298
299 oss << tabS << "------- GeomObject --------" << std::endl
300 << std::endl;
301 oss << tabS << "Base geometrical object" << std::endl;
302 oss << tabS << "Base implementation of GeomObject." << std::endl;
303 oss << tabS << "Name of GeomObject = " << d_name << std::endl;
304 oss << tabS << "Description of GeomObject = " << d_description
305 << std::endl;
306
307 return oss.str();
308 };
std::string getTabS(int nt)
Returns tab spaces of a given size.
Definition io.h:39

References d_description, d_name, and util::io::getTabS().

Referenced by print(), and geom::AnnulusGeomObject::printStr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ transform()

virtual void geom::GeomObject::transform ( const util::Point translation,
const double &  scale,
const double &  angle,
const util::Point axis,
const util::Point rotationPoint = nullptr 
)
inlinevirtual

Similarity about pivot \(\mathbf p\) (default: old center d_x), then rigid displacement \(\mathbf t\) = translation: \(\mathbf y = \mathbf p + s\,\mathbf R(\mathbf x-\mathbf p) + \mathbf t\). When \(\theta=0\) and \(s=1\), \(\mathbf y = \mathbf x + \mathbf t\) for every point and the center.

Parameters
translationRigid translation vector \(\mathbf t\) (added after rotate+scale about \(\mathbf p\))
scaleUniform scale factor
angleRotation angle (radians)
axisAxis of rotation
rotationPointIf non-null, use as \(\mathbf p\); if null, use old d_x as pivot.

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::NullGeomObject, geom::Plane, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 335 of file geomObjects.h.

337 {
338 // Base implementation does nothing
339 }

Referenced by geom::AnnulusGeomObject::transform().

Here is the caller graph for this function:

◆ volume()

virtual double geom::GeomObject::volume ( ) const
inlinevirtual

Computes the volume (area in 2d, length in 1d) of object.

Returns
Volume Volume of object

Reimplemented in geom::AnnulusGeomObject, geom::ComplexGeomObject, geom::Plane, geom::Line, geom::Triangle, geom::Square, geom::Rectangle, geom::Hexagon, geom::Drum2D, geom::Cube, geom::Cuboid, geom::Circle, geom::Ellipse, geom::Sphere, geom::Ellipsoid, geom::Cylinder, geom::OpenCuboidChannel3D, and geom::OpenRectChannel2D.

Definition at line 149 of file geomObjects.h.

149{ return 0.; };

Referenced by geom::AnnulusGeomObject::center(), and geom::AnnulusGeomObject::volume().

Here is the caller graph for this function:

◆ wallContactQuery()

virtual bool geom::GeomObject::wallContactQuery ( const util::Point x,
WallContactHit hit 
) const
inlinevirtual

Closest-point / signed-gap query for analytical wall contact. Default: unsupported (returns false, clears hit).

Reimplemented in geom::Plane, geom::Line, and geom::Rectangle.

Definition at line 345 of file geomObjects.h.

346 {
347 (void)x;
348 hit = WallContactHit();
349 return false;
350 }

Referenced by anonymous_namespace{main.cpp}::checkWallSpringOnly(), and anonymous_namespace{main.cpp}::minGrainWallGap().

Here is the caller graph for this function:

Field Documentation

◆ d_description

const std::string geom::GeomObject::d_description

Further description of object.

Definition at line 129 of file geomObjects.h.

Referenced by printStr().

◆ d_name

◆ d_tags


The documentation for this class was generated from the following file: