Nektar++
Functions
SpatialDomains.cpp File Reference
#include <LibUtilities/Python/NekPyConfig.hpp>

Go to the source code of this file.

Functions

void export_Geometry ()
 
void export_Curve ()
 
void export_MeshGraph ()
 MeshGraph exports. More...
 
void export_GeomElements ()
 
void export_Zones ()
 
void export_Interfaces ()
 
void export_Movement ()
 
 BOOST_PYTHON_MODULE (_SpatialDomains)
 

Function Documentation

◆ BOOST_PYTHON_MODULE()

BOOST_PYTHON_MODULE ( _SpatialDomains  )

Definition at line 45 of file SpatialDomains.cpp.

46{
47 np::initialize();
48
56}
void export_Geometry()
void export_Movement()
void export_GeomElements()
void export_Interfaces()
Definition: Interfaces.cpp:53
void export_MeshGraph()
MeshGraph exports.
void export_Curve()
Definition: Curve.cpp:61
void export_Zones()

References export_Curve(), export_GeomElements(), export_Geometry(), export_Interfaces(), export_MeshGraph(), export_Movement(), and export_Zones().

◆ export_Curve()

void export_Curve ( )

Definition at line 61 of file Curve.cpp.

62{
63 py::class_<Curve, std::shared_ptr<Curve>>(
64 "Curve", py::init<int, LibUtilities::PointsType>())
65
66 .def_readwrite("curveID", &Curve::m_curveID)
67 .def_readwrite("ptype", &Curve::m_ptype)
68 .add_property("points", &Curve_GetPoints, &Curve_SetPoints);
69}
py::list Curve_GetPoints(CurveSharedPtr curve)
Definition: Curve.cpp:41
void Curve_SetPoints(CurveSharedPtr curve, py::list &pts)
Definition: Curve.cpp:51

References Curve_GetPoints(), and Curve_SetPoints().

Referenced by BOOST_PYTHON_MODULE().

◆ export_GeomElements()

void export_GeomElements ( )

Definition at line 122 of file GeomElements.cpp.

123{
124 // Geometry dimensioned base classes
125 py::class_<Geometry1D, py::bases<Geometry>, std::shared_ptr<Geometry1D>,
126 boost::noncopyable>("Geometry1D", py::no_init);
127 py::class_<Geometry2D, py::bases<Geometry>, std::shared_ptr<Geometry2D>,
128 boost::noncopyable>("Geometry2D", py::no_init)
129 .def("GetCurve", &Geometry2D::GetCurve);
130 py::class_<Geometry3D, py::bases<Geometry>, std::shared_ptr<Geometry3D>,
131 boost::noncopyable>("Geometry3D", py::no_init);
132
133 // Point geometries
134 py::class_<PointGeom, py::bases<Geometry>, std::shared_ptr<PointGeom>>(
135 "PointGeom", py::init<>())
136 .def(py::init<int, int, NekDouble, NekDouble, NekDouble>())
137 .def("GetCoordinates", &PointGeom_GetCoordinates);
138
139 // Segment geometries
140 py::class_<SegGeom, py::bases<Geometry>, std::shared_ptr<SegGeom>>(
141 "SegGeom", py::init<>())
142 .def("__init__",
143 py::make_constructor(&SegGeom_Init, py::default_call_policies(),
144 (py::arg("id"), py::arg("coordim"),
145 py::arg("points") = py::list(),
146 py::arg("curve") = py::object())))
147 .def("GetCurve", &SegGeom::GetCurve);
148
149 export_Geom_2d<TriGeom, SegGeom>("TriGeom");
150 export_Geom_2d<QuadGeom, SegGeom>("QuadGeom");
151 export_Geom_3d<TetGeom, TriGeom>("TetGeom");
152 export_Geom_3d<PrismGeom, Geometry2D>("PrismGeom");
153 export_Geom_3d<PyrGeom, Geometry2D>("PyrGeom");
154 export_Geom_3d<HexGeom, QuadGeom>("HexGeom");
155}
py::tuple PointGeom_GetCoordinates(const PointGeom &self)
SegGeomSharedPtr SegGeom_Init(int id, int coordim, py::list &points, py::object &curve)

