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 const CompositeMap &domain,
54 const int coordDim,
55 const std::vector<NekDouble> &velocity)
56{
57 return std::make_shared<ZoneTranslate>(id, domainID, domain, coordDim,
58 velocity);
59}
60
62 const CompositeMap &domain,
63 const int coordDim,
67{
68 return std::make_shared<ZonePrescribe>(id, domainID, domain, coordDim,
69 xDeform, yDeform, zDeform);
70}
71
72ZoneFixedShPtr ZoneFixed_Init(int id, int domainID, const CompositeMap &domain,
73 const int coordDim)
74{
75 return std::make_shared<ZoneFixed>(id, domainID, domain, coordDim);
76}
77
79{
81
82 py::class_<ZoneBase, std::shared_ptr<ZoneBase>, boost::noncopyable>(
83 "ZoneBase", py::no_init)
84 .def("GetMovementType", &ZoneBase::GetMovementType)
85 .def("GetDomain", &ZoneBase::GetDomain)
86 .def("GetId", &ZoneBase::GetId,
87 py::return_value_policy<py::copy_non_const_reference>())
88 .def("GetDomainID", &ZoneBase::GetDomainID,
89 py::return_value_policy<py::copy_non_const_reference>())
90 .def("Move", &ZoneBase::Move)
91 .def("GetElements", &ZoneBase::GetElements,
92 py::return_internal_reference<>())
93 .def("GetMoved", &ZoneBase::GetMoved,
94 py::return_value_policy<py::copy_non_const_reference>())
95 .def("ClearBoundingBoxes", &ZoneBase::ClearBoundingBoxes);
96
97 py::class_<ZoneRotate, py::bases<ZoneBase>, std::shared_ptr<ZoneRotate>>(
98 "ZoneRotate", py::no_init)
99 .def("__init__", py::make_constructor(&ZoneRotate_Init))
100 .def("GetAngualrVel", &ZoneRotate::GetAngularVel)
101 .def("GetOrigin", &ZoneRotate::GetOrigin,
102 py::return_value_policy<py::copy_const_reference>())
103 .def("GetAxis", &ZoneRotate::GetAxis,
104 py::return_value_policy<py::copy_const_reference>())
105 .def("GetAngularVelEqn", &ZoneRotate::GetAngularVelEqn);
106
107 py::class_<ZoneTranslate, py::bases<ZoneBase>,
108 std::shared_ptr<ZoneTranslate>>("ZoneTranslate", py::no_init)
109 .def("__init__", py::make_constructor(&ZoneTranslate_Init))
110 .def("GetVel", &ZoneTranslate::GetVel);
111
112 py::class_<ZonePrescribe, py::bases<ZoneBase>,
113 std::shared_ptr<ZonePrescribe>>("ZonePrescribe", py::no_init)
114 .def("__init__", py::make_constructor(&ZonePrescribe_Init))
115 .def("GetXDeform", &ZonePrescribe::GetXDeform)
116 .def("GetYDeform", &ZonePrescribe::GetYDeform)
117 .def("GetZDeform", &ZonePrescribe::GetZDeform)
118 .def("GetXDeformEquation", &ZonePrescribe::GetXDeformEquation)
119 .def("GetYDeformEquation", &ZonePrescribe::GetYDeformEquation)
120 .def("GetZDeformEquation", &ZonePrescribe::GetZDeformEquation);
121
122 py::class_<ZoneFixed, py::bases<ZoneBase>, std::shared_ptr<ZoneFixed>>(
123 "ZoneFixed", py::no_init)
124 .def("__init__", py::make_constructor(&ZoneFixed_Init));
125}
126
127//
#define NEKPY_WRAP_ENUM_STRING(ENUMNAME, MAPNAME)
Definition: NekPyConfig.hpp:78
ZoneRotateShPtr ZoneRotate_Init(int id, int domainID, const CompositeMap &domain, const int coordDim, const NekPoint< NekDouble > &origin, const DNekVec &axis, LibUtilities::EquationSharedPtr &angularVelEqn)
ZoneTranslateShPtr ZoneTranslate_Init(int id, int domainID, const CompositeMap &domain, const int coordDim, const std::vector< NekDouble > &velocity)
ZoneFixedShPtr ZoneFixed_Init(int id, int domainID, const CompositeMap &domain, const int coordDim)
ZonePrescribeShPtr ZonePrescribe_Init(int id, int domainID, const CompositeMap &domain, const int coordDim, LibUtilities::EquationSharedPtr xDeform, LibUtilities::EquationSharedPtr yDeform, LibUtilities::EquationSharedPtr zDeform)
void export_Zones()
std::shared_ptr< Equation > EquationSharedPtr
Definition: Equation.h:125
const std::vector< NekDouble > velocity
const NekPoint< NekDouble > origin
std::shared_ptr< ZonePrescribe > ZonePrescribeShPtr
Definition: Zones.h:364
std::shared_ptr< ZoneTranslate > ZoneTranslateShPtr
Definition: Zones.h:363
std::shared_ptr< ZoneRotate > ZoneRotateShPtr
Definition: Zones.h:362
MovementType
Enum of zone movement type.
Definition: Zones.h:47
std::shared_ptr< ZoneFixed > ZoneFixedShPtr
Definition: Zones.h:365
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:136