libsurf
Programmer's Documentation

Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
PentaGrow Class Reference

Detailed Description

Hybrid prismatic mesh generation.

PentaGrow generates a layer of pentahedral elements between a triangular surface mesh and an automatically constructed envelope surface placed at a suitable distance. It is meant to be used to quickly create meshes appropriate for the solution of the Reynolds-Averaged Navier-Stokes equations around aircraft configurations or similar geometries.

The algorithms are described in:

D. Eller, M. Tomac: "Implementation and evaluation of automated tetrahedral–prismatic mesh generation software." Computer-Aided Design, July 2015. doi:10.1016/j.cad.2015.06.010

See Also
MxMesh, TriMesh

#include <pentagrow.h>

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

Classes

class  ExtrusionTask
 Task for parallel extrusion of prismatic mesh grid. More...
 
class  UncollideTask
 Task for parallel resolution of indirect collisions. More...
 

Public Member Functions

 PentaGrow ()
 empty object
 
 PentaGrow (const TriMesh &m)
 initialize from wall mesh
 
void configure (const ConfigParser &cfg)
 set configuration options
 
void generateShell (int hiter, int niter, int ncrititer, int laplaceiter)
 generate the outermost layer
 
size_t nWallNodes () const
 number of wall nodes
 
uint extrude (bool curvedGrowth)
 extrude between wall and envelope, return prism layer mesh section index
 
void adaptWall (const DVector< uint > &faceTags)
 adapt wall from refined outer shell (from tetgen)
 
void readTets (const std::string &basename)
 read tetgen result and collect face tags
 
void writeTetgen (const std::string &fname, const TriMesh &farf, const PointList< 3 > &holes, const TriMesh &refr=TriMesh(), Real nearBoxEdge=0.0)
 export boundaries to tetgen smesh file
 
void shrink ()
 reduce memory footprint by erasing all working data (only raw mesh left)
 
size_t countNegativeVolumes (std::ostream &msg)
 check volume elements in final mesh for positive volume
 
void envelopeBounds (Vct3 &plo, Vct3 &phi) const
 compute bounding box of wall mesh
 
bool ellipsoidEncloses (const Vct3 &ctr, const Vct3 &hax) const
 check whether axis-aligned ellipsoid encloses all envelope vertices
 
void envelopeEdgeStats (Real &lmean, Real &lmax) const
 used to suggest near-field refinement factor: envelope edge lengths
 
Vector prismQualitySumCos (const std::string &fname, uint isection, uint nbin=NotFound) const
 compute prism quality histogram and write to file
 
void writeShell (const std::string &fname)
 
void debugConnect ()
 
- Public Member Functions inherited from MxMesh
uint nelements () const
 
uint nnodes () const
 
const Vct3 & node (uint i) const
 
Vct3 & node (uint i)
 
const PointList< 3 > & nodes () const
 
PointList< 3 > & nodes ()
 
uint appendNode (const Vct3 &p)
 
uint appendNodes (const PointList< 3 > &nds)
 
uint appendNodes (NodeIter nbegin, NodeIter nend)
 
uint nsections () const
 
const MxMeshSectionsection (uint i) const
 
MxMeshSectionsection (uint i)
 
uint findSection (uint eix) const
 
uint findSection (const std::string &sname) const
 
const uint * globalElement (uint gix, uint &n, uint &isec) const
 
void elementSections (const Indices &gix, ConnectMap &s2e) const
 
uint appendSection (const MxMeshSection &ms)
 
uint appendSection (Mx::ElementType t, const Indices &idx)
 
uint appendSection (const TriMesh &m)
 
uint appendSection (const PointGrid< 3 > &pg)
 
uint appendSection (const PointList< 3 > &pts)
 
uint appendSection (const CgMesh &cgm)
 
void eraseSection (uint k)
 
uint mirrorCopyNodes (const Indices &snodes, const Plane &pln)
 
uint mirrorCopySection (uint k, uint voff, const Indices &snodes, bool merge=true)
 
uint nbocos () const
 