References PointGeom_GetCoordinates(), and SegGeom_Init().

Referenced by BOOST_PYTHON_MODULE().

◆ export_Geometry()

void export_Geometry ( )

Definition at line 55 of file Python/Geometry.cpp.

56{
57 py::class_<Geometry, std::shared_ptr<Geometry>, boost::noncopyable>(
58 "Geometry", py::no_init)
59
60 .def("GetCoordim", &Geometry::GetCoordim)
61 .def("GetGlobalID", &Geometry::GetGlobalID)
62 .def("SetGlobalID", &Geometry::SetGlobalID)
63
64 .def("Setup", &Geometry::Setup)
65 .def("FillGeom", &Geometry::FillGeom)
66 .def("GenGeomFactors", &Geometry_GenGeomFactors)
67
68 .def("ContainsPoint", &Geometry_ContainsPoint)
69
70 .def("GetVertex", &Geometry::GetVertex)
71 .def("GetEdge", &Geometry::GetEdge)
72 .def("GetFace", &Geometry::GetFace)
73 .def("GetVid", &Geometry::GetVid)
74 .def("GetEid", &Geometry::GetEid)
75 .def("GetFid", &Geometry::GetFid)
76 .def("GetTid", &Geometry::GetTid)
77
78 .def("GetNumVerts", &Geometry::GetNumVerts)
79 .def("GetNumEdges", &Geometry::GetNumEdges)
80 .def("GetNumFaces", &Geometry::GetNumFaces)
81 .def("GetShapeDim", &Geometry::GetShapeDim)
82 .def("GetShapeType", &Geometry::GetShapeType)
83 .def("GetEorient", &Geometry::GetEorient)
84 .def("GetForient", &Geometry::GetForient)
85
86 .def("GetXmap", &Geometry::GetXmap)
87 .def("GetCoeffs", &Geometry::GetCoeffs,
88 py::return_value_policy<py::copy_const_reference>());
89}
void Geometry_GenGeomFactors(GeometrySharedPtr geom)
bool Geometry_ContainsPoint(GeometrySharedPtr geom, const Array< OneD, const NekDouble > &gloCoord)

References Geometry_ContainsPoint(), and Geometry_GenGeomFactors().

Referenced by BOOST_PYTHON_MODULE().

◆ export_Interfaces()

void export_Interfaces ( )

Definition at line 53 of file Interfaces.cpp.

54{
55 py::class_<std::vector<unsigned int>>("UIntList")
56 .def(py::vector_indexing_suite<std::vector<unsigned int>, true>());
57
58 py::class_<Interface, std::shared_ptr<Interface>>("Interface", py::no_init)
59 .def("__init__", py::make_constructor(&Interface_Init))
60 .def<const std::map<int, GeometrySharedPtr> &(Interface::*)() const>(
61 "GetEdge", &Interface::GetEdge, py::return_internal_reference<>())
62 .def("IsEmpty", &Interface::IsEmpty)
63 .def("GetId", &Interface::GetId,
64 py::return_value_policy<py::copy_non_const_reference>())
65 .def("GetOppInterace", &Interface::GetOppInterface,
66 py::return_internal_reference<>())
67 .def("GetCompositeIDs", &Interface::GetCompositeIDs,
68 py::return_value_policy<py::copy_const_reference>());
69
70 py::class_<InterfacePair, std::shared_ptr<InterfacePair>>("InterfacePair",
71 py::no_init)
72 .def("__init__", py::make_constructor(&InterfacePair_Init))
73 .def("GetLeftInterface", &InterfacePair::GetLeftInterface,
74 py::return_value_policy<py::copy_const_reference>())
75 .def("GetRightInterface", &InterfacePair::GetRightInterface,
76 py::return_value_policy<py::copy_const_reference>());
77}
std::shared_ptr< InterfacePair > InterfacePair_Init(const InterfaceShPtr &leftInterface, const InterfaceShPtr &rightInterface)
Definition: Interfaces.cpp:47
std::shared_ptr< Interface > Interface_Init(int indx, const CompositeMap &edge)
Definition: Interfaces.cpp:42
A interface which is a single edge on a zone for handling non-conformality.

