Nektar++
Loading...
Searching...
No Matches
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 Array< OneD, LibUtilities::EquationSharedPtr > &velocityEqns, const Array< OneD, LibUtilities::EquationSharedPtr > &displacementEqns)
 
 ~ZoneTranslate () override=default
 Default destructor.
 
std::vector< NekDoubleGetVel (NekDouble &time) const
 Returns the velocity of the zone.
 
std::vector< NekDoubleGetDisp (NekDouble &time)
 Returns the displacement of the zone.
 
std::vector< NekDoublev_GetDisp () const override
 Returns zone displacment.
 
Array< OneD, LibUtilities::EquationSharedPtrGetVelocityEquation () const
 Returns the equation for the velocity of the translation.
 
Array< OneD, LibUtilities::EquationSharedPtrGetDisplacementEquation () const
 Returns the equation for the displacement of the translation.
 
const Array< OneD, NekDouble > & GetZoneBox () const
 
const Array< OneD, NekDouble > & GetZoneLength () const
 
void UpdateZoneBox (const Array< OneD, NekDouble > &ZoneBox, const Array< OneD, NekDouble > &ZoneLength)
 
- Public Member Functions inherited from Nektar::SpatialDomains::ZoneBase
 ZoneBase (MovementType type, int indx, int domainID, CompositeMap domain, int coordDim)
 Constructor.
 
virtual ~ZoneBase ()=default
 Default destructor.
 
MovementType GetMovementType () const
 Returns the type of movement.
 
CompositeMap GetDomain () const
 Returns the domain the zone is on.
 
int & GetId ()
 Returns the zone ID.
 
int & GetDomainID ()
 Returns the ID of the domain making up this Zone.
 
bool Move (NekDouble time)
 Performs the movement of the zone at.
 
std::vector< Geometry * > const & GetElements () const
 Returns all highest dimension elements in the zone.
 
bool & GetMoved ()
 Returns the flag which states if the zone has moved in this timestep.
 
void ClearBoundingBoxes ()
 Clears all bounding boxes associated with the zones elements.
 
std::array< std::set< Geometry * >, 3 > & GetConstituentElements ()
 Returns constituent elements, i.e. faces + edges.
 
std::vector< PointGeom > & GetOriginalVertex ()
 Returns all points in the zone at initialisation.
 
virtual NekDouble v_GetAngle () const
 Returns zone rotate angle.
 

Protected Member Functions

bool v_Move (NekDouble time) final
 Virtual function for movement of the zone at.
 

Protected Attributes

Array< OneD, LibUtilities::EquationSharedPtrm_velocityEqns
 
Array< OneD, LibUtilities::EquationSharedPtrm_displacementEqns
 
std::vector< NekDoublem_disp
 
Array< OneD, NekDoublem_ZoneBox
 
Array< OneD, NekDoublem_ZoneLength
 
- Protected Attributes inherited from Nektar::SpatialDomains::ZoneBase
MovementType m_type = MovementType::eNone
 Type of zone movement.
 
int m_id
 Zone ID.
 
int m_domainID
 ID for the composite making up this zone.
 
CompositeMap m_domain
 Zone domain.
 
std::vector< Geometry * > m_elements
 Vector of highest dimension zone elements.
 
std::array< std::set< Geometry * >, 3 > m_constituentElements
 Array of all dimension elements i.e. faces = [2], edges = [1], geom = [0].
 
bool m_moved = true
 Moved flag.
 
int m_coordDim
 Coordinate dimension.
 
std::vector< PointGeomUniquePtrm_verts
 Vector of all points in the zone.
 
std::vector< CurveSharedPtrm_curves
 Vector of all curves in the zone.
 
std::vector< PointGeomm_origVerts
 Vector of all points in the zone at initialisation.
 

Detailed Description

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

Definition at line 275 of file Zones.h.

Constructor & Destructor Documentation

◆ ZoneTranslate()

Nektar::SpatialDomains::ZoneTranslate::ZoneTranslate ( int  id,
int  domainID,
const CompositeMap domain,
const int  coordDim,
const Array< OneD, LibUtilities::EquationSharedPtr > &  velocityEqns,
const Array< OneD, LibUtilities::EquationSharedPtr > &  displacementEqns 
)

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 305 of file Movement/Zones.cpp.