const MxMeshBocoboco (uint i) const
 
MxMeshBocoboco (uint i)
 
uint appendBoco (Mx::BocoType t, const Indices &idx)
 
uint appendBoco (const MxMeshBoco &bc)
 
uint appendBoco (MxMeshBoco &&bc)
 
void eraseBoco (uint k)
 
void clearBocos ()
 
uint findBoco (const std::string &s) const
 
uint mappedSection (uint iboco) const
 
uint containedInSection (uint iboco) const
 
uint nfields () const
 
uint nDimFields (uint nd=3) const
 
const MxMeshFieldfield (uint i) const
 
MxMeshFieldfield (uint i)
 
void bindFields ()
 
void reserveFields (uint n)
 
uint appendField (const MxMeshField &f)
 
uint appendField (MxMeshField &&f)
 
uint swapField (MxMeshField &f)
 
uint appendField (const std::string &s, const Vector &v)
 
uint appendField (const std::string &s, const DVector< float > &v)
 
uint appendField (const std::string &s, const DVector< int > &v)
 
uint appendField (const std::string &s, const PointList< 3 > &v)
 
uint appendField (const std::string &s, const PointList< 3, float > &v)
 
uint appendField (const std::string &s, const PointList< 6 > &v)
 
uint appendField (const std::string &s, const PointList< 6, float > &v)
 
uint appendRigidBodyMode (int mindex, const Vct3 &rotctr, Real gm=1.0, Real gk=0.0)
 
uint findField (const std::string &s) const
 
void findFields (int valClass, Indices &flds) const
 
void eraseField (uint k)
 
void clearFields ()
 
bool generateMaxFields (bool useMaxAbs)
 
MxSolutionTreePtr solutionTree () const
 
void solutionTree (MxSolutionTreePtr p)
 
void merge (const MxMesh &a, bool mergeFieldsByName)
 
uint ndeform () const
 
const MxMeshDeformdeform (uint i) const
 
MxMeshDeformdeform (uint i)
 
void eraseDeform (uint i)
 
uint appendDeform (const MxMeshDeform &d)
 
uint appendTrajectory (const std::string &fn, const Indices &useCols=Indices())
 
uint appendFlutterMode (Complex p, const CpxVector &z, int nsample=32)
 
void smoothTetNodes (uint npass=1, Real omega=0.5)
 
uint planeCut (const Plane &p, Indices &ise) const
 
void nodesBelow (const Plane &p, std::vector< bool > &nbelow) const
 
virtual void reorder (const Indices &perm)
 
uint dropUnusedNodes ()
 
uint dropDegenerateElements ()
 
uint mergeNodes (Real threshold=gmepsilon)
 
virtual bool loadAny (const std::string &fname)
 
void importMvz (const MeshFields &mvz)
 
TriMeshPtr toTriMesh () const
 
CgMeshPtr toCgMesh () const
 
void writeAs (const std::string &fname, int fmt, int compression) const
 
void writeSTL (const std::string &fname, bool binaryStl=false) const
 
void writePLY (const std::string &fname, bool binary) const
 
void writeSmesh (const std::string &fname, const PointList< 3 > &holes=PointList< 3 >(), const PointList< 3 > &regionMarkers=PointList< 3 >(), const Vector &regionAttr=Vector()) const
 
void readTetgen (const std::string &basename, DVector< uint > *ftags=0)
 
void readCgns (const std::string &fname)
 
void writeCgns (const std::string &fname, bool bcAsSections=false) const
 
void readAbaqus (const std::string &fname)
 
void writeAbaqus (const std::string &fname) const
 
void writeNastran (const std::string &fname, size_t nodeOffset=0, size_t eidOffset=0) const
 
void writeNastran (std::ostream &os, size_t nodeOffset, size_t eidOffset) const
 
BinFileNodePtr gbfNode (bool share=true) const
 
void fromGbf (const BinFileNodePtr &np, bool digestNode=false)
 
virtual XmlElement toXml (bool share=false) const
 
virtual void fromXml (const XmlElement &xe)
 
