Nektar++
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Nektar::SpatialDomains::ZoneBase Struct Reference

Zone base: Contains the shared functions and variables. More...

#include <Zones.h>

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

Public Member Functions

 ZoneBase (MovementType type, int indx, int domainID, CompositeMap domain, int coordDim)
 Constructor. More...
 
virtual ~ZoneBase ()=default
 Default destructor. More...
 
MovementType GetMovementType () const
 Returns the type of movement. More...
 
CompositeMap GetDomain () const
 Returns the domain the zone is on. More...
 
int & GetId ()
 Returns the zone ID. More...
 
int & GetDomainID ()
 Returns the ID of the domain making up this Zone. More...
 
bool Move (NekDouble time)
 Performs the movement of the zone at. More...
 
std::vector< GeometrySharedPtr > const & GetElements () const
 Returns all highest dimension elements in the zone. More...
 
bool & GetMoved ()
 Returns the flag which states if the zone has moved in this timestep. More...
 
void ClearBoundingBoxes ()
 Clears all bounding boxes associated with the zones elements. More...
 

Protected Member Functions

virtual bool v_Move (NekDouble time)
 Virtual function for movement of the zone at. More...
 

Protected Attributes

MovementType m_type = MovementType::eNone
 Type of zone movement. More...
 
int m_id
 Zone ID. More...
 
int m_domainID
 ID for the composite making up this zone. More...
 
CompositeMap m_domain
 Zone domain. More...
 
std::vector< GeometrySharedPtrm_elements
 Vector of highest dimension zone elements. More...
 
bool m_moved = true
 Moved flag. More...
 
int m_coordDim
 Coordinate dimension. More...
 
std::vector< PointGeomSharedPtrm_verts
 Vector of all points in the zone. More...
 
std::vector< CurveSharedPtrm_curves
 Vector of all curves in the zone. More...
 
std::vector< PointGeomm_origVerts
 Vector of all points in the zone at initialisation. More...
 

Detailed Description

Zone base: Contains the shared functions and variables.

Definition at line 61 of file Zones.h.

Constructor & Destructor Documentation

◆ ZoneBase()

Nektar::SpatialDomains::ZoneBase::ZoneBase ( MovementType  type,
int  indx,
int  domainID,
CompositeMap  domain,
int  coordDim 
)

Constructor.

Definition at line 45 of file Movement/Zones.cpp.

