Advanced Multi-Physics (AMP)
On-Line Documentation
Sphere.h
Go to the documentation of this file.
1#ifndef included_AMP_Geometry_Sphere
2#define included_AMP_Geometry_Sphere
3
4#include "AMP/geometry/LogicalGeometry.h"
5
6#include <array>
7#include <vector>
8
9
10namespace AMP::Geometry {
11
12
18class Sphere final : public LogicalGeometry
19{
20public:
25 explicit Sphere( std::shared_ptr<const AMP::Database> db );
26
31 explicit Sphere( double R );
32
34 Sphere( int64_t );
35
36public: // Functions inherited from Geometry
37 std::string getName() const override final { return "Sphere"; }
38 bool isConvex() const override final { return true; }
39 Point nearest( const Point &pos ) const override final;
40 double distance( const Point &pos, const Point &dir ) const override final;
41 bool inside( const Point &pos ) const override final;
42 int NSurface() const override final { return 1; }
43 int surface( const Point & ) const override final { return 0; }
44 Point surfaceNorm( const Point & ) const override final;
45 Point logical( const Point &x ) const override final;
46 Point physical( const Point &x ) const override final;
47 Point centroid() const override final;
48 std::pair<Point, Point> box() const override final;
49 double volume() const override final;
50 void displace( const double *x ) override final;
51 ArraySize getLogicalGridSize( const ArraySize &x ) const override final;
52 ArraySize getLogicalGridSize( const std::vector<double> &res ) const override final;
53 std::unique_ptr<AMP::Geometry::Geometry> clone() const override final;
54 bool operator==( const Geometry &rhs ) const override final;
55 void writeRestart( int64_t ) const override;
56
57protected:
58 // Internal data
59 double d_r;
60 std::array<double, 3> d_offset;
61
62private:
63 // Private constructor
65};
66
67
68} // namespace AMP::Geometry
69
70#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.
void writeRestart(int64_t) const override
Write restart data to file.
ArraySize getLogicalGridSize(const ArraySize &x) const override final
Return the logical grid size.
std::pair< Point, Point > box() const override final
Return the bounding box.
Point centroid() const override final
Return the centroid.
Sphere(int64_t)
Construct from restart.
std::unique_ptr< AMP::Geometry::Geometry > clone() const override final
Clone the object.
double volume() const override final
Return the volume.
Point surfaceNorm(const Point &) const override final
Return the outward normal to a surface.
Sphere(std::shared_ptr< const AMP::Database > db)
Construct a Sphere geometry.
std::string getName() const override final
Get the name of the geometry.
Definition Sphere.h:37
Point physical(const Point &x) const override final
Return the physical position.
Point logical(const Point &x) const override final
Return the logical position.
bool inside(const Point &pos) const override final
Is the point in the geometry.
double distance(const Point &pos, const Point &dir) const override final
Calculate the distance to the object given a ray.
Point nearest(const Point &pos) const override final
Calculate the nearest point on the surface.
void displace(const double *x) override final
Displace the entire geometry.
Sphere(double R)
Construct a Sphere geometry.
std::array< double, 3 > d_offset
Definition Sphere.h:60
int surface(const Point &) const override final
Get the surface id.
Definition Sphere.h:43
bool isConvex() const override final
Is the object convex.
Definition Sphere.h:38
int NSurface() const override final
Get the number of surfaces.
Definition Sphere.h:42



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