void writeZml (const std::string &fname, int compression=1) const
 
void readZml (const std::string &fname)
 
XmlElement toVTK () const
 
void writeLegacyVtk (const std::string &fname) const
 
void readLegacyVtk (const std::string &fname)
 
void readAerel (const std::string &fname)
 
void writeFFA (const std::string &fname) const
 
void readFFA (const std::string &bmeshFile)
 
bool appendFFAFields (const std::string &boutFile)
 
size_t writeFieldsBdis (const std::string &basename) const
 
void writeSU2 (const std::string &fname) const
 
void readSU2 (const std::string &fname)
 
void writeEnsight (const std::string &basename) const
 
void readEnsight (const std::string &casename)
 
void fakeNastran (const std::string &fname) const
 
void countElements ()
 
void fixate ()
 
const ConnectMapv2eMap () const
 
void v2vMap (ConnectMap &v2v) const
 
void e2eMap (ConnectMap &e2e) const
 
bool containsNodesOf (uint e1, uint e2) const
 
uint connectedComponents (Indices &ecmp, bool crossTypes=false) const
 
virtual void clear ()
 
virtual float megabytes () const
 
int resetSectionColors (int hue, int sat=120, int val=140)
 
int resetBocoColors (int hue, int sat=160, int val=170)
 
- Public Member Functions inherited from MxAnnotated
 MxAnnotated (const MxAnnotated &)=default
 
 MxAnnotated (MxAnnotated &&a)
 
MxAnnotatedoperator= (const MxAnnotated &)=default
 
MxAnnotatedoperator= (MxAnnotated &&a)
 
void note (const XmlElement &xe)
 
const XmlElementnote () const
 
void annotate (const XmlElement &xe)
 
XmlElement::const_iterator noteBegin () const
 
XmlElement::const_iterator noteEnd () const
 
void attribute (const std::string &key, const std::string &value)
 
std::string attribute (const std::string &key) const
 
- Public Member Functions inherited from Logger
 Logger (const Logger &a)
 
Loggeroperator= (const Logger &a)
 
void storeLogMessages (bool flag)
 
const std::vector< std::string > & logMessages () const
 
virtual void log (const std::string &s) const
 
void log (const FirstType &a1, MoreTypes...as) const
 
void reset ()
 
bool increment (int step=1)
 
virtual bool nextStage (int steps)
 
int progress () const
 
int nsteps () const
 
float percentage () const
 
int stage () const
 
void interrupt (bool flag)
 
bool interrupted () const
 

Static Public Member Functions

static int maximumTagValue ()
 maximum permitted section tag value
 
static uint maximumTriangleCount ()
 maximum permitted number of boundary triangles
 
- Static Public Member Functions inherited from MxMesh
static uint nElementNodes (Mx::ElementType t)
 

Private Types

enum  VertexCategory {
  Undefined = 0, Concave = 1, Convex = 2, Conical = 4,
  Corner = 8, Ridge = 16, StrongCurvature = 32, Sharp = 64,
  Saddle = (Concave | Convex), ConcaveCorner = (Corner | Concave), ConvexCorner = (Corner | Convex), SaddleCorner = (Corner | Saddle),
  ConeDipp = (Concave | Corner | Conical), ConeTip = (Convex | Corner | Conical), BluntCorner = (Corner|Saddle|Conical), Trench = (Ridge | Concave),
  ConvexEdge = (Ridge | Convex), Wedge = (Ridge | Convex | Concave), RidgeConeTip = (Convex | Conical | Ridge), LeadingEdgeIntersection = (Trench | StrongCurvature),
  TrailingEdgeIntersection = (SaddleCorner | Sharp), CriticalCorner = 512, Flat = 1024, Anything = -1
}
 

Private Member Functions

void extractWall (const MxMesh &gm)
 extract wall from global mesh
 
void classify ()
 classify and rank vertices
 
void adjustRidgeNormals ()
 determine initial wall normals
 
bool isClass (size_t i, int cat) const
 test whether a vertex is exactly of a certain category
 
