Hello, I am currently trying to define a mesh from a grid defined by loops but something does not work. Actually, there is no message error from gmsh but the output result is not correct: a physical surface does not seem to be taken into account in the resulting msh file. Here is defined my geometry (grid):
--------------------------------------------------------------------------- Printf("DEBUG")>"toto.txt"; // parametres de la geometrie nrow = 7; // nombre de lignes (matrice) ncol = 7; // nombre de colonnes (matrice) step = 1; nhe = (nrow+1)*ncol; // nombre aretes horizontales nve = nrow*(ncol+1); // nombre aretes verticales noe = nrow*ncol; // nombre aretes obliques he={}; ve={}; oe={}; // points de la grille For i In {1:nrow+1} For j In {1:ncol+1} idx = j+(i-1)*(ncol+1); Point (idx) = {j-ncol-1,i-1,0}; EndFor EndFor // arêtes horizontales de la grille cpt=1; For i In {1:nrow+1} For j In {1:ncol} idx = j+(i-1)*(ncol+1); Line (cpt) = {idx,idx+1}; he[cpt] = cpt; cpt+=1; EndFor EndFor // arêtes verticales de la grille k=1; For i In {1:nrow} For j In {1:ncol+1} idx = j+(i-1)*(ncol+1); Line (cpt) = {idx,idx+ncol+1}; ve[k] = cpt; cpt+=1; k+=1; EndFor EndFor // arêtes obliques de la grille k=1; For i In {1:nrow} For j In {1:ncol} idx = j+(i-1)*(ncol+1); Line (cpt) = {idx,idx+ncol+2}; oe[k] = cpt; cpt+=1; k+=1; EndFor EndFor // carres carres={}; For i In {1:nrow} For j In {1:ncol} idx = j+(i-1)*ncol; Line Loop (cpt) = {-ve[idx+i-1],he[idx],ve[idx+i],-he[idx+ncol]}; Plane Surface (cpt+1) = {cpt}; // Physical Surface ( Sprintf ("C%g%g",i,j)) = {cpt+1}; Printf("cpt = %g",cpt)>>"toto.txt"; carres[idx] = cpt+1; Printf("carres[idx] = %g",carres[idx])>>"toto.txt"; cpt+=2; EndFor EndFor // definition du guide Physical Surface ("GUIDE1") = carres[1]; Physical Surface ("GUIDE2") = {carres[1],carres[2]}; carres_guide={}; For j In{1:2} carres_guide[j] = carres[j]; EndFor Physical Surface ("GUIDE3") = carres_guide; --------------------------------------------------------------------------------------------------- At the end of this file, I try to define 3 physical surfaces: GUIDE1, GUIDE2 and GUIDE3. The last physical surface (GUIDE3) does not seem to be correctly defined since I obtain the following msh file: --------------------------------------------------------------------------------------------------------- $MeshFormat 2.2 0 8 $EndMeshFormat $PhysicalNames 3 2 1 "GUIDE1" 2 2 "GUIDE2" 2 3 "GUIDE3" $EndPhysicalNames $Nodes 8 1 -7 0 0 2 -6 0 0 3 -5 0 0 4 -7 1 0 5 -6 1 0 6 -5 1 0 7 -6.5 0.5 0 8 -5.5 0.5 0 $EndNodes $Elements 12 1 2 2 1 163 1 7 4 2 2 2 2 163 1 7 4 3 2 2 1 163 1 2 7 4 2 2 2 163 1 2 7 5 2 2 1 163 4 7 5 6 2 2 2 163 4 7 5 7 2 2 1 163 2 5 7 8 2 2 2 163 2 5 7 9 2 2 2 165 3 6 8 10 2 2 2 165 5 8 6 11 2 2 2 165 2 8 5 12 2 2 2 165 2 3 8 $EndElements --------------------------------------------------------------------------------------------------------- In other words, no element is linked with GUIDE3. Does anybody know how to overcome this problem? Thank you very much for your help! Cédric Doucet
_______________________________________________ gmsh mailing list gmsh@geuz.org http://www.geuz.org/mailman/listinfo/gmsh