1 // Gmsh - Copyright (C) 1997-2021 C. Geuzaine, J.-F. Remacle 2 // 3 // See the LICENSE.txt file in the Gmsh root directory for license information. 4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues. 5 6 #ifndef MESH_GFACE_H 7 #define MESH_GFACE_H 8 9 #include <vector> 10 #include <set> 11 #include <list> 12 #include "SPoint2.h" 13 #include "SVector3.h" 14 #include "MElementOctree.h" 15 16 class GEdge; 17 class GFace; 18 class MVertex; 19 20 // Create the mesh of the face 21 class meshGFace { 22 const bool repairSelfIntersecting1dMesh; 23 24 public: repairSelfIntersecting1dMesh(r)25 meshGFace(bool r = true) : repairSelfIntersecting1dMesh(r) {} 26 void operator()(GFace *, bool print = true); 27 }; 28 29 // Destroy the mesh of the face 30 class deMeshGFace { 31 public: deMeshGFace()32 deMeshGFace() {} 33 void operator()(GFace *); 34 }; 35 36 // Orient the mesh of a face to match the orientation of the underlying 37 // geometry. This is necessary for 3 different reasons: 38 // 1) some surface mesh algorithms do not respect the original geometrical 39 // orientation 40 // 2) some volume algorithms need to change the surface mesh orientation 41 // 3) users can choose to reverse the natural orientation 42 class orientMeshGFace { 43 public: 44 void operator()(GFace *); 45 }; 46 47 void fourthPoint(double *p1, double *p2, double *p3, double *p4); 48 void findTransfiniteCorners(GFace *gf, std::vector<MVertex *> &corners); 49 int MeshTransfiniteSurface(GFace *gf); 50 int MeshExtrudedSurface( 51 GFace *gf, 52 std::set<std::pair<MVertex *, MVertex *> > *constrainedEdges = nullptr); 53 bool meshGenerator(GFace *gf, int RECUR_ITER, bool repairSelfIntersecting1dMesh, 54 bool onlyInitialMesh, bool debug = true, 55 std::vector<GEdge *> *replacement_edges = nullptr); 56 bool pointInsideParametricDomain(std::vector<SPoint2> &bnd, SPoint2 &p, 57 SPoint2 &out, int &N); 58 59 /** 60 * @brief Automatically set transfinite constraints on curves and faces 61 * in the candidate_faces if possible. Curves on opposide sides 62 * of rectangular faces are constrained to reiceive the same number 63 * of points. 64 * 65 * @param candidate_faces The faces which are candidate for transfinite 66 * @param cornerAngle Threshold on the angle (viewed from face) at corners 67 * @param setRecombine If true, quads will be built instead of triangles when 68 * meshing 69 * @param maxDiffRel Reject transfinite constraints if the relative difference 70 * on the initial number of lines (from sizing constraints) on opposite sides is 71 * larger than the maxDiffRel 72 * @param ignoreEmbedded If true, ignore embedded edges and vertices in faces 73 * 74 * @return true if success 75 */ 76 bool MeshSetTransfiniteFacesAutomatic(std::set<GFace *> &candidate_faces, 77 double cornerAngle = 2.35, 78 bool setRecombine = true, 79 double maxDiffRel = 1., 80 bool ignoreEmbedded = false); 81 82 #endif 83