mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
pyb11 fixes
This commit is contained in:
parent
2122a954aa
commit
9e14f2ceb8
@ -254,7 +254,7 @@ DLL_HEADER void ExportCSG(py::module &m)
|
||||
}))
|
||||
;
|
||||
|
||||
bp::class_<SplineGeometry<3>,shared_ptr<SplineGeometry<3>>> ("SplineCurve3d")
|
||||
py::class_<SplineGeometry<3>,shared_ptr<SplineGeometry<3>>> (m,"SplineCurve3d")
|
||||
.def ("AddPoint", FunctionPointer
|
||||
([] (SplineGeometry<3> & self, double x, double y, double z)
|
||||
{
|
||||
@ -273,16 +273,15 @@ DLL_HEADER void ExportCSG(py::module &m)
|
||||
}))
|
||||
;
|
||||
|
||||
bp::class_<SplineSurface, shared_ptr<SplineSurface>,boost::noncopyable> ("SplineSurface",
|
||||
"A surface for co dim 2 integrals on the splines", bp::no_init)
|
||||
.def("__init__", bp::make_constructor (FunctionPointer
|
||||
([](const shared_ptr<SPSolid> base, bp::list cuts)
|
||||
py::class_<SplineSurface, shared_ptr<SplineSurface>> (m, "SplineSurface",
|
||||
"A surface for co dim 2 integrals on the splines")
|
||||
.def("__init__", FunctionPointer ([](const shared_ptr<SPSolid> base, py::list cuts)
|
||||
{
|
||||
auto primitive = dynamic_cast<OneSurfacePrimitive*> (base->GetSolid()->GetPrimitive());
|
||||
auto acuts = new Array<OneSurfacePrimitive*>();
|
||||
for(int i = 0; i<bp::len(cuts);i++)
|
||||
for(int i = 0; i<py::len(cuts);i++)
|
||||
{
|
||||
bp::extract<shared_ptr<SPSolid>> sps(cuts[i]);
|
||||
py::extract<shared_ptr<SPSolid>> sps(cuts[i]);
|
||||
if(!sps.check())
|
||||
throw NgException("Cut must be SurfacePrimitive in constructor of SplineSurface!");
|
||||
auto sp = dynamic_cast<OneSurfacePrimitive*>(sps()->GetSolid()->GetPrimitive());
|
||||
@ -294,21 +293,21 @@ DLL_HEADER void ExportCSG(py::module &m)
|
||||
if(!primitive)
|
||||
throw NgException("Base is not a SurfacePrimitive in constructor of SplineSurface!");
|
||||
return make_shared<SplineSurface>(primitive,acuts);
|
||||
}),bp::default_call_policies(),(bp::arg("base"), bp::arg("cuts")=bp::list())))
|
||||
}),(py::arg("base"), py::arg("cuts")=py::list()))
|
||||
.def("AddPoint", FunctionPointer
|
||||
([] (SplineSurface & self, double x, double y, double z, bool hpref)
|
||||
{
|
||||
self.AppendPoint(Point<3>(x,y,z),hpref);
|
||||
return self.GetNP()-1;
|
||||
}),
|
||||
(bp::arg("self"),bp::arg("x"),bp::arg("y"),bp::arg("z"),bp::arg("hpref")=false))
|
||||
py::arg("x"),py::arg("y"),py::arg("z"),py::arg("hpref")=false)
|
||||
.def("AddSegment", FunctionPointer
|
||||
([] (SplineSurface & self, int i1, int i2, string bcname, double maxh)
|
||||
{
|
||||
auto str = new string(bcname);
|
||||
self.AppendSegment(new LineSeg<3>(self.GetPoint(i1),self.GetPoint(i2)),str,maxh);
|
||||
}),
|
||||
(bp::arg("self"),bp::arg("pnt1"),bp::arg("pnt2"),bp::arg("bcname")="default", bp::arg("maxh")=-1.))
|
||||
py::arg("pnt1"),py::arg("pnt2"),py::arg("bcname")="default", py::arg("maxh")=-1.)
|
||||
;
|
||||
|
||||
py::class_<SPSolid, shared_ptr<SPSolid>> (m, "Solid")
|
||||
@ -496,7 +495,7 @@ DLL_HEADER void ExportCSG(py::module &m)
|
||||
for(auto p : surf->GetPoints())
|
||||
self.AddUserPoint(p);
|
||||
}),
|
||||
(bp::arg("self"), bp::arg("SplineSurface")))
|
||||
py::arg("SplineSurface"))
|
||||
|
||||
.def("CloseSurfaces", FunctionPointer
|
||||
([] (CSGeometry & self, shared_ptr<SPSolid> s1, shared_ptr<SPSolid> s2, py::list aslices )
|
||||
|
Loading…
Reference in New Issue
Block a user