47 : m_type(type), m_id(indx), m_domainID(domainID), m_domain(domain),
48 m_coordDim(coordDim)
49{
50 // Fill elements from domain
51 for (auto &comp : domain)
52 {
53 for (auto &geom : comp.second->m_geomVec)
54 {
55 m_elements.emplace_back(geom);
56 }
57 }
58
59 // The seenVerts/Edges/Faces keeps track of geometry so duplicates aren't
60 // emplaced in to the storage vector
61 std::unordered_set<int> seenVerts, seenEdges, seenFaces;
62
63 // Fill verts/edges/faces vector storage that are to be moved each timestep
64 for (auto &comp : m_domain)
65 {
66 for (auto &geom : comp.second->m_geomVec)
67 {
68 for (int i = 0; i < geom->GetNumVerts(); ++i)
69 {
70 PointGeomSharedPtr vert = geom->GetVertex(i);
71
72 if (seenVerts.find(vert->GetGlobalID()) != seenVerts.end())
73 {
74 continue;
75 }
76
77 seenVerts.insert(vert->GetGlobalID());
78 m_verts.emplace_back(vert);
79 }
80
81 for (int i = 0; i < geom->GetNumEdges(); ++i)
82 {
83 SegGeomSharedPtr edge =
84 std::static_pointer_cast<SegGeom>(geom->GetEdge(i));
85
86 if (seenEdges.find(edge->GetGlobalID()) != seenEdges.end())
87 {
88 continue;
89 }
90
91 seenEdges.insert(edge->GetGlobalID());
92
93 CurveSharedPtr curve = edge->GetCurve();
94 if (!curve)
95 {
96 continue;
97 }
98
99 m_curves.emplace_back(curve);
100 }
101
102 for (int i = 0; i < geom->GetNumFaces(); ++i)
103 {
105 std::static_pointer_cast<Geometry2D>(geom->GetFace(i));
106
107 if (seenFaces.find(face->GetGlobalID()) != seenFaces.end())
108 {
109 continue;
110 }
111
112 seenFaces.insert(face->GetGlobalID());
113
114 CurveSharedPtr curve = face->GetCurve();
115 if (!curve)
116 {
117 continue;
118 }
119
120 m_curves.emplace_back(curve);
121 }
122 }
123 }
124
125 // Copy points so we know original positions.
126 for (auto &pt : m_verts)
127 {
128 m_origVerts.emplace_back(*pt);
129 }
130
131 for (auto &curve : m_curves)
132 {
133 for (auto &pt : curve->m_points)
134 {
135 m_origVerts.emplace_back(*pt);
136 }
137 }
138}
std::shared_ptr< Curve > CurveSharedPtr
Definition: Curve.hpp:58
std::shared_ptr< SegGeom > SegGeomSharedPtr
Definition: Geometry2D.h:59
std::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:57
std::shared_ptr< Geometry2D > Geometry2DSharedPtr
Definition: Geometry.h:62
std::vector< PointGeomSharedPtr > m_verts
Vector of all points in the zone.
Definition: Zones.h:131
int m_coordDim
Coordinate dimension.
Definition: Zones.h:129
std::vector< PointGeom > m_origVerts
Vector of all points in the zone at initialisation.
Definition: Zones.h:135
std::vector< CurveSharedPtr > m_curves
Vector of all curves in the zone.
Definition: Zones.h:133
int m_domainID
ID for the composite making up this zone.
Definition: Zones.h:121
CompositeMap m_domain
Zone domain.
Definition: Zones.h:123
std::vector< GeometrySharedPtr > m_elements
Vector of highest dimension zone elements.
Definition: Zones.h:125
MovementType m_type
Type of zone movement.
Definition: Zones.h:117

References m_curves, m_domain, m_elements, m_origVerts, and m_verts.

◆ ~ZoneBase()

virtual Nektar::SpatialDomains::ZoneBase::~ZoneBase ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ ClearBoundingBoxes()

void Nektar::SpatialDomains::ZoneBase::ClearBoundingBoxes ( )

Clears all bounding boxes associated with the zones elements.

Definition at line 158 of file Movement/Zones.cpp.

159{
160 // Clear bboxes (these will be regenerated next time GetBoundingBox is
161 // called)
162 for (auto &el : m_elements)
163 {
164 el->ClearBoundingBox();
165
166 int nfaces = el->GetNumFaces();
167 for (int i = 0; i < nfaces; ++i)
168 {
169 el->GetFace(i)->ClearBoundingBox();
170 }
171
172 int nedges = el->GetNumEdges();
173 for (int i = 0; i < nedges; ++i)
174 {
175 el->GetEdge(i)->ClearBoundingBox();
176 }
177 }
178}

References m_elements.

Referenced by Nektar::SpatialDomains::ZoneRotate::v_Move(), Nektar::SpatialDomains::ZoneTranslate::v_Move(), and Nektar::SpatialDomains::ZonePrescribe::v_Move().

◆ GetDomain()

CompositeMap Nektar::SpatialDomains::ZoneBase::GetDomain ( ) const
inline

Returns the domain the zone is on.

Definition at line 77 of file Zones.h.

78 {
79 return m_domain;
80 }

References m_domain.

◆ GetDomainID()

int & Nektar::SpatialDomains::ZoneBase::GetDomainID ( )
inline

Returns the ID of the domain making up this Zone.

Definition at line 89 of file Zones.h.

90 {
91 return m_domainID;
92 }

References m_domainID.

◆ GetElements()

std::vector< GeometrySharedPtr > const & Nektar::SpatialDomains::ZoneBase::GetElements ( ) const
inline

Returns all highest dimension elements in the zone.

Definition at line 101 of file Zones.h.

102 {
103 return m_elements;
104 }

References m_elements.

◆ GetId()

int & Nektar::SpatialDomains::ZoneBase::GetId ( )
inline

Returns the zone ID.

Definition at line 83 of file Zones.h.

