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...
 
std::array< std::set< GeometrySharedPtr >, 3 > & GetConstituentElements ()
 Returns constituent elements, i.e. faces + edges. More...
 
std::vector< PointGeom > & GetOriginalVertex ()
 Returns all points in the zone at initialisation. More...
 
virtual std::vector< NekDoublev_GetDisp () const
 Returns zone displacment. 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...
 
std::array< std::set< GeometrySharedPtr >, 3 > m_constituentElements
 Array of all dimension elements i.e. faces = [2], edges = [1], geom = [0]. 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 for (auto &comp : domain)
51 {
52 for (auto &geom : comp.second->m_geomVec)
53 {
54 m_elements.emplace_back(geom);
55
56 // Fill constituent elements (i.e. faces and edges)
57 switch (geom->GetShapeDim())
58 {
59 case 3:
60 for (int i = 0; i < geom->GetNumFaces(); ++i)
61 {
62 m_constituentElements[2].insert(geom->GetFace(i));
63 }
64 /* fall through */
65 case 2:
66 for (int i = 0; i < geom->GetNumEdges(); ++i)
67 {
68 m_constituentElements[1].insert(geom->GetEdge(i));
69 }
70 /* fall through */
71 case 1:
72 m_constituentElements[0].insert(geom);
73 /* fall through */
74 default:
75 break;
76 }
77 }
78 }
79
80 // The seenVerts/Edges/Faces keeps track of geometry so duplicates aren't
81 // emplaced in to the storage vector
82 std::unordered_set<int> seenVerts, seenEdges, seenFaces;
83
84 // Fill verts/edges/faces vector storage that are to be moved each timestep
85 for (auto &comp : m_domain)
86 {
87 for (auto &geom : comp.second->m_geomVec)
88 {
89 for (int i = 0; i < geom->GetNumVerts(); ++i)
90 {
91 PointGeomSharedPtr vert = geom->GetVertex(i);
92
93 if (seenVerts.find(vert->GetGlobalID()) != seenVerts.end())
94 {
95 continue;
96 }
97
98 seenVerts.insert(vert->GetGlobalID());
99 m_verts.emplace_back(vert);
100 }
101
102 for (int i = 0; i < geom->GetNumEdges(); ++i)
103 {
104 SegGeomSharedPtr edge =
105 std::static_pointer_cast<SegGeom>(geom->GetEdge(i));
106
107 if (seenEdges.find(edge->GetGlobalID()) != seenEdges.end())
108 {
109 continue;
110 }
111
112 seenEdges.insert(edge->GetGlobalID());
113
114 CurveSharedPtr curve = edge->GetCurve();
115 if (!curve)
116 {
117 continue;
118 }
119
120 m_curves.emplace_back(curve);
121 }
122
123 for (int i = 0; i < geom->GetNumFaces(); ++i)
124 {
126 std::static_pointer_cast<Geometry2D>(geom->GetFace(i));
127
128 if (seenFaces.find(face->GetGlobalID()) != seenFaces.end())
129 {
130 continue;
131 }
132
133 seenFaces.insert(face->GetGlobalID());
134
135 CurveSharedPtr curve = face->GetCurve();
136 if (!curve)
137 {
138 continue;
139 }
140
141 m_curves.emplace_back(curve);
142 }
143 }
144 }
145
146 // Copy points so we know original positions.
147 for (auto &pt : m_verts)
148 {
149 m_origVerts.emplace_back(*pt);
150 }
151
152 for (auto &curve : m_curves)
153 {
154 for (auto &pt : curve->m_points)
155 {
156 m_origVerts.emplace_back(*pt);
157 }
158 }
159}
std::shared_ptr< Curve > CurveSharedPtr
Definition: Curve.hpp:58
std::shared_ptr< SegGeom > SegGeomSharedPtr
Definition: Geometry2D.h:58
std::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:57
std::shared_ptr< Geometry2D > Geometry2DSharedPtr
Definition: Geometry.h:62
std::array< std::set< GeometrySharedPtr >, 3 > m_constituentElements
Array of all dimension elements i.e. faces = [2], edges = [1], geom = [0].
Definition: Zones.h:152
std::vector< PointGeomSharedPtr > m_verts
Vector of all points in the zone.
Definition: Zones.h:158
int m_coordDim
Coordinate dimension.
Definition: Zones.h:156
std::vector< PointGeom > m_origVerts
Vector of all points in the zone at initialisation.
Definition: Zones.h:162
std::vector< CurveSharedPtr > m_curves
Vector of all curves in the zone.
Definition: Zones.h:160
int m_domainID
ID for the composite making up this zone.
Definition: Zones.h:145
CompositeMap m_domain
Zone domain.
Definition: Zones.h:147
std::vector< GeometrySharedPtr > m_elements
Vector of highest dimension zone elements.
Definition: Zones.h:149
MovementType m_type
Type of zone movement.
Definition: Zones.h:141

