50template <
class T,
class S>
53 std::vector<std::shared_ptr<S>> geomVec;
55 for (
int i = 0; i < py::len(facets); ++i)
57 geomVec.push_back(py::cast<std::shared_ptr<S>>(facets[i]));
60 return std::make_shared<T>(
id, &geomVec[0]);
63template <
class T,
class S>
67 std::vector<std::shared_ptr<S>> geomVec;
69 for (
int i = 0; i < py::len(facets); ++i)
71 geomVec.push_back(py::cast<std::shared_ptr<S>>(facets[i]));
74 return std::make_shared<T>(
id, &geomVec[0], curve);
79 py::class_<T, Geometry2D, std::shared_ptr<T>>(m,
name)
81 .def(py::init<>(&Geometry_Init<T, S>), py::arg(
"id"),
82 py::arg(
"segments") = py::list())
83 .def(py::init<>(&Geometry_Init_Curved<T, S>), py::arg(
"id"),
84 py::arg(
"segments"), py::arg(
"curve"));
89 py::class_<T, Geometry3D, std::shared_ptr<T>>(m,
name)
91 .def(py::init<>(&Geometry_Init<T, S>), py::arg(
"id"),
92 py::arg(
"segments") = py::list());
98 std::vector<PointGeomSharedPtr> geomVec;
100 for (
int i = 0; i < py::len(points); ++i)
102 geomVec.push_back(py::cast<PointGeomSharedPtr>(points[i]));
107 return std::make_shared<SegGeom>(
id, coordim, &geomVec[0]);
111 return std::make_shared<SegGeom>(
id, coordim, &geomVec[0], curve);
117 return py::make_tuple(self.
x(), self.
y(), self.
z());
123 py::class_<Geometry1D, Geometry, std::shared_ptr<Geometry1D>>(m,
125 py::class_<Geometry2D, Geometry, std::shared_ptr<Geometry2D>>(m,
127 .def(
"GetCurve", &Geometry2D::GetCurve);
128 py::class_<Geometry3D, Geometry, std::shared_ptr<Geometry3D>>(m,
132 py::class_<PointGeom, Geometry, std::shared_ptr<PointGeom>>(m,
"PointGeom")
134 .def(py::init<int, int, NekDouble, NekDouble, NekDouble>())
138 py::class_<SegGeom, Geometry, std::shared_ptr<SegGeom>>(m,
"SegGeom")
140 .def(py::init<>(&
SegGeom_Init), py::arg(
"id"), py::arg(
"coordim"),
141 py::arg(
"points") = py::list(),
143 .def(
"GetCurve", &SegGeom::GetCurve);
145 export_Geom_2d<TriGeom, SegGeom>(m,
"TriGeom");
146 export_Geom_2d<QuadGeom, SegGeom>(m,
"QuadGeom");
147 export_Geom_3d<TetGeom, TriGeom>(m,
"TetGeom");
148 export_Geom_3d<PrismGeom, Geometry2D>(m,
"PrismGeom");
149 export_Geom_3d<PyrGeom, Geometry2D>(m,
"PyrGeom");
150 export_Geom_3d<HexGeom, QuadGeom>(m,
"HexGeom");
py::tuple PointGeom_GetCoordinates(const PointGeom &self)
void export_Geom_3d(py::module &m, const char *name)
void export_Geom_2d(py::module &m, const char *name)
std::shared_ptr< T > Geometry_Init(int id, py::list &facets)
void export_GeomElements(py::module &m)
std::shared_ptr< T > Geometry_Init_Curved(int id, py::list &facets, CurveSharedPtr curve)
SegGeomSharedPtr SegGeom_Init(int id, int coordim, py::list &points, CurveSharedPtr curve)
boost::call_traits< DataType >::const_reference x() const
boost::call_traits< DataType >::const_reference z() const
boost::call_traits< DataType >::const_reference y() const
std::shared_ptr< Curve > CurveSharedPtr
std::shared_ptr< SegGeom > SegGeomSharedPtr