mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
Merge branch 'master' into occ_spline_tools
This commit is contained in:
commit
947da90a00
@ -196,6 +196,8 @@ namespace netgen
|
||||
size_t GetNFaces() const { return faces.Size(); }
|
||||
|
||||
const GeometryFace & GetFace(int i) const { return *faces[i]; }
|
||||
const GeometryEdge & GetEdge(int i) const { return *edges[i]; }
|
||||
const GeometryVertex & GetVertex(int i) const { return *vertices[i]; }
|
||||
|
||||
void Clear();
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include <set>
|
||||
|
||||
#include <mystdlib.h>
|
||||
#include "meshing.hpp"
|
||||
#include "debugging.hpp"
|
||||
@ -169,8 +171,8 @@ namespace netgen
|
||||
{
|
||||
static Timer timer("FillCloseSurface"); RegionTimer rtimer(timer);
|
||||
|
||||
auto & mesh = md.mesh;
|
||||
auto & identifications = mesh->GetIdentifications();
|
||||
auto & mesh = *md.mesh;
|
||||
auto & identifications = mesh.GetIdentifications();
|
||||
auto nmax = identifications.GetMaxNr();
|
||||
|
||||
bool have_closesurfaces = false;
|
||||
@ -188,7 +190,7 @@ namespace netgen
|
||||
|
||||
identifications.GetMap(identnr, map);
|
||||
|
||||
for(auto & sel : mesh->SurfaceElements())
|
||||
for(auto & sel : mesh.SurfaceElements())
|
||||
{
|
||||
bool is_mapped = true;
|
||||
for(auto pi : sel.PNums())
|
||||
@ -197,28 +199,45 @@ namespace netgen
|
||||
|
||||
if(!is_mapped)
|
||||
continue;
|
||||
|
||||
// in case we have symmetric mapping (used in csg), only map in one direction
|
||||
if(map[map[sel[0]]] == sel[0] && map[sel[0]] < sel[0])
|
||||
continue;
|
||||
|
||||
// insert prism
|
||||
// insert prism/hex
|
||||
auto np = sel.GetNP();
|
||||
Element el(2*np);
|
||||
std::set<int> pis;
|
||||
for(auto i : Range(np))
|
||||
{
|
||||
el[i] = sel[i];
|
||||
el[i+np] = map[sel[i]];
|
||||
pis.insert(sel[i]);
|
||||
pis.insert(map[sel[i]]);
|
||||
}
|
||||
|
||||
// degenerate element (mapped element onto itself, might happend for surface elements connecting two identified faces)
|
||||
if(pis.size() < 2*np)
|
||||
continue;
|
||||
|
||||
bool is_domout = md.domain == mesh.GetFaceDescriptor(sel.GetIndex()).DomainOut();
|
||||
|
||||
// check if new element is inside current domain
|
||||
auto p0 = mesh[sel[0]];
|
||||
Vec<3> n = Cross(mesh[sel[1]] - p0, mesh[sel[2]] - p0 );
|
||||
n = is_domout ? n : -n;
|
||||
|
||||
if(n*(mesh[el[np]]-p0) < 0.0)
|
||||
continue;
|
||||
|
||||
if(is_domout)
|
||||
el.Invert();
|
||||
|
||||
el.SetIndex(md.domain);
|
||||
mesh->AddVolumeElement(el);
|
||||
mesh.AddVolumeElement(el);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CloseOpenQuads( MeshingData & md)
|
||||
{
|
||||
static Timer t("CloseOpenQuads"); RegionTimer rt(t);
|
||||
auto & mesh = *md.mesh;
|
||||
auto domain = md.domain;
|
||||
MeshingParameters & mp = md.mp;
|
||||
@ -277,10 +296,11 @@ namespace netgen
|
||||
{
|
||||
mesh.GetIdentifications().GetPairs (nr, connectednodes);
|
||||
for (auto pair : connectednodes)
|
||||
{
|
||||
meshing.AddConnectedPair (pair);
|
||||
meshing.AddConnectedPair ({pair[1], pair[0]});
|
||||
}
|
||||
}
|
||||
// for (auto pair : md.connected_pairs)
|
||||
// meshing.AddConnectedPair (pair);
|
||||
|
||||
for (int i = 1; i <= mesh.GetNOpenElements(); i++)
|
||||
{
|
||||
@ -539,7 +559,6 @@ namespace netgen
|
||||
if (md[i].mesh->CheckOverlappingBoundary())
|
||||
throw NgException ("Stop meshing since boundary mesh is overlapping");
|
||||
|
||||
// TODO: FillCloseSurface is not working with CSG closesurfaces
|
||||
if(md[i].mesh->GetGeometry()->GetGeomType() == Mesh::GEOM_OCC)
|
||||
FillCloseSurface( md[i] );
|
||||
CloseOpenQuads( md[i] );
|
||||
|
@ -27,7 +27,7 @@ namespace netgen
|
||||
#define TCL_ERROR 1
|
||||
|
||||
#define DIVIDEEDGESECTIONS 10000 // better solution to come soon
|
||||
#define IGNORECURVELENGTH 1e-4
|
||||
#define IGNORECURVELENGTH 0
|
||||
#define VSMALL 1e-10
|
||||
|
||||
|
||||
@ -495,6 +495,24 @@ namespace netgen
|
||||
continue;
|
||||
}
|
||||
|
||||
bool is_identified_edge = false;
|
||||
// TODO: change to use hash value
|
||||
const auto& gedge = geom.GetEdge(geom.edge_map.at(e.TShape()));
|
||||
auto& v0 = gedge.GetStartVertex();
|
||||
auto& v1 = gedge.GetEndVertex();
|
||||
for(auto & ident : v0.identifications)
|
||||
{
|
||||
auto other = ident.from == &v0 ? ident.to : ident.from;
|
||||
if(other->nr == v1.nr && ident.type == Identifications::CLOSESURFACES)
|
||||
{
|
||||
is_identified_edge = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(is_identified_edge)
|
||||
continue;
|
||||
|
||||
double localh = len/mparam.segmentsperedge;
|
||||
double s0, s1;
|
||||
|
||||
|
@ -115,10 +115,11 @@ namespace netgen
|
||||
// int resthcloseedgeenable = true;
|
||||
|
||||
/// Minimum edge length to be used for dividing edges to mesh points
|
||||
double resthminedgelen = 0.001;
|
||||
// double resthminedgelen = 0.001;
|
||||
double resthminedgelen = 1e-4;
|
||||
|
||||
/// Enable / Disable use of the minimum edge length (by default use 1e-4)
|
||||
int resthminedgelenenable = true;
|
||||
int resthminedgelenenable = false;
|
||||
|
||||
/*!
|
||||
Dump all the OpenCascade specific meshing parameters
|
||||
|
@ -48,10 +48,10 @@ namespace netgen
|
||||
|
||||
virtual void SetParameters (Tcl_Interp * interp)
|
||||
{
|
||||
occparam.resthminedgelen =
|
||||
atof (Tcl_GetVar (interp, "::stloptions.resthminedgelen", 0));
|
||||
occparam.resthminedgelenenable =
|
||||
atoi (Tcl_GetVar (interp, "::stloptions.resthminedgelenenable", 0));
|
||||
// occparam.resthminedgelen =
|
||||
// atof (Tcl_GetVar (interp, "::stloptions.resthminedgelen", 0));
|
||||
// occparam.resthminedgelenenable =
|
||||
// atoi (Tcl_GetVar (interp, "::stloptions.resthminedgelenenable", 0));
|
||||
if(auto geo = dynamic_pointer_cast<OCCGeometry>(ng_geometry); geo)
|
||||
geo->SetOCCParameters(occparam);
|
||||
}
|
||||
|
@ -821,11 +821,11 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
|
||||
return shape;
|
||||
}, py::arg("name"), "sets 'name' property to all solids of shape")
|
||||
|
||||
.def_property("name", [](const TopoDS_Shape & self) {
|
||||
.def_property("name", [](const TopoDS_Shape & self) -> optional<string> {
|
||||
if (auto name = OCCGeometry::global_shape_properties[self.TShape()].name)
|
||||
return *name;
|
||||
else
|
||||
return string();
|
||||
return nullopt;
|
||||
}, [](const TopoDS_Shape & self, optional<string> name) {
|
||||
OCCGeometry::global_shape_properties[self.TShape()].name = name;
|
||||
}, "'name' of shape")
|
||||
|
Loading…
Reference in New Issue
Block a user