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_MeshGraphIO ()
 
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 46 of file SpatialDomains.cpp.

47{
48 np::initialize();
49
58}
void export_Geometry()
void export_Movement()
void export_GeomElements()
void export_Interfaces()
Definition: Interfaces.cpp:54
void export_MeshGraph()
MeshGraph exports.
void export_MeshGraphIO()
void export_Curve()
Definition: Curve.cpp:61
void export_Zones()

References export_Curve(), export_GeomElements(), export_Geometry(), export_Interfaces(), export_MeshGraph(), export_MeshGraphIO(), 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 61 of file Python/Geometry.cpp.

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

References Geometry_ContainsPoint(), Geometry_GenGeomFactors(), and Geometry_IsValid().

Referenced by BOOST_PYTHON_MODULE().

◆ export_Interfaces()

void export_Interfaces ( )

Definition at line 54 of file Interfaces.cpp.

55{
56 py::class_<std::vector<unsigned int>>("UIntList")
57 .def(py::vector_indexing_suite<std::vector<unsigned int>, true>());
58
59 py::class_<Interface, std::shared_ptr<Interface>>("Interface", py::no_init)
60 .def("__init__", py::make_constructor(&Interface_Init))
61 .def<const std::map<int, GeometrySharedPtr> &(Interface::*)() const>(
62 "GetEdge", &Interface::GetEdge, py::return_internal_reference<>())
63 .def("IsEmpty", &Interface::IsEmpty)
64 .def("GetId", &Interface::GetId,
65 py::return_value_policy<py::copy_non_const_reference>())
66 .def("GetOppInterace", &Interface::GetOppInterface,
67 py::return_internal_reference<>())
68 .def("GetCompositeIDs", &Interface::GetCompositeIDs,
69 py::return_value_policy<py::copy_const_reference>());
70
71 py::class_<InterfacePair, std::shared_ptr<InterfacePair>>("InterfacePair",
72 py::no_init)
73 .def("__init__", py::make_constructor(&InterfacePair_Init))
74 .def("GetLeftInterface", &InterfacePair::GetLeftInterface,
75 py::return_value_policy<py::copy_const_reference>())
76 .def("GetRightInterface", &InterfacePair::GetRightInterface,
77 py::return_value_policy<py::copy_const_reference>());
78}
std::shared_ptr< InterfacePair > InterfacePair_Init(const InterfaceShPtr &leftInterface, const InterfaceShPtr &rightInterface)
Definition: Interfaces.cpp:48
std::shared_ptr< Interface > Interface_Init(int indx, const CompositeMap &edge, bool skipCoordCheck)
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 64 of file Python/MeshGraph.cpp.

