libsurf
Programmer's Documentation

Public Member Functions | Protected Member Functions | Private Attributes | List of all members
PatchMerger Class Reference

Detailed Description

Top-level mesh generator.

PatchMerger is used to generate meshes for multiple surface patches which may intersect in pairs of two. First, a surface object is added the the assembly together with an appropriate refinement criterion. After that, each surface is discretized on its own using premesh() as a preparation for intersection computations. Then, intersections can be determined for each pair of surfaces idependently. Should any of the intersections yield unsatisfactory results, the computation can be repeated several times with progressivley (and locally) refined meshes. If even this fails, then the geometry is likely not valid, i.e. contains intersections of open surfaces which cannot be repaired.

Once all intersections are found, the main mesh generation phase can be started using mainPass(). After that, triangles which end up inside other surfaces, along with duplicate vertices, are removed in finalize().

Optionally, any remaining aperture loops in the mesh can be plugged using closeHoles().

Deprecated:

#include <patchmerger.h>

Inheritance diagram for PatchMerger:
[legend]
Collaboration diagram for PatchMerger:
[legend]

Public Member Functions

 PatchMerger ()
 empty generator
 
uint addSurface (const SurfacePtr &srf, const DnRegionCriterionPtr &tq)
 add a surface to collection, returns index of this surface
 
void addConstraints (uint i, const PointList< 2 > &c)
 add parametric constraints to patch i (for structural mesh)
 
uint npatches () const
 number of surfaces in this set
 
MeshPatchPtr patch (uint i) const
 access patch i
 
void premesh (uint i, bool psm=true)
 premesh patch, before intersections can be computed
 
bool findIntersections (uint i, uint j, IsecTopology &si, IsecTopology &sj, MeshFields &itrack)
 Determine intersections between surface i and j.
 
void refineIntersectionRegions (uint i, uint j, Real rf, const IsecTopology &si, const IsecTopology &sj)
 Refine primary meshes. More...
 
void refineRegion (uint i, const DnRefineRegion &rg)
 add a refinement region to one surface only
 
void resetMeshCriteria ()
 remove temporary refinement regions
 
MgError mainPass (uint i, bool psm=true, bool xcoarse=false, bool pir=true)
 mesh generation pass for patch i
 
bool finalize ()
 join seams and remove internal triangles, return if succeeded
 
bool closeHoles ()
 discrete postprocessing: close holes in resulting mesh by adding bulges
 
uint destretch (Real maxstr=-1.0, Real maxphi=-1.0, int npass=3)
 discrete postprocessing : carefully remove stretched triangles
 
const Vct3 & failPosition () const
 access location of failure, if possible
 
- Public Member Functions inherited from TriMesh
 TriMesh (const TriMesh &msh)
 
TriMeshoperator= (const TriMesh &msh)
 
void reserve (size_t nv, size_t nf)
 
uint addVertex (const Vct3 &p)
 
uint addVertex (const Vct3 &p, const Vct3 &n)
 
uint addFace (uint a, uint b, uint c, int t=0)
 
uint addFace (const uint vi[], int t=0)
 
void triangulate (const PointGrid< 3 > &pg, GridPattern gpt=XPattern)
 
void merge (const TriMesh &msh)
 
void merge (const Triangulation &t)
 
void importMesh (const PointList< 3 > &pts, const Indices &tri, bool udrop=false)
 
void importMesh (const PointList< 3 > &pts, const PointList< 3 > &nmv, const Indices &tri, bool udrop=false)
 
void exportMesh (PointList< 3 > &pts, Indices &tri) const
 
void exportMesh (PointList< 3 > &pts, PointList< 3 > &nmv, Indices &tri) const
 
void buildConnectivity (bool udrop=false)
 
void fixate (bool udrop=false)
 
uint nvertices () const
 
uint nfaces () const
 
uint nedges () const
 
const Vct3 & vertex (uint i) const
 
Vct3 & vertex (uint i)
 
const Vct3 & normal (uint i) const
 
Vct3 & normal (uint i)
 
const PointList< 3 > & vertices () const
 
PointList< 3 > & vertices ()
 
const PointList< 3 > & normals () const
 
PointList< 3 > & normals ()
 
const TriFaceface (uint i) const
 
TriFaceface (uint i)
 
const TriEdge & edge (uint i) const
 
TriEdge & edge (uint i)
 
uint vdegree (uint i) const
 
uint edegree (uint i) const
 
const uint * firstEdgeIndex (uint iface) const
 
const uint * firstFaceIndex (uint iedge) const
 
void boundaries (Indices &bde) const
 
void gradient (uint i, SpMatrix &gmx) const
 
Vct3 gradient (uint i, const Vector &x) const
 
CpxVct3 gradient (uint i, const CpxVector &x) const
 
bool isClosedManifold () const
 
bool findInternalPoints (PointList< 3 > &holes) const
 
uint findFlippedFaces (Indices &fflip, Real maxphi=PI) const
 