bool hasClass (size_t i, int cat) const
 test whether a vertex has at least a certain category
 
Real convexity (const Vct3 &p1, const Vct3 &n1, const Vct3 &p2, const Vct3 &n2)
 test for convexity, returns positive values for convex features
 
Real convexity (uint i1, uint i2)
 test for convexity, returns positive values for convex features
 
void smoothThickness (Vector &lyt, int niter) const
 smooth thickness of prismatic layers
 
void edgeLengthStats (uint k, Real &lmean, Real &lmax, Real &lmin) const
 compute wall mesh edge length statistics around node k
 
void prismPattern (Real rhfirst, Real rhlast, Vector &xpp) const
 determine suitable normalized pattern for prism heights
 
Vct3 projectToWall (const TriMesh &mout, const Vct3 &pout, uint inear) const
 determine wall point for outer mesh point pout
 
Vct3 findWallVertex (const TriMesh &oldShell, const TriMesh &newShell, uint niShell) const
 determine corresponding wall mesh vertex
 
void rebuildTree ()
 rebuild search tree using current set of outer-layer vertices
 
void findNeighbors (const Vct3 &p, Real r, Indices &neighbors) const
 find all outer-layer nodes closer than r to p
 
bool collisions (Indices &colliding, uint iwall, Real safety, Real nrmdev=cos(rad(60.)), Real fnrmdev=cos(rad(120.))) const
 find collision candidates using normal criterion
 
int collisions (uint iwall, Real safety=1.2, Real nrmdev=cos(rad(60.)), Real fnrmdev=cos(rad(120.))) const
 just test for collisions using normal criterion, do not collect neighbors
 
uint32_t extractSectionTag (uint32_t tag) const
 extract section tag from tetgen tag
 
uint32_t extractElementTag (uint32_t tag) const
 extract element tag from tetgen tag
 
void edgeMap (ConnectMap &map) const
 build vertex-to-vertex connectivity for the surface
 
template<class Container >
void smooth (const ConnectMap &map, Container &c) const
 generalized nodal smoothing.
 
template<class Container , class WritePred , class ReadPred >
void smooth (const ConnectMap &map, Container &c, const WritePred &writeNode, const ReadPred &readNode) const
 generalized nodal smoothing.
 
void smoothShellNodes (const Vector &lyt, int niter, Real omega=0.5)
 Laplace smoothing of outer shell node coordinates.
 
Vct3 nbBarycenter (const PointList< 3 > &pts, size_t k) const
 compute barycenter of local neighborhood of node k
 
int untangle (Vector &lyt, int niter, Real permitted_etwist)
 reduce edge twist
 
void unwarp (int niter, Real permitted_angle)
 reduce penta warp
 
void uncollide (int niter, Real safety, Real retraction, Real limitphi, Real limitphif)
 resolve indirect collisions
 
uint uncollideVertex (uint i, Vector &lyt, Real safety, Real retraction, Real cphi, Real cphif)
 uncollide a single vertex (nucleus function for parallelization)
 
void retractNeighbors (const Indices &afv, Vector &lyt, int ring=3)
 ring-2 smoothing of affected vertices in untangle/unwarp/uncollide
 
void extrudeVertex (int ivx, int nl, Real hi, bool curvedGrowth, PointGrid< 3 > &grid) const
 extrude a single vertex (nucleaus for parallelization)
 
void smoothWallTransition (int niter)
 optionally initialize, then distribute wall normal transition parameters
 
void mergeNeighbors (Indices &idx) const
 augment a set of vertices with its direct neighbors
 
size_t untangleGrid (PointGrid< 3 > &grid)
 attempt to untangle remaining tangled pentahedra
 
uint appendPrismLayer (const PointGrid< 3 > &grid)
 add pentahedral elements to mesh, return mesh section index
 
void updateShellNormals ()
 determine vertex normals for envelope
 
void centerGridNodes (uint niter, PointGrid< 3 > &grid) const
 move grid vertices to the barycenter of their neighborhood
 
