Advanced Multi-Physics (AMP)
On-Line Documentation
RegularPolygon.h
Go to the documentation of this file.
1#ifndef included_AMP_Geometry_RegularPolygon
2#define included_AMP_Geometry_RegularPolygon
3
4#include "AMP/geometry/LogicalGeometry.h"
5
6#include <array>
7#include <vector>
8
9
10namespace AMP::Geometry {
11
12
18class RegularPolygon final : public LogicalGeometry
19{
20public:
25 explicit RegularPolygon( std::shared_ptr<const AMP::Database> db );
26
32 explicit RegularPolygon( int N, double R );
33
35 RegularPolygon( int64_t );
36
37public: // Functions inherited from Geometry
38 std::string getName() const override { return "RegularPolygon"; }
39 bool isConvex() const override final { return true; }
40 Point nearest( const Point &pos ) const override final;
41 double distance( const Point &pos, const Point &dir ) const override final;
42 bool inside( const Point &pos ) const override final;
43 int NSurface() const override final;
44 int surface( const Point & ) const override final;
45 Point surfaceNorm( const Point &x ) const override final;
46 Point logical( const Point &x ) const override final;
47 Point physical( const Point &x ) const override final;
48 Point centroid() const override final;
49 std::pair<Point, Point> box() const override final;
50 double volume() const override final;
51 void displace( const double *x ) override final;
52 ArraySize getLogicalGridSize( const ArraySize &x ) const override final;
53 ArraySize getLogicalGridSize( const std::vector<double> &res ) const override final;
54 std::unique_ptr<AMP::Geometry::Geometry> clone() const override final;
55 bool operator==( const Geometry &rhs ) const override final;
56 void writeRestart( int64_t ) const override;
57
58protected:
59 // Internal data
60 int d_N = 0;
61 double d_R = 0;
62 std::array<double, 2> d_offset = { 0, 0 };
63 std::vector<std::array<double, 2>> d_vertices;
64 std::vector<Point> d_norm;
65
66protected:
67 // Internal functions
68 std::tuple<Point, double, int> nearest2( const Point &pos ) const;
70
71
72private:
73 // Private constructor
75};
76
77
78} // namespace AMP::Geometry
79
80#endif
Simple class to store the array dimensions.
Definition ArraySize.h:138
A class used to abstract away geometry information from an application or mesh.
Definition Geometry.h:29
A class used to abstract away logical geometry based operations.
A class used to abstract away geometry information from an application or mesh.
void displace(const double *x) override final
Displace the entire geometry.
bool inside(const Point &pos) const override final
Is the point in the geometry.
RegularPolygon(int N, double R)
Construct a regular polygon geometry.
std::vector< Point > d_norm
Point centroid() const override final
Return the centroid.
Point surfaceNorm(const Point &x) const override final
Return the outward normal to a surface.
std::vector< std::array< double, 2 > > d_vertices
double volume() const override final
Return the volume.
std::string getName() const override
Get the name of the geometry.
Point physical(const Point &x) const override final
Return the physical position.
std::tuple< Point, double, int > nearest2(const Point &pos) const
std::unique_ptr< AMP::Geometry::Geometry > clone() const override final
Clone the object.
Point nearest(const Point &pos) const override final
Calculate the nearest point on the surface.
bool isConvex() const override final
Is the object convex.
Point logical(const Point &x) const override final
Return the logical position.
int surface(const Point &) const override final
Get the surface id.
double distance(const Point &pos, const Point &dir) const override final
Calculate the distance to the object given a ray.
int NSurface() const override final
Get the number of surfaces.
std::array< double, 2 > d_offset
void writeRestart(int64_t) const override
Write restart data to file.
RegularPolygon(std::shared_ptr< const AMP::Database > db)
Construct a regular polygon geometry.
ArraySize getLogicalGridSize(const ArraySize &x) const override final
Return the logical grid size.
RegularPolygon(int64_t)
Construct from restart.
std::pair< Point, Point > box() const override final
Return the bounding box.



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:40.
Comments on this page