Nektar++
Public Member Functions | Protected Attributes | List of all members
Nektar::SpatialDomains::ZoneTranslate Struct Referencefinal

Translating zone: addition of a constant vector to every point. More...

#include <Zones.h>

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

Public Member Functions

 ZoneTranslate (int id, const CompositeMap &domain, const int coordDim, const std::vector< NekDouble > &velocity)
 
virtual ~ZoneTranslate ()=default
 Default destructor. More...
 
std::vector< NekDoubleGetVel () const
 Returns the velocity of the zone. More...
 
virtual bool v_Move (NekDouble time) final
 Virtual function for movement of the zone at. More...
 
- Public Member Functions inherited from Nektar::SpatialDomains::ZoneBase
 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...
 
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

std::vector< NekDoublem_velocity
 
- Protected Attributes inherited from Nektar::SpatialDomains::ZoneBase
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

Translating zone: addition of a constant vector to every point.

Definition at line 179 of file Zones.h.

Constructor & Destructor Documentation

◆ ZoneTranslate()

Nektar::SpatialDomains::ZoneTranslate::ZoneTranslate ( int  id,
const CompositeMap domain,
const int  coordDim,
const std::vector< NekDouble > &  velocity 
)
inline

Constructor for translating zone

Parameters
idZone ID
domainDomain that the zone consists of
coordDimCoordinate dimension
velocityVector of translation velocity in x,y,z direction

Definition at line 189 of file Zones.h.

191  : ZoneBase(MovementType::eTranslate, id, domain, coordDim),
192  m_velocity(velocity)
193  {
194  }
ZoneBase(MovementType type, int indx, CompositeMap domain, int coordDim)
Constructor.
Definition: Zones.cpp:47
std::vector< NekDouble > m_velocity
Definition: Zones.h:209

References Nektar::SpatialDomains::eTranslate.

◆ ~ZoneTranslate()

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

Default destructor.

Member Function Documentation

◆ GetVel()

std::vector<NekDouble> Nektar::SpatialDomains::ZoneTranslate::GetVel ( ) const
inline

Returns the velocity of the zone.

Definition at line 200 of file Zones.h.

201  {
202  return m_velocity;
203  }

References m_velocity.

◆ v_Move()

bool Nektar::SpatialDomains::ZoneTranslate::v_Move ( NekDouble  time)
finalvirtual

Virtual function for movement of the zone at.

Parameters
time

Reimplemented from Nektar::SpatialDomains::ZoneBase.

Definition at line 234 of file Zones.cpp.

235 {
236  Array<OneD, NekDouble> dist(3, 0.0);
237  for (int i = 0; i < m_coordDim; ++i)
238  {
239  dist[i] = m_velocity[i] * timeStep;
240  }
241 
242  int cnt = 0;
243  for (auto &vert : m_verts)
244  {
245  Array<OneD, NekDouble> newLoc(3, 0.0);
246  auto pnt = m_origVerts[cnt];
247 
248  for (int i = 0; i < m_coordDim; ++i)
249  {
250  newLoc[i] = pnt(i) + dist[i];
251  }
252 
253  vert->UpdatePosition(newLoc[0], newLoc[1], newLoc[2]);
254  cnt++;
255  }
256 
257  for (auto &curve : m_curves)
258  {
259  for (auto &vert : curve->m_points)
260  {
261  Array<OneD, NekDouble> newLoc(3, 0.0);
262  auto pnt = m_origVerts[cnt];
263 
264  for (int i = 0; i < m_coordDim; ++i)
265  {
266  newLoc[i] = pnt(i) + dist[i];
267  }
268 
269  vert->UpdatePosition(newLoc[0], newLoc[1], newLoc[2]);
270  cnt++;
271  }
272  }
273 
275 
276  return true;
277 }
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
void ClearBoundingBoxes()
Clears all bounding boxes associated with the zones elements.
Definition: Zones.cpp:158
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

References Nektar::SpatialDomains::ZoneBase::ClearBoundingBoxes(), Nektar::SpatialDomains::ZoneBase::m_coordDim, Nektar::SpatialDomains::ZoneBase::m_curves, Nektar::SpatialDomains::ZoneBase::m_origVerts, m_velocity, and Nektar::SpatialDomains::ZoneBase::m_verts.

Member Data Documentation

◆ m_velocity

std::vector<NekDouble> Nektar::SpatialDomains::ZoneTranslate::m_velocity
protected

Definition at line 209 of file Zones.h.

Referenced by GetVel(), and v_Move().