Nektar++
Public 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, 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...
 
virtual bool v_Move (NekDouble time)
 Virtual function for movement of the zone at. 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 Attributes

MovementType m_type = MovementType::eNone
 Type of zone movement. More...
 
int m_id
 Zone ID. 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 62 of file Zones.h.

Constructor & Destructor Documentation

◆ ZoneBase()

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

Constructor.

Definition at line 47 of file Zones.cpp.

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

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 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.

◆ GetElements()

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

Returns all highest dimension elements in the zone.

Definition at line 102 of file Zones.h.

103  {
104  return m_elements;
105  }

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

109  {
110  return m_moved;
111  }
bool m_moved
Moved flag.
Definition: Zones.h:126

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

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

References v_Move().

◆ v_Move()

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

Virtual function for movement of the zone at.

Parameters
time

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

Definition at line 89 of file Zones.h.

90  {
91  boost::ignore_unused(time);
92  return false;
93  }

Referenced by Move().

Member Data Documentation

◆ m_coordDim

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

Coordinate dimension.

Definition at line 128 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 132 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 122 of file Zones.h.

Referenced by GetDomain(), and ZoneBase().

◆ m_elements

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

Vector of highest dimension zone elements.

Definition at line 124 of file Zones.h.

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

◆ m_id

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

Zone ID.

Definition at line 120 of file Zones.h.

Referenced by GetId().

◆ m_moved

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

Moved flag.

Definition at line 126 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 134 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 118 of file Zones.h.

Referenced by GetMovementType().

◆ m_verts

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