Nektar++
Loading...
Searching...
No Matches
Python/Zones.cpp
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////////////
2//
3// File: Zones.cpp
4//
5// For more information, please see: http://www.nektar.info/
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Python wrapper for Zones.
32//
33////////////////////////////////////////////////////////////////////////////////
34
36
40
41using namespace Nektar;
42using namespace Nektar::SpatialDomains;
43
45 int id, int domainID, const CompositeMap &domain, const int coordDim,
46 const NekPoint<NekDouble> &origin, const DNekVec &axis,
47 const LibUtilities::EquationSharedPtr &angularVelEqn,
48 const NekDouble rampTime, const NekDouble sector,
49 const Array<OneD, NekDouble> &base)
50{
51 return std::make_shared<ZoneRotate>(id, domainID, domain, coordDim, origin,
52 axis, angularVelEqn, rampTime, sector,
53 base);
54}
55
57 int id, int domainID, const CompositeMap &domain, const int coordDim,
60{
61 return std::make_shared<ZoneTranslate>(id, domainID, domain, coordDim,
62 velocityEqns, displacementEqns);
63}
64
65ZoneFixedShPtr ZoneFixed_Init(int id, int domainID, const CompositeMap &domain,
66 const int coordDim)
67{
68 return std::make_shared<ZoneFixed>(id, domainID, domain, coordDim);
69}
70
71void export_Zones(py::module &m)
72{
74
75 py::class_<ZoneBase, std::shared_ptr<ZoneBase>>(m, "ZoneBase")
76 .def("GetMovementType", &ZoneBase::GetMovementType,
77 py::return_value_policy::reference_internal)
78 .def("GetDomain", &ZoneBase::GetDomain,
79 py::return_value_policy::reference_internal)
80 .def("GetId", &ZoneBase::GetId, py::return_value_policy::copy)
81 .def("GetDomainID", &ZoneBase::GetDomainID,
82 py::return_value_policy::copy)
83 .def("Move", &ZoneBase::Move)
84 .def("GetElements", &ZoneBase::GetElements,
85 py::return_value_policy::reference_internal)
86 .def("GetMoved", &ZoneBase::GetMoved, py::return_value_policy::copy)
87 .def("ClearBoundingBoxes", &ZoneBase::ClearBoundingBoxes);
88
89 py::class_<ZoneRotate, ZoneBase, std::shared_ptr<ZoneRotate>>(m,
90 "ZoneRotate")
91 .def(py::init<>(&ZoneRotate_Init))
92 .def("GetAngualrVel", &ZoneRotate::GetAngularVel)
93 .def("GetOrigin", &ZoneRotate::GetOrigin, py::return_value_policy::copy)
94 .def("GetAxis", &ZoneRotate::GetAxis, py::return_value_policy::copy)
95 .def("GetAngularVelEqn", &ZoneRotate::GetAngularVelEqn);
96
97 py::class_<ZoneTranslate, ZoneBase, std::shared_ptr<ZoneTranslate>>(
98 m, "ZoneTranslate")
99 .def(py::init<>(&ZoneTranslate_Init))
100 .def("GetVelocityEquation", &ZoneTranslate::GetVelocityEquation)
101 .def("GetDisplacementEqn", &ZoneTranslate::GetDisplacementEquation);
102
103 py::class_<ZoneFixed, ZoneBase, std::shared_ptr<ZoneFixed>>(m, "ZoneFixed")
104 .def(py::init<>(&ZoneFixed_Init));
105}
106
107//
#define NEKPY_WRAP_ENUM_STRING(MOD, ENUMNAME, MAPNAME)
void export_Zones(py::module &m)
ZoneRotateShPtr ZoneRotate_Init(int id, int domainID, const CompositeMap &domain, const int coordDim, const NekPoint< NekDouble > &origin, const DNekVec &axis, const LibUtilities::EquationSharedPtr &angularVelEqn, const NekDouble rampTime, const NekDouble sector, const Array< OneD, NekDouble > &base)
ZoneFixedShPtr ZoneFixed_Init(int id, int domainID, const CompositeMap &domain, const int coordDim)
ZoneTranslateShPtr ZoneTranslate_Init(int id, int domainID, const CompositeMap &domain, const int coordDim, const Array< OneD, LibUtilities::EquationSharedPtr > &velocityEqns, const Array< OneD, LibUtilities::EquationSharedPtr > &displacementEqns)
std::shared_ptr< Equation > EquationSharedPtr
Definition Equation.h:131
std::shared_ptr< ZoneTranslate > ZoneTranslateShPtr
Definition Zones.h:376
std::shared_ptr< ZoneRotate > ZoneRotateShPtr
Definition Zones.h:375
MovementType
Enum of zone movement type.
Definition Zones.h:48
std::shared_ptr< ZoneFixed > ZoneFixedShPtr
Definition Zones.h:377
const std::string MovementTypeStr[]
Map of zone movement type to movement type string.
Definition Zones.h:57
std::map< int, CompositeSharedPtr > CompositeMap
Definition MeshGraph.h:179
bool Move(NekDouble time)
Performs the movement of the zone at.
Definition Zones.h:95
void ClearBoundingBoxes()
Clears all bounding boxes associated with the zones elements.
CompositeMap GetDomain() const
Returns the domain the zone is on.
Definition Zones.h:77
bool & GetMoved()
Returns the flag which states if the zone has moved in this timestep.
Definition Zones.h:107
MovementType GetMovementType() const
Returns the type of movement.
Definition Zones.h:71
std::vector< Geometry * > const & GetElements() const
Returns all highest dimension elements in the zone.
Definition Zones.h:101
int & GetDomainID()
Returns the ID of the domain making up this Zone.
Definition Zones.h:89
int & GetId()
Returns the zone ID.
Definition Zones.h:83
LibUtilities::EquationSharedPtr GetAngularVelEqn() const
Returns the equation for the angular velocity of the rotation.
Definition Zones.h:227
NekDouble GetAngularVel(const NekDouble &time) const
Return the angular velocity of the zone at.
const DNekVec & GetAxis() const
Returns the axis the zone rotates about.
Definition Zones.h:221
const NekPoint< NekDouble > & GetOrigin() const
Returns the origin the zone rotates about.
Definition Zones.h:215
Array< OneD, LibUtilities::EquationSharedPtr > GetDisplacementEquation() const
Returns the equation for the displacement of the translation.
Definition Zones.h:314
Array< OneD, LibUtilities::EquationSharedPtr > GetVelocityEquation() const
Returns the equation for the velocity of the translation.
Definition Zones.h:307