Give bcname and maxh to revolution by adding it to spline

This commit is contained in:
Christopher Lackner 2021-06-08 14:35:58 +02:00
parent 12a5d14967
commit b8ab3a47a7
4 changed files with 38 additions and 20 deletions

View File

@ -7,6 +7,7 @@
using namespace netgen;
using namespace pybind11::literals;
namespace netgen
{
@ -179,16 +180,16 @@ DLL_HEADER void ExportCSG(py::module &m)
self.geompoints.Append (GeomPoint<2> (Point<2> (x,y)));
return self.geompoints.Size()-1;
}))
.def ("AddSegment", FunctionPointer
([] (SplineGeometry<2> & self, int i1, int i2)
{
self.splines.Append (new LineSeg<2> (self.geompoints[i1], self.geompoints[i2]));
}))
.def ("AddSegment", FunctionPointer
([] (SplineGeometry<2> & self, int i1, int i2, int i3)
{
self.splines.Append (new SplineSeg3<2> (self.geompoints[i1], self.geompoints[i2], self.geompoints[i3]));
}))
.def ("AddSegment", [] (SplineGeometry<2> & self, int i1, int i2,
string bcname, double maxh)
{
self.splines.Append (new LineSeg<2> (self.geompoints[i1], self.geompoints[i2], maxh, bcname));
}, "p1"_a, "p2"_a, "bcname"_a="default", "maxh"_a=1e99)
.def ("AddSegment", [] (SplineGeometry<2> & self, int i1, int i2,
int i3, string bcname, double maxh)
{
self.splines.Append (new SplineSeg3<2> (self.geompoints[i1], self.geompoints[i2], self.geompoints[i3], bcname, maxh));
}, "p1"_a, "p2"_a, "p3"_a, "bcname"_a="default", "maxh"_a=1e99)
;
py::class_<SplineGeometry<3>,shared_ptr<SplineGeometry<3>>> (m,"SplineCurve3d")

View File

@ -48,6 +48,8 @@ namespace netgen
isfirst(first), islast(last), spline(&spline_in), p0(p), v_axis(vec), id(id_in)
{
deletable = false;
maxh = spline_in.GetMaxh();
bcname = spline_in.GetBCName();
Init();
}

View File

@ -89,8 +89,10 @@ namespace netgen
template<int D>
SplineSeg3<D> :: SplineSeg3 (const GeomPoint<D> & ap1,
const GeomPoint<D> & ap2,
const GeomPoint<D> & ap3)
: p1(ap1), p2(ap2), p3(ap3)
const GeomPoint<D> & ap3,
string bcname,
double maxh)
: SplineSeg<D>(maxh, bcname), p1(ap1), p2(ap2), p3(ap3)
{
weight = Dist (p1, p3) / sqrt (0.5 * (Dist2 (p1, p2) + Dist2 (p2, p3)));
// weight = sqrt(2);
@ -102,8 +104,10 @@ namespace netgen
SplineSeg3<D> :: SplineSeg3 (const GeomPoint<D> & ap1,
const GeomPoint<D> & ap2,
const GeomPoint<D> & ap3,
double aweight)
: p1(ap1), p2(ap2), p3(ap3), weight(aweight)
double aweight,
string bcname,
double maxh)
: SplineSeg<D>(maxh, bcname), p1(ap1), p2(ap2), p3(ap3)
{
proj_latest_t = 0.5;
}

View File

@ -50,8 +50,11 @@ namespace netgen
template < int D >
class SplineSeg
{
double maxh;
string bcname;
public:
SplineSeg () { ; }
SplineSeg (double amaxh = 1e99, string abcname = "default")
: maxh(amaxh), bcname(abcname) { ; }
///
virtual ~SplineSeg() { ; }
/// calculates length of curve
@ -116,6 +119,8 @@ namespace netgen
virtual void GetRawData (NgArray<double> & data) const
{ cerr << "GetRawData not implemented for spline base-class" << endl;}
double GetMaxh() const { return maxh; }
string GetBCName() const { return bcname; }
};
@ -127,7 +132,8 @@ namespace netgen
GeomPoint<D> p1, p2;
public:
///
LineSeg (const GeomPoint<D> & ap1, const GeomPoint<D> & ap2);
LineSeg (const GeomPoint<D> & ap1, const GeomPoint<D> & ap2,
double maxh=1e99, string bcname="default");
///
// default constructor for archive
LineSeg() {}
@ -184,11 +190,15 @@ namespace netgen
///
SplineSeg3 (const GeomPoint<D> & ap1,
const GeomPoint<D> & ap2,
const GeomPoint<D> & ap3);
const GeomPoint<D> & ap3,
string bcname="default",
double maxh=1e99);
SplineSeg3 (const GeomPoint<D> & ap1,
const GeomPoint<D> & ap2,
const GeomPoint<D> & ap3,
double aweight);
double aweight,
string bcname="default",
double maxh=1e99);
// default constructor for archive
SplineSeg3() {}
///
@ -384,8 +394,9 @@ namespace netgen
template<int D>
LineSeg<D> :: LineSeg (const GeomPoint<D> & ap1,
const GeomPoint<D> & ap2)
: p1(ap1), p2(ap2)
const GeomPoint<D> & ap2,
double maxh, string bcname)
: SplineSeg<D>(maxh, bcname), p1(ap1), p2(ap2)
{
;
}