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 60 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:59
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:151
std::vector< PointGeomSharedPtr > m_verts
Vector of all points in the zone.
Definition: Zones.h:157
int m_coordDim
Coordinate dimension.
Definition: Zones.h:155
std::vector< PointGeom > m_origVerts
Vector of all points in the zone at initialisation.
Definition: Zones.h:161
std::vector< CurveSharedPtr > m_curves
Vector of all curves in the zone.
Definition: Zones.h:159
int m_domainID
ID for the composite making up this zone.
Definition: Zones.h:144
CompositeMap m_domain
Zone domain.
Definition: Zones.h:146
std::vector< GeometrySharedPtr > m_elements
Vector of highest dimension zone elements.
Definition: Zones.h:148
MovementType m_type
Type of zone movement.
Definition: Zones.h:140

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 115 of file Zones.h.

116 {
118 }

References m_constituentElements.

◆ GetDomain()

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

Returns the domain the zone is on.

Definition at line 76 of file Zones.h.

77 {
78 return m_domain;
79 }

References m_domain.

◆ GetDomainID()

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

Returns the ID of the domain making up this Zone.

Definition at line 88 of file Zones.h.

89 {
90 return m_domainID;
91 }

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 100 of file Zones.h.

101 {
102 return m_elements;
103 }

References m_elements.

◆ GetId()

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

Returns the zone ID.

Definition at line 82 of file Zones.h.

83 {
84 return m_id;
85 }

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 106 of file Zones.h.

107 {
108 return m_moved;
109 }
bool m_moved
Moved flag.
Definition: Zones.h:153

References m_moved.

◆ GetMovementType()

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

Returns the type of movement.

Definition at line 70 of file Zones.h.

71 {
72 return m_type;
73 }

References m_type.

◆ GetOriginalVertex()

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

Returns all points in the zone at initialisation.

Definition at line 121 of file Zones.h.

122 {
123 return m_origVerts;
124 }

References m_origVerts.

◆ Move()

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

Performs the movement of the zone at.

Parameters
time

Definition at line 94 of file Zones.h.

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

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 127 of file Zones.h.

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

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 164 of file Zones.h.

165 {
166 return false;
167 }

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 151 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 159 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 146 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 144 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 148 of file Zones.h.

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

◆ m_id

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

Zone ID.

Definition at line 142 of file Zones.h.

Referenced by GetId().

◆ m_moved

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

Moved flag.

Definition at line 153 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 161 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 140 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 157 of file Zones.h.

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