309 : ZoneBase(MovementType::eTranslate, id, domainID, domain, coordDim),
310 m_velocityEqns(velocityEqns), m_displacementEqns(displacementEqns)
311{
312 int NumVerts = m_origVerts.size();
313 // Bounding length
314 m_ZoneLength = Array<OneD, NekDouble>(3);
315 // Bounding box
316 m_ZoneBox = Array<OneD, NekDouble>(6);
317 // NekDouble minx, miny, minz, maxx, maxy, maxz;
318 Array<OneD, NekDouble> min(3), max(3);
319 Array<OneD, NekDouble> x(3);
320 // Initialise max and min
321 for (int j = 0; j < 3; ++j)
322 {
323 min[j] = std::numeric_limits<double>::max();
324 max[j] = -std::numeric_limits<double>::max();
325 }
326 // Loop over all original vertexes to get the box and length
327 for (int i = 0; i < NumVerts; ++i)
328 {
329 PointGeom p = m_origVerts[i];
330 p.GetCoords(x[0], x[1], x[2]);
331 for (int j = 0; j < 3; ++j)
332 {
333 min[j] = (x[j] < min[j] ? x[j] : min[j]);
334 max[j] = (x[j] > max[j] ? x[j] : max[j]);
335 }
336 }
337 for (int j = 0; j < 3; ++j)
338 {
339 m_ZoneBox[j] = min[j];
340 m_ZoneBox[j + 3] = max[j];
341 m_ZoneLength[j] = max[j] - min[j];
342 }
343}
std::vector< double > p(NPUPPER)
scalarT< T > max(scalarT< T > lhs, scalarT< T > rhs)
Definition scalar.hpp:305
scalarT< T > min(scalarT< T > lhs, scalarT< T > rhs)
Definition scalar.hpp:300
ZoneBase(MovementType type, int indx, int domainID, CompositeMap domain, int coordDim)
Constructor.
std::vector< PointGeom > m_origVerts
Vector of all points in the zone at initialisation.
Definition Zones.h:168
Array< OneD, NekDouble > m_ZoneLength
Definition Zones.h:345
Array< OneD, LibUtilities::EquationSharedPtr > m_displacementEqns
Definition Zones.h:342
Array< OneD, LibUtilities::EquationSharedPtr > m_velocityEqns
Definition Zones.h:341
Array< OneD, NekDouble > m_ZoneBox
Definition Zones.h:344

References Nektar::SpatialDomains::ZoneBase::m_origVerts, m_ZoneBox, m_ZoneLength, tinysimd::max(), and tinysimd::min().

◆ ~ZoneTranslate()

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

Default destructor.

Member Function Documentation

◆ GetDisp()

std::vector< NekDouble > Nektar::SpatialDomains::ZoneTranslate::GetDisp ( NekDouble time)

Returns the displacement of the zone.

Definition at line 356 of file Movement/Zones.cpp.

357{
358 m_disp = std::vector<NekDouble>(m_coordDim);
359 for (int i = 0; i < m_coordDim; ++i)
360 {
361 m_disp[i] = m_displacementEqns[i]->Evaluate(0, 0, 0, time);
362 }
363 return m_disp;
364}
int m_coordDim
Coordinate dimension.
Definition Zones.h:162
std::vector< NekDouble > m_disp
Definition Zones.h:343

References Nektar::SpatialDomains::ZoneBase::m_coordDim, m_disp, and m_displacementEqns.

Referenced by v_Move().

◆ GetDisplacementEquation()

Array< OneD, LibUtilities::EquationSharedPtr > Nektar::SpatialDomains::ZoneTranslate::GetDisplacementEquation ( ) const
inline

Returns the equation for the displacement of the translation.

Definition at line 314 of file Zones.h.

316 {
317 return m_displacementEqns;
318 }

References m_displacementEqns.

Referenced by export_Zones().

◆ GetVel()

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

Returns the velocity of the zone.

Definition at line 345 of file Movement/Zones.cpp.

346{
347 std::vector<NekDouble> vel(m_coordDim);
348 for (int i = 0; i < m_coordDim; ++i)
349 {
350 vel[i] = m_velocityEqns[i]->Evaluate(0, 0, 0, time);
351 }
352
353 return vel;
354}

References Nektar::SpatialDomains::ZoneBase::m_coordDim, and m_velocityEqns.

◆ GetVelocityEquation()

Array< OneD, LibUtilities::EquationSharedPtr > Nektar::SpatialDomains::ZoneTranslate::GetVelocityEquation ( ) const
inline

