load "medit" // ! basic functions to build regular mesh of a cube /* mesh3 Cube(NN,BB,L); -- build the surface mesh of a 3d box where: for exqmple: int[int] NN=[nx,ny,nz]; // the number of seg in the 3 direction real [int,int] BB=[[xmin,xmax],[ymin,ymax],[zmin,zmax]]; // bounding bax int [int,int] L=[[1,2],[3,4],[5,6]]; // the label of the 6 face left,right, front, back, down, right */ func mesh3 Cube(int[int] & NN,real[int,int] &BB ,int[int,int] & L) { // first build the 6 faces of the hex. real x0=BB(0,0),x1=BB(0,1); real y0=BB(1,0),y1=BB(1,1); real z0=BB(2,0),z1=BB(2,1); int nx=NN[0],ny=NN[1],nz=NN[2]; mesh Thx = square(nx,ny,[x0+(x1-x0)*x,y0+(y1-y0)*y]); int[int] rup=[0,L(2,1)], rdown=[0,L(2,0)], rmid=[1,L(1,0), 2,L(0,1), 3, L(1,1), 4, L(0,0) ]; mesh3 Th=buildlayers(Thx,nz, zbound=[z0,z1], labelmid=rmid, labelup = rup, labeldown = rdown); return Th; } func mesh3 Cube(int Nx,int Ny,int Nz) { int[int] NN=[Nx,Ny,Nz]; real [int,int] BB=[[0,1],[0,1],[0,1]]; int[int,int] LL=[[1,2],[3,4],[5,6]]; return Cube(NN,BB,LL); }