Real area () const
 
Real volume () const
 
Vct3 volumeCenter () const
 
Real shortestEdgeLength () const
 
Real solidAngle (uint i) const
 
uint mergeNodes (Real threshold=gmepsilon, Real dphimax=M_PI)
 
uint cleanup (Real threshold=gmepsilon)
 
void detectEdges (Real ridgeLimitAngle, Real mergeThreshold=gmepsilon)
 
void reverse ()
 
virtual void reorder (const Indices &perm)
 
virtual void swap (TriMesh &a)
 
virtual Real megabytes () const
 
virtual void clear ()
 
virtual XmlElement toXml (bool share=false) const
 
virtual void fromXml (const XmlElement &xe)
 
virtual void writeBin (std::ostream &os) const
 
virtual void readBin (std::istream &is)
 
virtual void toCgns (CgnsFile &file) const
 
virtual void fromCgns (CgnsZone &zone)
 
void writeCgns (const std::string &fname) const
 
void readCgns (const std::string &fname)
 
void readSTL (const std::string &fname)
 
void readAsciiSTL (const std::string &fname)
 
void readBinarySTL (const std::string &fname)
 
void writeBinarySTL (const std::string &fname) const
 
void writeAsciiSTL (const std::string &fname, const std::string &solid="") const
 
edge_iterator edgeBegin () const
 
edge_iterator edgeEnd () const
 
face_iterator faceBegin () const
 
face_iterator faceEnd () const
 
nb_face_iterator v2fBegin (uint i) const
 
nb_face_iterator v2fEnd (uint i) const
 
nb_face_iterator e2fBegin (uint i) const
 
nb_face_iterator e2fEnd (uint i) const
 
nb_edge_iterator v2eBegin (uint i) const
 
nb_edge_iterator v2eEnd (uint i) const
 
nb_edge_iterator f2eBegin (uint i) const
 
nb_edge_iterator f2eEnd (uint i) const
 
void bind ()
 
void estimateNormals ()
 
uint tsearchEdge (uint s, uint t) const
 
uint bsearchEdge (uint s, uint t) const
 
void faceTag (int t)
 
void allTags (Indices &tgs) const
 
std::string tagName (int t) const
 
void tagName (int t, const std::string &s)
 
void submesh (int t, TriMesh &sub) const
 
bool enclosedTriangles (const Indices &vloop, Indices &t) const
 
void icosahedron (const Vct3 &ctr, Real r)
 
void tetrahedron (const Vct3 &ctr, Real r)
 
void sphere (const Vct3 &ctr, Real r, int nrefp)
 
void tsphere (const Vct3 &ctr, Real r, int nrefp)
 
void quadSplit (int npass=1)
 
void dropDuplicates ()
 
uint dropInternalTriangles (uint itx, bool usetags=false)
 
uint dropInternalTriangles (const Indices &idx, bool usetags=false)
 
uint dropOrphanRidges (const Indices &killtags)
 
bool mergeAndDrop (uint itx, Real thrstart, Real thrend)
 
void joinSingleEdges (Real threshold)
 
uint dropStretchedTriangles (Real maxstretch, Real maxphi)
 
uint dropTriStars ()
 
void splitRidges (Indices &ridges, Real cosphi=0.5)
 

Protected Member Functions

void buildCapSurface (TriMesh &tmerge, const Indices &idx)
 construct surface which caps hole delimited by vertices idx (heuristic)
 
bool traceBoundary (Indices &bde, std::deque< uint > &lni) const
 trace a closed boundary line, return true if successfull
 
bool contBoundaryLine (std::deque< uint > &bdi) const
 try to find a continuation for an apparently open boundary line
 
void resetRegions (uint i)
 reset refinement regions to initial state
 
virtual void progress (const std::string &msg) const
 called to indicate mesh generation phase
 

Private Attributes

SurfaceArray surfaces
 continuous surfaces
 
MeshPatchList patches
 mesh patches
 
std::vector< DnRegionCriterionPtr > mcrits
 individual meshing criterions for surfaces
 
Indices noreg
 number of original refinement regions
 
Vct3 pfail
 stores the location of a detected problem
 
bool haveIsecs
 flag set if any intersections have been processed
 

Additional Inherited Members

- Protected Attributes inherited from TriMesh
PointList< 3 > vtx
 
TriFaceArray faces
 
TriEdgeArray edges
 
ConnectMap v2f
 
TagMap tagnames
 

Member Function Documentation

void PatchMerger::refineIntersectionRegions ( uint  i,
uint  j,
Real  rf,
const IsecTopology si,
const IsecTopology sj 
)

Refine primary meshes.

The most common reason for insufficient accuracy in the detection of intersection lines is a coarse primary mesh. This functions allows to refine intersection regions on the primary mesh. This function is not suitable to be called multiple times with the same intersection regions.


The documentation for this class was generated from the following files:
Generated on Wed Jan 19 2022 03:03:17 for libsurf by   doxygen 1.8.5