Nektar++
Public Member Functions | Protected 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, int domainID, const CompositeMap &domain, const int coordDim, const std::vector< NekDouble > &velocity)
 
 ~ZoneTranslate () override=default
 Default destructor. More...
 
std::vector< NekDoubleGetVel () const
 Returns the velocity of the zone. More...
 
- Public Member Functions inherited from Nektar::SpatialDomains::ZoneBase
 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

bool v_Move (NekDouble time) final
 Virtual function for movement of the zone at. More...
 
virtual bool v_Move (NekDouble time)
 Virtual function for movement of the zone at. 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...
 
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

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

Definition at line 207 of file Zones.h.

Constructor & Destructor Documentation

◆ ZoneTranslate()

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

Constructor for translating zone

Parameters
idZone ID
domainIDID associated with the the domain making up the zone
domainDomain that the zone consists of
coordDimCoordinate dimension
velocityVector of translation velocity in x,y,z direction

Definition at line 219 of file Zones.h.

221 : ZoneBase(MovementType::eTranslate, id, domainID, domain, coordDim),
223 {
224 }
const std::vector< NekDouble > velocity
ZoneBase(MovementType type, int indx, int domainID, CompositeMap domain, int coordDim)
Constructor.
std::vector< NekDouble > m_velocity
Definition: Zones.h:236

◆ ~ZoneTranslate()

Nektar::SpatialDomains::ZoneTranslate::~ZoneTranslate ( )
overridedefault

Default destructor.

Member Function Documentation

◆ GetVel()

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

Returns the velocity of the zone.

Definition at line 230 of file Zones.h.

231 {
232 return m_velocity;
233 }

References m_velocity.

◆ v_Move()

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

Virtual function for movement of the zone at.

Parameters
time

Reimplemented from Nektar::SpatialDomains::ZoneBase.

Definition at line 234 of file Movement/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:131
int m_coordDim
Coordinate dimension.
Definition: Zones.h:129
void ClearBoundingBoxes()
Clears all bounding boxes associated with the zones elements.
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

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

Referenced by GetVel(), and v_Move().