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 Array< OneD, LibUtilities::EquationSharedPtr > &velocityEqns, const Array< OneD, LibUtilities::EquationSharedPtr > &displacementEqns)
 
 ~ZoneTranslate () override=default
 Default destructor. More...
 
std::vector< NekDoubleGetVel (NekDouble &time) const
 Returns the velocity of the zone. More...
 
std::vector< NekDoubleGetDisp (NekDouble &time)
 Returns the displacement of the zone. More...
 
std::vector< NekDoublev_GetDisp () const override
 Returns zone displacment. More...
 
Array< OneD, LibUtilities::EquationSharedPtrGetVelocityEquation () const
 Returns the equation for the velocity of the translation. More...
 
Array< OneD, LibUtilities::EquationSharedPtrGetDisplacementEquation () const
 Returns the equation for the displacement of the translation. 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...
 
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

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

Array< OneD, LibUtilities::EquationSharedPtrm_velocityEqns
 
Array< OneD, LibUtilities::EquationSharedPtrm_displacementEqns
 
std::vector< NekDoublem_disp
 
- 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...
 
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

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

Definition at line 233 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 
)
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 245 of file Zones.h.

249 : ZoneBase(MovementType::eTranslate, id, domainID, domain, coordDim),
250 m_velocityEqns(velocityEqns), m_displacementEqns(displacementEqns)
251 {
252 }
ZoneBase(MovementType type, int indx, int domainID, CompositeMap domain, int coordDim)
Constructor.
Array< OneD, LibUtilities::EquationSharedPtr > m_displacementEqns
Definition: Zones.h:284
Array< OneD, LibUtilities::EquationSharedPtr > m_velocityEqns
Definition: Zones.h:283

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

287{
288 m_disp = std::vector<NekDouble>(m_coordDim);
289 for (int i = 0; i < m_coordDim; ++i)
290 {
291 m_disp[i] = m_displacementEqns[i]->Evaluate(0, 0, 0, time);
292 }
293 return m_disp;
294}
int m_coordDim
Coordinate dimension.
Definition: Zones.h:155
std::vector< NekDouble > m_disp
Definition: Zones.h:285

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

278 {
279 return m_displacementEqns;
280 }

References m_displacementEqns.

◆ GetVel()

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

Returns the velocity of the zone.

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

276{
277 std::vector<NekDouble> vel(m_coordDim);
278 for (int i = 0; i < m_coordDim; ++i)
279 {
280 vel[i] = m_velocityEqns[i]->Evaluate(0, 0, 0, time);
281 }
282
283 return vel;
284}

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

271 {
272 return m_velocityEqns;
273 }

References m_velocityEqns.

◆ v_GetDisp()

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

Returns zone displacment.

Reimplemented from Nektar::SpatialDomains::ZoneBase.

Definition at line 263 of file Zones.h.

264 {
265 return m_disp;
266 }

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

297{
298 auto disp = GetDisp(time);
299
300 int cnt = 0;
301 for (auto &vert : m_verts)
302 {
303 Array<OneD, NekDouble> newLoc(3, 0.0);
304 auto pnt = m_origVerts[cnt];
305
306 for (int i = 0; i < m_coordDim; ++i)
307 {
308 newLoc[i] = pnt(i) + disp[i];
309 }
310
311 vert->UpdatePosition(newLoc[0], newLoc[1], newLoc[2]);
312 cnt++;
313 }
314
315 for (auto &curve : m_curves)
316 {
317 for (auto &vert : curve->m_points)
318 {
319 Array<OneD, NekDouble> newLoc(3, 0.0);
320 auto pnt = m_origVerts[cnt];
321
322 for (int i = 0; i < m_coordDim; ++i)
323 {
324 newLoc[i] = pnt(i) + disp[i];
325 }
326
327 vert->UpdatePosition(newLoc[0], newLoc[1], newLoc[2]);
328 cnt++;
329 }
330 }
331
333
334 return true;
335}
std::vector< PointGeomSharedPtr > m_verts
Vector of all points in the zone.
Definition: Zones.h:157
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:161
std::vector< CurveSharedPtr > m_curves
Vector of all curves in the zone.
Definition: Zones.h:159
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 285 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 284 of file Zones.h.

Referenced by GetDisp(), and GetDisplacementEquation().

◆ m_velocityEqns

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

Definition at line 283 of file Zones.h.

Referenced by GetVel(), and GetVelocityEquation().