Returns the equation for the velocity of the translation.

Definition at line 307 of file Zones.h.

309 {
310 return m_velocityEqns;
311 }

References m_velocityEqns.

Referenced by export_Zones().

◆ GetZoneBox()

const Array< OneD, NekDouble > & Nektar::SpatialDomains::ZoneTranslate::GetZoneBox ( ) const
inline

Definition at line 320 of file Zones.h.

322 {
323 return m_ZoneBox;
324 }

References m_ZoneBox.

◆ GetZoneLength()

const Array< OneD, NekDouble > & Nektar::SpatialDomains::ZoneTranslate::GetZoneLength ( ) const
inline

Definition at line 326 of file Zones.h.

328 {
329 return m_ZoneLength;
330 }

References m_ZoneLength.

◆ UpdateZoneBox()

void Nektar::SpatialDomains::ZoneTranslate::UpdateZoneBox ( const Array< OneD, NekDouble > &  ZoneBox,
const Array< OneD, NekDouble > &  ZoneLength 
)
inline

Definition at line 332 of file Zones.h.

335 {
336 m_ZoneBox = ZoneBox;
337 m_ZoneLength = ZoneLength;
338 }

References m_ZoneBox, and m_ZoneLength.

◆ v_GetDisp()

std::vector< NekDouble > Nektar::SpatialDomains::ZoneTranslate::v_GetDisp ( ) const
inlineoverridevirtual

Returns zone displacment.

Reimplemented from Nektar::SpatialDomains::ZoneBase.

Definition at line 301 of file Zones.h.

302 {
303 return m_disp;
304 }

References m_disp.

◆ 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 366 of file Movement/Zones.cpp.

367{
368 auto disp = GetDisp(time);
369
370 int cnt = 0;
371 for (auto &vert : m_verts)
372 {
373 Array<OneD, NekDouble> newLoc(3, 0.0);
374 auto pnt = m_origVerts[cnt];
375
376 for (int i = 0; i < m_coordDim; ++i)
377 {
378 newLoc[i] = pnt(i) + disp[i];
379 }
380
381 vert->UpdatePosition(newLoc[0], newLoc[1], newLoc[2]);
382 cnt++;
383 }
384
385 for (auto &curve : m_curves)
386 {
387 for (auto &vert : curve->m_points)
388 {
389 Array<OneD, NekDouble> newLoc(3, 0.0);
390 auto pnt = m_origVerts[cnt];
391
392 for (int i = 0; i < m_coordDim; ++i)
393 {
394 newLoc[i] = pnt(i) + disp[i];
395 }
396
397 vert->UpdatePosition(newLoc[0], newLoc[1], newLoc[2]);
398 cnt++;
399 }
400 }
401
403
404 return true;
405}
void ClearBoundingBoxes()
Clears all bounding boxes associated with the zones elements.
std::vector< CurveSharedPtr > m_curves
Vector of all curves in the zone.
Definition Zones.h:166
std::vector< PointGeomUniquePtr > m_verts
Vector of all points in the zone.
Definition Zones.h:164
std::vector< NekDouble > GetDisp(NekDouble &time)
Returns the displacement of the zone.

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

Member Data Documentation

◆ m_disp

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

Definition at line 343 of file Zones.h.

Referenced by GetDisp(), and v_GetDisp().

◆ m_displacementEqns

Array<OneD, LibUtilities::EquationSharedPtr> Nektar::SpatialDomains::ZoneTranslate::m_displacementEqns
protected

Definition at line 342 of file Zones.h.

Referenced by GetDisp(), and GetDisplacementEquation().

◆ m_velocityEqns

Array<OneD, LibUtilities::EquationSharedPtr> Nektar::SpatialDomains::ZoneTranslate::m_velocityEqns
protected

Definition at line 341 of file Zones.h.

Referenced by GetVel(), and GetVelocityEquation().

◆ m_ZoneBox

Array<OneD, NekDouble> Nektar::SpatialDomains::ZoneTranslate::m_ZoneBox
protected

Definition at line 344 of file Zones.h.

Referenced by GetZoneBox(), UpdateZoneBox(), and ZoneTranslate().

◆ m_ZoneLength

Array<OneD, NekDouble> Nektar::SpatialDomains::ZoneTranslate::m_ZoneLength
protected

Definition at line 345 of file Zones.h.

Referenced by GetZoneLength(), UpdateZoneBox(), and ZoneTranslate().