Home

cm2 triamesh & cm2 quadmesh cm2 triamesh aniso & cm2

image

Contents

1. 10 OOS Joe 8 jos pusm legk DOS MOUS leno 123 2 THE GEOMETRIC SUPPORT OF THE EXTERNAL CONTOUR sizes 4 1 0 100 meshtoolsid mesh straight pos 0 1 UIntVec DoubleVec sizes true indicesO 00 meshtoolsid mesh straight 1 2 UIntVec DoubleVec sizes erruer sinchieasil meshtoolsid mesh straight pos 2 3 UIntVec DoubleVec sizes 012 8 meshtoolsid mesh straight pos 3 0 UIntVec DoubleVec sizes erue U3 S get 3D coordinates pos pos Map the contour onto the surface MESH THE EXTERNAL CONTOUR BASED ON THE PREVIOUS GEOMETRIC SUPPORT sizes clear Sizes resize pos cols meshtoolsld mesh_straight pos 0 1 indicesO UO sizes true indices new_U indices pop back new U pop back os 2 Wil Sizes true ndices new U indices pop back new U pop back meshtoolsilld meshustraight 2 3 indices 2 sizes true indices new_U indices pop back new U pop back meshtoolsild mesh straight pos 3 0 indices3 U3 sizes true indices new U meshtoolsid indices to connectE2 indices connectE2 SURFACIC MESH
2. 1 1 sizes 1 2 0 L N hard nodes 2 2 sizes 2 0 1 L N hard_nodes 3 3 sizes 3 2 0 L N hard nodes 4 0 sizes 4 0 1 L N meshtoolsld mesh straight pos hard nodes sizes true indices meshtoolsid indices to connectE2 indices connectB f Weis D Wisse triamesh mesher the mesher triamesh mesher data type Creuse 6 the mesher run data Jf WLSUALIL SATION meshtools medit output out mesh data pos data connectM CM2 FACET3 return 0 main This variant of the mesh straight function uses a vector of hard nodes like a polygonal line and a vector of target size values one value for each hard node The contour mesh is generated to fit best the target values on the four corners These target sizes are not used by the 2 D mesher Only the resulting edge lengths of the contour will be used to compute the 2 D size field 17 By averaging the lengths of the adjacents edges to each hard node Copyright Computing Objects October 2015 33 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 The se size va 34 Dm SES CAE NES SRE Figure 10 Meshes with grading size T3 and all Q4 cond way to get grading sizes is to specify manually in the data of the 2 D mesher the target lues on some hard nodes the next section e os d This is explained in
3. interrupt Table 11 triamesh aniso operating mode type only the data members are shown Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 enum basic mode type MESH MODE REGULARIZE MODE CONVEX HULL MODE struct operating mode type basic mode type bool imt bool bool bool bool bool bool bool bool bool bool unsigned unsigned double double double double double double display handler type basic mode COMsiciwasiocs_x lacie subdomains_forcing all_quad_flag refine flag reset external boundaries flag node smoothing flag node inserting flag node removing flag shell remeshing flag compute Oh flag structured flag se kao nodes limit optim level target metric max gradation shape quality weight quadrangle weight min 04 angle quality length upper bound display hdl interrupt handler typ vondi interrupt hdl ASS Table 12 quadmesh operating mode type only the data members are shown Copyright Computing Objects October 2015 95 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 96 enum basic mode type MESH MODE REGULARIZE MODE HULL MODE st
4. u pos2D 0 3 18 5 B 3 m 5 Jw 5 8 25 3 9 08 524 0 0 4 5 ile m 9 x 6 B S 3 0208 return 0 OK fit Compuce che local curvatures int get local curvatures const DoubleMat amp pos2D DoubleMat amp H const const unsigned NODS pos2D cols ie OOSZD soe lt 2 zem ils aie 0 t 3 9180 lt NODS Ho wesize 3 NODS H 0 0 Null curvatures here the surface is plane return 0 members double 818 IE surface bul int main const DoubleVec2 20 0 9 const DoubleVec2 Pi quis const DoubleVec2 0 5 const DoubleVec2 23 0 9 0 5 5 DoubleMat POSI UIntVec indicesO indicesl indices2 indices3 indices DoubleVec UO U1 U2 U3 new U UIntMat connectE2 connectM DoubleVec sizes const double 110 019 64 Copyright Computing Objects October 2015 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 const double Ly 6 0 const double 0 surface S Lx Ly 0 5 The parametric surface char filename 64 UNLOCK THE triamesh aniso registration triamesh registration E Su Licensed to SMART Inc B657DA670QZ01 Licensed to SMART Inc F53EAT08BCWX
5. 09 We 0 qe TES 168 We 29 Gy SOUAREN ent pos ent pos TRET connectB connectB 4 unsigned stop index indices stop index Ne gt Ne Ne ER CLOCKWIS Lal ER CLOCKWIS Licensed to SMART Inc ER CLOCKWIS 52 num edges connectB unsigned num edges indices F53EA108BCWX 124 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 mesh segment pos connectB 8 4 N mesh segment pos connectB 4 3 N MERGE TOGETHER DUPLICATED NODES meshtools merge pos connectB ff Weis MSIE triamesh mesher the_mesher triamesh mesher data type data pos connectB the mesher run data NESUALISAT LON meshtools medit output out mesh data pos data connectM CM2 FACET3 return 0 Jd Note that this solution works because the shared edges are discretized similarly and the nodes coincident x 2 Figure 14 Example with shared boundaries T3 and all Q4 Note that the contour of the inner square is oriented completely both ways positive and negative In such a case the mesher favors the positive orientation and meshes the inner square A similar c
6. ZSAZSA YNA 722 69 72 65 72 63 722 3722 5312 55 72 53 72 6722 69 722 2 65 N N N NI 15372 53 72 53 72 59 72 SAYSA YNNN A N N N N Figure 19 The background mesh used in the previous example The background mesh does not need to fit exactly the domain to be meshed It can cover only a small part of it or be partially outside of the domain In the areas not covered by the background mesh the default interpolation of the sizes at the hard nodes is used instead Copyright Computing Objects October 2015 49 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 Here is an example where the domain is a disk and the background mesh is also a disk but with half the radius We have set a uniform value for the sizes field on the background mesh to get a finer mesh in this area Figure 20 Background mesh covering only a fraction of the domain The next step is when the b
7. pos 1 lex lix ue 8 meshtoolslid indices to connectE2 indices Connecti connectE push back 1 RIGHT SIDE LINE indices clear meshtoolsid mesh straight 1 2 h0y hly true indices meshtoolsid indices to connectE2 indices connect2 connectE push back connect2 LEFT SIDE LINE indices clear 1615 oS 2 S lx lix wie meshtoolsid indices to connectE2 indices connect3 connectE push back connect3 TOP LINE indices clear MASINCOOlSilels meshistra ghi qoos lw iu meshtoolsid indices to connectE2 indices connect4 connectE push back connect4 METRICS meshtoolsld metrics gen aniso2d pos connectl hn gt hOy metrics meshtoolsld metrics gen aniso2d pos connect2 hn gt hx metrics meshtoolsld metrics gen aniso2d pos connect3 hn gt hly metrics meshtoolsld metrics gen aniso2d pos connect4 hn gt hx metrics 2D MESH triamesh aniso mesher the mesher triamesh aniso mesher data type data pos connectE2 metrics data metrics the mesher run 56 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 VISUALISATION meshtools medit_output out mesh data pos data connectM CM2 FACET3 return 0 As already stated
8. triamesh mesher the mesher triamesh mesher data type data aS 3 matio read istrm data connectB the mesher run data 210908 connectM push back data connectM istrm open spade dat OS matio read istrm data connectB the mesher run data matscal add pos cols data connectM Suit To eS Sie ced latae sp connectM push back data connectM istrm open diamond dat P matio read istrm data connectB the mesher run data matscal add pos cols data connectM 2 Suri eS connectM push back data connectM epe else matio read istrm data pos matio read istrm data connectB the mesher run data matscal add pos cols data connectM 7 Slate Iosue acie datas connectM push back data connectM meshtools medit output out mesh pos connectM CM2 FACET3 return 0 main Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 40 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 1 7 SHARED BOUNDARIES Edges can be shared between some contours and lines In this case some edges are def
9. CM2 BOUNDARY i The external boundary mesh is not closed The algorithm cannot distinguish the interior from the exterior At least one of the hard lines external boundary or internal line has an odd number of edges QuadMesh only CM2 BOUNDARY PARITY ERROR At least one of the hard lines external boundary or internal line is too CM2 IRREG irregular In case of a polygonal line try to enforce the even condition BOUNDARY 1 on each segment of the line QuadMesh only At least one of the elements is invalid null or negative surface Check the hard edges and hard nodes The background mesh is not valid not a triangle mesh nodes not in the pos matrix or degenerated elements Insufficient memory available Mesh is too big to be generated over several tens millions elements Unknown cause of error Contact support Table 6 Error codes This table reflects the priority of the error codes The highest in the table the highest priority For error codes 2 DEGENERATED ELEMENT and 2 INTERNAL ERROR save the data by calling data type save and send the zipped file to support computing objects com 82 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 Warning codes enum warning type CM2 NO WARNING Je C
10. Figure 26 2 0 anisotropic meshes and all Q4 58 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 10 3 D SURFACE MESHES ANISO MESHERS ONLY The four meshers TriaMesh QuadMesh and their anisotropic versions TriaMesh Aniso and QuadMesh Aniso are plane 2 D meshers They generate or optimize meshes in the Z 0 plane only To generate meshes on 3 D parametric surfaces CM2 MeshTools offers convenient solutions by the way of a template function that pre and post process the data for a 2 D anisotropic mesher TriaMesh Aniso or QuadMesh Aniso template lt class Surface class AnisoMesher class AuxMesher gt meshtools2d mesh surface param const Surface amp S AnisoMesher amp mesher2D typename AnisoMesher data type amp data3D AuxMesher amp aux mesher double max chordal error double min h unsigned chordal control type unsigned high order type 0 unsigned max bgm remeshings 4 bool recompute Qs flag true bool compute area flag true double progress start 0 0 double progress range 1 0 This function can be used as in the following code sample triamesh aniso mesher the mesher triamesh mesher aux mesher triamesh aniso mesher data type data pos connectE2 surface type parametric surface meshtools2d mesh surface param S the mesher data eus imesineic 1015 9 0 4 5 data extract
11. 2 D anisotropic meshes T3 and all Q4 Figure 27 Definition and storage of the 3 D anisotropic metrics Figure 28 Mapping between the reference space and the surface Figure 29 2 D anisotropic meshes in the reference space Figure 30 Surface meshes obtained via an anisotropic mesh in the reference space Figure 31 2 D anisotropic meshes in the reference space Figure 32 3 D surface meshes T3 and all Q4 Figure 33 Nodes and edges local numbering in triangles and quads Figure 34 Mode refine flag 1 Q4 for the example 3 Figure 35 General scheme of the mesh generators Tables Table 1 Vectors and matrices exported by the math1 library Table2 triamesh mesher data type and quadmesh mesher data type Table 3 triamesh aniso mesher data type quadmesh aniso mesher data type Table 4 Error codes for CM2 TriaMesh and 2 TriaMesh Aniso Table 5 Error codes for CM2 QuadMesh and CM2 QuadMesh Aniso Table 6 Error codes Table 7 Warning codes for all meshers Table 8 Warning codes Table 9 Effects of the strict constraints flag on invalid constraints Table 10 triamesh operating mode type Table 11 triamesh aniso operating mode type Table 12 quadmesh operating mode type Table 13 quadmesh aniso operating mode type 4 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso
12. CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso 8 QuadMesh Aniso V 4 6 S Area of the triangle Bes Length of the longest edge of the triangle P Perimeter of the triangle This quality measure ranges from 0 for a degenerated triangle to 1 for an equilateral triangle On the square example the worst shape quality is 0 83 and the average is 0 94 The size quality is also an important parameter to take into account The size quality of an edge is a measure based upon its actual length and the target size values defined at its two vertices A size quality of one indicates that the edge has the optimal length A too short edge has a size quality lesser than one but always positive and a too long edge has a size quality greater than one For instance an edge with a quality of two is twice as long as it should be The formula used to compute the length quality of an edge AB writes 4 AB I hy h AB h with Ls Actual length of edge AB Target size at node A expected edge length at A hy Target size at node B expected edge length at B Le s introduce also at this point the h shock measure of an edge 1 hs B A These two measures are dimensionless and positive Les h When edge AB is considered having optimal length with repect to its target mesh sizes h and When h the h shock is null and the length quality simply writes Q To optimize a mesh we need to imp
13. P cols Equals to 40 unsigned LD P ld Equals to 3 here stride rows for unsigned j 0 lt Ng 333 7 9 foriun 6 ah eese 12 0 10 30 g Changes in buff have been seen in P Here the math1 vectors and matrices are responsible for the deletion of their data DoubleMat PS 20 8 double DURE data delete buff Wf ive clo chaw 00056125 85 S0 Crash now or maybe later Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 14 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 TUTORIAL Copyright Computing Objects October 2015 15 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 Before meshing a 2 D domain the first step is to generate a 1 D mesh of the external contour This chapter mostly details cases where the boundary mesh is obtained using some simple CM2 MeshTools functions One example illustrates the case where the boundary mesh has been generated by other means and is simply read from a file Each example starts with including the file stdafx h can be a precompiled header giving access to the classes and the functions of the library API The general namespace cm2 has nested namespaces such as vecscal vecvec
14. QuadMesh Aniso V 4 6 46 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 1 8 BACKGROUND MESH Sometimes it is not convenient to specify the target mesh sizes at the hard nodes Non regular variations of the sizes inside the domain can be needed but the use of many hard nodes scattered over the domain should be avoided This is the case especially when automatic mesh adpativity is involved The background mesh option is the solution in this case The background mesh is an auxiliary mesh used by the mesher to find the target mesh size at any point inside the domain Hence the user controls exactly the size chart on the entire domain This background mesh is represented by the connectivity matrix background mesh in the data of the mesher As always the indices of the nodes refer to columns in the same pos matrix as all other connectivity matrices or vectors such as connectM The nodes of the background mesh must all have a valid associated size value in the metrics array In the following example a regular structured background mesh is used to support a size field with a sinusoidal variation in the two directions The domain to be meshed is a simple square regularly discretized along its boundaries 21 For a change we use here the mesh straight overload with the parameters for the sizes at the extremities Copyright Computing Objects October 2015
15. triamesh aniso mesher triamesh aniso mesher triamesh aniso mesher data type meshtools2d mesh surface param S data extract pos daca priina tato mel g the mesher aux mesher 999p the mesher connectE2 data aux mesher 0 0 0 VISUALISATION meshtools medit output ghe emis aa ear CeO C EM MA ICI S return 0 main We present below the intermediate anisotropic meshes on the reference space normally not shown and the final meshes on the parametric surface Copyright Computing Objects October 2015 65 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 KEM SS pe CS SS 252 lt lt aN NZ 2552 NW S 555 Z CN SZ RS Q SS EN 5 XS NW lt gt S em 29 ZO 7 m SH ANNAN ISAS 2 JS X PANN NAV KAKA 1 M KI uN Wi CN ES SQ SZ SS SOK 2 lt as BAEZ SSE AS Ss CZ 2 CSO SSeS e Q oe oS eX XO OX 2 NZS Oe Be A lt gt RS S LS Sa
16. Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 5 SQUARE WITH AN INTERNAL HARD NODE Until now we have seen only three fields of the structure used to exchange data with the mesher e The pos matrix for the coordinates of the points e The connect B matrix for the connectivity of the hard edges e The connectM matrix for the connectivity of the 2 D mesh In this example we will add an isolated hard node at the center of the square and specify a target size for the elements near this node This will be done using the two new fields isolated nodes and metrics include stdafx h aliene 0 const double d 10 106 const unsigned 10 const DoubleVec2 00 C 122 M DoubleMat OSs UIntVec indices UIntMat UNLOCK THE DLL triamesh registration Licensed to SMART Inc F53EA108BCWX NERTICES AND LINE MESHES pPosrpushiback 8 pos push back pos push back pos push back P4 meshtoolsid mesh straight pos meshtoolsid mesh straight pos P OOS Jose QE P P indices 1 E N indices indices IN meshtoolsid mesh straight pos meshtoolsid mesh straight pos s Of Nj meshtoolsid indices to connec
17. D ui The mesh of the circle is generated with the function ext rude_rotate from the meshtoolsid library The rotation is defined by a center here by the point DoubleVec2 1 2 1 2 and a rotation scalar around Oz here 2 M PI The circular line is discretized using 20 elements starting from point 4 Here the last generated point point 424 is coincident with the first one point 4 In order to topologically close the circle it is important to replace value 24 with value 4 in the indices vector so that the first and the last point are identical not only coincident indices back indices front As for the external contour these indices are converted into edges with the indices to connectE2 function and appended to the connect B matrix The meshing algorithm makes the difference between external and internal boundary edges Again to mesh with quads we simply replace the t riamesh namespace with quadmesh Moreover if we accept some triangles we can get a better mesh This is the quad dominant mode 14 Remember that CM2 QuadMesh needs an even number of edges on each line external and internal lines in all quad mode 15 Note that the coordinates at column 24 in the pos matrix will remain unused 28 Copyright Computing Objects October 2015 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 include stdafx h abu meua const double ds 1
18. QuadMesh Aniso V 4 6 In order to mesh with quadrangles all is needed is to change the class of the mesher include stdafx h Display handler optional HEELS woe Chisjley voici Const Chace wee lt lt sup int main const double L 10 0 const unsigned N 10 const DoubleVec2 EQ Pil Ch Oa 2 PS Os i 8 DoubleMat 99577 UIntVec indices UIntMat connectB UNLOCK THE DLL quadmesh registration Licensed to SMART Inc F53EA108BCWX NERTICES AND POS PUEN Dack INE MESHES PO POS cjus eee P2 PU 8 esh straight pos esh straight pos meshtoolsid mesh straight pos 2 meshtoolsid mesh straight pos 7 OW IN GCSE meshtoolsld indices_to_connectE2 indices connectB 2 10012 eee 8 meshtoolsid meshtoolsid nh E BS 5 8 CORSE i 20 missi quadmesh mesher the mesher quadmesh mesher data type data pos connectB the mesher run data darca prirne iraco Meul NISUALISATION meshtools medit output out mesh data pos data connectM CM2_FACEQ4 return 0 main In this particular case the generated m
19. This mesh must not contain any degenerated or badly oriented elements It can be used to control precisely the size of the elements on the entire domain not only from the hard nodes of the boundaries This is very useful for instance in a mesh adaptivity scheme in FEM analysis The mesh at step 1 connectM is generated using the mesh at step as the background mesh The background mesh does not need to cover the entire domain You can define a background mesh only on a part of the domain and leave the default metric interpolation outside Note also that the background mesh is always a triangle mesh even for the quad meshers If left empty a default background mesh is used instead Metric field Vector or matrix met rics OUT or IN OUT Vector for the isotropic meshers matrix with 3 rows for the anisotropic meshers Upon entry the user can specify a target mesh size on each hard node or each node of the background mesh If the value for a node is zero or negative or not present the automatically computed value will be used instead The 2 D mesh is generated to fit best the metric field all over the domain For better results it is recommended to specify a size value or metric matrix only on isolated nodes and leave the automatic values i e set to zero on the nodes of the hard edges Another solution is to use a background mesh but the user has to specify the target metric at each of its nodes Note that a steep gradi
20. Total number of counts 222 Number of larger values 0 Number of smaller values 0 V max 9 990807E 001 V mean 9 462349E 001 V min 8 374821E 001 Bin number Bin boundaries Hits 10 0 90 1 00 167 9 0 80 0 90 55 8 0 70 0 80 0 7 0 60 0 70 0 6 0 50 0 60 0 5 0 40 0 50 0 4 0 30 0 40 0 3 0 20 0 30 0 2 0 10 0 20 0 1 0 01 0 10 0 0 0 00 0 01 0 Figure 3 Print info for the square example The generated mesh has 132 nodes and 222 triangles for an initial contour mesh of 40 nodes and 40 edges hard nodes and hard edges The times spent in the three steps of the meshing process front refine optimize are given in seconds The front mesh is the triangulation mesh with only the boundary hard nodes In the second step new nodes are generated inside the domain to get elements with good shape and size Finally the last step is for geometrical and topological optimizations to improve the quality of the elements The formula used to compute the shape quality of a triangle writes S 445 9 with 11 Here the times are below 0 01 s All runs are done with x64 CM2 libs VS 2010 MD build on Windows 8 x64 with Intel amp 1270 V2 3 5 GHz 1 thread turbo boost disabled The typical speed with default settings on such a platform ranges from 10 000 quads s CM2 QuadMesh Aniso to more than 300 000 triangles s 2 TriaMesh Copyright Computing Objects October 2015 21
21. meshtools or triamesh The user can add using namespace directives in this stdafx h Keeping namespaces the user s source code can however be useful to improve the legibility and to avoid name conflicts File stdafx h 5 MESHTOOLS include meshtools h General purpose mesh routines include meshtoolsid h To generate 1D meshes MESHERS finclude triamesh h TriaMesh mesher finclude quadmesh h QuadMesh mesher using namespace cm2 Main cm2 namespace can now be omitted Required libraries cm2math1 cm2misc cm2meshtools cm2meshtoolsid cm2meshtools2d cm2triamesh cm2quadmesh 5 If neither meshtools nor CM2 QuadMesh is used the file stdafx h can reduce simply to Zinclude triamesh h and the required libraries are cm2math1 cm2misc cm2meshtools cm2meshtools2d and cm2triamesh 6 On Windows the lib names currently end with 1132 450r x64 45 For instance cm2mathi x64 45 411 On Windows file extensions for the libraries lib and dll Linux Unix Mac OS platforms file extensions are usually a static archive so or dylib dynamic lib 16 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 1 1 GETTING STARTED A SIMPLE SQUARE This first example is a regular mesh of a square The four boundary segments are equally discretized with 10 elements include stdafx h Disp
22. 3 D surface meshes T3 and all Q4 This solution for 3 D surface meshing can be used only when a mathematical representation of the surface is available through a CAD kernel for instance This method is implemented in CM2 SurfMesher T3 and CM2 SurfMesher Q4 experimental CM2 components using the OpenCascade kernel When there is only a discrete representation of the surface available such as a tessellated surface a different method can be used 3 D patch remeshing This method is implemented in CM2 SurfRemesher T3 and CM2 SurfRemesher Q4 two other components of the CM2 MeshTools library For more information please read 3 D Surface Remeshers Tutorial and User s Manual A similar template function meshtools1d mesh_curve_param is available for parametric curve meshing Copyright Computing Objects October 2015 69 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 70 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 Ill USER S MANUAL Copyright Computing Objects October 2015 71 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 72 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 11 1 MESH GENERATORS DATA All data for a run of the mesher are gathered into a single structure of type data type void
23. 6 MX WV AVAVAVAVAY SARA SAAS 4 SCRI RAK PRIN ADOOOQUS Figure 9 Concentric circles with alternate orientation and all Q4 Copyright Computing Objects October 2015 32 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 1 4 SQUARE WITH GRADING MESH SIZE There are two ways to get a graded size in a mesh First you can simply generate edges with varying size on the boundary or interior line The mesher computes a size chart on each hard node It interpolates these values inside the domain and generates elements accordingly To illustrate this let us use again the example of the square Instead of meshing regularly the four segments of the contour we will specify different target sizes on each four vertices include stdafx h int main const double in 10 07 const unsigned N 10 const DoubleVec2 POW pO IL E s IE 2S Oe ih DoubleMat POS UIntVec indices hard_nodes 5 DoubleVec sizes 5 UIntMat UNLOCK THE DLL triamesh registration Licensed to SMART Inc F53EA108BCWX NERTICES AND LINE MESHES pos push back P0 8 019 5 joos pusm 23 hard nodes 0 0 sizes 0 0 1 L N hard
24. This handler is not called in case of error or warning At the end of the run the user must check for an error or a warning in the fields data_type error_code and data_type warning_code and then in case of error or warning process the string data_type msg1 Example void my display hdl void pass thru unsigned level const char msg window type my window static cast window type pass thru my window show msg cm2 triamesh mesher my mesher cm2 triamesh mesher data type my data pos connectB window type my window A window instance my mesher mode display handler amp my display handler my mesher mode pass thru static cast void amp my window my mesher run my data Will call my display hdl with my window in pass thru parameter Interrupt handler interrupt hdl Default 2 NULL Used in all modes Can be useful for big meshes over hundreds of thousands of elements typedef bool interrupt handler type void pass thu double progress This handler if any is called periodically by the mesher to check for a stop signal When the handler returns t rue the mesher aborts its current step If the interruption occurs early in the meshing stage for instance in the front mesh step the mesh is invalid so it is cleared From the refine step on however the user can get a valid mesh upon exit though probably of poor quality An interruption also r
25. all Q4 8For an isolated node the computed size is based on the size value of the nearest nodes 36 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 ll 6 MULTIPLE MESHES The matrix connectB can contain several internal lines It can also contain several external contours This means that several disconnected domains can be meshed simultaneously Some care must be taken however in the orientation of these contours For multiple domains the edges of all external contours must be oriented the same way for instance counter clockwise the so called positive orientation In addition these contours must not intersect each other Ana LN NN RSSILS Figure 12 Multiple meshes and all Q4 The four domains are meshed simultaneously In this example the coordinates matrix and the connectivity of the contour meshes are read from a file 79 We could also have used the function meshtoolsid mesh spline which generate 1D meshes along splines Copyright Computing Objects October 2015 37 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 include stdafx h int main ifstream cardo datt triamesh mesher the mesher triamesh mesher data type data triamesh registration License
26. amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 Figure 2 Triangle mesh of a square Let us explain this program line by line Authorization of the library The libraries triamesh and quadmesh are protected and need to be unlocked with a call to triamesh registration Of quadmesh registration Two strings must be provided for each library the name of your company or organization that has acquired the license and a secret code contact license computing objects com for any licensing enquiry Note that both strings are case sensitive and the registration call must be made each time the library is loaded into memory and before any run of the mesher triamesh registration Licensed to SMART Inc F53EA108BCWX Contour mesh This is usually the heaviest part of the work for the user In this example we use only routines from the MeshTools libraries but the user is free to generate this contour mesh with any other tool or even to read it form a file Anyway the 2 D meshers need this contour mesh as a couple of matrices the matrix pos containing the points coordinates and the connectivity matrix connectB of the boundary edges First the corners of the square are created as four pair of coordinates in the pos matrix POs 2 00015 lt posk pos push back 7 See example II 5 18 Copyright Computing Objects
27. as cec JA V BASAZ 254 5 SAN SNL Ke y SZ gt As ADS 7 lt WZ KEE SEE Se KY kj A 57 P poy pas BRO CP OR Ke NI Figure 18 Use background mesh to support a sizes field on the domain T3 and all Q4 The background mesh is the same structured triangle mesh in both cases 637 5372 53 721 53 53 722 53 63 72 172 5372 65 722 SVAN MANANNAN N NJ a NAN ANA NANA 1725372 59 2 57 63 72 6 7 5 65 72 65 7 2 65 72 55 153 7 2 53 72 53 722 53 722 63 7 2 53 ASTA YASA STAYAT A S ASANA 172 5372 5 2 69 2 63 72 597 5 72 69 72 NARNIA SASAS ASA 2 2 ANAN VALUES AES P ES Pa 65 72255 SAN ES Fa 53 Pa ES P ES SANAN NANANA YNN ANANN ANANA ZNN SANANA ANANN N ZNASZ ANANI NANA ANANI
28. boundary node is valid no self intersection 86 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 1 ES AS p m S u Figure 34 Mode refine flag false and 04 for the example 11 3 XN SI 77 STA 2 SN P 9 E aia Recomputing the boundary edges reset_external_boundaries_flag Default false Used in REGULARIZE MODE and CONVEX HULL MODE This flag is useful when the user wants to regularize 2 0 mesh without having its boundaries or to get the boundary of the convex hull of a set of points When this flag is up the mesher will search for all edges that are connected to only one element These edges will be considered as hard edges and appended to the input connectB matrix if not already there The edges present upon entry in connectB Will remain in the matrix and will also be considered as hard edges by the optimizer Internal hard nodes cannot be automatically detected They must be specified by the user in the isolated nodes vector so that they are not smoothed or eliminated Node smoothing node smoothing flag Default t rue Used in MESH MODE and REGULARIZE MODE This flag controls the node smoothing scheme in the optimization step Node smoothing doesn t change the mesh connectivity only the coordinates of nodes This flag has no
29. exit shape and size qualities histograms matrix of the neighbors number of subdomains meshed surface Like all the other meshers of the library CM2 TriaMesh CM2 QuadMesh CM2 TriaMesh Aniso and 2 QuadMesh Aniso thread safe several instances or the meshers can be ran concurrently The mat n1 library exports the vector and matrix classes needed to communicate with the meshers The additional libraries meshtools meshtoolsid meshtools2d and meshtools3D can be used to generate simple 1 D meshes for the boundaries or to do some mesh transformations translation rotations concatenation merging For maximum performance these software components are developed using the standard C language with efficient object oriented programming techniques The full sources are available and they have been ported to most major platforms With a binary license these libraries are shipped as precompiled dynamic libraries DLL Win32 or shared Linux i386 with lib and C headers files The source code of CM2 MeshTools full library has been registered with the APP under Inter Deposit number IDDN FR 001 260002 00 R P 1998 000 20700 22 06 1998 and IDDN FR 001 250030 00 S P 1999 000 20700 16 06 1999 is regularly deposited since then The source code specific to CM2 TriaMesh together with this manual has been registered with the APP under Inter Deposit number IDDN FR 001 440021 000 R P 2008 000 20700 31 10 2008 and is regularly dep
30. garbage collection Copyright Computing Objects October 2015 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 Example DoubleVec V1 new DoubleVec 10 1 0 DoubleVec V2 new DoubleVec V1 Shallow copy share the data delete V1 The data are still referenced by V2 delete V2 Now the data are destroyed too Fixed size containers The fixed size math containers are deep copy containers The copy constructor and the copy operator do not make the data to be shared anymore but leads to actually different arrays in memory They are simpler than the variable size containers and faster for short arrays whereas the variable size containers are more suited for big arrays Example DoubleVec2 Wile Vector of 2 unintitialized values double DoubleVec2 2 551820 jf 2 values ipxwieliceo to 1 0 Wi Ol 9 02 1 0 Wi Was 1 2 iy 2 10 9 0 Al 41 TO 00 fi WL e i Uh w2 10 1 STL like iterators and the generic math library All these math containers are optimized for numerical computation The vector containers variable size and fixed size are equipped with STL like iterators begin and to make them compatible with most of the STL algorithms They also have access operators such as operator and the usual functions for a vector cl
31. of the underlying buffert In the case where a container constructed this way is subsequently resized it may point to another array of memory but the initial buffer remains valid double buff new double 6 DoubleVec WS Vepushmoack 2 0 Reallocation and copy performed 2 gcill alive burt does moe point co jj dig uxo V clear hard The new array of V is deallocated not buff As a rule of thumb the lifetime of the external buffer must span the lifetime of the math1 container double buff new double 6 DoubleVec W 5 9 8 77 Wee mese V is killed here but the buffer is spared delete buff So long with buff We have seen how to construct math1 variable size container upon other containers or buffers To do the other way we use the data or begin members to access the underlying data Example 4 A default parameter protect in the constructors can be used to change this behaviour 12 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 DoubleVec w S Q0 5 double unsigned N Wo SEEZ p 50 fOr 1 OF 3L 9 buff double i esses 10 110 5 Changes in buff have been seen in V DoubleMat ps AO double buff P data unsigned M P rows ies 9 unsigned N
32. pos connectM The class Surface for parameter s is a concept of parametric surface with members int get 3D coordinates const DoubleMat amp pos2D DoubleMat amp pos3D const int get 2D coordinates const DoubleMat amp pos3D const UIntVec amp nodeIDs DoubleMat amp pos2D const int get local bases const DoubleMat amp pos2D DoubleMat amp local B const int get local curvatures const DoubleMat amp pos2D DoubleMat amp local H const The Surface get 3D coordinates member should compute the 3 D coordinates of a set of 2 D points located on the reference plane The 3 D coordinates of the point in column j of pos2D must be returned in column j of pos3D This function should return zero when successful The Surface get 2D coordinates member is the reciprocal function of the previous one2 It should give the coordinates in the 2 D reference plane of a set of 3 D points The reference coordinates of the point in column j of pos3D must be returned column j of pos2D This function should return zero when successful nodeIDs is an auxiliary vector that can be helpful for an effective implementation It contains the global indices of the nodes for which the 2 D coordinates are required These are the indices in the the global matrix data3D pos nodeIDs j is the node ID i e column in data pos for the coordinates in 27 For parametric surfaces such as Bezier surfaces or NURB surfaces the computation o
33. qualities of all the edges in the square example Figure 5 Square meshed with quads Figure 6 Square with internal line and all Q4 Figure 7 Square with internal line quad dominant mode Figure 8 Square with a hole T3 and all Q4 Figure 9 Concentric circles with alternate rotation sign T3 and all Q4 Figure 10 Meshes with grading size T3 and all Q4 Figure 11 Mesh concentration near a hard node and all Q4 Figure 12 Multiple meshes T3 and all Q4 The four domains are meshed simultaneously Figure 13 Domain composed of three attached subdomains Figure 14 Example with shared boundaries T3 and all Q4 Figure 15 Example of ambiguous orientation of an inner contour Figure 16 Hole adjacent to the external contour Figure 17 Hole adjacent to the external contour T3 and Q4 Figure 18 Use of a background mesh to support a sizes field on the domain T3 and all Q4 Figure 19 The background mesh used in the previous example Figure 20 Background mesh covering only a fraction of the domain Figure 21 Background meshes for both the boundary and the domain T3 and all Q4 Figure 22 A single scalar defines an isotropic metric A 2D anisotropic metric needs two vectors Figure 23 Definition and storage of the 2 D anisotropic metrics Figure 24 Anisotropic meshes T3 and Q4 Figure 25 2 D anisotropic meshes T3 and all Q4 Figure 26
34. the initial color vector is empty all elements initial and new ones are affected with color 1 76 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 L Max length of the four sides and the two diagonals max P Perimeter of the quadrangle The formula for the shape quality of a 3 D quadrangle writes Q Q with Warp quality of the quadrangle 1 cos max N N N N c Ni Normal to the quad at node i Histograms The histo Qs and histo histograms be used to check for the shape and size qualities of the mesh In the anisotropic case the shape quality of an element is computed using the metrics at its nodes minimum value of the qualities computed with the nodal metric transformations histo 05 is the histogram of the shape qualities vector histo Qh is computed only when the option flag compute flag is up see 111 3 Each histogram stores the minimum the maximum and the average value as data members Errors and warnings error code and warning code are two enums Which give upon exit the error and warning codes if any The string msgi holds explanations messages about the error warning raised In case of error the meshing process is aborted and the output mesh connectw is empty With a mere warning the process goes to its end though the final mesh may have a poor quality A correct run give
35. total time Speed error code warning code msg1 256 Table 3 triamesh aniso mesher data type and quadmesh aniso mesher data type only the data members are shown Copyright Computing Objects October 2015 79 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 80 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 11 2 ERROR AND WARNING CODES Error codes SMU Cats Oem OS CM2_NO_ERROR CM2 LICENSE ERROR 100 CM2 MODE ERROR CM2 DATA ERROR 7 102 CM2 NODES LIMIT ERROR 103 CM2 NODE ERROR 7 104 CM2 EDGE ERROR 105 CM2 BOUNDARY ERROR 7 106 CM2 DEGENERATED ELEMENT 107 CM2 BACKGROUND MESH ERROR 108 CM2 SYSTEM MEMORY ERROR 7 199 CM2 INTERNAL ERROR 7 200 Table 4 Error codes for CM2 TriaMesh and 2 TriaMesh Aniso GB YD 2 NO ERROR ii CM2 LICENSE ERROR 100 CM2 MODE ERROR 101 CM2 DATA ERROR 102 CM2 NODES LIMIT ERROR 7 103 CM2 NODE ERROR 7 10 2 EDGE ERROR 105 CM2 BOUNDARY ERROR 106 CM2 BOUNDARY PARITY ERROR 107 CM2 IRREGULAR BOUNDARY ERROR 7 108 2 DEGENERATED ELEMENT 109 CM2 BACKGROUND MES
36. 0 0 const double R 3 0 const unsigned 1 10 const unsigned N2 20 DoubleMat Des const DoubleVec2 EQ Oo ES ib const DoubleVec2 2 UIntVec indices UIntMat GOTT arb triamesh registration Licensed to SMART Inc F53EA108BCWX VERTICES AND LINE MESHES pos push back 1 pos push back P2 pos push back COSMO siamo cet pos push back DoubleVec2 L 2 R L 2 meshtoolstd smesh straight 0 1 indices indices back esintoomsiic 4 27 ENC indices 27 97 5 8 ICRC CSO mlb eshtoolsid mesh straight pos 3 0 indices eshtoolsid indices to connectE2 indices connectB indices clear meshtoolsld extrude rotate pos 4 DoubleVec2 L 2 L 2 ZW IET sees indices back indices front meshtoolsid indices to connectE2 indices connectB n m m m m 20 MESH quadmesh mesher the mesher quadmesh mesher data type data pos connectB the mesher mode all quad flag false the mesher run data NISUALISATION meshtools medit output out mesh data pos data connectM CM2 FACE MIX return 0 main Copyright Com
37. 2D MESH GENERATORS CM2 TRIAMESH amp CM2 QUADMESH CM2 TRIAMESH ANISO amp CM2 QUADMESH ANISO Series 4 6 x TUTORIAL AND USER S MANUAL Computing Objects 25 rue du Mar chal Foch 5 ersai illes www computing objects com Revision of manual October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 OVERVIEW OF THE MATH1 LIBRARY 7 Variable size containers and fixed size containers 8 Views of the variable size containers 9 Fixed size containers 10 STL like iterators and the generic math library 10 Bound checking 11 Interoperability with other math containers 11 Il TUTORIAL 15 1 1 GETTING STARTED A SIMPLE SQUARE 17 11 2 SQUARE WITH AN INTERNAL LINE 27 1 3 SQUARE WITH INTERNAL HOLES 31 1 4 SQUARE WITH GRADING MESH SIZE 33 11 5 SQUARE WITH AN INTERNAL HARD NODE 35 Il 6 MULTIPLE MESHES 37 11 7 SHARED BOUNDARIES 41 Il 8 BACKGROUND MESH 47 1 9 ANISOTROPIC MESHES 53 1 10 3 D SURFACE MESHES ANISO MESHERS ONLY 59 1 USER S MANUAL 71 MESH GENERATORS DATA 73 Coordinates of the points 73 Hard edges 73 Isolated hard nodes 73 Repulsive points 74 Background mesh 74 Metric field 74 Elements 75 Unenforced entities 75 Pathological boundaries 75 Elements color 76 Neighbors 76 Ancestors 76 Shape qualities 76 Histograms 77 2 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 Errors and warn
38. 2_BOUNDARY_ERROR CM2_BOUNDARY_ERROR Table 9 Effects of the strict constraints flag on invalid constraints All quad or quad dominant mode CM2 QuadMesh amp CM2 QuadMesh Aniso all quad flag Default true Used in MESH MODE only This flag tells the mesher to generate only quadrangles When this flag is on parity of the 1 D meshes along the boundaries and internal lines is generally needed and sufficient to get an all quad mesh Otherwise the mesher may fail with a 2 BOUNDARY PARITY error Note that when this flag is off quad dominant mode triangles are not necessarily present in the final mesh i e an all quad mesh may still be achieved in some cases Usually the mesher generates better meshes in quad dominant mode because of this possibility to use triangles Refinement refine flag Default true Used in MESH MODE only This flag enables the generation of new points inside the domain in order to get good element size qualities For TriaMesh this flag off makes the mesher to triangulate only the domain i e it stops after the front mesh step Only the hard nodes will be in the final mesh and matrix pos will be unchanged For QuadMesh however a minimal amount of new nodes has to be generated in order to mesh a domain with quads only even with refine_flag false 38 The rule of thumb for all quad meshing is that the domain defined by the twice coarser boundary using every other
39. 3 min box max TDO Omi Qmin subdomains boundary sgn front time refine time optim time total time Speed error code warning code imus 4250 g Table 2 triamesh mesher data type and quadmesh mesher data type only the data members are shown 78 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 struct data type DoubleMat UIntMat Uf Acne VES ubleMat IntMat IntMat Hide Wee UIntVec IntVec Jong WSS UIntMat UME Wee DoubleVec misc histogram mi Seki unsigned nsigned nsigned nsigned nsigned nsigned nsigned nsigned nsigned 2 5 double double DoubleVec2 DoubleVec2 double double unsigned double double double double double SEO type warning type Cheie pos connectB isolated nodes repulsive points background mesh metrics connectM unenforced boundary IDs unenforced node IDs pathological boundary IDs colons neighbors ancestors shape qualities histo Os histo Oh nefs nefs Q4 Ine T3 nods E call imocls hard_nodes_in hard edges in hard nodes out hard edges out area area 04 area T3 nati loess max box in subdomains boundary sgn front time refine_time optim time
40. 47 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 include stdafx h int main const double L 4 0 const double In Wo 256 const double ink e 05 055 DoubleMat POSI UIntVec indices UIntMat connectE2 connectT3 BGM DoubleVec sizes unsigned BGM n double Wy 2 UNLOCK THE DLL triamesh registration Licensed to SMART Inc F53EA108BCWX NERTICES AND LINE MESHES pos push back DoubleVec2 L 2 L 2 pos push back DoubleVec2 1 2 1 2 pos push back DoubleVec2 1 2 1 2 pos push back DoubleVec2 1 2 1 2 OOS 0 dL ew truer Indices indices pop back 1615 su xeughar pos 1 22 Jw MO 8 meshtoolb suceuga qos 2 SB 0 MO 2 OTI aC kN Wreshueoolsicssuesm pos 35 WO 0 MO iaces meshtoolsid indices to connectE2 indices connectE2 THE BACKGROUND MESH BGM unsigned L h1 The discretization for the background mesh indices clear meshtoolsid mesh straight pos 0 1 indices indices pop back 2 indices pop b
41. ANAN ZNAN N N N SANASA ZNANA NANN Va ZNZNZNZNZ N N 153 72 65 722 53 722 53 72 637 NI SNP N N SAN SAN VA 2 N N MNRAS N VAS PAS P ES PES PES P ES P ANANIN NL N NJ N N 53725572 5572 NANNAN N N L7 NJ ZNANA ZNAN ZNAN AYNA NL 5 A VIN Is AN NI NI ZVN ZAZNANA NI AN m 153 72 55 72 5972 5922 65 2 65 72 6972 59 2 65 2 65 Is n n N a N N 172 53 7 55 2 63 72 69 7 5 6 LENA 722 ZAZNA SASA N N ESL NINE N
42. For the quadrangle meshers the dimensions are either 4xNEFS in MESH MODE and in REGULARIZE MODE or 3xNEFS in CONVEX HULL MODE because only triangles are generated in this case MESH MODE and in REGULARIZE MODE the leading part of this matrix from columns 0 to 04 1 is the connectivity of the quadrangle elements The tailing part of this matrix from columns nefs 04 to ne s 1 is the connectivity of the triangles elements The fourth node ID in this part of the matrix is always 2 NONE unsigned 1 This matrix can be non empty upon entry when the mesher is used as an optimizer of an already existing mesh REGULARIZE MODE Otherwise it is always an output matrix The ordering of the elements in this matrix is irrelevant E2 1 3 5 lt 4 4 EO Figure 33 Nodes and edges local numbering in triangles and quads The elements triangles or quads are always oriented counter clockwise normal towards positive Z whatever the orientation of the edges of the external contour Unenforced entities Vectors unenforced boundary IDs unenforced node IDs IN and OUT Upon exit these two arrays store the IDs of the entities that could not be enforced because of intersections between hard entities or hard entities located outside the domain In strict constraint mode see 111 3 an error is raised when at least one such
43. H ERROR 110 CM2 SYSTEM MEMORY ERROR 199 CM2 INTERNAL ERROR 200 Table 5 Error codes for CM2 QuadMesh 2 QuadMesh Aniso The error code is located in the data structure triamesh mesher data type and quadmesh mesher data type Example if data error code triamesh mesher data type CM2 NO ERROR Jf CO e Copyright Computing Objects October 2015 81 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 2 ERROR problem The registration must occur before the instantiation of any meshers Check also your license You may renew it computing objects com The operating mode is not valid see 111 3 Check the positivity range of scalar values such as shape quality weight max gradation The input data are not valid Check the sizes of matrices of vectors CM2 DATA ERROR nae ii node indices in the connectivity matrices look for insane values 2 NODES LIMIT RE ERROR The limitation on nodes number is too low Invalid hard node s some hard nodes are considered coincident or a node isolated_nodes is located outside the domain Strict mode only Invalid hard edge s at least one hard edge is intersecting another hard entity node edge or is located outside the domain Strict mode only
44. M2 INTERRUPTION 10 CM2 5 LIMIT WARNING 11 CM2 NODE DISCARDED 12 CM2 EDGE DISCARDED 13 2 SHAPE QUALITY WARNING 14 Table 7 Warning codes for all meshers The warning code is located in the data structure data type Example if data warning code triamesh mesher data type CM2 SHAPE QUALITY WARNING Warning do something 2 INTERRUPTION The run has been aborted by the user through the interrupt handler The final mesh may be empty or valid but of poor quality CM2 NODES LIMIT WARNING The node limit has been reached and the mesh may be far from optimal Invalid hard node s some hard nodes are considered coincident only one node is kept Ae lowest one or a node isolated_nodes is located outside the domain Non strict mode only CM2_NODE_DISCARDE Invalid hard edge s at least one hard edge is intersecting another hard E_DISCARDE entity node edge or is located outside the domain Non strict mode only The final mesh is valid but at least one of the elements is very bad shape quality lt 0 01 Check that the discretizations of connected lines are not too different CM2_SHAPE_QUALITY_ WARNING Table 8 Warning codes This table reflects the priority of the warning codes The highest in the table the highest priority For warning code CM2_SHAPE_QUALITY_WARNING if the boundary mesh is good save the data by c
45. Mi is replaced by intersection hn Using the ellipse representation of the metrics intersection Mi Mj is the ellipse inscribed inside the two associated ellipses Note also that a null metric is equivalent to an infinite circle and that intersection Mi 0 Mi This property of the metrics 2 function is essential to make coherant the intersections of the generated metrics at the four sommits of the square Copyright Computing Objects October 2015 55 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 include stdafx h int main 1 const double L 10 0 const double e 1020 const double hOy hx muse const double dee 2X0 const DoubleVec2 150 00 ODE const DoubleVec2 PIL ly 0 8 const DoubleVec2 192 155 const DoubleVec2 i95 0 DoubleMat DOSP UIntVec indices UIntMat connectl connect2 connect3 UIntMat connectM DoubleMat metrics UNLOCK Tiin Diis triamesh registration Licensed to SMART Inc VERTICES pos pos pos pos push back lox DUE n lores push back Ing no 9 09 Ne BOTTOM LINE indices clear at bottom line ff uve obo connect4 connect 5 108 Wreshueoolsicssues m
46. October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 The push back function appends a new column at the end of a matrix The size of the column must match the current number of rows of the matrix If the matrix is empty the first vector sets this number of rows After these four push backs the dimensions of the pos matrix are 2x4 Now that the four corners are present we can create the points in between and the associated edges ueslaeoodsessuesim sexuels qos 1 8 Mes PZN p Minde POR Bess gN oes 2 Sy p joc 0 meshtoolsld mesh_straight pos 3 0 indices The mesh straight routine of the meshtoolsid library generates N 1 new points equally spaced into new appended columns in the pos matrix meshtoolsid mesh straight DoubleMat amp pos unsigned i0 unsigned il unsigned N UIntVec amp indices The index of each point i e the column in matrix pos is also appended to the vector indices With i0 0 and i1 1 this vector contains upon exit of this function 04 56 78 9 10 11 12 1 And the matrix pos is now of size 2x13 01234 12 Four corners New generated nodes 4 to 12 The last value in the indices vector i e value 1 must be suppressed to avoid having it twice indices p
47. TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 98 Copyright Computing Objects October 2015
48. ack meshtoolsid mesh straight pos 2 3 BGM indices indices pop back meshtoolsid mesh straight pos 3 0 BGM indices meshtools2d mesh struct T3 pos indices N BGM true BGM THE METRICS ON THE BACKGROUND MESH indices clear meshtools unique indices indices BGM sizes resize pos cols 0 0 Null value for nodes not in BGM for unsigned 0 lt indices size i n indices i Siecls CS Barcelo OOS 0 8 il ia 8 in aseos hen IN Sw 2 esi 725 sizes n h 7 Walt 20 MSIE triamesh mesher the mesher triamesh mesher data type data pos connectE2 data background mesh BGM data metrics sizes the mesher run data 48 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 Li WALSALL SABATO NIS meshtools medit output out mesh data pos data connectM CM2 FACET3 return OF main AY CERE Von b Ki gt A x D A 4 ASI SEC a e PIS ran a OS LAK x ara p VS Des me 7 cQ LN NA NN gt ve Is 1 XX VAN SERRA SN
49. aises the 2 INTERRUPTION Warning The pass thru parameter is the pointer set by the user in the operating mode structure the same parameter is also passed to the display handler The parameter progress between 0 and 1 gives a hint about the progress of the meshing Example Copyright Computing Objects October 2015 91 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 bool my interrupt handler void pass thu double progress cic 17 return O gt cm2 triamesh mesher my mesher cm2 triamesh mesher data type my data pos connectB estilo e my limit clock 1E3 CLOCKS PER SEC my mesher mode interrupt handler amp my interrupt handler my mesher mode pass thru static cast clock t amp my limit my mesher run my data WLLL geo aie duracion gt 1000 8 92 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 enum basic mode type MESH MODE REGULARIZE MODE CONVEX HULL MODE struct operating mode type basic mode type bool ime bool bool bool bool bool bool bool bool 1 unsigned unsigned double double double double display handler type interrupt handler type vondi basic mode GCONeEIEBLINES subdo
50. alling data_type save and send the zipped file to support computing objects com Copyright Computing Objects October 2015 83 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 84 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 Ill 3 OPTIONS OF THE MESH GENERATORS CM2 TriaMesh and CM2 QuadMesh and their anisotropic counterparts can be used as regular meshers or as optimizers of some already existing meshes For that matter flags and parameters can be used to adapt the meshers to many various needs Some options are relevant only in the meshing mode some only in the optimizing mode They are all gathered into a structure of type operating mode type as a public member field of the meshers cm2 triamesh mesher operating mode type mode cm2 quadmesh mesher operating mode type mode cm2 triamesh aniso mesher operating mode type mode cm2 quadmesh aniso mesher operating mode type mode From this point and all along this section we will make no distinction between the isotropic meshers and their anisotropic counter parts as they have the very same options For instance a mention to 2 QuadMesh will stand for both CM2 QuadMesh and CM2 QuadMesh Aniso Basic operating mode basic mode Default MESH MODE The meshers have three distinct operating modes MESH MODE This is the default mode 2 D mesh is genera
51. amp QuadMesh Aniso V 4 6 This manual describes the 2 D mesh generators of the CM2 MeshTools library the isotropic meshers CM2 TriaMesh CM2 QuadMesh and the anisotropic meshers CM2 TriaMesh Aniso and CM2 QuadMesh Aniso Cases of 3 D surface mesh using the anisotropic meshers are also presented All these mesh generators are constrained unstructured meshers the boundary mesh contour mesh as well as the internal hard edges and hard points embedded are kept unmodified in the final mesh Based on a fast and robust hybrid Advancing Front and Delaunay algorithm they generate high quality elements with smooth grading size according to the length of the boundary edges or to the user specified sizes The speed is near independent of the number of the elements to be generated Option switches can be used to adapt the meshers to the various needs of the user concerning mesh generation refinement and optimization they can also be used as optimizers only of some already existing meshes The quad meshers can generate meshes the default or mixed quad dominant meshes In the all quad mode the number of edges in each segment must be even This condition can be easily respected using the functions of CM2 Meshtools1D However when parity is not suitable or even impossible to achieve the quad dominant mode must be activated and user must accept some triangles in the final mesh Many data concerning the mesh are available upon
52. ase occurs when an inner contour is not properly oriented see figure below The mesher considers the inner domain to have the same status as the most external domain adjacent to it Here the most external domain adjacent to the inner square is the outer square Hence the inner square will be meshed i e no hole Copyright Computing Objects October 2015 43 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 Figure 15 Example of ambiguous orientation of an inner contour Here is another example where a hole is adjacent to the external contour In this case the most external domain adjacent to the inner square is the outside void Hence the inner square will not be meshed i e hole Figure 16 Hole adjacent to the external contour 44 Copyright Computing Objects October 2015 V 4 6 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso d 524 IN N SOIN INC NINININIAT VN AN NN M XE 2 M N Q CIN NC NC ME gt gt N Nf AAAA N e Figure 17 Hole adjacent to the external contour T3 and Q4 XS N ANN 45 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso
53. ass size empty front back The variable size vectors are also equipped with members such as reserve resize push back and pop back Aside from the STL algorithms one can also use the math specific template functions of the vecscal vecvec matscal matvec and matmat libraries cf math1 Example DoubleVec wid 3 WZ Sr l3s0 2 DoubleMat Mi S 10 M oie doubles 3 low 10 sec co 0 vecvec copy V2 V1 herd copy oi WA succo Wil sizes march o saxoy 2 0 Wil V2 jd se 2 gt vecscal smale 1 Wil fi Wd wi The variable size matrix types DoubleMat IntMat and UIntMat have a behavior similar to the vectors with respect to the memory management and the copy operators and the copy constructors In addition the rows and the columns are equipped with iterators just like the vectors and the same template functions can be used on them Example 10 Copyright Computing Objects October 2015 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 const unsigned 10 const double BT Sabes DoubleMat 1903 2 2 matiis DoubleVec2 We JJ Usiwmiicialivec vector git ime 2 77 Pointe cu Girele ror 3 Of J lt sary 998 ANDE jos 8 See to 3 0 Wasueeeedissmui 3 0
54. can be far from optimal When the limit is so low that the mesher cannot even insert all the hard nodes the 2 NODES LIMIT ERROR is raised and the mesh is aborted Optimization level optim level Integer between 0 and 10 Default 3 Used in MESH MODE and REGULARIZE MODE A null value makes the mesher to skip the optimization step The speed is maximal but the quality may be poor From value 1 on the optimizer algorithm uses several techniques to improve both the shape quality and the size quality of the elements such as node smoothing edge swapping node insertion and node removal Level 3 is usually a good trade off between quality and speed Target metric target metric Double value isotropic or DoubleSym2 anisotropic Default 0 Used in MESH MODE only Element size inside the domain The elements size tends toward this value as they get away from the hard boundary edges This parameter is often used to reduce the total number of elements when target metric default sizes based on boundary edge lengths and to save FEM computation time without loosing much on element shape quality The target metric may be smaller or bigger than the default sizes based on boundary edge lengths Max gradation max gradation Double value greater than 0 Default 0 5 Used in MESH MODE only This parameter controls the gradation of the elements size from the boundary sizes to the siz
55. d to SMART Inc F53EA108BCWX matio Gistrm data HOS matio read 15 data connectB the mesher run data meshtools medit output out mesh data pos data connectM CM2 FACE zl E return 0 san The input boundary meshes are read from an ASCII file with mat io read The format for the matrices is nxm do do 1 do ma di o di 2 Om dn 1 0 dn 1 1 1 2 dn 1 m i The format for each component of the matrix is free For instance a 2x4 DoubleMat can be stored as 2 4 1 0 9 51 2 0 0 1 1 2 E 1 Notes e We can see also in this example that the meshes may not be symmetric with a symmetric contour e n the all quad case we set indeed the flag multi structured flag true This is the reason why the diamond is meshed in a structured manner As an exercise we can get the same result by making four successive meshes and concatenating the results 20 A similar matio transpose read function can read a matrix and transpose it on the fly This can be more useful because it is usually more convenient to store the transposed matrices in the ASCII files 38 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 include stdafx h aigue meua ifstream istrm UIntMat connectM DoubleMat POs triamesh registration Licensed to SMART Inc F53EA108BCWX
56. e im 0 6 meshtoolsld extrude rotate pos 1 CR 2 M 1 1 50 indicesO back indicesO front en THE METRICS ON THE BACKGROUND MESHES indices clear meshtools unique indices indices BGM std copy indicesO begin 0 back inserter indices sizes resize pos cols 0 0 T icone ab Of sb sue p sat jos t m 8 y 5 WO e t ZU Wil Wwe le m 2 s std min w0 wl std min w 2 sig im e 1 790 5 sizes n h Pickup the sizes along the circle sizesO clear Copyright Computing Objects October 2015 51 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 vecvec push back sizes 0 sizes0 MESH THE EXTERNAL CONTOUR indices clear connectE clear cm2 meshtoolsld mesh line pos 0 sizesO true 1 UINT MAX 0 0 indices new U meshtoolsid indices to connectE2 indices connectE triamesh mesher data type data pos connectE data background mesh BGM data metrics sizes the mesher mode reset Reset to default values the mesher run data WLSUALTSATION meshtools
57. e defined by target metric inside the domain A value close to 0 leads to a more progressive variation of mesh size smoother 40 This may give also structured meshes The true option enforces this and is much faster whenever structured mesh can be generated Since release 3 4 this flag is less useful because QuadMesh is able to generate naturally a perfect mesh on rectangle domains or on domains such as shown in Figure 17 even with this flag off This limit is not strict The number of nodes actually in the final mesh may be slightly different from this limit lesser or greater Copyright Computing Objects October 2015 89 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 Weight on shape quality shape quality weight Double value between 0 and 1 Default 0 60 Used in MESH MODE and REGULARIZE MODE This parameter controls the trade off between shape optimization and size optimization It is the weight of the shape quality in the measure of the global quality of an element The default value 0 6 gives a slight preference to the shape quality over the size quality Weight on quadrangles CM2 QuadMesh amp CM2 QuadMesh Aniso quadrangle weight Double value between 0 and 1 Default 0 70 Used in MESH MODE and REGULARIZE MODE This parameter controls the trade off between a higher ratio of quads and a better mesh with more triangles With quadra
58. ed mesh normalized length This is not a strict enforcement however Most of the edges will be shorter than this limit but some may remain somewhat longer The default value 1 414 gives the optimal meshes with respect to the size qualities With this default value the average edge length tends to be 1 optimal edge quality on average Sometimes it can be useful to limit the length of the edges to a shorter value usually between 1 and 1 414 and to accept an average value smaller than 1 sub optimal edge qualities on average Display handler display hdl Default 2 NULL Used in all modes The angle quality of a rectangle equals to 1 perfect whereas the geometric quality is equal to 1 only for a square 90 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 This user supplied function is used to handle the messages issued by the mesher typedef void display handler type void pass thu unsigned level const char msg The pass thru parameter is the pointer set by the user in the operating mode structure The level parameter gives the importance of the message e 0 important for instance entering a major step of the process e 41 gt somewhat important minor step of the process e gt 2 gt not serious debug messages that should not be printed for end users The msg parameter is the string message length lt 255 characters Note
59. ee 0 1 Mou sec 1 m Copyright Computing Objects October 2015 61 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 A null matrix would lead to infinite sizes in the three directions infinite sphere The two parameters max chordal error and control type are used to limit the chordal error between the mesh and the parametric surface We don t use them in this tutorial set to 0 Please refer to the documentation for more information on them This first example illustrates the use of the anisotropic mesh as the intermediate mesh Here the parametric surface to be meshed is plane but its boundaries are curved sinusoidal The parameters range is the unit square O 1 x 0 1 Q u v Figure 28 Mapping between the reference space and the surface The source of this example is as follow 62 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 include stdafx h The Surface class implements the functions needed by mesh surface param struct surface 1 J surface double Lx des 115 parameters to define the surface should be passed here double Ly Ly double ala M 5 Compute the 3D coordinates int get 3D coordinates const DoubleMat amp pos2D DoubleMat amp pos3D const const unsigned NODS p
60. effect when the optimization step is skipped opt im level 0 Node inserting node inserting flag Default t rue Used in MESH MODE and REGULARIZE MODE This flag controls the node inserting scheme in the optimization step Node inserting increases the number of nodes changes the mesh connectivity but doesn t change the other nodes coordinates This flag has no effect when the optimization step is skipped optim level 0 Node removing node removing flag Default t rue Used in MESH MODE and REGULARIZE MODE 39 Set reset external boundaries flag true andoptim level 0 cf below to only extract the boundary of a 2D mesh without any change on it Copyright Computing Objects October 2015 87 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 This flag controls the node removing scheme in the optimization step Node removing decreases the number of nodes changes the mesh connectivity but doesn t change the other nodes coordinates This flag has no effect when the optimization step is skipped opt im level 0 Shell remeshing shell remeshing flag Default t rue Used in MESH MODE and REGULARIZE MODE This flag controls the edge swapping scheme in the optimization step Edge swapping changes the mesh connectivity but doesn t change the number of nodes nor their coordinates This flag has no effect when the op
61. ent all the edges of the external contour s must be oriented the same way for instance all counter clockwise Edges in the contour of the holes must be oriented the opposite way for instance clockwise This matrix can be left empty upon entry when the mesher is used in the optimizer mode or in the convex hull mode cf 111 3 Options of the mesh generators Basic operating mode The user can let the mesher to recalculate this boundary mesh totally or partially setting the flag reset external boundaries flag true see 111 3 In this case the connectB matrix is also an output data The ordering of the edges in the matrix i e ordering of the columns is irrelevant Edges of holes can for instance be mixed with edges of the external boundary Edges can also be oriented both ways For instance some edges of the contour of a hole so called negative contour can be shared with edges of a positive contour same nodes but opposite orientation See example 11 7 Isolated embedded hard nodes Vector isolated nodes IN 29 Condition 1 can be partially cancelled with flag strict constraints flag false With this flag down cuts between boundary edges are allowed as well as isolated nodes inside an edge but a warning is echoed See 111 3 30 However the ordering is taken into account when boundaries intersecting and mode is non strict enforcement In this case only the lowest intersecting edges are kept Copyr
62. ent in the metric field renders the task of the mesher more difficult and surely affects the quality of the elements 31 However if such an isolated point is located outside the domain or inside a hole it will not be present in the final mesh Its coordinates are left unchanged in the pos matrix 32 Except if flag strict constraints flag false see Ill 3 33 The meshtools2d split Q4 into T3 can be used to convert a quad mesh into a triangle mesh 34 This is the front mesh triangulation mesh of the hard nodes only when the use default background mesh flag flag in the operating mode is set to true If it is set to false the background mesh is simply the current mesh in the meshing process It is recommended to leave this flag to false 35 For a node of a boundary or internal line the computed size is the average length of the coincident edges For an isolated node the computed size is based on the size value of the nearest nodes 74 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 Elements Matrix connectM OUT or IN OUT of the connectivity of the elements column oriented The node IDs of the elements are stored column wise connectM i is the i node of the element They refer to columns in the coordinates matrix pos The local numbering of the nodes is shown Figure 33 For the triangle meshers the dimensions of this matrix are always 3XNEFS
63. erates structured right oriented meshes simply oriented pattern 2 When possible generates structured UJ meshes Union Jack pattern Pattern for structured meshes CM2 QuadMesh amp CM2 QuadMesh Aniso structured flag Default true Used in MESH MODE only This option controls the way the generators do the structured meshes when possible on rectangular like domains e true This is the default mode When possible generates structured grid like meshes 88 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 e false The quad meshes are always done with the frontal Delaunay algorithm 0 Multi structured subdomains multi structured flag Default false Used in MESH MODE only Triggers a more complete search for structurable subdomains than normally at the price of a lower speed With this flag on several rectangular subdomains can be meshed structurably whereas it is not always the case with this flag down Used only when refine flag true and structured flag true QuadMesh structured pattern 1 TriaMesh and when there is no background mesh no isolated nodes and null max gradation null target metric Limit on the number of nodes nodes limit Default UINT MAX Used in all modes When this limit is reached by the mesher the 2 NODES LIMIT WARNING is issued The algorithm generates a mesh but the quality
64. es_to_connectE2 meshtool int main CONSE CORSE CONSE CONSE CONSE CONSE CORSE Conse CONSE CONSE CONSE 0 at UNLOCK THE triamesh registration NERTICES Dou Dou Dou Dou Dou Dou Dou Dou Dou Dou unsigned leVec2 leVec2 leVec2 leVec2 leVec2 leVec2 leVec2 leVec2 leVec2 leVec2 07 07 Sec ees DLL EXON pos pos pos pos Dose pos pos pos BOTTOM esh_segm esh_segm esh_segm esh_segm esh_segm esh_segm 3333353383 333335333383 3 3 42 NOUS push back 51 backs cjpulsim Jose Dien Jose TOP HORSE esh segm esh segm esh segm esh segm esh segm esh segm esh segm esh segm INNER esh segm esh segm RECTANGLE eng ent ent ent H IPOS IVE IEW COnneeEs Some eS Somme eS connectB connectB ene eng 09 NH O ge 99 BOO IA WE b connectB connectB COnneGER eomm eS connectB connectB um pm vm SRNE ent ent ent ent gt ent ene ene
65. esh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 ANV NVA VA AAM Le LI pm ES pa T A j Figure 24 Anisotropic meshes T3 and Q4 Here a square is meshed non uniformly with the variant of mesh straight we have already seen in the previous section This is not sufficient to get 2 0 anisotropic mesh We need an anisotropic mesher We need also to specify that we want a different size along the normals than along the tangents of the boundary lines along the tangents the default sizes i e mean of the edges lengths suit us This is the role of meshtoolsid metrics gen aniso2d This function takes a 1D mesh and a size along the normal and generates a set of 2 D anisotropic metrics stored in array metrics as depicted in Figure 23 At each node a metric M N hn is computed For instance along the right vertical line we specify a constant size hx in the horizontal direction meshtoolsld metrics gen aniso2d pos connect2 hn gt hx metrics 25 We could obviously get about the same structured Q4 mesh with meshtools2d mesh struct Q4 26 Note that the met rics parameter is not a pure out parameter Indeed this function does not simply overwrite the existing columns met rics but replace them with their intersection with the newly computed metric M Ni hn If Mi in column i already exists in metrics
66. esh is a perfect structured quad mesh with all qualities equal to 113 13 We could get the same structured Q4 mesh with meshtools2d mesh struct 04 24 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 Figure 5 Square meshed with quads For a plane quadrangle we use the following measure of the shape quality with S ui Q 84 2 min L nax P S Minimum area of the four triangles Los Max length of the four sides and the two diagonals P Perimeter of the quad This measure gives the maximal value 1 only for a square The size quality is given by the same measure as for the triangles because it is based on edges only Copyright Computing Objects October 2015 25 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 26 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 1 2 SQUARE WITH AN INTERNAL LINE Starting from the previous example we add a circle inside the square Here is the program for a triangle mesh include stdafx h int main const double is 10 05 const double R 920 const unsigned N1 10 const unsigned NA 200 const DoubleVec2 POM Oo 3L P2 hpi 13 const DoubleVec2 P4 L 2 R 1 2 DoubleMat UIntVec indices UIntMat connectB UNLOCK THE DLL triame
67. est of the example 22 Several overloads for mesh straight mesh spline andmesh line exist in the meshtools1d library 3 See online doc for more info on these parameters 50 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 include stdafx h int main const double R 4 0 const double 0 57 const double lub gis const double 51 22 const DoubleVec2 Cet 0 9 const DoubleVec2 PO CR O 9 DoubleMat Ost DoubleVec sizes sizes0 UIntVec indices0 indices UIntMat connectE connectM BGM unsigned Me double SL Wn WO wil w2 Ine DoubleVec UO new_U 7 UNLOCK THE DEL triamesh registration Licensed to SMART Inc F53EA108BCWX triamesh mesher the mesher joowergiewislm loe CR QE 5 THE 2D BACKGROUND MESH a oem 2 Wb The discretization for the BGM meshtoolsid extrude rotate pos 1 CR 2 M PI indices back 0 crome 2 Closs che causels meshtoolsld indices_to_connectE2 indices connectE triamesh mesher data type BGMdata pos connectE the mesher mode optim level 0 No need to have a very good BGM the mesher run BGMdata BGMdata extract pos BGM MESH THE GEOMETRIC SUPPORT OF THE BOUNDARY 1D BACKGROUND MESH im lo
68. except for the met rics array the anisotropic meshers have the very same options and parameters as their isotropic counterparts They accept internal hard lines isolated nodes multiple domains shared boundaries background meshes The following example illustrates the internal hard line feature We have specified a normal size on the circle much smaller than default tangent size again using the same meshtoolsld metrics gen aniso2d function For the external square nothing was specified the metrics array and the mesher used its default isotropic metrics based on the length of the adjacent edges Figure 25 2 D anisotropic meshes T3 and all Q4 The example in Figure 21 is revisited the anisotropic way Here we specify a small size in the directions normal to the three lines but a uniform size along the tangents The normal sizes follow the same kind of Gaussian variation All these metrics are specified at the nodes of the same uniform background mesh Copyright Computing Objects October 2015 57 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 Wey 1 ECTS SIN VANNES A AL NX 22 7 N S NAZI m ZB 127 NN V SOS VA OUO AA e EU LO x A 222 2771 ZZ N NS 2222 S VA BZ 5
69. exhibits some singularities the user can correct the deficient bases As far as the mesher is concerned the exactness of these tangents with respect to the true surface is not critical More precisely the tangent bases are used by the template function as transformation matrices to compute the target anisotropic 2 D metrics array The template function checks for deficient aniso metrics derived from deficient local bases and replace them with a default one 60 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 depending on the type of anisotropic mesher used The point is that the pos matrix is now a 3 D coordinates matrix and the met rics array contains 3 D anisotropic metrics dimensions 6xNODS 3D anisotropic metrics are defined as below a b d e b e f i data3D metrics d with gt 0 gt 0 gt 0 column sj __ i e the three eigen values are gt 0 Figure 27 Definition and storage of the 3 D anisotropic metrics Let Vo V1 V2 be the three orthonormal vectors along the axes of the ellipsoid 1 0 0 vi 2 20 ok VV sl Then the metrics M writes pra 0 0 M B 0 5 1 1 0 0 with B vo Vi stored column wise The 3 D metric equivalent to an isotropic size of writes 1 j
70. f reference coordinates often involves a non linear search However this function is called only for the nodes on the boundary mesh and for the isolated nodes i e the hard nodes only It is not called for the new nodes generated inside the surface by the mesher Copyright Computing Objects October 2015 59 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 column 3 of pos3D This array can be used for fast 2 D coordinates retrieval if these coordinates have been computed before oP The Surface get local bases member should compute the two tangents B and u T on the surface at a set of points given by their reference coordinates y These tangents must not be normalized They are the mere derivatives of the surface with respect to two reference parameters The two tangents at the point in column j of pos2D must be returned in column j of 1ocal B dimension 6xN The first three values are for the first tangent with respect to the first reference coordinate then the next three are for the second tangent This function should return zero when successful The Surface get local curvatures function may compute the curvatures of the surface at a set of points given by their reference coordinates optional The curvatures H are 2x2 symmetric matrices defined as H Dot product between the derivative of first local tangent with respect to and the n
71. hard entity cannot be enforced Pathological boundaries Vector pathological boundary IDs OUT This vector gives the column IDs in the connectB matrix of the edges that intersect other hard edge s node s pathological boundary IDs contains all the intersecting edges In non strict mode strict constraints flag false some of them will be present in the final mesh the first in connectB some will be missing the highest in connectB In strict constraints mode strict constraints flag true the generator stops with an error when this vector is not empty Copyright Computing Objects October 2015 75 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso 8 QuadMesh Aniso V 4 6 Elements color Vector colors OUT or IN OUT of size equal to M same size as the number of columns in the connectM matrix For each element this vector gives the index the so called color of the subdomain in which it belongs Upon exit the size of this vector equals to the number of output elements i e number of columns in matrix connectM The color values start at one for the most external subdomain and are incremented each time an internal closed boundary is encountered from the exterior towards the interior If several subdomains have the same level with respect to the outer boundary one cannot assume any order between the colors of these subdomains In the optimizing mode the user can input an initial color chart with size equals to the
72. ight Computing Objects October 2015 73 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 This vector stores the index of the points in the pos matrix that the user wants to be present in the final mesh in top of the hard edges nodes These points must be geometrically distinct and not located on a hard edge These nodes together with the nodes of the hard edges make the set of the so called hard nodes Repulsive points Vector repulsive_points IN This vector contains the index of the points stored in the pos matrix that will define areas of node repulsion in the final mesh These repulsive points must be associated with valid metrics mesh sizes to be properly taken into account Because of the mesh sizes at the neighboring hard nodes the disks are mere repulsion disks not exclusion disks The closer to the repulsive points the less the probability to find a generated node Background mesh Matrix background_mesh IN of dimensions 3xMb This is the connectivity matrix of an auxiliary mesh used to interpolate the metric field Like the other connectivity matrices connectB connectM the indices refer to columns in the pos coordinates matrix The metrics at the nodes of this background mesh are given in the met rics array All nodes of the background mesh must have a valid metric in this array i e a positive value for the isotropic meshers a matrix with two positive eigen values in the anisotropic cases
73. ined several times usually twice in the connect B matrix but with different orientation In addition it is sometimes more convenient for the user to generate the 1D meshes of the contours independently from each other That usually implies duplicated nodes on the shared contours The following example deals with such a case Consider three subdomains all oriented counter clockwise as defined below Several edges are shared between subdomains but with different orientation We also want to mesh the contours of the subdomains independently from each other but without any duplicated nodes P7 P6 P1 Figure 13 Domain composed of three attached subdomains The shared edges are no problem for the mesher The duplicate nodes however must be avoided In non strict mode see 111 3 duplicated nodes can be discarded indeed but that implies also that the associated edges cannot be enforced As a side effect the mesher may not be able to tell the sign of the inner square and that can lead to a hole The solution consists in merging the nodes after the meshing of the edges before the 2 D meshing Copyright Computing Objects October 2015 41 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 include V BNC CIEE olm static void mesh_segment DoubleMat amp pos unsigned start_index UIntVec meshtool UIntMat amp connectB indices lsld mesh_straight Seals lsld indic
74. ings Complementary information 1 2 ERROR AND WARNING CODES Error codes Warning codes 11 3 OPTIONS OF THE MESH GENERATORS Basic operating mode Strict constraints enforcement Keeping or removing internal holes All quad or quad dominant mode CM2 QuadMesh amp CM2 QuadMesh Aniso Refinement Recomputing the boundary edges Node smoothing Node inserting Node removing Shell remeshing Avoiding clamped edges CM2 TriaMesh amp CM2 TriaMesh Aniso Computation of the size qualities histogram Pattern for structured meshes CM2 TriaMesh amp CM2 TriaMesh Aniso Pattern for structured meshes CM2 QuadMesh amp CM2 QuadMesh Aniso Multi structured subdomains Limit on the number of nodes Optimization level Target metric Max gradation Weight on shape quality Weight on quadrangles CM2 QuadMesh amp CM2 QuadMesh Aniso Minimum quad quality CM2 QuadMesh amp CM2 QuadMesh Aniso Upper bound on edges length Display handler Interrupt handler 11 4 GENERAL SCHEME OF THE GENERATORS Copyright Computing Objects October 2015 77 77 81 81 83 85 85 85 85 86 86 87 87 87 87 88 88 88 88 88 89 89 89 89 89 90 90 90 90 90 97 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 Figures Figure 1 Views and data in variable sized vectors Figure 2 Triangle mesh of a square Figure 3 Print info for the square example Figure 4 Histogram of the size
75. its deletion Example Copyright Computing Objects October 2015 11 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 double L LOO 2 Susie raw arrays double buff2 new double 100 laute raw array sred waris 1 00 8 STL vector DoubleVec tche 50 Sllemeimes Je DoubleVec 5 2 0 Jf the 50 Slemeimies La DoubleVec V3 50 buff3 begin Views the first 50 elements in buff3 W2 cuesess ff buit ie moe ceallocarecl W2 wis ig deals ect WS nor delete buff2 Dangerous but correct because buff2 is no longer referenced by any DoubleVec owne ESaC Dangerous data in buff3 may have been deallocated Don t use V3 anymore Note that this can be done with the fixed size containers of math1 Dxexeledlewecs ws ds 020 1 O F DoubleVec V r Wil begali Views th alm WS The matrices of math1 can view also the data in an external container In addition to the raw pointer to the data the user must provide the number of rows the number of columns and the stride between two columns so called leading dimension unsigned buff new unsigned 30 IO 3 low As before the matrix is not responsible for the deletion
76. joos p Copy column 2 to V ok dimensions match oce 2 Vp Copy V to column 9 the last one CW POS COLI Ne Copy column 9 to column 0 Vie ceci eoe o ste 9 Append in a new column of pos dimensions match pos push back V pos cols 11 after this line Bound checking In debug mode with macro _DEBUG defined bound violations abort the program In release mode however for best performance no check is performed and the user must take care not to out value the limits of the vectors and matrices Interoperability with other math containers The API of the MeshTools library use exclusively vectors and matrices of the math1 library such as DoubleMat UIntMat FloatVec To use the meshers with other types of vectors and matrices the variable size containers are equipped with constructors with raw pointers as arguments Hence they can view the data in any other math containers as long as the latter provide a way to get a raw pointer to their data and that these data are contiguous in memory Remember that the variable size containers implement shallow copies This means that the arrays are shared not copied Therefore the memory management becomes a point to take care of and the user must keep in mind which library is responsible for deleting the memory upon exit The default is that the allocator of the array remains responsible for
77. late function vecvec copy Vl resize V2 size Resize V1 to V2 size vecvec copy V2 V1 Copy all V2 values into 1 or with the copy member 1 V2 Resize V1 to V2 size and copies the data 8 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 UIntVec UIntMat UIntSym DoubleVec2 DoubleVec3 L DoubleSym2 DoubleVec4 le DoubleVec6 DoubleSym3 e leVec8 leVec9 tVec2 tVec3 UIntSym2 tVec4 tVec6 UIntSym3 tVec8 tVec9 Table 1 Vectors and matrices exported by the matn1 library Views of the variable size containers Several variable sized containers can have a view on the same array of data but the view can be different from each other The beginning and the size in the array are specific to each container For instance in an array of 30 items a first vector views items from 0 to 9 and a second one views items from 5 to 20 Data array Figure 1 Views and data in variable sized vectors Elements from 5 to 9 are accessible from the two vectors When a destructor is called on a variable size container the data are destroyed only when no other container shares them anymore A smart pointer mechanism is used to count the number of references on the data and the deallocation actually occurs when the count reaches null The memory management is automatic automatic
78. lay handler optional starre eae winsieinecl Glue quse cou lt lt Tae meura const double 10 0 const unsigned 10 const DoubleVec2 02202 I3 05 052 12 5 1 54 2909 DoubleMat POSF UIntVec indices UIntMat connectB UNLOCK THE DLL triamesh registration Licensed to SMART Inc F53EA108BCWX NE MESHES VERTICES AND LI joosr pusm 120 oos spem legis 8 P2 P3 possum lose OOS _ n 5 ais ch indices meshtoolsid mesh straight pos 1 2 indices indices pop back meshtoolsid mesh straight pos 2 3 indices indices pop back ees 9 OW IN indices meshtoolsid indices to connectE2 indices connectB THE 2D MESH triamesh mesher the mesher triamesh mesher data type CAica CwominSeics 6 the mesher run data SOME OUTPUT INFO OPTIONAL data print info amp display hdl JJ OUA Our ONDE meshtools medit output out mesh data pos data connectM CM2 FACET3 return 0 I man The resulting mesh is shown Figure 2 Copyright Computing Objects October 2015 17 CM2 TriaMesh
79. mains forcing refine flag reset external boundaries flag node smoothing flag node inserting flag node removing flag shell remeshing flag no clamped edges flag compute Oh flag structured pattern Camella nodes limit optim level target metric max gradation shape quality weight length upper bound disp oy interrupt hdl IOS Table 10 triamesh operating mode type only the data members are shown Copyright Computing Objects October 2015 93 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 94 enum basic mode type MESH MODE REGULARIZE MODE CONVEX HULL MODE struct operating mode type basic mode type bool irre bool bool bool bool bool bool bool bool SLE bool unsigned unsigned DoubleSym2 double double double display handler type basic mode CoOMmscranings 12 lacs subdomains forcing refine flag reset external boundaries flag node smoothing flag node inserting flag node removing flag shell remeshing flag no clamped edges flag compute Oh flag structured pattern 1 ic nodes limit optim level target metric max gradation shape quality weight length upper bound interrupt handler typ
80. medit output out mesh data pos data connectM CM2 FACET3 return 0 Jf S 4 LAS S COS DN 555 ARES Figure 21 Background meshes for both the boundary and the domain T3 and all Q4 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 1 9 ANISOTROPIC MESHES 2 TriaMesh and CM2 QuadMesh are isotropic unstructured meshers that is they tend to produce equilateral triangles and squares It is sometimes useful however to have elements stretched in some special directions To deal with complex domains we still need an unstructured mesher Here come the anisotropic unstructured meshers CM2 TriaMesh Aniso and CM2 QuadMesh Aniso They are almost identical to their isotropic counterparts except for the data metrics array that is now a matrix In the isotropic case we need only a scalar at each node to define the target mesh size Now the target mesh size is defined by a 2x2 symmetric matrix at each node stored column wise in the metrics array Figure 22 A single scalar defines an isotropic metric left A 2D anisotropic metric needs two vectors right _ b M EZ 4 sow X 20 data metrics b with k go eed gt 0 ac b gt 0 column j __ i e the two eigen values are gt 0 Figure 23 Definition and storage of the 2 D a
81. ngle weight 0 quadrangles are never used With quadrangle weight 0 5 quadrangles are used only when they improve the quality of the mesh when a quad is better than two triangles e For values between 0 5 and 1 quadrangles are more and more used even if this lead to a lesser global quality of the mesh With quadrangle weight 1 the minimum number of triangles are used to get a valid mesh but may be of poor quality The default value 0 70 gives a significant preference to the quad triangle ratio over the mesh quality Minimum quad quality CM2 QuadMesh amp CM2 QuadMesh Aniso min 04 angle quality Double value between 0 and 1 Default 0 no minimum Used in MESH MODE Minimum acceptable angle quality for the quadrangles This parameter is taken into account in mixed mode only a11 quad flag false This quality threshold is based on the angle quality of the quads not the geometric quality which takes the length ratios also into account The angle quality is computed as the minimum of the four angles at sommits Set min Q4 angle quality 1 to allow rectangles only quads with right angles only In this case be aware that when boundaries are not straight very few rectangles may be generated mostly triangles Upper bound on edges length length upper bound Double value greater than 0 Default 1 414 Used in MESH MODE only This parameter is used to limit the length of the edges in the generat
82. nisotropic metrics Let Vo V1 be the two orthonormal vectors along the axes of the ellipse vol z 0 Then the metrics M writes Copyright Computing Objects October 2015 53 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 0 TB j 1 B i h with B vo vi stored column wise The metric equivalent to an isotropic size of writes h M 1 0 noy A null matrix would lead to infinite sizes in both directions infinite circle When the user doesn t specify a metric the mesher uses the default one which is equivalent to the isotropic default metrics we have seen before For each hard node the default metric is based on the length of the adjacent edges This leads to the same default behavior as their related isotropic counterparts Take for instance examples 11 1 11 2 11 3 or 11 4 and replace triamesh mesher the mesher with triamesh aniso mesher the mesher and you get the same meshes To benefit from the anisotropic features the user must fill the metrics array with valid anisotropic matrices i e positive definite matrices Some functions in meshtools and meshtoolsi1d can help in computing these matrices as in the following example 24 The anisotropic meshers are however significantly slower than their isotropic counterparts 54 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadM
83. number of input elements This will be used to affect a color to the elements created by the optimizer if needed Neighbors Matrix neighbors OUT of dimensions 3xM for the triangles and 4xM for the quads This matrix gives for each element in the final mesh the indices of the three or four neighboring elements 1 if none neighbors i j is the neighbor of the element sharing the edge See Figure 33 for the local numbering of the edges Ancestors Vector ancestors OUT of size N i e the number of columns in the pos matrix This vector gives for each point the index of one of the elements in which it belongs 1 if none i e if the point is not in the final mesh Together with the neighbors matrix this can make easy the design of some search algorithms such as looking for all elements connected to a node Shape qualities Vector shape qualities OUT of size M same size as the number of columns in the connectM matrix This vector gives the shape quality of each element The formula for the shape quality of a triangle writes Q 2448 Lal with S Area of the triangle Ls Max length of the four sides and the two diagonals P Perimeter of the triangle The formula for the shape quality of a 2 D quadrangle writes 0 2842 S min Do P with S Minimum area of the four triangles min 36 A subdomain means a set of connected elements not fully separated by a hard edge boundary 37 f
84. ontainers are zero based a vector with size extends from index 0 to N 1 Variable size containers and fixed size containers Besides the fact that only the containers of the first category can be resized automatically or manually they differ by the way the copy constructors and the copy operators work The variable size containers are merely views to data arrays whereas the fixed size containers actually hold the data as a member The first category only holds a reference and a copy implies only a copy of that reference not the data shallow copy copy of a container of the second category actually copies the data deep copy Example DoubleVec Empty vector DoubleVec 5 2 10 1 0 Z7 Weeror ox 10 valves all tacicializec to 1 0 vil push back 3 0 i push back 2 0 22 Wl eize 2 Vl V2 Shallow copy 1 517 10 I previous Wi eue lose 3 0 2 0 0 07 N2 0 0 0 because the data are shared N2 size 0 but 1 10 The data are not deleted because still viewed Vilo math1 html or math1 chm Some other types are defined but not exported they cannot be exchanged between dynamic libraries only between statically linked entities vector fixed T N matrix fixed T M N denselD T dense2D lt T gt and symmetric full T deep copy be obtained with the temp
85. op back The second call to mesh straight with 10 1 and i1 2 sets the indices vector to 04 56 78 9 10 11 12 1 13 14 15 16 17 18 19 20 21 2 After the four line meshes the matrix pos is of size 2x40 and the indices vector has 41 values the last index equals to the first here zero to indicate that the contour is closed The vector of indices is used to create the connectivity matrix of the boundary mesh 8 The same result could have been achieved with UIntVec hard nodes 5 hard nodes 0 0 hard 1 1 hard nodes 2 2 hard nodes 3 3 hard nodes 4 0 meshtoolsid mesh straight pos hard nodes 4 N indices This variant of mesh straight meshes a polyline going through some constrained points hard nodes Copyright Computing Objects October 2015 19 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 meshtoolsid indices to connectE2 indices connectB The connectB matrix has now dimensions 2x40 39 2x40 0 7 4 Ba 0 456 5 6 3 Now we have done the boundary mesh all we have to do is to call the 2 D mesher This done by creating a data structure holding this 1D mesh and make the mesher run on it triamesh mesher data type data pos connectB the mesher run data Upon exit the matrix data pos is bigger and contains all the new points generated inside the square by the 2 D mesher These new points are appended to the original matri
86. ormal N tothe surface dP e A N S 2 Dot product between the derivative of B first local tangent with respect to v or derivative of B second local tangent with respect to u and the normal N to the surface dP g Dot product between the derivative of second local tangent with respect to v and the normal N to the surface These three values must be stored column wise in matrix local_H on row 0 H on row 1 and on row 2 This function should return zero when successful and a negative value 1 for instance when failed You can leave the implementation of this member empty returning 1 for instance In this case approximative curvatures computed from variations of the tangents will be used instead The template class AnisoMesher is a concept of triangle anisometric mesher with function void run typename AnisoMesher data type amp data const The mesh surface param function is designed to work with one of the 2 D anisotropic meshers CM2 TriaMesh Aniso or CM2 QuadMesh Aniso The data3D parameter is the structure gathering all the input and output data just like for any other unstructured mesher of 2 MeshTools type of data3D is either triamesh aniso mesher data type Or quadmesh aniso mesher data type 28 This function should normally return in 1 1 B only valid bases made of two non null and non colinear vectors When the surface
87. os2D cols double V X 2 if pos2D rows 2 return 1 fd RYE pessD mewe 3 oosaD cols lt NODS c Satz c 97 Ge Op 3 lt x pos2D 0 3 v pos2D 1 4 1 5 ex cw 55 qp xev Zz 0 0 0 x a return 0 Compute the reference coordinates UV nodeIDs not used int get 2D coordinates const DoubleMat amp pos3D const UIntVec amp nodeIDs DoubleMat amp pos2D const const unsigned NODS pos3D cols double V X cows le 3 12 f ix cows 2 pos2D cols lt NODS pos2D resize 2 NODS ioe 3 WF 3 lt 90390 01 31 J u sx w e f s m x 8 joo 210 0 5 OS b ex return 0 fii QU Copyright Computing Objects October 2015 63 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 Compute the local tangents int get local bases const DoubleMat amp pos2D DoubleMat amp B const const unsigned NOD cols double lt 2 weicwiem ig f Yero 12 08 0 t 6 S cols lt NODS 0 iue Os 5 NOISE 33
88. osing boundary e 0 Intern subdomains are considered as holes when the orientation of their enclosing boundary is opposite to the orientation of the most enclosing domain Otherwise they are meshed e 41 All intern subdomains are meshed regardless of the orientation of their enclosing boundary Copyright Computing Objects October 2015 85 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 strict constraints flag true false Warning CM2 NODE DISCARDED The highest node is rejected Two hard nodes are coincident or too close from each other Warning CM2 EDGE DISCARDED The edge is rejected A hard node is located inside a hard edge EDGE Warning CM2 EDGE DISCARDED The highest edge is rejected Two hard edges cross each Error other EDGE F Warning CM2 NODE DISCARDED The node is rejected A hard node is located outside Error the domain or in a hole CM2 NODE E A hard edge is located outside Error Warning the domain or in a hole but with FDGR E CM2_EDGE_DISCARDED nodes on boundary The edge is rejected Warning Error CM2_NODE_DISCARDED CM2_NODE_E The node s and the edge are rejected A hard edge is located outside the domain or in a hole with nodes ouside also Error Error TRE Contour mesris qot Close CM
89. osited since then The source code specific to CM2 QuadMesh together with this manual has been registered with the APP under Inter Deposit number IDDN FR 001 440020 000 R P 2008 000 20700 31 10 2008 and is regularly deposited since then Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 OVERVIEW OF THE LIBRARY Copyright Computing Objects October 2015 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 Before digging into the meshers let us have a look into the matn1 library which exports the types of vector and matrix used by the meshers We do not intend here to give a full description of this math1 library nor the associated template libraries vecscal vecvec matscal matvec and matmat We will simply explain the basic traits of these math classes in order to use the meshers properly A full description can be found in the math1 API The math1 library exports 16 types of vector 14 types of rectangular matrix and 8 types of symmetric matrix They can be divided into two main categories the variable size containers such aS DoubleVec DoubleMat DoubleSym and the fixed size containers such as DoubleVec3 DoubleMat2x2 or DoubleSym2 Following the C usage all these math c
90. oundary mesh of the domain must also be governed by a background mesh In addition to the 2D background mesh we need also to discretize the boundary in order to support the sizes field on this line Then the real boundary mesh is generated using this 1D background mesh and the associated sizes The discretization for this 1D background mesh must be fine enough to represent accurately the geometry of the line An overload of the meshtoolsid mesh line function does this 0022 Here we discretize a full circle with 200 nodes 1 1 0 and keep the associated parameters in the UO vector i ogma R 100 5 meshtoolsild extrude rotate pos 1 CR 2 M PI n indices0O indicesO back indicesO front Sizes are specified on the nodes of this arc and on the 2D background mesh as well Then the circle is remeshed using the initial discretization of the circle and the new sizes field vecvec push back sizes 0 sizes0 cm2 meshtoolsld mesh line pos 0 sizesO true 1 UINT MAX 0 0 indices new U meshtoolsid indices to connectE2 indices connectE The parameters true 1 UINT MAX and 0 0 stand for force even number of edges minimum of 1 edge maximum of UINT_MAX edges along the arc and no chordal 123 The indices vector contains now the nodes of the real boundary mesh new U contains their parameter values along the circle but this vector is not used in the r
91. puting Objects October 2015 29 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 PRS HE Figure 7 Square with internal line quad dominant mode Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 3 SQUARE WITH INTERNAL HOLES A hole is an internal closed contour with edges oriented the opposite way from the external contour Note that this implies that all edges of the external contour should be oriented in a uniform way either clockwise or counter clockwise Based on the previous example we simply change the sign of the rotation vector to revert the orientation of the internal edges and thus to remove the disk from the domain meshtoolsld extrude rotate pos 4 DoubleVec3 L 2 L 2 2 Pl 2 ACHLES And the resulting meshes give SAARI 77 2 peepee SOK SUN CRY 206 SESE pm SOKO Figure 8 Square with a circular hole T3 and all Q4 7 o E e E 17 12 SO SONS V gt ES SR OE m One can nest alternatively positive and negative rotations 6 Without any hole the orientation of the external contour is irrelevant Copyright Computing Objects October 2015 31 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4
92. rnal boundary 1 if the contour is counter clockwise 1 if the contour is clockwise e The error and warning codes see 2 e The error message Copyright Computing Objects October 2015 77 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 e The times spent in the three successive steps of the mesher The total time spent in the mesher The global speed of the mesher number of generated elements per second struct data type DoubleMat IntMat Line WSC dene WES IntMat 1 U U ubleVec ntMat ine Wee gue Wee IRE WSS EVES UIntMat Ule Se DoubleVec mise MES totam misc histogram de de nsigned nsigned nsigned nsigned nsigned nsigned nsigned nsigned nsigned doub dou dou Dou Dou dou dou unsigned int oy Hen en en den IS 07 07 0 double double double double double 21218015 Eye warning type char pos e isolated nodes repulsive points background mesh metrics connectM unenforced boundary IDs unenforced node IDs pathological boundary IDs neighbors ancestors shape qualities Qsp 2160 Ohi nefs nefs 04 nefs T3 nods hard nodes in hard edges in hard nodes out hard edges out area area 04 area T
93. rove simultaneously both the shape quality of the elements and the size quality of the edges Unfortunately these two targets are often contradictory The histogram of the size qualities can be computed either inside the mesher by raising the flag mode compute flag before meshing or with a posteriori call to the auxiliary function meshtools edge qualities On the square example the size qualities are well centered on the value 1 with a small variance 12 See 111 3 for full description of the options of the meshers 22 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 KKKKKKKKKKKK HISTOGRAM OH KKKKKKKKKKKK Total number of bins 20 Total number of counts 353 Number of larger values 0 Number of smaller values 0 V max 1 284916 000 V mean 1 021125 000 V min 7 444225E 001 Bin number Bin boundaries Hits 19 1 90 2 00 0 18 1 80 1 90 0 17 1 70 1 80 0 16 1 60 1 70 0 15 1 50 1 60 0 14 1 40 1 50 0 13 1 30 1 40 0 12 1 20 1 30 16 11 1 10 1 20 36 10 1 00 1 4250 174 9 0 590 1 00 102 8 0 80 0 90 17 7 0 70 0 80 8 6 0 60 0 70 0 5 0 50 0 60 0 4 0 40 0 50 0 3 0 30 0 40 0 2 0 20 0 30 0 1 0 10 0 20 0 0 0 00 0 10 0 Figure 4 Histogram of the size qualities of all the edges in the square example Copyright Computing Objects October 2015 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso
94. ruct operating mode type basic mode type bool bool bool bool bool bool bool bool bool bool bool unsigned unsigned DoubleSym2 double double double double double display handler type basic mode strice COMmScranings 12 lacs subdomains_forcing all cme refine_flag reset_external_boundaries_flag node smoothing flag node inserting flag node removing flag shell remeshing flag compute Oh flag SO multi structured flag nodes limit optim level target metric max gradation shape quality weight quadrangle weight min O4 angle quality length upper bound interrupt handler typ void molle pasg _iclaiewls Table 13 quadmesh aniso operating mode type only the data members are shown Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 11 4 GENERAL SCHEME OF THE GENERATORS INITIALIZATION false true regularize only flag FRONT MESH Constraints enforcement Elements coloring true false false feset external fi fl boundaries_flag refine_flag true Detection of the REFINEMENT boundary edges optim level 0 0 OPTIMIZATION FINALIZATION Figure 35 General scheme of the mesh generators Copyright Computing Objects October 2015 97 CM2
95. s 7 CSS V WW COSA VU NN 10000 Figure 29 2 anisotropic meshes in the reference space UV VN KIY QL e N EC OTR 259 SOK 4 D ITA SEER EBSA ANAK ROD RS SA VOS S SIS SS rr OLAI e ANARAN ITT ZAR a oa Kb N 45 40404 STATAN ATA Io ONSE Sel UT EAA RACER ERTIES ane XH lose SPP SISSE SISSE EE CET pO ER le ASS ERRIREN 5 opes oS A A K Pa a p a Ire Te eret SESSA LK 225252550411 c M Se 27 CSS RN ES Seb OC 1 Ny d ETT EEO 2221 KARAS mcr 4 p 075 Figure 30 Surface meshes T3 and all Q4 obtained via an anisotropic mesh in the reference space The next example is a
96. s the 2 NO ERROR and CM2 NO WARNING codes zero value See III 2 for more detailed explanations of the error and warning codes Complementary information We gather in this section all the remaining fields of the data structure They are all output values about the final mesh e The number of elements in the mesh also equals to the number of columns in connectM e The number of quads always null with TriaMesh amp TriaMesh Aniso and the number of triangles null with QuadMesh amp QuadMesh Aniso when all quad flag true The sum equals to the number of elements above e The number of nodes in the mesh less or equal to the number of columns in pos e The number of input and output hard edges In strict mode see 111 3 these two quantities must be equal e The number of input and output hard nodes In strict mode these two quantities must be equal e The area of the mesh e area of the quads always null with TriaMesh amp TriaMesh Aniso and the area of the triangles null with QuadMesh amp QuadMesh Aniso when all quad flag true The sum equals to the area of the mesh above e The bounding box of the mesh e The worst shape quality of the elements in the mesh upon entry REGULARIZE MODE only e worst shape quality of the elements the final mesh also available in nisto 05 e The number of subdomains i e the number of different values in the colors vector e orientation of the exte
97. sh registration Licensed to SMART Inc F53EA108BCWX NERTICES AND LINE MESHES pos push back SINN pos push back OOS pos push back P4 22 023 r ool 5 mcshmsi 5a chc cH ess meimasecesopi meshtoolsid mesh straight pos 1 2 indices indices pop back meshtoolsid mesh straight pos 2 3 indices indices pop back indices meshtoolsid indices to connectE2 indices connectB indices clear meshtoolsild extrude rotate pos 4 DoubleVec2 L 2 L 2 Zo 2 8 indices back indices front meshtoolsid indices to connectE2 indices connectB THE 2D MESH triamesh mesher the mesher triamesh mesher data type creme et the mesher run data STORY c meshtools medit output out mesh data pos data connectM CM2 FACET3 return 0 main Copyright Computing Objects October 2015 27 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 E Ae xD FE _ 1 E t Ba 5 A S 22 m ava LV A Figure 6 Square with internal line T3 and all Q4
98. tE2 indices connectB ph Com Gy L3 c m m m m THE 2D MESH triamesh mesher the mesher triamesh mesher data type data pos connectB data isolated nodes push back 4 data metrics resize 5 0 0 data metrics 4 0 1 L N the mesher run data VISUALISATION meshtools medit output out mesh data pos data connectM CM2 FACET3 return 0 main We have created a new point at the center with coordinates placed in column 4 of matrix pos Its index i e 4 is then pushed into the vector data isolated nodes This new field serves to store all the isolated nodes that must be present in the final mesh Copyright Computing Objects October 2015 35 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 The vector data metrics stores the user specified target sizes If the value for a node is zero or negative or not present the automatically computed value will be used instead 8 In our example the vector is resized to 5 with all values set to zero except for point 4 where we ask for a 10 times finer mesh around it VO OC 5 POE DERE KERR x RUN opem 2509 2 Figure 11 Mesh concentration near hard node T3
99. ted from a set of hard edges and possibly some internal hard nodes The connectB matrix and isolated nodes in the data structure are input fields whereas the connect M matrix is an output of the mesher e REGULARIZE MODE The mesher is only used to improve the quality of an already existing mesh The connectM matrix is both input and output of the mesher e CONVEX HULL MODE The mesher builds a triangulation of a set of points This is the approximate convex hull of the points No boundary connectB is needed here only the isolated nodes are used No new nodes are added to the mesh Note that the convex hull is always a triangle mesh even with QuadMesh Strict constraints enforcement strict constraints flag Default true Used in MESH MODE only This flag tells the mesher to stop on an aborting error 2 EDGE ERROR CM2 NODE ERROR if at least one of the constraints cannot be enforced to simply issue a warning 2 EDGE DISCARDED 2 DISCARDED and go on with the process if possible Beware that a rejected edge can make a contour mesh unclosed and then lead to a CM2 BOUNDARY ERROR Keeping or removing internal holes subdomains forcing Default 0 Used in MESH MODE only Forcing mode for intern subdomains Possible values are 1 All intern subdomains are considered as holes regardless of the orientation of their encl
100. timization step is skipped opt im level 0 Avoiding clamped edges 2 TriaMesh amp CM2 TriaMesh Aniso no clamped edges flag Default false Used in MESH MODE and REGULARIZE MODE This is a special node inserting scheme dedicated to breaking the non hard edges with two hard nodes This option supersedes node inserting flag ltincreases the number of nodes changes the mesh connectivity but doesn t change the other nodes coordinates This flag has no effect when the optimization step is skipped opt im level 0 Computation of the size qualities histogram compute flag Default false Used in all modes Before exiting the process this flag tells the mesher to compute the histogram of the size quality of all the edges in the mesh The users are rarely interested in this histogram so the default state is false Pattern for structured meshes CM2 TriaMesh amp 2 TriaMesh Aniso Structured pattern Default 1 Used in MESH MODE only This option controls the way the generators does the structured meshes when possible on rectangular like domains In TriaMesh amp TriaMesh Aniso structured pattern can take four values e 1 This is the default mode The triangular meshes always done with the frontal Delaunay algorithm This usually gives optimal meshes 0 When possible generates structured left oriented meshes simply oriented pattern e 1 When possible gen
101. triamesh mesher run triamesh mesher data type amp data void quadmesh mesher run quadmesh mesher data type amp data void triamesh aniso mesher run triamesh aniso mesher data type amp data void quadmesh aniso mesher run quadmesh aniso mesher data type amp data Some of the most important fields of these structures have already been seen in the previous chapter This part recalls these points and details all the others Coordinates of the points Matrix pos of dimensions 2xN IN OUT This matrix stores the coordinates of a points The coordinates are stored column wise The column index is the index of the node zero based i e from 0 to N 1 The X coordinates are in the first row and the Y coordinates in the second row Upon exit the coordinates of the newly generated nodes are appended to the back of the matrix as new columns The initial columns are left unchanged Hard edges Matrix connect B of dimensions 2xB IN OUT This matrix stores the connectivity of the edges of the boundary mesh and if any the edges of the constrained internal lines These edges are also called hard edges The node IDs of the edges are stored column wise connectB i j is the 0 or 1 node of the j edge This 1D mesh must comply with three conditions e must be valid no edge cuts no degenerated edges e t must contain at least one closed external boundary e f holes or several external boundaries are pres
102. true 3 D parametric surface double sinusoidal We present only the source code for the surface class 66 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 The Surface class implements the functions needed by mesh surface param surface double L double H m 1 Compute the 3D coordinates int get 3D coordinates const DoubleMat amp pos2D DoubleMat amp pos3D const const unsigned NODS pos2D cols double Up Wp 2p Ng ie lt 2 12 iif it 9OSSD cows t eessDaeolse lt NODS 009300 12652005 S 903 fom 5 5 lt 0052 ag Ww 1 1 91 BE We ex EJ dep ow 39005 SEG Pos DOPIN 90830 il 3 y g OSSD 2 return 0 Jd QU Compute the reference coordinates UV nodeIDs not used int get 2D coordinates const DoubleMat amp pos3D const UIntVec amp nodeIDs DoubleMat amp pos2D const const unsigned NODS pos3D cols double u V X Y ii o0os3D sows lt 2 Jf ads SOSZ2D rowalt 1 2 epesZD eols lt NODS pxesZiD xesuime 2 wor 3 Of 3 lt 02 33 19 0 0 J p u S NEU w oy f J
103. ug 1007 210 00072 3 Up pos2D 1 j v return 0 MEORE Compute the local tangents int get local bases const DoubleMat amp pos2D DoubleMat amp B const const unsigned NODS pos2D cols double u V X y Copyright Computing Objects October 2015 CM2 TriaMesh amp QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 xeeZU cowe lt 2 zseuwm 12 jf ies aie 8 cows O t 6 QSoeods lt NODS B resize 6 NODS core Of 7 9059 3 1200521000 91 8 5 M Us OSEE VALLES UR 2 0 3 1 jog 92 06 ij 2 3 ih 53 s809 3 3 9 9 B 4 3 5 4 H 5 return 0 Compute the local curvatures int get_local_curvatures const Doubl leMat amp pos2D const unsigned NOD Se 5 2 69510 double V X Y 12 lt 2 5 f BOR die Gi vows O t 3 a cols lt JNODS iue 3 OF 3 10050 U 3 8 SB us Sx Sou p Gx ssees gy Sssama y p Gy ssecos w p 5 JH 7 a JE B EL ex ew 5 qe s SE H 2 9 Grey Sp Data members double H IE 68 DoubleMat amp const SX GRC Ei 9 Cop
104. x The initial 40 points are still untouched in the first 40 columns The connectivity of the final mesh is stored in the matrix data connectM each column storing the indices of the nodes for element connectM i j is the it local node of the element Printed information about the generated mesh MEDIT output file are obtained with daca preing iaro acil 5 meshtools medit output out mesh data pos data connectM CM2 FACET3 Here is the output given by data print info amp display hdl The elements are always oriented counter clock wise director up 10 MEDIT is a free vizualisation program http www ann jussieu fr frey logiciels medit html Other output formats are Ensight FEMAP neutral Nastran STL VTK and Wavefront OBJ 20 Copyright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso amp QuadMesh Aniso V 4 6 CKCkCck kCk ck kCck ck ck ck ck ck ck ck ck ck ck ck ck k ck ck k ck ck k ck k k ck k k kk kk KKKKKKKKKKKKK CM2 TRIAMESH KKKKKKKKKKKK KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK Version 4 6 0 0 Hard nodes 40 40 in Hard edges 40 40 in Nodes 2132 Triangles 222 Subdomains sm Area 1 600000 001 8 374821 001 Front time 0 00 s Refine time 0 00 s Optim time 0 00 s Total time 0 00 s INF t s ck k k ck kk HISTOGRAM 05 Ckckckck ck ck ck ck ckck ck Total number of bins 2 11
105. yright Computing Objects October 2015 CM2 TriaMesh 8 QuadMesh CM2 TriaMesh Aniso QuadMesh Aniso V 4 6 ESSERI VN MSS Zo NST SAINI NSIS e PN RSS SSCP ANY Se EVANS REPOS ENSE ZEE ZEON SSE eC ASS SSE OS 75 55 ES ea SSE TRAN WAS Notes A M A YO 51 n ANSA VU SAAN DRM PS V ce aet LO BERE DENTIS COMES DE Wann AKIN CON WS H WA VN Nw 7 V SOY Ni VE WH IP us 7 Va N N p O Figure 32

Download Pdf Manuals

image

Related Search

Related Contents

Mode d`emploi & bon à savoir  Convertidores de frecuencia, forma constr. en chasis CA-CA  

Copyright © All rights reserved.
Failed to retrieve file