Skip to content
Snippets Groups Projects
Commit c269e7f6 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

No commit message

No commit message
parent a4233644
No related branches found
No related tags found
No related merge requests found
...@@ -2,56 +2,65 @@ ...@@ -2,56 +2,65 @@
* *
* Gmsh tutorial 12 * Gmsh tutorial 12
* *
* Remeshing STL with compounds * Cross-patch meshing with compounds
* *
*********************************************************************/ *********************************************************************/
// Compound geometrical entities can be defined to compute a new // Compound geometrical entities can be defined to compute a new
// parametrization of groups of elementary geometrical entities. This // parametrization of groups of elementary geometrical entities. This
// parametrization can then be used for remeshing the compound as if // parametrization can then be used for remeshing the compound as if
// it were a CAD entity. // it were a single CAD entity.
// Merge the original mesh, that we would like to remesh. This mesh lc = 0.2;
// was reclassified ("colored") from an initial STL triangulation Point(1) = {0, 0, 0, lc};
// using the "Reclassify 2D" tool in Gmsh, so that we can preserve Point(2) = {1, 0, 0, lc};
// sharp geometrical features. Point(3) = {1, 1, 0.5, lc};
Merge "t12_data.msh"; Point(4) = {0, 1, 0.4, lc};
Point(5) = {0.3, 0.2, 0, lc};
Point(6) = {0, 0.01, 0.01, lc};
Point(7) = {0, 0.02, 0.02, lc};
Point(8) = {1, 0.05, 0.02, lc};
Point(9) = {1, 0.32, 0.02, lc};
Line(1) = {1, 2};
Line(2) = {2, 8};
Line(3) = {8, 9};
Line(4) = {9, 3};
Line(5) = {3, 4};
Line(6) = {4, 7};
Line(7) = {7, 6};
Line(8) = {6, 1};
Spline(9) = {7, 5, 9};
Line(10) = {6, 8};
Line Loop(11) = {5, 6, 9, 4};
Ruled Surface(12) = {11};
Line Loop(13) = {9, -3, -10, -7};
Ruled Surface(14) = {13};
Line Loop(15) = {10, -2, -1, -8};
Ruled Surface(16) = {15};
// Since the original mesh is a bit coarse, we refine it once // Treat lines 2, 3 and 4 as a single line
RefineMesh; Compound Line(100) = {2, 3, 4};
// Idem with lines 6, 7 and 8
Compound Line(101) = {6, 7, 8};
// Create the topology of the discrete model // Treat surfaces 12, 14 and 16 as a single surface
CreateTopology; Compound Surface(200) = {12, 14, 16};
// We can now define a compound line (resp. surface) for each discrete
// line (resp. surface) in the model
ll[] = Line "*";
For j In {0 : #ll[]-1}
Compound Line(newl) = ll[j];
EndFor
ss[] = Surface "*";
s = news;
For i In {0 : #ss[]-1}
Compound Surface(s+i) = ss[i];
EndFor
Surface Loop(1) = {s : s + #ss[]-1};
Volume(1) = {1};
Physical Surface(1) = {s : s + #ss[]-1};
Physical Volume(1) = 1;
// Apply a funny mesh size field, just because we can :-)
Field[1] = MathEval;
Field[1].F = "2*Sin((x+y)/5) + 3.3";
Background Field = 1;
Mesh.RemeshAlgorithm = 1; // (0) no split (1) automatic (2) automatic only with metis
Mesh.RemeshParametrization = 1; // (0) harmonic (1) conformal
// More details about the reparametrization technique can be found in // More details about the reparametrization technique can be found in
// the following papers: // the following papers:
// //
// * J.-F. Remacle, C. Geuzaine, G. Compère and E. Marchandise,
// "High-Quality Surface Remeshing Using Harmonic Maps",
// International Journal for Numerical Methods in Engineering,
// 83 (4), pp. 403-425, 2010.
// //
// // * E. Marchandise, G. Compère, M. Willemet, G. Bricteux, C. Geuzaine
// and J-F Remacle, "Quality meshing based on STL triangulations for
// biomedical simulations", International Journal for Numerical
// Methods in Biomedical Engineering", 26 (7), pp. 876-889, 2010.
//
// * E. Marchandise, C. Carton de Wiart, W. G. Vos, C. Geuzaine and
// J.-F. Remacle, "High Quality Surface Remeshing Using Harmonic
// Maps. Part II: Surfaces with High Genus and of Large Aspect
// Ratio", International Journal for Numerical Methods in
// Engineering, 86 (11), pp. 1303-1321, 2011.
...@@ -2,12 +2,50 @@ ...@@ -2,12 +2,50 @@
* *
* Gmsh tutorial 13 * Gmsh tutorial 13
* *
* Cross-patch meshing with compounds * Remeshing STL with compounds
* *
*********************************************************************/ *********************************************************************/
// Compound geometrical entities can be defined to compute a new // Since compound geometrical compute a new parametrization, one can
// parametrization of groups of elementary geometrical entities. This // also use them to remesh STL files, even if there's only a single
// parametrization can then be used for remeshing the compound as if // elementary per compound.
// it were a CAD entity.
// Let's merge the mesh that we would like to remesh. This mesh was
// reclassified ("colored") from an initial STL triangulation using
// the "Reclassify 2D" tool in Gmsh, so that we could split it along
// sharp geometrical features.
Merge "t13_data.msh";
// Since the original mesh is a bit coarse, we refine it once
RefineMesh;
// Create the topology of the discrete model
CreateTopology;
// We can now define a compound line (resp. surface) for each discrete
// line (resp. surface) in the model
ll[] = Line "*";
For j In {0 : #ll[]-1}
Compound Line(newl) = ll[j];
EndFor
ss[] = Surface "*";
s = news;
For i In {0 : #ss[]-1}
Compound Surface(s+i) = ss[i];
EndFor
// And we can create the volume based on the new compound entities
Surface Loop(1) = {s : s + #ss[]-1};
Volume(1) = {1};
Physical Surface(1) = {s : s + #ss[]-1};
Physical Volume(1) = 1;
// Apply a funny mesh size field, just because we can :-)
Field[1] = MathEval;
Field[1].F = "2*Sin((x+y)/5) + 3.3";
Background Field = 1;
Mesh.RemeshAlgorithm = 1; // (0) no split (1) automatic (2) automatic only with metis
Mesh.RemeshParametrization = 1; // (0) harmonic (1) conformal
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment