Advanced Multi-Physics (AMP)
On-Line Documentation
SquareFrustum.h
Go to the documentation of this file.
1#ifndef included_AMP_Geometry_SquareFrustum
2#define included_AMP_Geometry_SquareFrustum
3
4#include "AMP/geometry/LogicalGeometry.h"
5
6#include <vector>
7
8
9namespace AMP::Geometry {
10
11
17class SquareFrustum final : public LogicalGeometry
18{
19public:
24 explicit SquareFrustum( std::shared_ptr<const AMP::Database> db );
25
32 explicit SquareFrustum( const std::vector<double> &range, int dir, double height );
33
35 SquareFrustum( int64_t );
36
37public: // Functions inherited from Geometry
38 std::string getName() const override final { return "SquareFrustum"; }
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 { return 6; }
44 int surface( const Point &x ) 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 using FaceNormal = std::array<Point, 6>;
61 using FacePoints = std::array<std::array<Point, 4>, 6>;
62 uint8_t d_dir;
63 std::array<double, 6> d_range; // The bounding box size
64 std::array<double, 3> d_pyramid_size; // The underlying rotated pyramid size
65 double d_scale_height; // Ratio of frustum to pyramid height
66 double d_volume; // Volume
67 Point d_centroid; // Centroid
68 FacePoints d_face; // Points forming each face
69 FaceNormal d_normal; // Normal to each face
70
71private:
72 // Private constructor
74 // Initialize the data
75 void initialize( const std::vector<double> &range, int dir, double height );
76};
77
78
79} // namespace AMP::Geometry
80
81#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 geometry for a square frustum.
std::array< Point, 6 > FaceNormal
int surface(const Point &x) const override final
Get the surface id.
void writeRestart(int64_t) const override
Write restart data to file.
void initialize(const std::vector< double > &range, int dir, double height)
std::array< std::array< Point, 4 >, 6 > FacePoints
ArraySize getLogicalGridSize(const ArraySize &x) const override final
Return the logical grid size.
SquareFrustum(std::shared_ptr< const AMP::Database > db)
Construct a SquareFrustum geometry.
Point nearest(const Point &pos) const override final
Calculate the nearest point on the surface.
SquareFrustum(int64_t)
Construct from restart.
std::pair< Point, Point > box() const override final
Return the bounding box.
int NSurface() const override final
Get the number of surfaces.
double distance(const Point &pos, const Point &dir) const override final
Calculate the distance to the object given a ray.
std::string getName() const override final
Get the name of the geometry.
std::unique_ptr< AMP::Geometry::Geometry > clone() const override final
Clone the object.
std::array< double, 6 > d_range
bool isConvex() const override final
Is the object convex.
Point logical(const Point &x) const override final
Return the logical position.
Point centroid() const override final
Return the centroid.
Point surfaceNorm(const Point &x) const override final
Return the outward normal to a surface.
bool inside(const Point &pos) const override final
Is the point in the geometry.
double volume() const override final
Return the volume.
Point physical(const Point &x) const override final
Return the physical position.
SquareFrustum(const std::vector< double > &range, int dir, double height)
Construct a SquareFrustum geometry.
void displace(const double *x) override final
Displace the entire geometry.
std::array< double, 3 > d_pyramid_size



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