mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
Merge branch 'geom2d_dont_need_spline_name' into 'master'
Don't need to specify string description of spline type in 2d geom See merge request jschoeberl/netgen!363
This commit is contained in:
commit
993c02b391
@ -66,10 +66,12 @@ DLL_HEADER void ExportGeom2d(py::module &m)
|
|||||||
.def("Append", FunctionPointer([](SplineGeometry2d &self, py::list segment, int leftdomain, int rightdomain,
|
.def("Append", FunctionPointer([](SplineGeometry2d &self, py::list segment, int leftdomain, int rightdomain,
|
||||||
optional<variant<int, string>> bc, optional<int> copy, double maxh,
|
optional<variant<int, string>> bc, optional<int> copy, double maxh,
|
||||||
double hpref, double hprefleft, double hprefright)
|
double hpref, double hprefleft, double hprefright)
|
||||||
|
{
|
||||||
|
SplineSegExt * seg;
|
||||||
|
if(py::isinstance<py::str>(segment[0]))
|
||||||
{
|
{
|
||||||
auto segtype = py::cast<std::string>(segment[0]);
|
auto segtype = py::cast<std::string>(segment[0]);
|
||||||
|
|
||||||
SplineSegExt * seg;
|
|
||||||
if (segtype == "line")
|
if (segtype == "line")
|
||||||
{
|
{
|
||||||
LineSeg<2> * l = new LineSeg<2>(self.GetPoint(py::cast<int>(segment[1])),
|
LineSeg<2> * l = new LineSeg<2>(self.GetPoint(py::cast<int>(segment[1])),
|
||||||
@ -85,6 +87,25 @@ DLL_HEADER void ExportGeom2d(py::module &m)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw Exception("Appended segment is not a line or a spline3");
|
throw Exception("Appended segment is not a line or a spline3");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(py::len(segment) == 2)
|
||||||
|
{
|
||||||
|
auto l = new LineSeg<2>(self.GetPoint(py::cast<int>(segment[0])),
|
||||||
|
self.GetPoint(py::cast<int>(segment[1])));
|
||||||
|
seg = new SplineSegExt(*l);
|
||||||
|
}
|
||||||
|
else if(py::len(segment) == 3)
|
||||||
|
{
|
||||||
|
SplineSeg3<2> * seg3 = new SplineSeg3<2>(self.GetPoint(py::cast<int>(segment[0])),
|
||||||
|
self.GetPoint(py::cast<int>(segment[1])),
|
||||||
|
self.GetPoint(py::cast<int>(segment[2])));
|
||||||
|
seg = new SplineSegExt(*seg3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw Exception("Appended segment must either have 2 or 3 points");
|
||||||
|
}
|
||||||
seg->leftdom = leftdomain;
|
seg->leftdom = leftdomain;
|
||||||
seg->rightdom = rightdomain;
|
seg->rightdom = rightdomain;
|
||||||
seg->hmax = maxh;
|
seg->hmax = maxh;
|
||||||
|
Loading…
Reference in New Issue
Block a user