48template <
class T,
class S>
51 std::vector<std::shared_ptr<S>> geomVec;
53 for (
int i = 0; i < py::len(facets); ++i)
55 geomVec.push_back(
py::extract<std::shared_ptr<S>>(facets[i]));
58 return std::make_shared<T>(
id, &geomVec[0]);
61template <
class T,
class S>
65 std::vector<std::shared_ptr<S>> geomVec;
67 for (
int i = 0; i < py::len(facets); ++i)
69 geomVec.push_back(
py::extract<std::shared_ptr<S>>(facets[i]));
72 return std::make_shared<T>(
id, &geomVec[0], curve);
77 py::class_<T, py::bases<Geometry2D>, std::shared_ptr<T>>(
name, py::init<>())
78 .def(
"__init__", py::make_constructor(
79 &Geometry_Init<T, S>, py::default_call_policies(),
80 (py::arg(
"id"), py::arg(
"segments") = py::list())))
83 &Geometry_Init_Curved<T, S>, py::default_call_policies(),
84 (py::arg(
"id"), py::arg(
"segments"), py::arg(
"curve"))));
89 py::class_<T, py::bases<Geometry3D>, std::shared_ptr<T>>(
name, py::init<>())
92 &Geometry_Init<T, S>, py::default_call_policies(),
93 (py::arg(
"id"), py::arg(
"segments") = py::list())));
99 std::vector<PointGeomSharedPtr> geomVec;
101 for (
int i = 0; i < py::len(points); ++i)
103 geomVec.push_back(py::extract<PointGeomSharedPtr>(points[i]));
108 return std::make_shared<SegGeom>(
id, coordim, &geomVec[0]);
112 return std::make_shared<SegGeom>(
id, coordim, &geomVec[0],
113 py::extract<CurveSharedPtr>(curve));
119 return py::make_tuple(self.
x(), self.
y(), self.
z());
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);
134 py::class_<PointGeom, py::bases<Geometry>, std::shared_ptr<PointGeom>>(
135 "PointGeom", py::init<>())
136 .def(py::init<int, int, NekDouble, NekDouble, NekDouble>())
140 py::class_<SegGeom, py::bases<Geometry>, std::shared_ptr<SegGeom>>(
141 "SegGeom", py::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);
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");
void export_GeomElements()
py::tuple PointGeom_GetCoordinates(const PointGeom &self)
void export_Geom_3d(const char *name)
std::shared_ptr< T > Geometry_Init(int id, py::list &facets)
std::shared_ptr< T > Geometry_Init_Curved(int id, py::list &facets, CurveSharedPtr curve)
void export_Geom_2d(const char *name)
SegGeomSharedPtr SegGeom_Init(int id, int coordim, py::list &points, py::object &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
def extract(self, check_equality=False)
std::shared_ptr< Curve > CurveSharedPtr
std::shared_ptr< SegGeom > SegGeomSharedPtr