References Interface_Init(), and InterfacePair_Init().

Referenced by BOOST_PYTHON_MODULE().

◆ export_MeshGraph()

void export_MeshGraph ( )

MeshGraph exports.

Definition at line 98 of file Python/MeshGraph.cpp.

99{
100 py::class_<LibUtilities::FieldMetaDataMap>("FieldMetaDataMap")
101 .def(py::map_indexing_suite<LibUtilities::FieldMetaDataMap, true>());
102
103 py::class_<std::vector<GeometrySharedPtr>>("GeometryList")
104 .def(py::vector_indexing_suite<std::vector<GeometrySharedPtr>, true>());
105 py::class_<Composite, std::shared_ptr<Composite>>("Composite", py::init<>())
106 .def("__init__", py::make_constructor(&Composite_Init))
107 .def_readwrite("geometries", &Composite::m_geomVec);
108
109 py::class_<PointGeomMap>("PointGeomMap")
110 .def(py::map_indexing_suite<PointGeomMap, true>());
111 py::class_<SegGeomMap>("SegGeomMap")
112 .def(py::map_indexing_suite<SegGeomMap, true>());
113 py::class_<QuadGeomMap>("QuadGeomMap")
114 .def(py::map_indexing_suite<QuadGeomMap, true>());
115 py::class_<TriGeomMap>("TriGeomMap")
116 .def(py::map_indexing_suite<TriGeomMap, true>());
117 py::class_<TetGeomMap>("TetGeomMap")
118 .def(py::map_indexing_suite<TetGeomMap, true>());
119 py::class_<PrismGeomMap>("PrismGeomMap")
120 .def(py::map_indexing_suite<PrismGeomMap, true>());
121 py::class_<PyrGeomMap>("PyrGeomMap")
122 .def(py::map_indexing_suite<PyrGeomMap, true>());
123 py::class_<HexGeomMap>("HexGeomMap")
124 .def(py::map_indexing_suite<HexGeomMap, true>());
125 py::class_<CurveMap>("CurveMap")
126 .def(py::map_indexing_suite<CurveMap, true>());
127 py::class_<CompositeMap>("CompositeMap")
128 .def(py::map_indexing_suite<CompositeMap, true>());
129 py::class_<std::map<int, CompositeMap>>("DomainMap")
130 .def(py::map_indexing_suite<std::map<int, CompositeMap>, true>());
131
132 py::class_<MeshGraph, std::shared_ptr<MeshGraph>, boost::noncopyable>(
133 "MeshGraph", py::no_init)
134
135 .def("Read", MeshGraph_Read)
136 .staticmethod("Read")
137
138 .def("Write", &MeshGraph::WriteGeometry, py::default_call_policies(),
139 (py::arg("outfile"), py::arg("defaultExp") = false,
140 py::arg("metadata") = LibUtilities::NullFieldMetaDataMap))
141
142 .def("GetMeshDimension", &MeshGraph::GetMeshDimension)
143 .def("GetAllPointGeoms", &MeshGraph::GetAllPointGeoms,
144 py::return_internal_reference<>())
145 .def("GetAllSegGeoms", &MeshGraph::GetAllSegGeoms,
146 py::return_internal_reference<>())
147 .def("GetAllQuadGeoms", &MeshGraph::GetAllQuadGeoms,
148 py::return_internal_reference<>())
149 .def("GetAllTriGeoms", &MeshGraph::GetAllTriGeoms,
150 py::return_internal_reference<>())
151 .def("GetAllTetGeoms", &MeshGraph::GetAllTetGeoms,
152 py::return_internal_reference<>())
153 .def("GetAllPrismGeoms", &MeshGraph::GetAllPrismGeoms,
154 py::return_internal_reference<>())
155 .def("GetAllPyrGeoms", &MeshGraph::GetAllPyrGeoms,
156 py::return_internal_reference<>())
157 .def("GetAllHexGeoms", &MeshGraph::GetAllHexGeoms,
158 py::return_internal_reference<>())
159 .def("GetCurvedEdges", &MeshGraph::GetCurvedEdges,
160 py::return_internal_reference<>())
161 .def("GetCurvedFaces", &MeshGraph::GetCurvedFaces,
162 py::return_internal_reference<>())
163 .def("GetComposites", &MeshGraph::GetComposites,
164 py::return_internal_reference<>())
165 .def<std::map<int, CompositeMap> &(MeshGraph::*)()>(
166 "GetDomain", &MeshGraph::GetDomain,
167 py::return_internal_reference<>())
168
169 .def("GetMovement", &MeshGraph::GetMovement,
170 py::return_value_policy<py::return_by_value>())
171
172 .def("GetNumElements", &MeshGraph::GetNumElements)
173
174 .def("SetExpansionInfosToEvenlySpacedPoints",
175 &MeshGraph::SetExpansionInfoToEvenlySpacedPoints)
176 .def("SetExpansionInfosToPolyOrder",
177 &MeshGraph::SetExpansionInfoToNumModes)
178 .def("SetExpansionInfosToPointOrder",
179 &MeshGraph::SetExpansionInfoToPointOrder);
180
181 py::class_<MeshGraphXml, py::bases<MeshGraph>,
182 std::shared_ptr<MeshGraphXml>, boost::noncopyable>(
183 "MeshGraphXml", py::no_init)
184 .def("__init__", py::make_constructor(&MeshGraphXml_Init));
185
186 py::class_<MeshGraphXmlCompressed, py::bases<MeshGraphXml>,
187 std::shared_ptr<MeshGraphXmlCompressed>, boost::noncopyable>(
188 "MeshGraphXmlCompressed", py::no_init)
189 .def("__init__", py::make_constructor(&MeshGraphXmlCompressed_Init));
190}
MeshGraphSharedPtr MeshGraph_Read(const LibUtilities::SessionReaderSharedPtr &session)
CompositeSharedPtr Composite_Init(py::list geometries)
std::shared_ptr< MeshGraph > MeshGraphXmlCompressed_Init(int meshDim, int spatialDim)
std::shared_ptr< MeshGraph > MeshGraphXml_Init(int meshDim, int spatialDim)
Base class for a spectral/hp element mesh.
Definition: MeshGraph.h:181
static FieldMetaDataMap NullFieldMetaDataMap
Definition: FieldIO.h:51