References m_constituentElements, 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 179 of file Movement/Zones.cpp.

180{
181 // Clear bboxes (these will be regenerated next time GetBoundingBox is
182 // called)
183 for (auto &el : m_elements)
184 {
185 el->ClearBoundingBox();
186
187 int nfaces = el->GetNumFaces();
188 for (int i = 0; i < nfaces; ++i)
189 {
190 el->GetFace(i)->ClearBoundingBox();
191 }
192
193 int nedges = el->GetNumEdges();
194 for (int i = 0; i < nedges; ++i)
195 {
196 el->GetEdge(i)->ClearBoundingBox();
197 }
198 }
199}

References m_elements.

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

◆ GetConstituentElements()

std::array< std::set< GeometrySharedPtr >, 3 > & Nektar::SpatialDomains::ZoneBase::GetConstituentElements ( )
inline

Returns constituent elements, i.e. faces + edges.

Definition at line 116 of file Zones.h.

117 {
119 }

References m_constituentElements.

◆ 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:154

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.

◆ GetOriginalVertex()

std::vector< PointGeom > & Nektar::SpatialDomains::ZoneBase::GetOriginalVertex ( )
inline

Returns all points in the zone at initialisation.

Definition at line 122 of file Zones.h.

123 {
124 return m_origVerts;
125 }

References m_origVerts.

◆ 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:165

References v_Move().

◆ v_GetDisp()

virtual std::vector< NekDouble > Nektar::SpatialDomains::ZoneBase::v_GetDisp ( ) const
inlinevirtual

Returns zone displacment.

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

Definition at line 128 of file Zones.h.

129 {
130 std::vector<NekDouble> disp(m_coordDim);
131 for (int i = 0; i < m_coordDim; ++i)
132 {
133 disp[i] = 0.0;
134 }
135
136 return disp;
137 }

References m_coordDim.

◆ 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, and Nektar::SpatialDomains::ZoneFixed.

Definition at line 165 of file Zones.h.

166 {
167 return false;
168 }

Referenced by Move().

Member Data Documentation

◆ m_constituentElements

std::array<std::set<GeometrySharedPtr>, 3> Nektar::SpatialDomains::ZoneBase::m_constituentElements
protected

Array of all dimension elements i.e. faces = [2], edges = [1], geom = [0].

Definition at line 152 of file Zones.h.

Referenced by GetConstituentElements(), and ZoneBase().

◆ m_coordDim

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

◆ m_curves

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

Vector of all curves in the zone.

Definition at line 160 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 147 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 145 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 149 of file Zones.h.

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

◆ m_id

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

Zone ID.

Definition at line 143 of file Zones.h.

Referenced by GetId().

◆ m_moved

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

Moved flag.

Definition at line 154 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 162 of file Zones.h.

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

◆ m_type

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

Type of zone movement.

Definition at line 141 of file Zones.h.

Referenced by GetMovementType().

◆ m_verts

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

Vector of all points in the zone.

Definition at line 158 of file Zones.h.

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