Advanced Multi-Physics (AMP)
On-Line Documentation
Box.h
Go to the documentation of this file.
1#ifndef included_AMP_Geometry_Box
2#define included_AMP_Geometry_Box
3
4#include "AMP/geometry/LogicalGeometry.h"
5
6#include <array>
7#include <vector>
8
9
10namespace AMP::Geometry {
11
12
13std::unique_ptr<AMP::Geometry::Geometry> buildBox( std::shared_ptr<const AMP::Database> db );
14
15
21template<std::size_t NDIM>
22class Box : public LogicalGeometry
23{
24public:
29 explicit Box( std::shared_ptr<const AMP::Database> db );
30
35 explicit Box( const std::vector<double> &range );
36
38 Box( int64_t );
39
40public: // Default constructors
41 explicit Box( Box<NDIM> &&range ) = default;
42 explicit Box( const Box<NDIM> &range ) = default;
43 Box<NDIM> &operator=( Box<NDIM> &&range ) = default;
44 Box<NDIM> &operator=( const Box<NDIM> &range ) = default;
45
46public: // Functions inherited from Geometry
47 std::string getName() const override;
48 bool isConvex() const override final { return true; }
49 Point nearest( const Point &pos ) const override final;
50 double distance( const Point &pos, const Point &dir ) const override final;
51 bool inside( const Point &pos ) const override final;
52 int NSurface() const override final { return 2 * NDIM; }
53 int surface( const Point &x ) const override final;
54 Point surfaceNorm( const Point &x ) const override final;
55 Point logical( const Point &x ) const override;
56 Point physical( const Point &x ) const override;
57 Point centroid() const override final;
58 std::pair<Point, Point> box() const override final;
59 double volume() const override final;
60 void displace( const double *x ) override;
61 ArraySize getLogicalGridSize( const ArraySize &x ) const override final;
62 ArraySize getLogicalGridSize( const std::vector<double> &res ) const override final;
63 std::unique_ptr<AMP::Geometry::Geometry> clone() const override;
64 bool operator==( const Geometry &rhs ) const override;
65 void writeRestart( int64_t ) const override;
66
67protected:
68 Box();
69
70protected:
71 // Internal data
72 std::array<double, 6> d_range;
73};
74
75
81template<std::size_t NDIM>
82class Grid final : public Box<NDIM>
83{
84public:
89 explicit Grid( std::shared_ptr<const AMP::Database> db );
90
95 explicit Grid( const std::vector<std::vector<double>> &coord );
96
98 Grid( int64_t );
99
100public: // Default constructors
101 explicit Grid( Grid<NDIM> &&rhs ) = default;
102 explicit Grid( const Grid<NDIM> &rhs ) = default;
103 Grid<NDIM> &operator=( Grid<NDIM> &&rhs ) = default;
104 Grid<NDIM> &operator=( const Grid<NDIM> &rhs ) = default;
105
106public: // Functions inherited from Geometry
107 std::string getName() const override;
108 Point logical( const Point &x ) const override final;
109 Point physical( const Point &x ) const override final;
110 void displace( const double *x ) override final;
111 std::unique_ptr<AMP::Geometry::Geometry> clone() const override final;
112 bool operator==( const Geometry &rhs ) const override final;
113 void writeRestart( int64_t ) const override;
114
115protected:
116 std::array<std::vector<double>, NDIM> d_coord; // Coordinates
117
118private:
119 // Private constructor
121};
122
123
124} // namespace AMP::Geometry
125
126#endif
Simple class to store the array dimensions.
Definition ArraySize.h:138
double volume() const override final
Return the volume.
std::pair< Point, Point > box() const override final
Return the bounding box.
Box< NDIM > & operator=(Box< NDIM > &&range)=default
Point physical(const Point &x) const override
Return the physical position.
Box(Box< NDIM > &&range)=default
void displace(const double *x) override
Displace the entire geometry.
Box(const Box< NDIM > &range)=default
std::string getName() const override
Get the name of the geometry.
int NSurface() const override final
Get the number of surfaces.
Definition Box.h:52
bool inside(const Point &pos) const override final
Is the point in the geometry.
ArraySize getLogicalGridSize(const ArraySize &x) const override final
Return the logical grid size.
Box< NDIM > & operator=(const Box< NDIM > &range)=default
Point centroid() const override final
Return the centroid.
Box(int64_t)
ConstructGrid from restart.
Point logical(const Point &x) const override
Return the logical position.
Box(std::shared_ptr< const AMP::Database > db)
Construct a Box geometry.
double distance(const Point &pos, const Point &dir) const override final
Calculate the distance to the object given a ray.
std::array< double, 6 > d_range
Definition Box.h:72
Box(const std::vector< double > &range)
Construct a box.
Point surfaceNorm(const Point &x) const override final
Return the outward normal to a surface.
Point nearest(const Point &pos) const override final
Calculate the nearest point on the surface.
int surface(const Point &x) const override final
Get the surface id.
void writeRestart(int64_t) const override
Write restart data to file.
bool isConvex() const override final
Is the object convex.
Definition Box.h:48
std::unique_ptr< AMP::Geometry::Geometry > clone() const override
Clone the object.
A class used to abstract away geometry information from an application or mesh.
Definition Geometry.h:29
Grid< NDIM > & operator=(Grid< NDIM > &&rhs)=default
Grid(Grid< NDIM > &&rhs)=default
void displace(const double *x) override final
Displace the entire geometry.
Grid< NDIM > & operator=(const Grid< NDIM > &rhs)=default
Grid(std::shared_ptr< const AMP::Database > db)
Construct a Grid geometry.
Point physical(const Point &x) const override final
Return the physical position.
Grid(const Grid< NDIM > &rhs)=default
Point logical(const Point &x) const override final
Return the logical position.
std::string getName() const override
Get the name of the geometry.
std::unique_ptr< AMP::Geometry::Geometry > clone() const override final
Clone the object.
Grid(const std::vector< std::vector< double > > &coord)
Construct a grid geometry.
Grid(int64_t)
ConstructGrid from restart.
A class used to abstract away logical geometry based operations.
std::unique_ptr< AMP::Geometry::Geometry > buildBox(std::shared_ptr< const AMP::Database > db)



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