Merge branch 'meshing_fixes' into 'master'

Meshing fixes

See merge request jschoeberl/netgen!282
This commit is contained in:
Joachim Schöberl 2019-10-23 11:58:35 +00:00
commit df1f445c8f
8 changed files with 809 additions and 617 deletions

View File

@ -79,6 +79,12 @@ namespace netgen
p = hp;
}
bool CSGeometry :: ProjectPointGI(int surfind, Point<3> & p, PointGeomInfo & gi) const
{
GetSurface(surfind)->Project (p);
return true;
}
void CSGeometry :: ProjectPointEdge(int surfind, INDEX surfind2,
Point<3> & p) const
{

View File

@ -189,6 +189,7 @@ namespace netgen
virtual void SaveToMeshFile (ostream & ost) const override;
void ProjectPoint(INDEX surfind, Point<3> & p) const override;
bool ProjectPointGI (int surfind, Point<3> & p, PointGeomInfo & gi) const override;
void ProjectPointEdge(INDEX surfind, INDEX surfind2, Point<3> & p) const override;
Vec<3> GetNormal(int surfind, const Point<3> & p) const override;
void PointBetween(const Point<3> & p1, const Point<3> & p2,

View File

@ -156,6 +156,12 @@ namespace netgen
ar & materials & maxh & quadmeshing & tensormeshing & layer & bcnames & elto0;
}
bool ProjectPointGI (int surfind, Point<3> & p, PointGeomInfo & gi) const override
{
p(2) = 0.0;
return true;
}
void PointBetween(const Point<3> & p1, const Point<3> & p2, double secpoint,
int surfi,
const PointGeomInfo & gi1,

View File

@ -51,9 +51,9 @@ namespace netgen
virtual bool CalcPointGeomInfo(int surfind, PointGeomInfo& gi, const Point<3> & p3) const {return false;}
virtual bool ProjectPointGI (int surfind, Point<3> & p, PointGeomInfo & gi) const
{
ProjectPoint(surfind, p);
return CalcPointGeomInfo(surfind, gi, p);
throw Exception("ProjectPointGI not overloaded in class" + Demangle(typeid(*this).name()));
}
virtual Vec<3> GetNormal(int surfind, const Point<3> & p) const
{ return {0.,0.,1.}; }
virtual Vec<3> GetNormal(int surfind, const Point<3> & p, const PointGeomInfo & gi) const

View File

@ -969,7 +969,7 @@ namespace netgen
// NgProfiler::StopTimer (timer2);
Point3d origp = mesh[pi];
auto origp = mesh[pi];
int loci = 1;
double fact = 1;
int moveisok = 0;
@ -1021,7 +1021,7 @@ namespace netgen
}
else
{
mesh[pi] = Point<3> (origp);
mesh[pi] = origp;
}
}

View File

@ -185,8 +185,8 @@ DLL_HEADER void ExportNgOCC(py::module &m)
}
geo->SetOCCParameters(occparam);
auto mesh = make_shared<Mesh>();
geo->GenerateMesh(mesh, mp);
mesh->SetGeometry(geo);
geo->GenerateMesh(mesh, mp);
SetGlobalMesh(mesh);
ng_geometry = geo;
return mesh;

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@ import os, pytest
from netgen.meshing import meshsize, MeshingParameters, SetMessageImportance
import netgen.csg as csg
import netgen.stl as stl
import netgen.geom2d as geom2d
from pyngcore import TaskManager
import json
try:
@ -34,12 +35,12 @@ def checkData(mesh, mp, ref):
# get tutorials
def getFiles(fileEnding):
r, d, files = next(os.walk(os.path.join("..","..","tutorials")))
return (f for f in files if f.endswith(fileEnding))
return [f for f in files if f.endswith(fileEnding)]
# get additional tests
def getAdditionalFiles(fileEnding):
r, d, files = next(os.walk("geofiles"))
return (f for f in files if f.endswith(fileEnding))
return [f for f in files if f.endswith(fileEnding)]
@pytest.fixture
def refdata():
@ -64,13 +65,13 @@ def getMeshingparameters(filename):
return standard[0:1] + standard[2:] # very coarse does not work
return standard
_geofiles = [f for f in getFiles(".geo")] + [f for f in getFiles(".stl")]
_geofiles = getFiles(".in2d") + getFiles(".geo") + getFiles(".stl")
if has_occ:
_geofiles += [f for f in getFiles(".step")]
_geofiles += getFiles(".step")
_geofiles.sort()
_additional_testfiles = [f for f in getAdditionalFiles(".stl")]
_additional_testfiles = getAdditionalFiles(".stl")
if has_occ:
_additional_testfiles += [f for f in getAdditionalFiles(".step")]
_additional_testfiles += getAdditionalFiles(".step")
_additional_testfiles.sort()
def generateMesh(filename, mp):
@ -81,6 +82,8 @@ def generateMesh(filename, mp):
geo = stl.STLGeometry(os.path.join(folder, filename))
elif filename.endswith(".step"):
geo = occ.OCCGeometry(os.path.join(folder, filename))
elif filename.endswith(".in2d"):
geo = geom2d.SplineGeometry(os.path.join(folder, filename))
return geo.GenerateMesh(mp)
def isSlowTest(filename):