References Composite_Init(), MeshGraph_Read(), MeshGraphXml_Init(), MeshGraphXmlCompressed_Init(), and Nektar::LibUtilities::NullFieldMetaDataMap.

Referenced by BOOST_PYTHON_MODULE().

◆ export_Movement()

void export_Movement ( )

Definition at line 61 of file Python/Movement.cpp.

62{
63
64 py::class_<std::map<int, ZoneBaseShPtr>>("ZoneMap").def(
65 py::map_indexing_suite<std::map<int, ZoneBaseShPtr>, true>());
66
67 py::class_<Movement, std::shared_ptr<Movement>>("Movement", py::no_init)
68 .def("__init__", py::make_constructor(&Movement_Init))
69 .def("GetInterfaces", &GetInterfaces_wrapper)
70 .def("GetZones", &Movement::GetZones,
71 py::return_value_policy<py::copy_const_reference>())
72 .def("PerformMovement", &Movement::PerformMovement)
73 .def("AddZone", &Movement::AddZone)
74 .def("AddInterface", &Movement::AddInterface);
75}
py::dict GetInterfaces_wrapper(MovementSharedPtr movement)
MovementSharedPtr Movement_Init()

References GetInterfaces_wrapper(), and Movement_Init().

Referenced by BOOST_PYTHON_MODULE().

◆ export_Zones()

void export_Zones ( )

Definition at line 78 of file Python/Zones.cpp.

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}
#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)
MovementType
Enum of zone movement type.
Definition: Zones.h:47
const std::string MovementTypeStr[]
Map of zone movement type to movement type string.
Definition: Zones.h:57

References Nektar::SpatialDomains::MovementTypeStr, NEKPY_WRAP_ENUM_STRING, ZoneFixed_Init(), ZonePrescribe_Init(), ZoneRotate_Init(), and ZoneTranslate_Init().

Referenced by BOOST_PYTHON_MODULE().