void centerGridNodesPass (const PointGrid< 3 > &cgrid, PointGrid< 3 > &grid) const
 move grid vertices to the barycenter of their neighborhood, single pass
 
void findEnvelopeNeighbors (Indices &interfaceNodes, Indices &nearTetNodes) const
 find nodes which are part of prismatic and tetrahedral region
 

Private Attributes

TriMesh mwall
 wall mesh (must be watertight)
 
PointList< 3 > wfn
 smoothed wall normals
 
PointList< 3 > vout
 outermost layer
 
PointList< 3 > envNormals
 vertex normals for outer layer
 
PointList< 3 > fudir
 local wall coordinate system for optimization
 
PointList< 3 > fvdir
 
Vector targetHeight
 target height values for NLOPT
 
Vector invGrowthExponent
 exponent factor for curved growth direction (0.0 -> straight)
 
DVector< int > vtype
 integer flag indicating vertex category
 
DVector< int > etype
 integer flag indicating mesh edge category
 
DVector< uint > id2index
 maps triangle id passed to tetgen to original triangle index
 
DVector< uint > id2section
 maps triangle id passed to tetgen to section index
 
Indices wallTags
 mesh tags which contain wall boundary
 
Indices farTags
 
NDPointTree< 3, float > nodeTree
 search tree for nodes in the outer layer
 
std::vector< bool > gridBaseTangled
 tags surface nodes which resulted in tangled grid nodes
 
Real cosFeatureAngle
 Feature angle for geometrical identification.
 
Real cosconcave
 Angle for concave/convex identification.
 
Real cosSharpAngle
 cosine of angle limit for classification as sharp (default 150deg)
 
MxMeshSection farfieldSection
 farfield section generated by adaptWall
 
Real firstCellHeight
 configuration parameters
 
Real maxRelHeight
 
Real maxAbsHeight
 
Real maxExpansionFactor
 
Real maxOptimizationTime
 maximum time to be used by numerical optimization (default 30 seconds)
 
Real defaultInvGrowthExp
 growth exponent factor : make this larger for improved wall-normality
 
int numPrismLayers
 configuration parameters
 
bool chattyOptimization
 whether to log function values during optimization
 
bool attemptGridUntangling
 whether to attamept grid untangling or not (default - yes)
 

Additional Inherited Members

- Protected Member Functions inherited from MxMesh
void assembleVectorFields ()
 
virtual int readTetgenNodes (std::istream &is)
 
virtual void readTetgenFaces (std::istream &is, int offset, DVector< uint > *ptags=0)
 
virtual void readTetgenElements (std::istream &is, int offset)
 
void readFFARegion (const FFANode &node)
 
void readFFABoundary (const FFANode &node)
 
MxSolutionTreePtr appendSubcase (FFANodePtr pregion)
 
std::string readAbaqusNodes (std::istream &in, DVector< int > &gid)
 
std::string readAbaqusElements (const std::string &header, std::istream &in, DVector< int > &eid)
 
std::string readAbaqusSet (const std::string &header, const DVector< int > &eid, std::istream &in)
 
std::string readAbaqusKeyword (const std::string &header, std::istream &in, XmlElement &xabq)
 
MxSolutionTreePtr generateMaxFields (MxSolutionTreePtr root, bool useMaxAbs)
 
- Static Protected Member Functions inherited from MxMesh
static void fileFloatPrecision (TypeCode tc)
 
- Protected Attributes inherited from MxMesh
PointList< 3 > vtx
 
std::vector< MxMeshSectionsections
 
std::vector< MxMeshBocobocos
 
std::vector< MxMeshFieldfields
 
std::vector< MxMeshDeformdeforms
 
MxSolutionTreePtr soltree
 
ConnectMap v2e
 
std::string meshName
 
uint nelm
 
- Protected Attributes inherited from MxAnnotated
XmlElement xnote
 
- Static Protected Attributes inherited from MxMesh
static TypeCode s_fileFloatPrecision
 

The documentation for this class was generated from the following files:
Generated on Sun Nov 17 2019 03:03:18 for libsurf by   doxygen 1.8.5