Nektar++
Public Member Functions | Protected Member Functions | List of all members
Nektar::SpatialDomains::RefRegionSphere Class Reference

Derived class for the refinement surface region. More...

#include <RefRegionSphere.h>

Inheritance diagram for Nektar::SpatialDomains::RefRegionSphere:
[legend]

Public Member Functions

 RefRegionSphere (const unsigned int coordim, NekDouble radius, std::vector< NekDouble > coord1, std::vector< NekDouble > coord2, std::vector< unsigned int > numModes, std::vector< unsigned int > numPoints)
 Constructor. More...
 
 ~RefRegionSphere () override=default
 Destructor. More...
 
- Public Member Functions inherited from Nektar::SpatialDomains::RefRegion
 RefRegion (const unsigned int coordim, NekDouble m_radius, std::vector< NekDouble > coord1, std::vector< NekDouble > coord2, std::vector< unsigned int > numModes, std::vector< unsigned int > numPoints)
 Constructor. More...
 
virtual ~RefRegion ()=default
 Destructor. More...
 
virtual bool v_Contains (const Array< OneD, NekDouble > &coords)=0
 Pure virtual fuction. More...
 
std::vector< unsigned int > GetNumModes ()
 Get the number of modes to update expansion. More...
 
std::vector< unsigned int > GetNumPoints ()
 Get the number of quadrature points to update expansion. More...
 

Protected Member Functions

bool v_Contains (const Array< OneD, NekDouble > &coords) override
 Check if vertex is inside the sphere. More...
 

Additional Inherited Members

- Protected Attributes inherited from Nektar::SpatialDomains::RefRegion
std::vector< NekDoublem_coord1
 Coordinate 1. More...
 
std::vector< NekDoublem_coord2
 Coordinate 2. More...
 
std::vector< unsigned int > m_numModes
 Number of modes. More...
 
std::vector< unsigned int > m_numPoints
 Number of quadrature points. More...
 
NekDouble m_radius
 Radius of the surface region. More...
 
unsigned int m_coordim
 Dimension of the coordinate (space dimension) More...
 

Detailed Description

Derived class for the refinement surface region.

Definition at line 48 of file RefRegionSphere.h.

Constructor & Destructor Documentation

◆ RefRegionSphere()

Nektar::SpatialDomains::RefRegionSphere::RefRegionSphere ( const unsigned int  coordim,
NekDouble  radius,
std::vector< NekDouble coord1,
std::vector< NekDouble coord2,
std::vector< unsigned int >  numModes,
std::vector< unsigned int >  numPoints 
)

Constructor.

Definition at line 40 of file RefRegionSphere.cpp.

45 : RefRegion(coordim, radius, coord1, coord2, numModes, numPoints)
46{
47}
RefRegion(const unsigned int coordim, NekDouble m_radius, std::vector< NekDouble > coord1, std::vector< NekDouble > coord2, std::vector< unsigned int > numModes, std::vector< unsigned int > numPoints)
Constructor.
Definition: RefRegion.cpp:45

◆ ~RefRegionSphere()

Nektar::SpatialDomains::RefRegionSphere::~RefRegionSphere ( )
overridedefault

Destructor.

Member Function Documentation

◆ v_Contains()

bool Nektar::SpatialDomains::RefRegionSphere::v_Contains ( const Array< OneD, NekDouble > &  coords)
overrideprotectedvirtual

Check if vertex is inside the sphere.

Parameters
coordscoordinates of the vertex
Returns
true or false depending on if the vertex is inside or not of the surface defined by the user.

Implements Nektar::SpatialDomains::RefRegion.

Definition at line 56 of file RefRegionSphere.cpp.

57{
58 const size_t dim = coords.size(); // get space dimension.
59
60 if (dim == 3)
61 {
62 if (((m_coord1[0] - coords[0]) * (m_coord1[0] - coords[0]) +
63 (m_coord1[1] - coords[1]) * (m_coord1[1] - coords[1]) +
64 (m_coord1[2] - coords[2]) * (m_coord1[2] - coords[2])) <=
66 {
67 return true;
68 }
69 }
70 else if (dim == 2)
71 {
72 if (((m_coord1[0] - coords[0]) * (m_coord1[0] - coords[0]) +
73 (m_coord1[1] - coords[1]) * (m_coord1[1] - coords[1]) +
74 m_coord1[2] * m_coord1[2]) <= (m_radius * m_radius))
75 {
76 return true;
77 }
78 }
79 else
80 {
81 if (((m_coord1[0] - coords[0]) * (m_coord1[0] - coords[0]) +
82 m_coord1[1] * m_coord1[1] + m_coord1[2] * m_coord1[2]) <=
84 {
85 return true;
86 }
87 }
88
89 return false;
90}
std::vector< NekDouble > m_coord1
Coordinate 1.
Definition: RefRegion.h:81
NekDouble m_radius
Radius of the surface region.
Definition: RefRegion.h:89

References Nektar::SpatialDomains::RefRegion::m_coord1, and Nektar::SpatialDomains::RefRegion::m_radius.