Merge branch 'revolution_boundaryconditions' into 'master'

Revolution boundaryconditions

See merge request jschoeberl/netgen!388
This commit is contained in:
Christopher Lackner 2021-06-08 13:01:14 +00:00
commit aceb2fac32
4 changed files with 38 additions and 20 deletions

View File

@ -7,6 +7,7 @@
using namespace netgen; using namespace netgen;
using namespace pybind11::literals;
namespace netgen namespace netgen
{ {
@ -179,16 +180,16 @@ DLL_HEADER void ExportCSG(py::module &m)
self.geompoints.Append (GeomPoint<2> (Point<2> (x,y))); self.geompoints.Append (GeomPoint<2> (Point<2> (x,y)));
return self.geompoints.Size()-1; return self.geompoints.Size()-1;
})) }))
.def ("AddSegment", FunctionPointer .def ("AddSegment", [] (SplineGeometry<2> & self, int i1, int i2,
([] (SplineGeometry<2> & self, int i1, int i2) string bcname, double maxh)
{ {
self.splines.Append (new LineSeg<2> (self.geompoints[i1], self.geompoints[i2])); 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", FunctionPointer .def ("AddSegment", [] (SplineGeometry<2> & self, int i1, int i2,
([] (SplineGeometry<2> & self, int i1, int i2, int i3) int i3, string bcname, double maxh)
{ {
self.splines.Append (new SplineSeg3<2> (self.geompoints[i1], self.geompoints[i2], self.geompoints[i3])); 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") 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) isfirst(first), islast(last), spline(&spline_in), p0(p), v_axis(vec), id(id_in)
{ {
deletable = false; deletable = false;
maxh = spline_in.GetMaxh();
bcname = spline_in.GetBCName();
Init(); Init();
} }

View File

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

View File

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