48 template<
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]);
61 template<
class T,
class S,
class PARENT>
64 py::class_<T, py::bases<PARENT>, std::shared_ptr<T> >(
name, py::init<>())
65 .def(
"__init__", py::make_constructor(
66 &Geometry_Init<T, S>, py::default_call_policies(), (
67 py::arg(
"id"), py::arg(
"segments")=py::list())));
76 std::vector<PointGeomSharedPtr> geomVec;
78 for (
int i = 0; i < py::len(points); ++i)
80 geomVec.push_back(py::extract<PointGeomSharedPtr>(points[i]));
85 return std::make_shared<SegGeom>(id, coordim, &geomVec[0]);
89 return std::make_shared<SegGeom>(id, coordim, &geomVec[0],
90 py::extract<CurveSharedPtr>(curve));
97 py::class_<Geometry1D, py::bases<Geometry>, std::shared_ptr<Geometry1D>,
99 "Geometry1D", py::no_init);
100 py::class_<Geometry2D, py::bases<Geometry>, std::shared_ptr<Geometry2D>,
102 "Geometry2D", py::no_init);
103 py::class_<Geometry3D, py::bases<Geometry>, std::shared_ptr<Geometry3D>,
105 "Geometry3D", py::no_init);
108 py::class_<PointGeom, py::bases<Geometry>, std::shared_ptr<PointGeom> >(
109 "PointGeom", py::init<>())
110 .def(py::init<int, int, NekDouble, NekDouble, NekDouble>());
113 py::class_<SegGeom, py::bases<Geometry>, std::shared_ptr<SegGeom> >(
114 "SegGeom", py::init<>())
115 .def(
"__init__", py::make_constructor(
117 py::arg(
"id"), py::arg(
"coordim"),
118 py::arg(
"points")=py::list(),
119 py::arg(
"curve")=py::object())))
122 export_Geom<TriGeom, SegGeom, Geometry2D>(
"TriGeom");
123 export_Geom<QuadGeom, SegGeom, Geometry2D>(
"QuadGeom");
124 export_Geom<TetGeom, TriGeom, Geometry3D>(
"TetGeom");
125 export_Geom<PrismGeom, Geometry2D, Geometry3D>(
"PrismGeom");
126 export_Geom<PyrGeom, Geometry2D, Geometry3D>(
"PyrGeom");
127 export_Geom<HexGeom, QuadGeom, Geometry3D>(
"HexGeom");
Base class for shape geometry information.
CurveSharedPtr GetCurve()
void export_GeomElements()
#define NEKPY_SHPTR_FIX(SOURCE, TARGET)
def extract(self, check_equality=False)
SegGeomSharedPtr SegGeom_Init(int id, int coordim, py::list &points, py::object &curve)
std::shared_ptr< T > Geometry_Init(int id, py::list &facets)
void export_Geom(const char *name)
std::shared_ptr< SegGeom > SegGeomSharedPtr