Hello 

 I have started to enhance my EmCAD EM modeler in order to deal with
periodic structures (which are present in many important applications).

To enforce mesh periodicity my new code make calls to the gmsh functions
GEdge::setMeshMaster( ..) and GFace::setMeshMaster(..).

I am doing a few experiments with a simple brick which is imported from 
a step file and then partitioned with a grid of parallel planes.
The partitioning is done by EmCAD which calls the Salome library for
this job.

After having computed a map which associates each edge with the
corresponding master edge and the related transform I was using 
GEdge::setMeshMaster(GEdge* ge,const std::vector<double>& tfo)
to enforce edge mesh copying.

I have seen that GEdge::setMeshMaster checks that two edges are properly
matched under the transformation. These checks were all passed in the
test case.

Nevertheless I have observed that the function copyMesh(GEdge *from,
GEdge *to, int direction) was copying the master mesh into a wrong
position. This problem has been fixed (at least for my test case) by the
annexed patch which is defined with reference to the Gmsh version
2.10.1.


Walter 

--- meshGEdge.cpp	2015-10-15 18:20:24.488074751 +0200
+++ meshGEdge_new.cpp	2015-10-15 18:20:12.196074841 +0200
@@ -273,11 +273,15 @@
   double u_min = u_bounds.low();
   double u_max = u_bounds.high();
 
+  Range<double> to_u_bounds = to->parBounds(0);
+  double to_u_min = to_u_bounds.low();
+  double to_u_max = to_u_bounds.high();
+
   for(unsigned int i = 0; i < from->mesh_vertices.size(); i++){
     int index = (direction < 0) ? (from->mesh_vertices.size() - 1 - i) : i;
     MVertex *v = from->mesh_vertices[index];
     double u; v->getParameter(0, u);
-    double newu = (direction > 0) ? u : (u_max - u + u_min);
+    double newu = (direction > 0) ? (u-u_min+to_u_min) : (u_max-u+to_u_min);
     GPoint gp = to->point(newu);
     MEdgeVertex *vv = new MEdgeVertex(gp.x(), gp.y(), gp.z(), to, newu);
     to->mesh_vertices.push_back(vv);
_______________________________________________
gmsh mailing list
[email protected]
http://www.geuz.org/mailman/listinfo/gmsh

Reply via email to