Nektar++
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
37#include <boost/python/suite/indexing/map_indexing_suite.hpp>
38
39using namespace Nektar;
40using namespace Nektar::SpatialDomains;
41
42ZoneRotateShPtr ZoneRotate_Init(int id, int domainID,
43 const CompositeMap &domain, const int coordDim,
45 const DNekVec &axis,
47{
48 return std::make_shared<ZoneRotate>(id, domainID, domain, coordDim, origin,
49 axis, angularVelEqn);
50}
51
53 int id, int domainID, const CompositeMap &domain, const int coordDim,
56{
57 return std::make_shared<ZoneTranslate>(id, domainID, domain, coordDim,
58 velocityEqns, displacementEqns);
59}
60
61ZoneFixedShPtr ZoneFixed_Init(int id, int domainID, const CompositeMap &domain,
62 const int coordDim)
63{
64 return std::make_shared<ZoneFixed>(id, domainID, domain, coordDim);
65}
66
68{
70
71 py::class_<ZoneBase, std::shared_ptr<ZoneBase>, boost::noncopyable>(
72 "ZoneBase", py::no_init)
73 .def("GetMovementType", &ZoneBase::GetMovementType)
74 .def("GetDomain", &ZoneBase::GetDomain)
75 .def("GetId", &ZoneBase::GetId,
76 py::return_value_policy<py::copy_non_const_reference>())
77 .def("GetDomainID", &ZoneBase::GetDomainID,
78 py::return_value_policy<py::copy_non_const_reference>())
79 .def("Move", &ZoneBase::Move)
80 .def("GetElements", &ZoneBase::GetElements,
81 py::return_internal_reference<>())
82 .def("GetMoved", &ZoneBase::GetMoved,
83 py::return_value_policy<py::copy_non_const_reference>())
84 .def("ClearBoundingBoxes", &ZoneBase::ClearBoundingBoxes);
85
86 py::class_<ZoneRotate, py::bases<ZoneBase>, std::shared_ptr<ZoneRotate>>(
87 "ZoneRotate", py::no_init)
88 .def("__init__", py::make_constructor(&ZoneRotate_Init))
89 .def("GetAngualrVel", &ZoneRotate::GetAngularVel)
90 .def("GetOrigin", &ZoneRotate::GetOrigin,
91 py::return_value_policy<py::copy_const_reference>())
92 .def("GetAxis", &ZoneRotate::GetAxis,
93 py::return_value_policy<py::copy_const_reference>())
94 .def("GetAngularVelEqn", &ZoneRotate::GetAngularVelEqn);
95
96 py::class_<ZoneTranslate, py::bases<ZoneBase>,
97 std::shared_ptr<ZoneTranslate>>("ZoneTranslate", py::no_init)
98 .def("__init__", py::make_constructor(&ZoneTranslate_Init))
99 .def("GetVelocityEquation", &ZoneTranslate::GetVelocityEquation)
100 .def("GetDisplacementEqn", &ZoneTranslate::GetDisplacementEquation);
101
102 py::class_<ZoneFixed, py::bases<ZoneBase>, std::shared_ptr<ZoneFixed>>(
103 "ZoneFixed", py::no_init)
104 .def("__init__", py::make_constructor(&ZoneFixed_Init));
105}
106
107//
#define NEKPY_WRAP_ENUM_STRING(ENUMNAME, MAPNAME)
Definition: NekPyConfig.hpp:80
ZoneRotateShPtr ZoneRotate_Init(int id, int domainID, const CompositeMap &domain, const int coordDim, const NekPoint< NekDouble > &origin, const DNekVec &axis, LibUtilities::EquationSharedPtr &angularVelEqn)
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)
void export_Zones()
std::shared_ptr< Equation > EquationSharedPtr
Definition: Equation.h:125
const NekPoint< NekDouble > origin
std::shared_ptr< ZoneTranslate > ZoneTranslateShPtr
Definition: Zones.h:313
std::shared_ptr< ZoneRotate > ZoneRotateShPtr
Definition: Zones.h:312
MovementType
Enum of zone movement type.
Definition: Zones.h:47
std::shared_ptr< ZoneFixed > ZoneFixedShPtr
Definition: Zones.h:314
const std::string MovementTypeStr[]
Map of zone movement type to movement type string.
Definition: Zones.h:56
std::map< int, CompositeSharedPtr > CompositeMap
Definition: MeshGraph.h:136