65{
66 py::class_<LibUtilities::FieldMetaDataMap>("FieldMetaDataMap")
67 .def(py::map_indexing_suite<LibUtilities::FieldMetaDataMap, true>());
68
69 py::class_<std::vector<GeometrySharedPtr>>("GeometryList")
70 .def(py::vector_indexing_suite<std::vector<GeometrySharedPtr>, true>());
71 py::class_<Composite, std::shared_ptr<Composite>>("Composite", py::init<>())
72 .def("__init__", py::make_constructor(&Composite_Init))
73 .def_readwrite("geometries", &Composite::m_geomVec);
74
75 py::class_<PointGeomMap>("PointGeomMap")
76 .def(py::map_indexing_suite<PointGeomMap, true>());
77 py::class_<SegGeomMap>("SegGeomMap")
78 .def(py::map_indexing_suite<SegGeomMap, true>());
79 py::class_<QuadGeomMap>("QuadGeomMap")
80 .def(py::map_indexing_suite<QuadGeomMap, true>());
81 py::class_<TriGeomMap>("TriGeomMap")
82 .def(py::map_indexing_suite<TriGeomMap, true>());
83 py::class_<TetGeomMap>("TetGeomMap")
84 .def(py::map_indexing_suite<TetGeomMap, true>());
85 py::class_<PrismGeomMap>("PrismGeomMap")
86 .def(py::map_indexing_suite<PrismGeomMap, true>());
87 py::class_<PyrGeomMap>("PyrGeomMap")
88 .def(py::map_indexing_suite<PyrGeomMap, true>());
89 py::class_<HexGeomMap>("HexGeomMap")
90 .def(py::map_indexing_suite<HexGeomMap, true>());
91 py::class_<CurveMap>("CurveMap")
92 .def(py::map_indexing_suite<CurveMap, true>());
93 py::class_<CompositeMap>("CompositeMap")
94 .def(py::map_indexing_suite<CompositeMap, true>());
95 py::class_<std::map<int, CompositeMap>>("DomainMap")
96 .def(py::map_indexing_suite<std::map<int, CompositeMap>, true>());
97
98 py::class_<MeshGraph, std::shared_ptr<MeshGraph>, boost::noncopyable>(
99 "MeshGraph", py::init<>())
100
101 .def("Empty", &MeshGraph::Empty)
102
103 .def("GetMeshDimension", &MeshGraph::GetMeshDimension)
104 .def("GetSpaceDimension", &MeshGraph::GetSpaceDimension)
105
106 .def("SetMeshDimension", &MeshGraph::SetMeshDimension)
107 .def("SetSpaceDimension", &MeshGraph::SetSpaceDimension)
108
109 .def("GetAllPointGeoms", &MeshGraph::GetAllPointGeoms,
110 py::return_internal_reference<>())
111 .def("GetAllSegGeoms", &MeshGraph::GetAllSegGeoms,
112 py::return_internal_reference<>())
113 .def("GetAllQuadGeoms", &MeshGraph::GetAllQuadGeoms,
114 py::return_internal_reference<>())
115 .def("GetAllTriGeoms", &MeshGraph::GetAllTriGeoms,
116 py::return_internal_reference<>())
117 .def("GetAllTetGeoms", &MeshGraph::GetAllTetGeoms,
118 py::return_internal_reference<>())
119 .def("GetAllPrismGeoms", &MeshGraph::GetAllPrismGeoms,
120 py::return_internal_reference<>())
121 .def("GetAllPyrGeoms", &MeshGraph::GetAllPyrGeoms,
122 py::return_internal_reference<>())
123 .def("GetAllHexGeoms", &MeshGraph::GetAllHexGeoms,
124 py::return_internal_reference<>())
125 .def("GetCurvedEdges", &MeshGraph::GetCurvedEdges,
126 py::return_internal_reference<>())
127 .def("GetCurvedFaces", &MeshGraph::GetCurvedFaces,
128 py::return_internal_reference<>())
129 .def("GetComposites", &MeshGraph::GetComposites,
130 py::return_internal_reference<>())
131 .def<std::map<int, CompositeMap> &(MeshGraph::*)()>(
132 "GetDomain", &MeshGraph::GetDomain,
133 py::return_internal_reference<>())
134
135 .def("GetMovement", &MeshGraph::GetMovement,
136 py::return_value_policy<py::return_by_value>())
137
138 .def("GetNumElements", &MeshGraph::GetNumElements)
139
140 .def("SetExpansionInfosToEvenlySpacedPoints",
141 &MeshGraph::SetExpansionInfoToEvenlySpacedPoints)
142 .def("SetExpansionInfosToPolyOrder",
143 &MeshGraph::SetExpansionInfoToNumModes)
144 .def("SetExpansionInfosToPointOrder",
145 &MeshGraph::SetExpansionInfoToPointOrder);
146}
CompositeSharedPtr Composite_Init(py::list geometries)
Base class for a spectral/hp element mesh.
Definition: MeshGraph.h:181

References Composite_Init().

Referenced by BOOST_PYTHON_MODULE().

◆ export_MeshGraphIO()

void export_MeshGraphIO ( )

Definition at line 57 of file Python/MeshGraphIO.cpp.

58{
59 py::class_<MeshGraphIO, std::shared_ptr<MeshGraphIO>, boost::noncopyable>(
60 "MeshGraphIO", py::no_init)
61
62 .def("Write", &MeshGraphIO::WriteGeometry, py::default_call_policies(),
63 (py::arg("outfile"), py::arg("defaultExp") = false,
64 py::arg("metadata") = LibUtilities::NullFieldMetaDataMap))
65
66 .def("SetMeshGraph", &MeshGraphIO::SetMeshGraph)
67
68 .def("Read", MeshGraphIO_Read)
69 .staticmethod("Read")
70
71 .def("Create", MeshGraphIO_Create)
72 .staticmethod("Create");
73}
MeshGraphSharedPtr MeshGraphIO_Read(const LibUtilities::SessionReaderSharedPtr &session)
MeshGraphIOSharedPtr MeshGraphIO_Create(std::string ioType)
static FieldMetaDataMap NullFieldMetaDataMap
Definition: FieldIO.h:51

References MeshGraphIO_Create(), MeshGraphIO_Read(), 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 67 of file Python/Zones.cpp.

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}
#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)
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:56

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

Referenced by BOOST_PYTHON_MODULE().