point-sources in 2D

This commit is contained in:
Joachim Schöberl 2018-12-04 06:58:08 +01:00
parent 63b7719c22
commit e4d6ff8302
6 changed files with 27 additions and 6 deletions

View File

@ -208,6 +208,9 @@ namespace netgen
// mesh size restrictions ... // mesh size restrictions ...
for (auto & point : geompoints)
mesh2d.RestrictLocalH (Point<3> (point(0), point(1), 0), point.hmax);
for (int i = 0; i < splines.Size(); i++) for (int i = 0; i < splines.Size(); i++)
{ {
const SplineSegExt & spline = GetSpline(i); const SplineSegExt & spline = GetSpline(i);
@ -241,6 +244,20 @@ namespace netgen
for (auto mspnt : mp.meshsize_points) for (auto mspnt : mp.meshsize_points)
mesh2d.RestrictLocalH (mspnt.pnt, mspnt.h); mesh2d.RestrictLocalH (mspnt.pnt, mspnt.h);
// add point elements
for (auto & point : geompoints)
if (point.name.length())
{
Point<3> newp(point(0), point(1), 0);
PointIndex npi = mesh2d.AddPoint (newp, 1, FIXEDPOINT);
mesh2d.AddLockedPoint(npi);
Element0d el(npi, npi);
el.name = point.name;
mesh2d.SetCD2Name(npi, point.name);
mesh2d.pointelements.Append (el);
searchtree.Insert (newp, npi);
}
// first add all vertices (for compatible orientation on periodic bnds) // first add all vertices (for compatible orientation on periodic bnds)
{ {
double diam2 = Dist2(pmin, pmax); double diam2 = Dist2(pmin, pmax);

View File

@ -31,7 +31,7 @@ DLL_HEADER void ExportGeom2d(py::module &m)
.def("Load",&SplineGeometry2d::Load) .def("Load",&SplineGeometry2d::Load)
.def("AppendPoint", FunctionPointer .def("AppendPoint", FunctionPointer
([](SplineGeometry2d &self, double px, double py, double maxh, double hpref) ([](SplineGeometry2d &self, double px, double py, double maxh, double hpref, string name)
{ {
Point<2> p; Point<2> p;
p(0) = px; p(0) = px;
@ -39,10 +39,11 @@ DLL_HEADER void ExportGeom2d(py::module &m)
GeomPoint<2> gp(p); GeomPoint<2> gp(p);
gp.hmax = maxh; gp.hmax = maxh;
gp.hpref = hpref; gp.hpref = hpref;
gp.name = name;
self.geompoints.Append(gp); self.geompoints.Append(gp);
return self.geompoints.Size()-1; return self.geompoints.Size()-1;
}), }),
py::arg("x"), py::arg("y"), py::arg("maxh") = 1e99, py::arg("hpref")=0) py::arg("x"), py::arg("y"), py::arg("maxh") = 1e99, py::arg("hpref")=0, py::arg("name")="")
.def("Append", FunctionPointer([](SplineGeometry2d &self, py::list segment, int leftdomain, int rightdomain, .def("Append", FunctionPointer([](SplineGeometry2d &self, py::list segment, int leftdomain, int rightdomain,
py::object bc, py::object copy, double maxh, double hpref) py::object bc, py::object copy, double maxh, double hpref)
{ {

View File

@ -28,7 +28,8 @@ namespace netgen
double hmax; double hmax;
/// hp-refinement /// hp-refinement
double hpref; double hpref;
///
string name;
/// ///
GeomPoint () { ; } GeomPoint () { ; }

View File

@ -47,6 +47,7 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<0> (size_t nr) const
Ng_Element ret; Ng_Element ret;
ret.type = NG_PNT; ret.type = NG_PNT;
ret.index = el.index; ret.index = el.index;
ret.mat = &el.name;
ret.points.num = 1; ret.points.num = 1;
ret.points.ptr = (int*)&el.pnum; ret.points.ptr = (int*)&el.pnum;

View File

@ -22,7 +22,7 @@ namespace netgen
mgi = new MultiPointGeomInfo (*amgi); mgi = new MultiPointGeomInfo (*amgi);
for (int i = 1; i <= mgi->GetNPGI(); i++) for (int i = 1; i <= mgi->GetNPGI(); i++)
if (mgi->GetPGI(i).trignum <= 0) if (mgi->GetPGI(i).trignum <= 0)
cout << "Add FrontPoint2, illegal geominfo = " << mgi->GetPGI(i).trignum << endl; cout << "WARNING: Add FrontPoint2, illegal geominfo = " << mgi->GetPGI(i).trignum << endl;
} }
else else
mgi = NULL; mgi = NULL;
@ -136,7 +136,7 @@ namespace netgen
if (!gi1.trignum || !gi2.trignum) if (!gi1.trignum || !gi2.trignum)
{ {
cout << "ERROR: in AdFront::AddLine, illegal geominfo" << endl; cout << "WARNING: in AdFront::AddLine, illegal geominfo" << endl;
} }
lines[li].SetGeomInfo (gi1, gi2); lines[li].SetGeomInfo (gi1, gi2);

View File

@ -1062,6 +1062,7 @@ namespace netgen
{ {
public: public:
PointIndex pnum; PointIndex pnum;
string name;
int index; int index;
Element0d () = default; Element0d () = default;
Element0d (PointIndex _pnum, int _index) Element0d (PointIndex _pnum, int _index)