84 {
85 return m_id;
86 }

References m_id.

◆ GetMoved()

bool & Nektar::SpatialDomains::ZoneBase::GetMoved ( )
inline

Returns the flag which states if the zone has moved in this timestep.

Definition at line 107 of file Zones.h.

108 {
109 return m_moved;
110 }
bool m_moved
Moved flag.
Definition: Zones.h:127

References m_moved.

◆ GetMovementType()

MovementType Nektar::SpatialDomains::ZoneBase::GetMovementType ( ) const
inline

Returns the type of movement.

Definition at line 71 of file Zones.h.

72 {
73 return m_type;
74 }

References m_type.

◆ Move()

bool Nektar::SpatialDomains::ZoneBase::Move ( NekDouble  time)
inline

Performs the movement of the zone at.

Parameters
time

Definition at line 95 of file Zones.h.

96 {
97 return v_Move(time);
98 }
virtual bool v_Move(NekDouble time)
Virtual function for movement of the zone at.
Definition: Zones.h:138

References v_Move().

◆ v_Move()

virtual bool Nektar::SpatialDomains::ZoneBase::v_Move ( NekDouble  time)
inlineprotectedvirtual

Virtual function for movement of the zone at.

Parameters
time

Reimplemented in Nektar::SpatialDomains::ZoneRotate, Nektar::SpatialDomains::ZoneTranslate, Nektar::SpatialDomains::ZonePrescribe, and Nektar::SpatialDomains::ZoneFixed.

Definition at line 138 of file Zones.h.

139 {
140 return false;
141 }

Referenced by Move().

Member Data Documentation

◆ m_coordDim

int Nektar::SpatialDomains::ZoneBase::m_coordDim
protected

Coordinate dimension.

Definition at line 129 of file Zones.h.

Referenced by Nektar::SpatialDomains::ZoneTranslate::v_Move().

◆ m_curves

std::vector<CurveSharedPtr> Nektar::SpatialDomains::ZoneBase::m_curves
protected

Vector of all curves in the zone.

Definition at line 133 of file Zones.h.

Referenced by Nektar::SpatialDomains::ZoneRotate::v_Move(), Nektar::SpatialDomains::ZoneTranslate::v_Move(), and ZoneBase().

◆ m_domain

CompositeMap Nektar::SpatialDomains::ZoneBase::m_domain
protected

Zone domain.

Definition at line 123 of file Zones.h.

Referenced by GetDomain(), and ZoneBase().

◆ m_domainID

int Nektar::SpatialDomains::ZoneBase::m_domainID
protected

ID for the composite making up this zone.

Definition at line 121 of file Zones.h.

Referenced by GetDomainID().

◆ m_elements

std::vector<GeometrySharedPtr> Nektar::SpatialDomains::ZoneBase::m_elements
protected

Vector of highest dimension zone elements.

Definition at line 125 of file Zones.h.

Referenced by ClearBoundingBoxes(), GetElements(), and ZoneBase().

◆ m_id

int Nektar::SpatialDomains::ZoneBase::m_id
protected

Zone ID.

Definition at line 119 of file Zones.h.

Referenced by GetId().

◆ m_moved

bool Nektar::SpatialDomains::ZoneBase::m_moved = true
protected

Moved flag.

Definition at line 127 of file Zones.h.

Referenced by GetMoved().

◆ m_origVerts

std::vector<PointGeom> Nektar::SpatialDomains::ZoneBase::m_origVerts
protected

Vector of all points in the zone at initialisation.

Definition at line 135 of file Zones.h.

Referenced by Nektar::SpatialDomains::ZoneRotate::v_Move(), Nektar::SpatialDomains::ZoneTranslate::v_Move(), Nektar::SpatialDomains::ZonePrescribe::v_Move(), and ZoneBase().

◆ m_type

MovementType Nektar::SpatialDomains::ZoneBase::m_type = MovementType::eNone
protected

Type of zone movement.

Definition at line 117 of file Zones.h.

Referenced by GetMovementType().

◆ m_verts

std::vector<PointGeomSharedPtr> Nektar::SpatialDomains::ZoneBase::m_verts
protected