diff --git a/tutorial/c++/t1.cpp b/tutorial/c++/t1.cpp index a41f1059888ef0fbf019ef3cb202b3d37465289d..2d0105619aee073be3df3262f79fb4af8f4f490c 100644 --- a/tutorial/c++/t1.cpp +++ b/tutorial/c++/t1.cpp @@ -49,7 +49,7 @@ int main(int argc, char **argv) // // We can then define some additional points. All points should have different // tags: - gmsh::model::geo::addPoint(.1, 0, 0, lc, 2); + gmsh::model::geo::addPoint(.1, 0, 0, lc, 2); gmsh::model::geo::addPoint(.1, .3, 0, lc, 3); // If the tag is not provided explicitly, a new tag is automatically created, diff --git a/tutorial/c++/t10.cpp b/tutorial/c++/t10.cpp index d4a2705c1ec56d760139bc7c4bc26f6e54835bc4..e7e51013fad816ba7af93d6f83403b45387c4937 100644 --- a/tutorial/c++/t10.cpp +++ b/tutorial/c++/t10.cpp @@ -22,18 +22,18 @@ int main(int argc, char **argv) // Let's create a simple rectangular geometry: double lc = .15; - gmsh::model::geo::addPoint(0.0,0.0,0,lc, 1); - gmsh::model::geo::addPoint(1,0.0,0,lc, 2); - gmsh::model::geo::addPoint(1,1,0,lc, 3); - gmsh::model::geo::addPoint(0,1,0,lc, 4); - gmsh::model::geo::addPoint(0.2,.5,0,lc, 5); - - gmsh::model::geo::addLine(1,2, 1); - gmsh::model::geo::addLine(2,3, 2); - gmsh::model::geo::addLine(3,4, 3); - gmsh::model::geo::addLine(4,1, 4); - - gmsh::model::geo::addCurveLoop({1,2,3,4}, 5); + gmsh::model::geo::addPoint(0.0, 0.0, 0, lc, 1); + gmsh::model::geo::addPoint(1, 0.0, 0, lc, 2); + gmsh::model::geo::addPoint(1, 1, 0, lc, 3); + gmsh::model::geo::addPoint(0, 1, 0, lc, 4); + gmsh::model::geo::addPoint(0.2, .5, 0, lc, 5); + + gmsh::model::geo::addLine(1, 2, 1); + gmsh::model::geo::addLine(2, 3, 2); + gmsh::model::geo::addLine(3, 4, 3); + gmsh::model::geo::addLine(4, 1, 4); + + gmsh::model::geo::addCurveLoop({1, 2, 3, 4}, 5); gmsh::model::geo::addPlaneSurface({5}, 6); gmsh::model::geo::synchronize(); @@ -70,8 +70,8 @@ int main(int argc, char **argv) // function of the spatial coordinates. We can do this with the MathEval // field: gmsh::model::mesh::field::add("MathEval", 3); - gmsh::model::mesh::field::setString - (3, "F", "Cos(4*3.14*x) * Sin(4*3.14*y) / 10 + 0.101"); + gmsh::model::mesh::field::setString( + 3, "F", "Cos(4*3.14*x) * Sin(4*3.14*y) / 10 + 0.101"); // We could also combine MathEval with values coming from other fields. For // example, let's define a `Distance' field around point 1 diff --git a/tutorial/c++/t11.cpp b/tutorial/c++/t11.cpp index ffc0f29690225c6b48295049ee0c9ac87761bc56..b3601fb53086ac931bdde4d480a20c3e4eefe822 100644 --- a/tutorial/c++/t11.cpp +++ b/tutorial/c++/t11.cpp @@ -36,8 +36,8 @@ int main(int argc, char **argv) gmsh::model::geo::synchronize(); gmsh::model::mesh::field::add("MathEval", 1); - gmsh::model::mesh::field::setString - (1, "F", "0.01*(1.0+30.*(y-x*x)*(y-x*x) + (1-x)*(1-x))"); + gmsh::model::mesh::field::setString( + 1, "F", "0.01*(1.0+30.*(y-x*x)*(y-x*x) + (1-x)*(1-x))"); gmsh::model::mesh::field::setAsBackgroundMesh(1); // To generate quadrangles instead of triangles, we can simply add diff --git a/tutorial/c++/t13.cpp b/tutorial/c++/t13.cpp index 56bdac7f140dd972d701a6e13591316752ee395b..295e229b82a54ab5b108bd529e04b846bf98cc68 100644 --- a/tutorial/c++/t13.cpp +++ b/tutorial/c++/t13.cpp @@ -20,8 +20,7 @@ int main(int argc, char **argv) // directory): try { gmsh::merge("../t13_data.stl"); - } - catch(...) { + } catch(...) { gmsh::logger::write("Could not load STL mesh: bye!"); gmsh::finalize(); return 0; @@ -43,8 +42,7 @@ int main(int argc, char **argv) // Force curves to be split on given angle: double curveAngle = 180; - gmsh::model::mesh::classifySurfaces(angle * M_PI / 180., - includeBoundary, + gmsh::model::mesh::classifySurfaces(angle * M_PI / 180., includeBoundary, forceParametrizablePatches, curveAngle * M_PI / 180.); @@ -63,7 +61,7 @@ int main(int argc, char **argv) gmsh::model::geo::synchronize(); // We specify element sizes imposed by a size field, just because we can :-) - bool funny = true;//false; + bool funny = true; // false; int f = gmsh::model::mesh::field::add("MathEval"); if(funny) gmsh::model::mesh::field::setString(f, "F", "2*Sin((x+y)/5) + 3"); diff --git a/tutorial/c++/t14.cpp b/tutorial/c++/t14.cpp index beba240d1b8dc7c347fdb3aaa4252a573a589e81..92463eee895691aaf8710c48896b3b5efc53d41a 100644 --- a/tutorial/c++/t14.cpp +++ b/tutorial/c++/t14.cpp @@ -62,7 +62,7 @@ int main(int argc, char **argv) gmsh::model::geo::addPlaneSurface({13, 14}, 15); std::vector<std::pair<int, int> > ext_tags; - gmsh::model::geo::extrude({{2,15}}, 0, 0, h, ext_tags); + gmsh::model::geo::extrude({{2, 15}}, 0, 0, h, ext_tags); // Create physical groups, which are used to define the domain of the // (co)homology computation and the subdomain of the relative (co)homology @@ -71,7 +71,7 @@ int main(int argc, char **argv) // Whole domain int domain_tag = 1; int domain_physical_tag = 1001; - gmsh::model::addPhysicalGroup(3,{domain_tag}, domain_physical_tag); + gmsh::model::addPhysicalGroup(3, {domain_tag}, domain_physical_tag); gmsh::model::setPhysicalName(3, domain_physical_tag, "Whole domain"); // Four "terminals" of the model @@ -109,20 +109,17 @@ int main(int argc, char **argv) // Find bases for relative homology spaces of the domain modulo the four // terminals gmsh::model::mesh::computeHomology({domain_physical_tag}, - {terminals_physical_tag}, - {0,1,2,3}); + {terminals_physical_tag}, {0, 1, 2, 3}); // Find homology space bases isomorphic to the previous bases: homology spaces // modulo the non-terminal domain surface, a.k.a the thin cuts gmsh::model::mesh::computeHomology({domain_physical_tag}, - {complement_physical_tag}, - {0,1,2,3}); + {complement_physical_tag}, {0, 1, 2, 3}); // Find cohomology space bases isomorphic to the previous bases: cohomology // spaces of the domain modulo the four terminals, a.k.a the thick cuts gmsh::model::mesh::computeCohomology({domain_physical_tag}, - {terminals_physical_tag}, - {0,1,2,3}); + {terminals_physical_tag}, {0, 1, 2, 3}); // More examples: // gmsh::model::mesh::computeHomology(); diff --git a/tutorial/c++/t15.cpp b/tutorial/c++/t15.cpp index f6c86df21250efc71457287b4c43d2a966e9eeb9..a09b3aaa5543bd9c514746761413c3f08ba2b14e 100644 --- a/tutorial/c++/t15.cpp +++ b/tutorial/c++/t15.cpp @@ -26,9 +26,9 @@ int main(int argc, char **argv) // Copied from t1.cpp: double lc = 1e-2; gmsh::model::geo::addPoint(0, 0, 0, lc, 1); - gmsh::model::geo::addPoint(.1, 0, 0, lc, 2); + gmsh::model::geo::addPoint(.1, 0, 0, lc, 2); gmsh::model::geo::addPoint(.1, .3, 0, lc, 3); - gmsh::model::geo::addPoint(0, .3, 0, lc, 4); + gmsh::model::geo::addPoint(0, .3, 0, lc, 4); gmsh::model::geo::addLine(1, 2, 1); gmsh::model::geo::addLine(3, 2, 2); gmsh::model::geo::addLine(3, 4, 3); @@ -37,7 +37,7 @@ int main(int argc, char **argv) gmsh::model::geo::addPlaneSurface({1}, 1); // We change the mesh size to generate a coarser mesh - lc *= 4; + lc *= 4; gmsh::model::geo::mesh::setSize({{0, 1}, {0, 2}, {0, 3}, {0, 4}}, lc); // We define a new point @@ -67,24 +67,24 @@ int main(int argc, char **argv) gmsh::model::geo::synchronize(); gmsh::model::mesh::embed(0, {p}, 3, 1); - gmsh::model::geo::addPoint(0.025, 0.15, 0.025, lc, p+1); - int l = gmsh::model::geo::addLine(7, p+1); + gmsh::model::geo::addPoint(0.025, 0.15, 0.025, lc, p + 1); + int l = gmsh::model::geo::addLine(7, p + 1); gmsh::model::geo::synchronize(); gmsh::model::mesh::embed(1, {l}, 3, 1); // Finally, we can also embed a surface in a volume: - gmsh::model::geo::addPoint(0.02, 0.12, 0.05, lc, p+2); - gmsh::model::geo::addPoint(0.04, 0.12, 0.05, lc, p+3); - gmsh::model::geo::addPoint(0.04, 0.18, 0.05, lc, p+4); - gmsh::model::geo::addPoint(0.02, 0.18, 0.05, lc, p+5); + gmsh::model::geo::addPoint(0.02, 0.12, 0.05, lc, p + 2); + gmsh::model::geo::addPoint(0.04, 0.12, 0.05, lc, p + 3); + gmsh::model::geo::addPoint(0.04, 0.18, 0.05, lc, p + 4); + gmsh::model::geo::addPoint(0.02, 0.18, 0.05, lc, p + 5); - gmsh::model::geo::addLine(p+2, p+3, l+1); - gmsh::model::geo::addLine(p+3, p+4, l+2); - gmsh::model::geo::addLine(p+4, p+5, l+3); - gmsh::model::geo::addLine(p+5, p+2, l+4); + gmsh::model::geo::addLine(p + 2, p + 3, l + 1); + gmsh::model::geo::addLine(p + 3, p + 4, l + 2); + gmsh::model::geo::addLine(p + 4, p + 5, l + 3); + gmsh::model::geo::addLine(p + 5, p + 2, l + 4); - int ll = gmsh::model::geo::addCurveLoop({l+1, l+2, l+3, l+4}); + int ll = gmsh::model::geo::addCurveLoop({l + 1, l + 2, l + 3, l + 4}); int s = gmsh::model::geo::addPlaneSurface({ll}); gmsh::model::geo::synchronize(); diff --git a/tutorial/c++/t16.cpp b/tutorial/c++/t16.cpp index 1255cc7e396d9d26058a93cee5654d423394cf34..9c1b000b09d5a79fc03324f15f2e6631e6524f1f 100644 --- a/tutorial/c++/t16.cpp +++ b/tutorial/c++/t16.cpp @@ -28,10 +28,9 @@ int main(int argc, char **argv) // We first create two cubes: try { - gmsh::model::occ::addBox(0,0,0, 1,1,1, 1); - gmsh::model::occ::addBox(0,0,0, 0.5,0.5,0.5, 2); - } - catch(...) { + gmsh::model::occ::addBox(0, 0, 0, 1, 1, 1, 1); + gmsh::model::occ::addBox(0, 0, 0, 0.5, 0.5, 0.5, 2); + } catch(...) { gmsh::logger::write("Could not create OpenCASCADE shapes: bye!"); return 0; } @@ -39,19 +38,19 @@ int main(int argc, char **argv) // We apply a boolean difference to create the "cube minus one eigth" shape: std::vector<std::pair<int, int> > ov; std::vector<std::vector<std::pair<int, int> > > ovv; - gmsh::model::occ::cut({{3,1}}, {{3,2}}, ov, ovv, 3); + gmsh::model::occ::cut({{3, 1}}, {{3, 2}}, ov, ovv, 3); // Boolean operations with OpenCASCADE always create new entities. By default // the extra arguments `removeObject' and `removeTool' in `cut()' are set to // `true', which will delete the original entities. // We then create the five spheres: - double x = 0, y = 0.75, z = 0, r = 0.09 ; + double x = 0, y = 0.75, z = 0, r = 0.09; std::vector<std::pair<int, int> > holes; - for(int t = 1; t <= 5; t++){ - x += 0.166 ; - z += 0.166 ; - gmsh::model::occ::addSphere(x,y,z,r, 3 + t); + for(int t = 1; t <= 5; t++) { + x += 0.166; + z += 0.166; + gmsh::model::occ::addSphere(x, y, z, r, 3 + t); holes.push_back({3, 3 + t}); } @@ -59,7 +58,7 @@ int main(int argc, char **argv) // want five spherical inclusions, whose mesh should be conformal with the // mesh of the cube: we thus use `fragment()', which intersects all volumes in // a conformal manner (without creating duplicate interfaces): - gmsh::model::occ::fragment({{3,3}}, holes, ov, ovv); + gmsh::model::occ::fragment({{3, 3}}, holes, ov, ovv); // ov contains all the generated entities of the same dimension as the input // entities: @@ -74,10 +73,10 @@ int main(int argc, char **argv) in.insert(in.end(), holes.begin(), holes.end()); for(std::size_t i = 0; i < in.size(); i++) { std::string s = "parent (" + std::to_string(in[i].first) + "," + - std::to_string(in[i].second) + ") -> child"; + std::to_string(in[i].second) + ") -> child"; for(std::size_t j = 0; j < ovv[i].size(); j++) { s += " (" + std::to_string(ovv[i][j].first) + "," + - std::to_string(ovv[i][j].second) + ")"; + std::to_string(ovv[i][j].second) + ")"; } gmsh::logger::write(s); } @@ -93,8 +92,7 @@ int main(int argc, char **argv) // directly, as the five spheres (volumes 4, 5, 6, 7 and 8), which will be // deleted by the fragment operations, will be recreated identically (albeit // with new surfaces) with the same tags.: - for(int i = 1; i <= 5; i++) - gmsh::model::addPhysicalGroup(3, {3 + i}, i); + for(int i = 1; i <= 5; i++) gmsh::model::addPhysicalGroup(3, {3 + i}, i); // The tag of the cube will change though, so we need to access it // programmatically: @@ -122,8 +120,8 @@ int main(int argc, char **argv) // Select the corner point by searching for it geometrically: double eps = 1e-3; - gmsh::model::getEntitiesInBoundingBox(0.5-eps, 0.5-eps, 0.5-eps, - 0.5+eps, 0.5+eps, 0.5+eps, ov, 0); + gmsh::model::getEntitiesInBoundingBox(0.5 - eps, 0.5 - eps, 0.5 - eps, + 0.5 + eps, 0.5 + eps, 0.5 + eps, ov, 0); gmsh::model::mesh::setSize(ov, lcar2); gmsh::model::mesh::generate(3); diff --git a/tutorial/c++/t17.cpp b/tutorial/c++/t17.cpp index adfdd97cc598f4160f7549c3e231cebb2fdbf024..ed7e5892110071bc5e190fcbf42a991e5ebf488b 100644 --- a/tutorial/c++/t17.cpp +++ b/tutorial/c++/t17.cpp @@ -31,8 +31,7 @@ int main(int argc, char **argv) // Merge a post-processing view containing the target anisotropic mesh sizes try { gmsh::merge("../t17_bgmesh.pos"); - } - catch(...) { + } catch(...) { gmsh::logger::write("Could not load background mesh: bye!"); gmsh::finalize(); return 0; diff --git a/tutorial/c++/t18.cpp b/tutorial/c++/t18.cpp index 71f09e6d03d28deca4e4fcd46706e5e08ade7878..03856c83e37bc8e3e4315ba09198119c6cb3573e 100644 --- a/tutorial/c++/t18.cpp +++ b/tutorial/c++/t18.cpp @@ -30,12 +30,13 @@ int main(int argc, char **argv) std::vector<std::pair<int, int> > out; gmsh::model::getEntities(out, 0); gmsh::model::mesh::setSize(out, 0.1); - gmsh::model::mesh::setSize({{0,1}}, 0.02); + gmsh::model::mesh::setSize({{0, 1}}, 0.02); // To impose that the mesh on surface 2 (the right side of the cube) should // match the mesh from surface 1 (the left side), the following periodicity // constraint is set: - std::vector<double> translation({1,0,0,1, 0,1,0,0, 0,0,1,0, 0,0,0,1}); + std::vector<double> translation( + {1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}); gmsh::model::mesh::setPeriodic(2, {2}, {1}, translation); // The periodicity transform is provided as a 4x4 affine transformation @@ -45,10 +46,10 @@ int main(int argc, char **argv) // the mesh from surface 1. // Multiple periodicities can be imposed in the same way: - gmsh::model::mesh::setPeriodic(2, {6}, {5}, - {1,0,0,0, 0,1,0,0, 0,0,1,1, 0,0,0,1}); - gmsh::model::mesh::setPeriodic(2, {4}, {3}, - {1,0,0,0, 0,1,0,1, 0,0,1,0, 0,0,0,1}); + gmsh::model::mesh::setPeriodic( + 2, {6}, {5}, {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1}); + gmsh::model::mesh::setPeriodic( + 2, {4}, {3}, {1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1}); // For more complicated cases, finding the corresponding surfaces by hand can // be tedious, especially when geometries are created through solid @@ -56,22 +57,22 @@ int main(int argc, char **argv) // We start with a cube and some spheres: gmsh::model::occ::addBox(2, 0, 0, 1, 1, 1, 10); - double x = 2-0.3, y = 0, z = 0; + double x = 2 - 0.3, y = 0, z = 0; gmsh::model::occ::addSphere(x, y, z, 0.35, 11); - gmsh::model::occ::addSphere(x+1, y, z, 0.35, 12); - gmsh::model::occ::addSphere(x, y+1, z, 0.35, 13); - gmsh::model::occ::addSphere(x, y, z+1, 0.35, 14); - gmsh::model::occ::addSphere(x+1, y+1, z, 0.35, 15); - gmsh::model::occ::addSphere(x, y+1, z+1, 0.35, 16); - gmsh::model::occ::addSphere(x+1, y, z+1, 0.35, 17); - gmsh::model::occ::addSphere(x+1, y+1, z+1, 0.35, 18); + gmsh::model::occ::addSphere(x + 1, y, z, 0.35, 12); + gmsh::model::occ::addSphere(x, y + 1, z, 0.35, 13); + gmsh::model::occ::addSphere(x, y, z + 1, 0.35, 14); + gmsh::model::occ::addSphere(x + 1, y + 1, z, 0.35, 15); + gmsh::model::occ::addSphere(x, y + 1, z + 1, 0.35, 16); + gmsh::model::occ::addSphere(x + 1, y, z + 1, 0.35, 17); + gmsh::model::occ::addSphere(x + 1, y + 1, z + 1, 0.35, 18); // We first fragment all the volumes, which will leave parts of spheres // protruding outside the cube: std::vector<std::vector<std::pair<int, int> > > out_map; std::vector<std::pair<int, int> > sph; for(int i = 11; i <= 18; i++) sph.push_back(std::pair<int, int>(3, i)); - gmsh::model::occ::fragment({{3,10}}, sph, out, out_map); + gmsh::model::occ::fragment({{3, 10}}, sph, out, out_map); gmsh::model::occ::synchronize(); // Ask OpenCASCADE to compute more accurate bounding boxes of entities using @@ -82,8 +83,8 @@ int main(int argc, char **argv) // and delete all the parts outside it: double eps = 1e-3; std::vector<std::pair<int, int> > in; - gmsh::model::getEntitiesInBoundingBox(2-eps,-eps,-eps, 2+1+eps,1+eps,1+eps, - in, 3); + gmsh::model::getEntitiesInBoundingBox(2 - eps, -eps, -eps, 2 + 1 + eps, + 1 + eps, 1 + eps, in, 3); for(auto it = in.begin(); it != in.end(); ++it) { auto it2 = std::find(out.begin(), out.end(), *it); if(it2 != out.end()) out.erase(it2); @@ -95,7 +96,7 @@ int main(int argc, char **argv) std::vector<std::pair<int, int> > p; gmsh::model::getBoundary(in, p, false, false, true); // Get all points gmsh::model::mesh::setSize(p, 0.1); - gmsh::model::getEntitiesInBoundingBox(2-eps, -eps, -eps, 2+eps, eps, eps, + gmsh::model::getEntitiesInBoundingBox(2 - eps, -eps, -eps, 2 + eps, eps, eps, p, 0); gmsh::model::mesh::setSize(p, 0.001); @@ -104,24 +105,24 @@ int main(int argc, char **argv) // First we get all surfaces on the left: std::vector<std::pair<int, int> > sxmin; - gmsh::model::getEntitiesInBoundingBox(2-eps, -eps, -eps, 2+eps, 1+eps, 1+eps, - sxmin, 2); + gmsh::model::getEntitiesInBoundingBox(2 - eps, -eps, -eps, 2 + eps, 1 + eps, + 1 + eps, sxmin, 2); for(std::size_t i = 0; i < sxmin.size(); i++) { // Then we get the bounding box of each left surface double xmin, ymin, zmin, xmax, ymax, zmax; - gmsh::model::getBoundingBox(sxmin[i].first, sxmin[i].second, - xmin, ymin, zmin, xmax, ymax, zmax); + gmsh::model::getBoundingBox(sxmin[i].first, sxmin[i].second, xmin, ymin, + zmin, xmax, ymax, zmax); // We translate the bounding box to the right and look for surfaces inside // it: std::vector<std::pair<int, int> > sxmax; - gmsh::model::getEntitiesInBoundingBox(xmin-eps+1, ymin-eps, zmin-eps, - xmax+eps+1, ymax+eps, zmax+eps, - sxmax, 2); + gmsh::model::getEntitiesInBoundingBox(xmin - eps + 1, ymin - eps, + zmin - eps, xmax + eps + 1, + ymax + eps, zmax + eps, sxmax, 2); // For all the matches, we compare the corresponding bounding boxes... for(std::size_t j = 0; j < sxmax.size(); j++) { double xmin2, ymin2, zmin2, xmax2, ymax2, zmax2; - gmsh::model::getBoundingBox(sxmax[j].first, sxmax[j].second, - xmin2, ymin2, zmin2, xmax2, ymax2, zmax2); + gmsh::model::getBoundingBox(sxmax[j].first, sxmax[j].second, xmin2, ymin2, + zmin2, xmax2, ymax2, zmax2); xmin2 -= 1; xmax2 -= 1; // ...and if they match, we apply the periodicity constraint diff --git a/tutorial/c++/t19.cpp b/tutorial/c++/t19.cpp index f05444c273dffc89df29e67a0dbe570e6868d2ac..1fceb49f438f82917a82eddfa4940ddc1d5d6f89 100644 --- a/tutorial/c++/t19.cpp +++ b/tutorial/c++/t19.cpp @@ -22,24 +22,24 @@ int main(int argc, char **argv) // Volumes can be constructed from (closed) curve loops thanks to the // `addThruSections()' function - gmsh::model::occ::addCircle(0,0,0, 0.5, 1); + gmsh::model::occ::addCircle(0, 0, 0, 0.5, 1); gmsh::model::occ::addCurveLoop({1}, 1); - gmsh::model::occ::addCircle(0.1,0.05,1, 0.1, 2); + gmsh::model::occ::addCircle(0.1, 0.05, 1, 0.1, 2); gmsh::model::occ::addCurveLoop({2}, 2); - gmsh::model::occ::addCircle(-0.1,-0.1,2, 0.3, 3); + gmsh::model::occ::addCircle(-0.1, -0.1, 2, 0.3, 3); gmsh::model::occ::addCurveLoop({3}, 3); std::vector<std::pair<int, int> > out; - gmsh::model::occ::addThruSections({1,2,3}, out, 1); + gmsh::model::occ::addThruSections({1, 2, 3}, out, 1); gmsh::model::occ::synchronize(); // We can also force the creation of ruled surfaces: - gmsh::model::occ::addCircle(2+0,0,0, 0.5, 11); + gmsh::model::occ::addCircle(2 + 0, 0, 0, 0.5, 11); gmsh::model::occ::addCurveLoop({11}, 11); - gmsh::model::occ::addCircle(2+0.1,0.05,1, 0.1, 12); + gmsh::model::occ::addCircle(2 + 0.1, 0.05, 1, 0.1, 12); gmsh::model::occ::addCurveLoop({12}, 12); - gmsh::model::occ::addCircle(2-0.1,-0.1,2, 0.3, 13); + gmsh::model::occ::addCircle(2 - 0.1, -0.1, 2, 0.3, 13); gmsh::model::occ::addCurveLoop({13}, 13); - gmsh::model::occ::addThruSections({11,12,13}, out, 11, true, true); + gmsh::model::occ::addThruSections({11, 12, 13}, out, 11, true, true); gmsh::model::occ::synchronize(); // We copy the first volume, and fillet all its edges: @@ -63,8 +63,8 @@ int main(int argc, char **argv) double h = 1 * nturns; std::vector<int> p; for(int i = 0; i < npts; i++) { - double theta = i * 2*M_PI*nturns/npts; - gmsh::model::occ::addPoint(r * cos(theta), r * sin(theta), i * h/npts, 1, + double theta = i * 2 * M_PI * nturns / npts; + gmsh::model::occ::addPoint(r * cos(theta), r * sin(theta), i * h / npts, 1, 1000 + i); p.push_back(1000 + i); } @@ -74,11 +74,11 @@ int main(int argc, char **argv) gmsh::model::occ::addWire({1000}, 1000); // We define the shape we would like to extrude along the spline (a disk): - gmsh::model::occ::addDisk(1,0,0, 0.2, 0.2, 1000); - gmsh::model::occ::rotate({{2,1000}}, 0, 0, 0, 1, 0, 0, M_PI/2); + gmsh::model::occ::addDisk(1, 0, 0, 0.2, 0.2, 1000); + gmsh::model::occ::rotate({{2, 1000}}, 0, 0, 0, 1, 0, 0, M_PI / 2); // We extrude the disk along the spline to create a pipe: - gmsh::model::occ::addPipe({{2,1000}}, 1000, out); + gmsh::model::occ::addPipe({{2, 1000}}, 1000, out); // We delete the source surface, and increase the number of sub-edges for a // nicer display of the geometry: diff --git a/tutorial/c++/t2.cpp b/tutorial/c++/t2.cpp index e2a7e90c5c789332e2ac84b38080f85fdd9fe7dc..e115580619bbfd9de08badfbf68d93a52fb050b7 100644 --- a/tutorial/c++/t2.cpp +++ b/tutorial/c++/t2.cpp @@ -22,9 +22,9 @@ int main(int argc, char **argv) // Copied from t1.cpp... double lc = 1e-2; gmsh::model::geo::addPoint(0, 0, 0, lc, 1); - gmsh::model::geo::addPoint(.1, 0, 0, lc, 2); + gmsh::model::geo::addPoint(.1, 0, 0, lc, 2); gmsh::model::geo::addPoint(.1, .3, 0, lc, 3); - gmsh::model::geo::addPoint(0, .3, 0, lc, 4); + gmsh::model::geo::addPoint(0, .3, 0, lc, 4); gmsh::model::geo::addLine(1, 2, 1); gmsh::model::geo::addLine(3, 2, 2); gmsh::model::geo::addLine(3, 4, 3); @@ -50,7 +50,7 @@ int main(int argc, char **argv) // And it can be further rotated by -Pi/4 around (0, 0.3, 0) (with the // rotation along the z axis) with: - gmsh::model::geo::rotate({{0, 5}}, 0,0.3,0, 0,0,1, -M_PI/4); + gmsh::model::geo::rotate({{0, 5}}, 0, 0.3, 0, 0, 0, 1, -M_PI / 4); // Note that there are no units in Gmsh: coordinates are just numbers - it's // up to the user to associate a meaning to them. @@ -66,7 +66,7 @@ int main(int argc, char **argv) // new lines: gmsh::model::geo::addLine(3, ov[0].second, 7); gmsh::model::geo::addLine(ov[0].second, 5, 8); - gmsh::model::geo::addCurveLoop({5,-8,-7,3}, 10); + gmsh::model::geo::addCurveLoop({5, -8, -7, 3}, 10); gmsh::model::geo::addPlaneSurface({10}, 11); // In the same way, we can translate copies of the two surfaces 1 and 11 to @@ -126,8 +126,9 @@ int main(int argc, char **argv) // Mesh sizes associated to geometrical points can be set by passing a vector // of (dim, tag) pairs for the corresponding points: - gmsh::model::geo::mesh::setSize({{0,103}, {0,105}, {0,109}, {0,102}, {0,28}, - {0, 24}, {0,6}, {0,5}}, lc * 3); + gmsh::model::geo::mesh::setSize( + {{0, 103}, {0, 105}, {0, 109}, {0, 102}, {0, 28}, {0, 24}, {0, 6}, {0, 5}}, + lc * 3); // We finally group volumes 129 and 130 in a single physical group with tag // `1' and name "The volume": @@ -141,8 +142,8 @@ int main(int argc, char **argv) gmsh::write("t2.msh"); // Note that, if the transformation tools are handy to create complex - // geometries, it is also sometimes useful to generate the `flat' geometry, with - // an explicit representation of all the elementary entities. + // geometries, it is also sometimes useful to generate the `flat' geometry, + // with an explicit representation of all the elementary entities. // // With the built-in geometry kernel, this can be achieved by saving the model // in the `Gmsh Unrolled GEO' format: diff --git a/tutorial/c++/t20.cpp b/tutorial/c++/t20.cpp index 2022bdf50f6a8196b00445f0ae76ff8e9185c8ef..e5f61cbb2971979ff6114e9a46a83be9280dd719 100644 --- a/tutorial/c++/t20.cpp +++ b/tutorial/c++/t20.cpp @@ -27,8 +27,7 @@ int main(int argc, char **argv) std::vector<std::pair<int, int> > v; try { gmsh::model::occ::importShapes("../t20_data.step", v); - } - catch(...) { + } catch(...) { gmsh::logger::write("Could not load STEP file: bye!"); gmsh::finalize(); return 0; @@ -44,8 +43,8 @@ int main(int argc, char **argv) // Get the bounding box of the volume: gmsh::model::occ::synchronize(); double xmin, ymin, zmin, xmax, ymax, zmax; - gmsh::model::getBoundingBox(v[0].first, v[0].second, xmin, ymin, zmin, - xmax, ymax, zmax); + gmsh::model::getBoundingBox(v[0].first, v[0].second, xmin, ymin, zmin, xmax, + ymax, zmax); // Note that the synchronization step can be avoided in Gmsh >= 4.6 by using // `gmsh::model::occ::getBoundingBox()' instead of @@ -61,9 +60,8 @@ int main(int argc, char **argv) // Define the cutting planes for(int i = 1; i < N; i++) - gmsh::model::occ::addRectangle(xmin, ymin, zmin + i * dz, - xmax-xmin, ymax-ymin, - 1000 + i); + gmsh::model::occ::addRectangle(xmin, ymin, zmin + i * dz, xmax - xmin, + ymax - ymin, 1000 + i); // Fragment (i.e. intersect) the volume with all the cutting planes: std::vector<std::pair<int, int> > p; @@ -95,9 +93,9 @@ int main(int argc, char **argv) std::vector<std::pair<int, int> > s; for(int i = 1; i < N; i++) { std::vector<std::pair<int, int> > e; - gmsh::model::getEntitiesInBoundingBox - (xmin-eps,ymin-eps,zmin + i * dz - eps, - xmax+eps,ymax+eps,zmin + i * dz + eps, e, 2); + gmsh::model::getEntitiesInBoundingBox( + xmin - eps, ymin - eps, zmin + i * dz - eps, xmax + eps, ymax + eps, + zmin + i * dz + eps, e, 2); s.insert(s.end(), e.begin(), e.end()); } // ...and remove all the other entities (here directly in the model, as we diff --git a/tutorial/c++/t21.cpp b/tutorial/c++/t21.cpp index 229604b3f04866b74ef0f244e9c486c5e7e6d976..ed17d836088d08988a09c60c5c6524545752208d 100644 --- a/tutorial/c++/t21.cpp +++ b/tutorial/c++/t21.cpp @@ -41,7 +41,7 @@ int main(int argc, char **argv) gmsh::model::occ::addRectangle(1, 0, 0, 1, 1, 2); std::vector<std::pair<int, int> > ov; std::vector<std::vector<std::pair<int, int> > > ovv; - gmsh::model::occ::fragment({{2,1}}, {{2,2}}, ov, ovv); + gmsh::model::occ::fragment({{2, 1}}, {{2, 2}}, ov, ovv); gmsh::model::occ::synchronize(); std::vector<std::pair<int, int> > tmp; gmsh::model::getEntities(tmp, 0); @@ -55,7 +55,8 @@ int main(int argc, char **argv) gmsh::model::setPhysicalName(2, 200, "Right"); gmsh::model::mesh::generate(2); - // We now define several constants to fine-tune how the mesh will be partitioned + // We now define several constants to fine-tune how the mesh will be + // partitioned int partitioner = 0; // 0 for Metis, 1 for SimplePartition int N = 3; // Number of partitions int topology = 1; // Create partition topology (BRep)? @@ -98,8 +99,7 @@ int main(int argc, char **argv) } // Save mesh file (or files, if `Mesh.PartitionSplitMeshFiles' is set): - if(write) - gmsh::write("t21.msh"); + if(write) gmsh::write("t21.msh"); // Iterate over partitioned entities and print some info (see the first // extended tutorial `x1.cpp' for additional information): diff --git a/tutorial/c++/t3.cpp b/tutorial/c++/t3.cpp index c5877bdaa6761a3ef106f8c19d13a77713c45b20..727cedd8bc8b1f300ec4b97707a39b435ae11cf1 100644 --- a/tutorial/c++/t3.cpp +++ b/tutorial/c++/t3.cpp @@ -19,9 +19,9 @@ int main(int argc, char **argv) // Copied from t1.cpp... double lc = 1e-2; gmsh::model::geo::addPoint(0, 0, 0, lc, 1); - gmsh::model::geo::addPoint(.1, 0, 0, lc, 2); + gmsh::model::geo::addPoint(.1, 0, 0, lc, 2); gmsh::model::geo::addPoint(.1, .3, 0, lc, 3); - gmsh::model::geo::addPoint(0, .3, 0, lc, 4); + gmsh::model::geo::addPoint(0, .3, 0, lc, 4); gmsh::model::geo::addLine(1, 2, 1); gmsh::model::geo::addLine(3, 2, 2); gmsh::model::geo::addLine(3, 4, 3); @@ -42,14 +42,15 @@ int main(int argc, char **argv) double h = 0.1, angle = 90.; std::vector<std::pair<int, int> > ov; - gmsh::model::geo::extrude({{2,1}}, 0, 0, h, ov, {8,2}, {0.5,1}); + gmsh::model::geo::extrude({{2, 1}}, 0, 0, h, ov, {8, 2}, {0.5, 1}); // The extrusion can also be performed with a rotation instead of a // translation, and the resulting mesh can be recombined into prisms (we use // only one layer here, with 7 subdivisions). All rotations are specified by // an an axis point (-0.1, 0, 0.1), an axis direction (0, 1, 0), and a // rotation angle (-Pi/2): - gmsh::model::geo::revolve({{2,28}}, -0.1,0,0.1, 0,1,0, -M_PI/2, ov, {7}); + gmsh::model::geo::revolve({{2, 28}}, -0.1, 0, 0.1, 0, 1, 0, -M_PI / 2, ov, + {7}); // Using the built-in geometry kernel, only rotations with angles < Pi are // supported. To do a full turn, you will thus need to apply at least 3 @@ -59,8 +60,8 @@ int main(int argc, char **argv) // can also be combined to form a "twist". The last (optional) argument for // the extrude() and twist() functions specifies whether the extruded mesh // should be recombined or not. - gmsh::model::geo::twist({{2,50}}, 0,0.15,0.25, -2*h,0,0, 1,0,0, - angle*M_PI/180., ov, {10}, {}, true); + gmsh::model::geo::twist({{2, 50}}, 0, 0.15, 0.25, -2 * h, 0, 0, 1, 0, 0, + angle * M_PI / 180., ov, {10}, {}, true); gmsh::model::geo::synchronize(); diff --git a/tutorial/c++/t4.cpp b/tutorial/c++/t4.cpp index 6e98192009c13577da71821c025e963704e7c560..5a72853369cfd953f9d6144994c026efcc8985c7 100644 --- a/tutorial/c++/t4.cpp +++ b/tutorial/c++/t4.cpp @@ -9,7 +9,7 @@ #include <math.h> #include <gmsh.h> -double hypoth(double a, double b){ return sqrt(a * a + b * b); } +double hypoth(double a, double b) { return sqrt(a * a + b * b); } int main(int argc, char **argv) { @@ -19,89 +19,90 @@ int main(int argc, char **argv) gmsh::model::add("t4"); double cm = 1e-02; - double e1 = 4.5 * cm, e2 = 6 * cm / 2, e3 = 5 * cm / 2; + double e1 = 4.5 * cm, e2 = 6 * cm / 2, e3 = 5 * cm / 2; double h1 = 5 * cm, h2 = 10 * cm, h3 = 5 * cm, h4 = 2 * cm, h5 = 4.5 * cm; double R1 = 1 * cm, R2 = 1.5 * cm, r = 1 * cm; double Lc1 = 0.01; double Lc2 = 0.003; - double ccos = (-h5*R1 + e2 * hypot(h5, hypot(e2, R1))) / (h5*h5 + e2*e2); - double ssin = sqrt(1 - ccos*ccos); + double ccos = + (-h5 * R1 + e2 * hypot(h5, hypot(e2, R1))) / (h5 * h5 + e2 * e2); + double ssin = sqrt(1 - ccos * ccos); // We start by defining some points and some lines. To make the code shorter // we can redefine a namespace: namespace factory = gmsh::model::geo; - factory::addPoint(-e1-e2, 0 , 0, Lc1, 1); - factory::addPoint(-e1-e2, h1 , 0, Lc1, 2); - factory::addPoint(-e3-r , h1 , 0, Lc2, 3); - factory::addPoint(-e3-r , h1+r , 0, Lc2, 4); - factory::addPoint(-e3 , h1+r , 0, Lc2, 5); - factory::addPoint(-e3 , h1+h2, 0, Lc1, 6); - factory::addPoint( e3 , h1+h2, 0, Lc1, 7); - factory::addPoint( e3 , h1+r , 0, Lc2, 8); - factory::addPoint( e3+r , h1+r , 0, Lc2, 9); - factory::addPoint( e3+r , h1 , 0, Lc2, 10); - factory::addPoint( e1+e2, h1 , 0, Lc1, 11); - factory::addPoint( e1+e2, 0 , 0, Lc1, 12); - factory::addPoint( e2 , 0 , 0, Lc1, 13); - - factory::addPoint( R1 / ssin, h5+R1*ccos, 0, Lc2, 14); - factory::addPoint( 0 , h5 , 0, Lc2, 15); - factory::addPoint(-R1 / ssin, h5+R1*ccos, 0, Lc2, 16); - factory::addPoint(-e2 , 0.0 , 0, Lc1, 17); - - factory::addPoint(-R2 , h1+h3 , 0, Lc2, 18); - factory::addPoint(-R2 , h1+h3+h4, 0, Lc2, 19); - factory::addPoint( 0 , h1+h3+h4, 0, Lc2, 20); - factory::addPoint( R2 , h1+h3+h4, 0, Lc2, 21); - factory::addPoint( R2 , h1+h3 , 0, Lc2, 22); - factory::addPoint( 0 , h1+h3 , 0, Lc2, 23); - - factory::addPoint(0, h1+h3+h4+R2, 0, Lc2, 24); - factory::addPoint(0, h1+h3-R2, 0, Lc2, 25); - - factory::addLine(1 , 17, 1); + factory::addPoint(-e1 - e2, 0, 0, Lc1, 1); + factory::addPoint(-e1 - e2, h1, 0, Lc1, 2); + factory::addPoint(-e3 - r, h1, 0, Lc2, 3); + factory::addPoint(-e3 - r, h1 + r, 0, Lc2, 4); + factory::addPoint(-e3, h1 + r, 0, Lc2, 5); + factory::addPoint(-e3, h1 + h2, 0, Lc1, 6); + factory::addPoint(e3, h1 + h2, 0, Lc1, 7); + factory::addPoint(e3, h1 + r, 0, Lc2, 8); + factory::addPoint(e3 + r, h1 + r, 0, Lc2, 9); + factory::addPoint(e3 + r, h1, 0, Lc2, 10); + factory::addPoint(e1 + e2, h1, 0, Lc1, 11); + factory::addPoint(e1 + e2, 0, 0, Lc1, 12); + factory::addPoint(e2, 0, 0, Lc1, 13); + + factory::addPoint(R1 / ssin, h5 + R1 * ccos, 0, Lc2, 14); + factory::addPoint(0, h5, 0, Lc2, 15); + factory::addPoint(-R1 / ssin, h5 + R1 * ccos, 0, Lc2, 16); + factory::addPoint(-e2, 0.0, 0, Lc1, 17); + + factory::addPoint(-R2, h1 + h3, 0, Lc2, 18); + factory::addPoint(-R2, h1 + h3 + h4, 0, Lc2, 19); + factory::addPoint(0, h1 + h3 + h4, 0, Lc2, 20); + factory::addPoint(R2, h1 + h3 + h4, 0, Lc2, 21); + factory::addPoint(R2, h1 + h3, 0, Lc2, 22); + factory::addPoint(0, h1 + h3, 0, Lc2, 23); + + factory::addPoint(0, h1 + h3 + h4 + R2, 0, Lc2, 24); + factory::addPoint(0, h1 + h3 - R2, 0, Lc2, 25); + + factory::addLine(1, 17, 1); factory::addLine(17, 16, 2); // Gmsh provides other curve primitives than straight lines: splines, // B-splines, circle arcs, ellipse arcs, etc. Here we define a new circle arc, // starting at point 14 and ending at point 16, with the circle's center being // the point 15: - factory::addCircleArc(14,15,16, 3); + factory::addCircleArc(14, 15, 16, 3); // Note that, in Gmsh, circle arcs should always be smaller than Pi. The // OpenCASCADE geometry kernel does not have this limitation. // We can then define additional lines and circles, as well as a new surface: - factory::addLine(14,13, 4); - factory::addLine(13,12, 5); - factory::addLine(12,11, 6); - factory::addLine(11,10, 7); - factory::addCircleArc(8,9,10, 8); - factory::addLine(8,7, 9); - factory::addLine(7,6, 10); - factory::addLine(6,5, 11); - factory::addCircleArc(3,4,5, 12); - factory::addLine(3,2, 13); - factory::addLine(2,1, 14); - factory::addLine(18,19, 15); - factory::addCircleArc(21,20,24, 16); - factory::addCircleArc(24,20,19, 17); - factory::addCircleArc(18,23,25, 18); - factory::addCircleArc(25,23,22, 19); - factory::addLine(21,22, 20); - - factory::addCurveLoop({17,-15,18,19,-20,16}, 21); + factory::addLine(14, 13, 4); + factory::addLine(13, 12, 5); + factory::addLine(12, 11, 6); + factory::addLine(11, 10, 7); + factory::addCircleArc(8, 9, 10, 8); + factory::addLine(8, 7, 9); + factory::addLine(7, 6, 10); + factory::addLine(6, 5, 11); + factory::addCircleArc(3, 4, 5, 12); + factory::addLine(3, 2, 13); + factory::addLine(2, 1, 14); + factory::addLine(18, 19, 15); + factory::addCircleArc(21, 20, 24, 16); + factory::addCircleArc(24, 20, 19, 17); + factory::addCircleArc(18, 23, 25, 18); + factory::addCircleArc(25, 23, 22, 19); + factory::addLine(21, 22, 20); + + factory::addCurveLoop({17, -15, 18, 19, -20, 16}, 21); factory::addPlaneSurface({21}, 22); // But we still need to define the exterior surface. Since this surface has a // hole, its definition now requires two curves loops: - factory::addCurveLoop({11,-12,13,14,1,2,-3,4,5,6,7,-8,9,10}, 23); - factory::addPlaneSurface({23,21}, 24); + factory::addCurveLoop({11, -12, 13, 14, 1, 2, -3, 4, 5, 6, 7, -8, 9, 10}, 23); + factory::addPlaneSurface({23, 21}, 24); - // As a general rule, if a surface has N holes, it is defined by N+1 curve loops: - // the first loop defines the exterior boundary; the other loops define the - // boundaries of the holes. + // As a general rule, if a surface has N holes, it is defined by N+1 curve + // loops: the first loop defines the exterior boundary; the other loops define + // the boundaries of the holes. factory::synchronize(); @@ -123,9 +124,8 @@ int main(int argc, char **argv) // after a `@' symbol in the form `widthxheight' (if one of `width' or // `height' is zero, natural scaling is used; if both are zero, original image // dimensions in pixels are used): - gmsh::view::addListDataString(v, {0, 0.09, 0}, - {"file://../t4_image.png@0.01x0"}, - {"Align", "Center"}); + gmsh::view::addListDataString( + v, {0, 0.09, 0}, {"file://../t4_image.png@0.01x0"}, {"Align", "Center"}); // The 3D orientation of the image can be specified by proving the direction // of the bottom and left edge of the image in model space: @@ -134,9 +134,8 @@ int main(int argc, char **argv) // The image can also be drawn in "billboard" mode, i.e. always parallel to // the camera, by using the `#' symbol: - gmsh::view::addListDataString(v, {0, 0.12, 0}, - {"file://../t4_image.png@0.01x0#"}, - {"Align", "Center"}); + gmsh::view::addListDataString( + v, {0, 0.12, 0}, {"file://../t4_image.png@0.01x0#"}, {"Align", "Center"}); // The size of 2D annotations is given directly in pixels: gmsh::view::addListDataString(v, {150, -7}, {"file://../t4_image.png@20x0"}); diff --git a/tutorial/c++/t5.cpp b/tutorial/c++/t5.cpp index 30753b1137732568cd05155939a947a03c285f2d..b9a55c73d03a492cac94a6c561aca776e6551bf1 100644 --- a/tutorial/c++/t5.cpp +++ b/tutorial/c++/t5.cpp @@ -15,35 +15,35 @@ void cheeseHole(double x, double y, double z, double r, double lc, // This function will create a spherical hole in a volume. We don't specify // tags manually, and let the functions return them automatically: - int p1 = gmsh::model::geo::addPoint(x, y, z, lc); - int p2 = gmsh::model::geo::addPoint(x+r,y, z, lc); - int p3 = gmsh::model::geo::addPoint(x, y+r,z, lc); - int p4 = gmsh::model::geo::addPoint(x, y, z+r, lc); - int p5 = gmsh::model::geo::addPoint(x-r,y, z, lc); - int p6 = gmsh::model::geo::addPoint(x, y-r,z, lc); - int p7 = gmsh::model::geo::addPoint(x, y, z-r, lc); - - int c1 = gmsh::model::geo::addCircleArc(p2,p1,p7); - int c2 = gmsh::model::geo::addCircleArc(p7,p1,p5); - int c3 = gmsh::model::geo::addCircleArc(p5,p1,p4); - int c4 = gmsh::model::geo::addCircleArc(p4,p1,p2); - int c5 = gmsh::model::geo::addCircleArc(p2,p1,p3); - int c6 = gmsh::model::geo::addCircleArc(p3,p1,p5); - int c7 = gmsh::model::geo::addCircleArc(p5,p1,p6); - int c8 = gmsh::model::geo::addCircleArc(p6,p1,p2); - int c9 = gmsh::model::geo::addCircleArc(p7,p1,p3); - int c10 = gmsh::model::geo::addCircleArc(p3,p1,p4); - int c11 = gmsh::model::geo::addCircleArc(p4,p1,p6); - int c12 = gmsh::model::geo::addCircleArc(p6,p1,p7); - - int l1 = gmsh::model::geo::addCurveLoop({c5,c10,c4}); - int l2 = gmsh::model::geo::addCurveLoop({c9,-c5,c1}); - int l3 = gmsh::model::geo::addCurveLoop({c12,-c8,-c1}); - int l4 = gmsh::model::geo::addCurveLoop({c8,-c4,c11}); - int l5 = gmsh::model::geo::addCurveLoop({-c10,c6,c3}); - int l6 = gmsh::model::geo::addCurveLoop({-c11,-c3,c7}); - int l7 = gmsh::model::geo::addCurveLoop({-c2,-c7,-c12}); - int l8 = gmsh::model::geo::addCurveLoop({-c6,-c9,c2}); + int p1 = gmsh::model::geo::addPoint(x, y, z, lc); + int p2 = gmsh::model::geo::addPoint(x + r, y, z, lc); + int p3 = gmsh::model::geo::addPoint(x, y + r, z, lc); + int p4 = gmsh::model::geo::addPoint(x, y, z + r, lc); + int p5 = gmsh::model::geo::addPoint(x - r, y, z, lc); + int p6 = gmsh::model::geo::addPoint(x, y - r, z, lc); + int p7 = gmsh::model::geo::addPoint(x, y, z - r, lc); + + int c1 = gmsh::model::geo::addCircleArc(p2, p1, p7); + int c2 = gmsh::model::geo::addCircleArc(p7, p1, p5); + int c3 = gmsh::model::geo::addCircleArc(p5, p1, p4); + int c4 = gmsh::model::geo::addCircleArc(p4, p1, p2); + int c5 = gmsh::model::geo::addCircleArc(p2, p1, p3); + int c6 = gmsh::model::geo::addCircleArc(p3, p1, p5); + int c7 = gmsh::model::geo::addCircleArc(p5, p1, p6); + int c8 = gmsh::model::geo::addCircleArc(p6, p1, p2); + int c9 = gmsh::model::geo::addCircleArc(p7, p1, p3); + int c10 = gmsh::model::geo::addCircleArc(p3, p1, p4); + int c11 = gmsh::model::geo::addCircleArc(p4, p1, p6); + int c12 = gmsh::model::geo::addCircleArc(p6, p1, p7); + + int l1 = gmsh::model::geo::addCurveLoop({c5, c10, c4}); + int l2 = gmsh::model::geo::addCurveLoop({c9, -c5, c1}); + int l3 = gmsh::model::geo::addCurveLoop({c12, -c8, -c1}); + int l4 = gmsh::model::geo::addCurveLoop({c8, -c4, c11}); + int l5 = gmsh::model::geo::addCurveLoop({-c10, c6, c3}); + int l6 = gmsh::model::geo::addCurveLoop({-c11, -c3, c7}); + int l7 = gmsh::model::geo::addCurveLoop({-c2, -c7, -c12}); + int l8 = gmsh::model::geo::addCurveLoop({-c6, -c9, c2}); // We need non-plane surfaces to define the spherical holes. Here we use the // `gmsh::model::geo::addSurfaceFilling()' function, which can be used for @@ -104,74 +104,76 @@ int main(int argc, char **argv) // // See `t10.cpp' for more information about mesh sizes. - // We proceed by defining some elementary entities describing a truncated cube: - - gmsh::model::geo::addPoint(0.5,0.5,0.5, lcar2, 1); - gmsh::model::geo::addPoint(0.5,0.5,0, lcar1, 2); - gmsh::model::geo::addPoint(0,0.5,0.5, lcar1, 3); - gmsh::model::geo::addPoint(0,0,0.5, lcar1, 4); - gmsh::model::geo::addPoint(0.5,0,0.5, lcar1, 5); - gmsh::model::geo::addPoint(0.5,0,0, lcar1, 6); - gmsh::model::geo::addPoint(0,0.5,0, lcar1, 7); - gmsh::model::geo::addPoint(0,1,0, lcar1, 8); - gmsh::model::geo::addPoint(1,1,0, lcar1, 9); - gmsh::model::geo::addPoint(0,0,1, lcar1, 10); - gmsh::model::geo::addPoint(0,1,1, lcar1, 11); - gmsh::model::geo::addPoint(1,1,1, lcar1, 12); - gmsh::model::geo::addPoint(1,0,1, lcar1, 13); - gmsh::model::geo::addPoint(1,0,0, lcar1, 14); - - gmsh::model::geo::addLine(8,9, 1); - gmsh::model::geo::addLine(9,12, 2); - gmsh::model::geo::addLine(12,11, 3); - gmsh::model::geo::addLine(11,8, 4); - gmsh::model::geo::addLine(9,14, 5); - gmsh::model::geo::addLine(14,13, 6); - gmsh::model::geo::addLine(13,12, 7); - gmsh::model::geo::addLine(11,10, 8); - gmsh::model::geo::addLine(10,13, 9); - gmsh::model::geo::addLine(10,4, 10); - gmsh::model::geo::addLine(4,5, 11); - gmsh::model::geo::addLine(5,6, 12); - gmsh::model::geo::addLine(6,2, 13); - gmsh::model::geo::addLine(2,1, 14); - gmsh::model::geo::addLine(1,3, 15); - gmsh::model::geo::addLine(3,7, 16); - gmsh::model::geo::addLine(7,2, 17); - gmsh::model::geo::addLine(3,4, 18); - gmsh::model::geo::addLine(5,1, 19); - gmsh::model::geo::addLine(7,8, 20); - gmsh::model::geo::addLine(6,14, 21); - - gmsh::model::geo::addCurveLoop({-11,-19,-15,-18}, 22); + // We proceed by defining some elementary entities describing a truncated + // cube: + + gmsh::model::geo::addPoint(0.5, 0.5, 0.5, lcar2, 1); + gmsh::model::geo::addPoint(0.5, 0.5, 0, lcar1, 2); + gmsh::model::geo::addPoint(0, 0.5, 0.5, lcar1, 3); + gmsh::model::geo::addPoint(0, 0, 0.5, lcar1, 4); + gmsh::model::geo::addPoint(0.5, 0, 0.5, lcar1, 5); + gmsh::model::geo::addPoint(0.5, 0, 0, lcar1, 6); + gmsh::model::geo::addPoint(0, 0.5, 0, lcar1, 7); + gmsh::model::geo::addPoint(0, 1, 0, lcar1, 8); + gmsh::model::geo::addPoint(1, 1, 0, lcar1, 9); + gmsh::model::geo::addPoint(0, 0, 1, lcar1, 10); + gmsh::model::geo::addPoint(0, 1, 1, lcar1, 11); + gmsh::model::geo::addPoint(1, 1, 1, lcar1, 12); + gmsh::model::geo::addPoint(1, 0, 1, lcar1, 13); + gmsh::model::geo::addPoint(1, 0, 0, lcar1, 14); + + gmsh::model::geo::addLine(8, 9, 1); + gmsh::model::geo::addLine(9, 12, 2); + gmsh::model::geo::addLine(12, 11, 3); + gmsh::model::geo::addLine(11, 8, 4); + gmsh::model::geo::addLine(9, 14, 5); + gmsh::model::geo::addLine(14, 13, 6); + gmsh::model::geo::addLine(13, 12, 7); + gmsh::model::geo::addLine(11, 10, 8); + gmsh::model::geo::addLine(10, 13, 9); + gmsh::model::geo::addLine(10, 4, 10); + gmsh::model::geo::addLine(4, 5, 11); + gmsh::model::geo::addLine(5, 6, 12); + gmsh::model::geo::addLine(6, 2, 13); + gmsh::model::geo::addLine(2, 1, 14); + gmsh::model::geo::addLine(1, 3, 15); + gmsh::model::geo::addLine(3, 7, 16); + gmsh::model::geo::addLine(7, 2, 17); + gmsh::model::geo::addLine(3, 4, 18); + gmsh::model::geo::addLine(5, 1, 19); + gmsh::model::geo::addLine(7, 8, 20); + gmsh::model::geo::addLine(6, 14, 21); + + gmsh::model::geo::addCurveLoop({-11, -19, -15, -18}, 22); gmsh::model::geo::addPlaneSurface({22}, 23); - gmsh::model::geo::addCurveLoop({16,17,14,15}, 24); + gmsh::model::geo::addCurveLoop({16, 17, 14, 15}, 24); gmsh::model::geo::addPlaneSurface({24}, 25); - gmsh::model::geo::addCurveLoop({-17,20,1,5,-21,13}, 26); + gmsh::model::geo::addCurveLoop({-17, 20, 1, 5, -21, 13}, 26); gmsh::model::geo::addPlaneSurface({26}, 27); - gmsh::model::geo::addCurveLoop({-4,-1,-2,-3}, 28); + gmsh::model::geo::addCurveLoop({-4, -1, -2, -3}, 28); gmsh::model::geo::addPlaneSurface({28}, 29); - gmsh::model::geo::addCurveLoop({-7,2,-5,-6}, 30); + gmsh::model::geo::addCurveLoop({-7, 2, -5, -6}, 30); gmsh::model::geo::addPlaneSurface({30}, 31); - gmsh::model::geo::addCurveLoop({6,-9,10,11,12,21}, 32); + gmsh::model::geo::addCurveLoop({6, -9, 10, 11, 12, 21}, 32); gmsh::model::geo::addPlaneSurface({32}, 33); - gmsh::model::geo::addCurveLoop({7,3,8,9}, 34); + gmsh::model::geo::addCurveLoop({7, 3, 8, 9}, 34); gmsh::model::geo::addPlaneSurface({34}, 35); - gmsh::model::geo::addCurveLoop({-10,18,-16,-20,4,-8}, 36); + gmsh::model::geo::addCurveLoop({-10, 18, -16, -20, 4, -8}, 36); gmsh::model::geo::addPlaneSurface({36}, 37); - gmsh::model::geo::addCurveLoop({-14,-13,-12,19}, 38); + gmsh::model::geo::addCurveLoop({-14, -13, -12, 19}, 38); gmsh::model::geo::addPlaneSurface({38}, 39); std::vector<int> shells, volumes; - int sl = gmsh::model::geo::addSurfaceLoop({35,31,29,37,33,23,39,25,27}); + int sl = + gmsh::model::geo::addSurfaceLoop({35, 31, 29, 37, 33, 23, 39, 25, 27}); shells.push_back(sl); // We create five holes in the cube: - double x = 0, y = 0.75, z = 0, r = 0.09 ; - for(int t = 1; t <= 5; t++){ - x += 0.166 ; - z += 0.166 ; + double x = 0, y = 0.75, z = 0, r = 0.09; + for(int t = 1; t <= 5; t++) { + x += 0.166; + z += 0.166; cheeseHole(x, y, z, r, lcar3, shells, volumes); gmsh::model::addPhysicalGroup(3, {volumes.back()}, t); std::printf("Hole %d (center = {%g,%g,%g}, radius = %g) has number %d!\n", @@ -201,8 +203,10 @@ int main(int argc, char **argv) // gmsh::option::setNumber("Mesh.MeshOnlyVisible", 1); // Meshing algorithms can changed globally using options: - gmsh::option::setNumber("Mesh.Algorithm", 6); // 2D algorithm set to Frontal-Delaunay - gmsh::option::setNumber("Mesh.Algorithm3D", 1); // 3D algorithm set to Delaunay + gmsh::option::setNumber("Mesh.Algorithm", + 6); // 2D algorithm set to Frontal-Delaunay + gmsh::option::setNumber("Mesh.Algorithm3D", + 1); // 3D algorithm set to Delaunay // They can also be set for individual surfaces, e.g. for using `MeshAdapt' on // surface 1: diff --git a/tutorial/c++/t6.cpp b/tutorial/c++/t6.cpp index 723eecdd54aced12a1157ec493efe32572cfb9fb..bc19ac033bc3148b88ed910c6d2f47026de0c952 100644 --- a/tutorial/c++/t6.cpp +++ b/tutorial/c++/t6.cpp @@ -18,9 +18,9 @@ int main(int argc, char **argv) // Copied from t1.cpp... double lc = 1e-2; gmsh::model::geo::addPoint(0, 0, 0, lc, 1); - gmsh::model::geo::addPoint(.1, 0, 0, lc, 2); + gmsh::model::geo::addPoint(.1, 0, 0, lc, 2); gmsh::model::geo::addPoint(.1, .3, 0, lc, 3); - gmsh::model::geo::addPoint(0, .3, 0, lc, 4); + gmsh::model::geo::addPoint(0, .3, 0, lc, 4); gmsh::model::geo::addLine(1, 2, 1); gmsh::model::geo::addLine(3, 2, 2); gmsh::model::geo::addLine(3, 4, 3); @@ -29,7 +29,7 @@ int main(int argc, char **argv) gmsh::model::geo::addPlaneSurface({1}, 1); // Delete the surface and the left line, and replace the line with 3 new ones: - gmsh::model::geo::remove({{2,1}, {1,4}}); + gmsh::model::geo::remove({{2, 1}, {1, 4}}); int p1 = gmsh::model::geo::addPoint(-0.05, 0.05, 0, lc); int p2 = gmsh::model::geo::addPoint(-0.05, 0.1, 0, lc); @@ -64,7 +64,7 @@ int main(int argc, char **argv) // the nodes on the boundary using a structured grid. If the surface has more // than 4 corner points, the corners of the transfinite interpolation have to // be specified by hand: - gmsh::model::geo::mesh::setTransfiniteSurface(1, "Left", {1,2,3,4}); + gmsh::model::geo::mesh::setTransfiniteSurface(1, "Left", {1, 2, 3, 4}); // To create quadrangles instead of triangles, one can use the `setRecombine' // constraint: diff --git a/tutorial/c++/t7.cpp b/tutorial/c++/t7.cpp index 146d19f2ff727dc065cf1064bb5de4bda382254f..3a4ea0614896243af6415e4acdaf149bb6ff76ae 100644 --- a/tutorial/c++/t7.cpp +++ b/tutorial/c++/t7.cpp @@ -21,9 +21,9 @@ int main(int argc, char **argv) // Create a simple rectangular geometry double lc = 1e-2; gmsh::model::geo::addPoint(0, 0, 0, lc, 1); - gmsh::model::geo::addPoint(.1, 0, 0, lc, 2); + gmsh::model::geo::addPoint(.1, 0, 0, lc, 2); gmsh::model::geo::addPoint(.1, .3, 0, lc, 3); - gmsh::model::geo::addPoint(0, .3, 0, lc, 4); + gmsh::model::geo::addPoint(0, .3, 0, lc, 4); gmsh::model::geo::addLine(1, 2, 1); gmsh::model::geo::addLine(3, 2, 2); gmsh::model::geo::addLine(3, 4, 3); @@ -36,8 +36,7 @@ int main(int argc, char **argv) // Merge a post-processing view containing the target mesh sizes try { gmsh::merge("../t7_bgmesh.pos"); - } - catch(...) { + } catch(...) { gmsh::logger::write("Could not load background mesh: bye!"); gmsh::finalize(); return 0; diff --git a/tutorial/c++/t8.cpp b/tutorial/c++/t8.cpp index 204c4df72165e2413ff3a835baca83ca9799e164..1d3eb5fb30e6cde6565f640e6473a9c3e0a8249e 100644 --- a/tutorial/c++/t8.cpp +++ b/tutorial/c++/t8.cpp @@ -21,9 +21,9 @@ int main(int argc, char **argv) // We first create a simple geometry double lc = 1e-2; gmsh::model::geo::addPoint(0, 0, 0, lc, 1); - gmsh::model::geo::addPoint(.1, 0, 0, lc, 2); + gmsh::model::geo::addPoint(.1, 0, 0, lc, 2); gmsh::model::geo::addPoint(.1, .3, 0, lc, 3); - gmsh::model::geo::addPoint(0, .3, 0, lc, 4); + gmsh::model::geo::addPoint(0, .3, 0, lc, 4); gmsh::model::geo::addLine(1, 2, 1); gmsh::model::geo::addLine(3, 2, 2); gmsh::model::geo::addLine(3, 4, 3); @@ -37,8 +37,7 @@ int main(int argc, char **argv) gmsh::merge("../view1.pos"); gmsh::merge("../view1.pos"); gmsh::merge("../view4.pos"); // contains 2 views inside - } - catch(...) { + } catch(...) { gmsh::logger::write("Could not load post-processing views: bye!"); gmsh::finalize(); return 0; @@ -62,8 +61,9 @@ int main(int argc, char **argv) gmsh::option::setColor("General.Background", white[0], white[1], white[2]); // We can make our own shorter versions of repetitive methods - auto set_color = [] (std::string name, int c[3]) -> void - { gmsh::option::setColor(name, c[0], c[1], c[2]); }; + auto set_color = [](std::string name, int c[3]) -> void { + gmsh::option::setColor(name, c[0], c[1], c[2]); + }; set_color("General.Foreground", black); set_color("General.Text", black); @@ -113,7 +113,6 @@ int main(int argc, char **argv) int t = 0; // Initial step for(int num = 1; num <= 3; num++) { - double nbt; gmsh::option::getNumber("View[0].NbTimeStep", nbt); t = (t < nbt - 1) ? t + 1 : 0; @@ -137,7 +136,6 @@ int main(int argc, char **argv) int frames = 50; for(int num2 = 1; num2 <= frames; num2++) { - // Incrementally rotate the scene double rotx; gmsh::option::getNumber("General.RotationX", rotx); diff --git a/tutorial/c++/t9.cpp b/tutorial/c++/t9.cpp index 55e2d9d6aa92b862f74181a61b0a95965f129b62..77c455c8b30cff8d28a898e89b94d5b7b08f2487 100644 --- a/tutorial/c++/t9.cpp +++ b/tutorial/c++/t9.cpp @@ -27,8 +27,7 @@ int main(int argc, char **argv) // Let us for example include a three-dimensional scalar view: try { gmsh::merge("../view3.pos"); - } - catch(...) { + } catch(...) { gmsh::logger::write("Could not load post-processing views: bye!"); gmsh::finalize(); return 0; diff --git a/tutorial/c++/x1.cpp b/tutorial/c++/x1.cpp index 85f11aae85ce1bc0bcdadfd965ee2ee3dfe6bf33..e296a64f6e3942d5a05b3650cf896f66b9835eef 100644 --- a/tutorial/c++/x1.cpp +++ b/tutorial/c++/x1.cpp @@ -18,7 +18,7 @@ int main(int argc, char **argv) { - if(argc < 2){ + if(argc < 2) { std::cout << "Usage: " << argv[0] << " file" << std::endl; return 0; } @@ -33,7 +33,8 @@ int main(int argc, char **argv) // Print the model name and dimension: std::string name; gmsh::model::getCurrent(name); - std::cout << "Model " << name << " (" << gmsh::model::getDimension() << "D)\n"; + std::cout << "Model " << name << " (" << gmsh::model::getDimension() + << "D)\n"; // Geometrical data is made of elementary model `entities', called `points' // (entities of dimension 0), `curves' (entities of dimension 1), `surfaces' @@ -50,7 +51,7 @@ int main(int argc, char **argv) std::vector<std::pair<int, int> > entities; gmsh::model::getEntities(entities); - for(std::size_t i = 0; i < entities.size(); i++){ + for(std::size_t i = 0; i < entities.size(); i++) { // Mesh data is made of `elements' (points, lines, triangles, ...), defined // by an ordered list of their `nodes'. Elements and nodes are identified by // `tags' as well (strictly positive identification numbers), and are stored @@ -93,17 +94,19 @@ int main(int argc, char **argv) // * Number of mesh nodes and elements: int numElem = 0; - for(std::size_t j = 0; j < elemTags.size(); j++) numElem += elemTags[j].size(); + for(std::size_t j = 0; j < elemTags.size(); j++) + numElem += elemTags[j].size(); std::cout << " - Mesh has " << nodeTags.size() << " nodes and " << numElem << " elements\n"; // * Entities on its boundary: std::vector<std::pair<int, int> > boundary; - gmsh::model::getBoundary({{dim,tag}}, boundary); + gmsh::model::getBoundary({{dim, tag}}, boundary); if(boundary.size()) { std::cout << " - Boundary entities: "; for(std::size_t j = 0; j < boundary.size(); j++) - std::cout << "(" << boundary[j].first << "," << boundary[j].second << ") "; + std::cout << "(" << boundary[j].first << "," << boundary[j].second + << ") "; std::cout << "\n"; } @@ -124,17 +127,18 @@ int main(int argc, char **argv) // * Is the entity a partition entity? If so, what is its parent entity? std::vector<int> partitions; gmsh::model::getPartitions(dim, tag, partitions); - if(partitions.size()){ + if(partitions.size()) { std::cout << " - Partition tags:"; for(std::size_t j = 0; j < partitions.size(); j++) std::cout << " " << partitions[j]; int parentDim, parentTag; gmsh::model::getParent(dim, tag, parentDim, parentTag); - std::cout << " - parent entity (" << parentDim << "," << parentTag << ")\n"; + std::cout << " - parent entity (" << parentDim << "," << parentTag + << ")\n"; } // * List all types of elements making up the mesh of the entity: - for(std::size_t j = 0; j < elemTypes.size(); j++){ + for(std::size_t j = 0; j < elemTypes.size(); j++) { std::string name; int d, order, numv, numpv; std::vector<double> param; diff --git a/tutorial/c++/x2.cpp b/tutorial/c++/x2.cpp index dfeec5704627c72a86e7a70c0a5dacb5e51d5ece..b73a2754f6a50c64e213a04a3458698a9b3312a4 100644 --- a/tutorial/c++/x2.cpp +++ b/tutorial/c++/x2.cpp @@ -32,7 +32,7 @@ int main(int argc, char **argv) int N = 100; // Helper function to return a node tag given two indices i and j: - auto tag = [N] (std::size_t i, std::size_t j) { return (N+1) * i + j + 1; }; + auto tag = [N](std::size_t i, std::size_t j) { return (N + 1) * i + j + 1; }; // The x, y, z coordinates of all the points: std::vector<double> coords; @@ -56,33 +56,33 @@ int main(int argc, char **argv) for(std::size_t j = 0; j < N + 1; j++) { nodes.push_back(tag(i, j)); coords.insert(coords.end(), {(double)i / N, (double)j / N, - 0.05 * sin(10 * (double)(i+j) / N)}); + 0.05 * sin(10 * (double)(i + j) / N)}); if(i > 0 && j > 0) { - tris.insert(tris.end(), {tag(i-1, j-1), tag(i, j-1), tag(i-1, j)}); - tris.insert(tris.end(), {tag(i, j-1), tag(i, j), tag(i-1, j)}); + tris.insert(tris.end(), + {tag(i - 1, j - 1), tag(i, j - 1), tag(i - 1, j)}); + tris.insert(tris.end(), {tag(i, j - 1), tag(i, j), tag(i - 1, j)}); } if((i == 0 || i == N) && j > 0) { std::size_t s = (i == 0) ? 3 : 1; - lin[s].insert(lin[s].end(), {tag(i, j-1), tag(i, j)}); + lin[s].insert(lin[s].end(), {tag(i, j - 1), tag(i, j)}); } if((j == 0 || j == N) && i > 0) { std::size_t s = (j == 0) ? 0 : 2; - lin[s].insert(lin[s].end(), {tag(i-1, j), tag(i, j)}); + lin[s].insert(lin[s].end(), {tag(i - 1, j), tag(i, j)}); } } } // Create 4 discrete points for the 4 corners of the terrain surface: - for(int i = 0; i < 4; i++) - gmsh::model::addDiscreteEntity(0, i+1); - gmsh::model::setCoordinates(1, 0, 0, coords[3*tag(0,0)-1]); - gmsh::model::setCoordinates(2, 1, 0, coords[3*tag(N,0)-1]); - gmsh::model::setCoordinates(3, 1, 1, coords[3*tag(N,N)-1]); - gmsh::model::setCoordinates(4, 0, 1, coords[3*tag(0,N)-1]); + for(int i = 0; i < 4; i++) gmsh::model::addDiscreteEntity(0, i + 1); + gmsh::model::setCoordinates(1, 0, 0, coords[3 * tag(0, 0) - 1]); + gmsh::model::setCoordinates(2, 1, 0, coords[3 * tag(N, 0) - 1]); + gmsh::model::setCoordinates(3, 1, 1, coords[3 * tag(N, N) - 1]); + gmsh::model::setCoordinates(4, 0, 1, coords[3 * tag(0, N) - 1]); // Create 4 discrete bounding curves, with their CAD boundary points: for(int i = 0; i < 4; i++) - gmsh::model::addDiscreteEntity(1, i+1, {i+1, (i < 3) ? (i+2) : 1}); + gmsh::model::addDiscreteEntity(1, i + 1, {i + 1, (i < 3) ? (i + 2) : 1}); // Create one discrete surface, with its bounding curves: gmsh::model::addDiscreteEntity(2, 1, {1, 2, -3, -4}); @@ -105,8 +105,8 @@ int main(int argc, char **argv) // the surface before with `addNodes' for simplicity) gmsh::model::mesh::reclassifyNodes(); - // Create a geometry for the discrete curves and surfaces, so that we can remesh - // them later on: + // Create a geometry for the discrete curves and surfaces, so that we can + // remesh them later on: gmsh::model::mesh::createGeometry(); // Note that for more complicated meshes, e.g. for on input unstructured STL @@ -127,15 +127,15 @@ int main(int argc, char **argv) int c11 = gmsh::model::geo::addLine(p2, 2); int c12 = gmsh::model::geo::addLine(p3, 3); int c13 = gmsh::model::geo::addLine(p4, 4); - int ll1 = gmsh::model::geo::addCurveLoop({c1,c2,c3,c4}); + int ll1 = gmsh::model::geo::addCurveLoop({c1, c2, c3, c4}); int s1 = gmsh::model::geo::addPlaneSurface({ll1}); - int ll3 = gmsh::model::geo::addCurveLoop({c1,c11,-1,-c10}); + int ll3 = gmsh::model::geo::addCurveLoop({c1, c11, -1, -c10}); int s3 = gmsh::model::geo::addPlaneSurface({ll3}); - int ll4 = gmsh::model::geo::addCurveLoop({c2,c12,-2,-c11}); + int ll4 = gmsh::model::geo::addCurveLoop({c2, c12, -2, -c11}); int s4 = gmsh::model::geo::addPlaneSurface({ll4}); - int ll5 = gmsh::model::geo::addCurveLoop({c3,c13,3,-c12}); + int ll5 = gmsh::model::geo::addCurveLoop({c3, c13, 3, -c12}); int s5 = gmsh::model::geo::addPlaneSurface({ll5}); - int ll6 = gmsh::model::geo::addCurveLoop({c4,c10,4,-c13}); + int ll6 = gmsh::model::geo::addCurveLoop({c4, c10, 4, -c13}); int s6 = gmsh::model::geo::addPlaneSurface({ll6}); int sl1 = gmsh::model::geo::addSurfaceLoop({s1, s3, s4, s5, s6, 1}); int v1 = gmsh::model::geo::addVolume({sl1});