In 2D quad mesh generation the middle point generated during subdivision does not fall on the embedded line (C++ API)
Hi,
First and foremost, many thanks for your amazing works.
I'm attempting to use GMSH's C++ API in my FEM software and am encountering the following problem during quad mesh generation. In my model, I utilize the "addCurveLoop" and "addPlaneSurface" methods to construct the exterior border, and embedded lines to produce the interior lines (i.e. material lines). Everything works fine when I use the simple recombination algorithm (Mesh.RecombinationAlgorithm = 0), but when I use Mesh.RecombinationAlgorithm = 1 or 2, the generated middle points on the embedded lines during the subdivision process are not falling on the line and, according to my understanding, are moving after smoothing. The C++ script below recreates this problem. I've also attached a few of images to help explain what I mean.
Is there a method to constraint the middle points such that they fall on the lines?
gmsh::initialize();
gmsh::model::add("model01");
double Lc1 = 1.0;
double Lc2 = 1.0;
namespace factory = gmsh::model::geo;
factory::addPoint(-10, -10, 0, Lc1, 1);
factory::addPoint(10, -10, 0, Lc1, 2);
factory::addPoint(10, 10, 0, Lc1, 3);
factory::addPoint(-10, 10, 0, Lc1, 4);
factory::addPoint(-9, -9, 0, Lc2, 5);
factory::addPoint(9, 9, 0, Lc2, 6);
factory::addLine(1, 2, 1);
factory::addLine(2, 3, 2);
factory::addLine(3, 4, 3);
factory::addLine(4, 1, 4);
factory::addLine(5, 6, 5);
factory::addCurveLoop({1, 2, 3, 4}, 1);
factory::addPlaneSurface({1}, 1);
gmsh::model::geo::synchronize();
gmsh::model::mesh::embed(1, {5}, 2, 1);
factory::synchronize();
gmsh::option::setNumber("Mesh.RecombineAll", 1);
gmsh::option::setNumber("Mesh.RecombinationAlgorithm", 2);
gmsh::model::mesh::generate(2);
gmsh::write("model01.msh");
gmsh::finalize();