/[escript]/trunk/finley/src/Mesh_hex8.c
ViewVC logotype

Diff of /trunk/finley/src/Mesh_hex8.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 152 by jgs, Thu Sep 15 03:44:45 2005 UTC revision 153 by jgs, Tue Oct 25 01:51:20 2005 UTC
# Line 32  Line 32 
32  /**************************************************************/  /**************************************************************/
33    
34  Finley_Mesh* Finley_RectangularMesh_Hex8(dim_t* numElements,double* Length,bool_t* periodic, index_t order,bool_t useElementsOnFace) {  Finley_Mesh* Finley_RectangularMesh_Hex8(dim_t* numElements,double* Length,bool_t* periodic, index_t order,bool_t useElementsOnFace) {
35    dim_t N0,N1,N2,NE0,NE1,NE2,i0,i1,i2,k,totalNECount,faceNECount,NDOF0,NDOF1,NDOF2,NFaceElements,NUMNODES;    dim_t N0,N1,N2,NE0,NE1,NE2,i0,i1,i2,k,totalNECount,faceNECount,NDOF0,NDOF1,NDOF2,NFaceElements,NUMNODES,M0,M1,M2;
36    index_t node0;    index_t node0;
37    Finley_Mesh* out;    Finley_Mesh* out;
38    char name[50];    char name[50];
# Line 44  Finley_Mesh* Finley_RectangularMesh_Hex8 Line 44  Finley_Mesh* Finley_RectangularMesh_Hex8
44    N1=NE1+1;    N1=NE1+1;
45    N2=NE2+1;    N2=NE2+1;
46    
47      if (N0<=MIN(N1,N2)) {
48         if (N1 <= N2) {
49            M0=1;
50            M1=N0;
51            M2=N0*N1;
52         } else {
53            M0=1;
54            M2=N0;
55            M1=N0*N2;
56         }
57      } else if (N1<=MIN(N2,N0)) {
58         if (N2 <= N0) {
59            M1=1;
60            M2=N1;
61            M0=N2*N1;
62         } else {
63            M1=1;
64            M0=N1;
65            M2=N1*N0;
66         }
67      } else {
68         if (N0 <= N1) {
69            M2=1;
70            M0=N2;
71            M1=N2*N0;
72         } else {
73            M2=1;
74            M1=N2;
75            M0=N1*N2;
76         }
77      }
78    
79    
80    NFaceElements=0;    NFaceElements=0;
81    if (!periodic[0]) {    if (!periodic[0]) {
82        NDOF0=N0;        NDOF0=N0;
# Line 96  Finley_Mesh* Finley_RectangularMesh_Hex8 Line 129  Finley_Mesh* Finley_RectangularMesh_Hex8
129    }    }
130        
131    /*  set nodes: */    /*  set nodes: */
132      
133    #pragma omp parallel for private(i0,i1,i2,k)    #pragma omp parallel for private(i0,i1,i2,k)
134    for (i2=0;i2<N2;i2++) {    for (i2=0;i2<N2;i2++) {
135      for (i1=0;i1<N1;i1++) {      for (i1=0;i1<N1;i1++) {
136        for (i0=0;i0<N0;i0++) {        for (i0=0;i0<N0;i0++) {
137          k=i0+N0*i1+N0*N1*i2;          k=M0*i0+M1*i1+M2*i2;
138          out->Nodes->Coordinates[INDEX2(0,k,3)]=DBLE(i0)/DBLE(N0-1)*Length[0];          out->Nodes->Coordinates[INDEX2(0,k,3)]=DBLE(i0)/DBLE(N0-1)*Length[0];
139          out->Nodes->Coordinates[INDEX2(1,k,3)]=DBLE(i1)/DBLE(N1-1)*Length[1];          out->Nodes->Coordinates[INDEX2(1,k,3)]=DBLE(i1)/DBLE(N1-1)*Length[1];
140          out->Nodes->Coordinates[INDEX2(2,k,3)]=DBLE(i2)/DBLE(N2-1)*Length[2];          out->Nodes->Coordinates[INDEX2(2,k,3)]=DBLE(i2)/DBLE(N2-1)*Length[2];
141          out->Nodes->Id[k]=k;          out->Nodes->Id[k]=i0+N0*i1+N0*N1*i2;
142          out->Nodes->Tag[k]=0;          out->Nodes->Tag[k]=0;
143          out->Nodes->degreeOfFreedom[k]=(i0%NDOF0) +N0*(i1%NDOF1) +N0*N1*(i2%NDOF2);          out->Nodes->degreeOfFreedom[k]=M0*(i0%NDOF0) +M1*(i1%NDOF1) +M2*(i2%NDOF2);
144        }        }
145      }      }
146    }    }
147    /* tags for the faces: */    /* tags for the faces: */
148      /* tags for the faces: */
149    if (!periodic[2]) {    if (!periodic[2]) {
150      for (i1=0;i1<N1;i1++) {       for (i1=0;i1<N1;i1++) {
151        for (i0=0;i0<N0;i0++) {         for (i0=0;i0<N0;i0++) {
152          out->Nodes->Tag[i0+N0*i1+N0*N1*0]+=100;           out->Nodes->Tag[M0*i0+M1*i1+M2*0]+=100;
153          out->Nodes->Tag[i0+N0*i1+N0*N1*(N2-1)]+=200;           out->Nodes->Tag[M0*i0+M1*i1+M2*(N2-1)]+=200;
154        }         }
155      }       }
156    }    }
157    if (!periodic[1]) {    if (!periodic[1]) {
158      for (i2=0;i2<N2;i2++) {      for (i2=0;i2<N2;i2++) {
159        for (i0=0;i0<N0;i0++) {        for (i0=0;i0<N0;i0++) {
160           out->Nodes->Tag[i0+N0*0+N0*N1*i2]+=10;           out->Nodes->Tag[M0*i0+M1*0+M2*i2]+=10;
161           out->Nodes->Tag[i0+N0*(N1-1)+N0*N1*i2]+=20;           out->Nodes->Tag[M0*i0+M1*(N1-1)+M2*i2]+=20;
162        }        }
163      }      }
164    }    }
165    if (!periodic[0]) {    if (!periodic[0]) {
166      for (i2=0;i2<N2;i2++) {      for (i2=0;i2<N2;i2++) {
167        for (i1=0;i1<N1;i1++) {        for (i1=0;i1<N1;i1++) {
168          out->Nodes->Tag[0+N0*i1+N0*N1*i2]+=1;          out->Nodes->Tag[M0*0+M1*i1+M2*i2]+=1;
169          out->Nodes->Tag[(N0-1)+N0*i1+N0*N1*i2]+=2;          out->Nodes->Tag[M0*(N0-1)+M1*i1+M2*i2]+=2;
170        }        }
171      }      }
172    }    }
173      
174    /*   set the elements: */    /*   set the elements: */
175        
176    #pragma omp parallel for private(i0,i1,i2,k,node0)    #pragma omp parallel for private(i0,i1,i2,k,node0)
# Line 396  Finley_Mesh* Finley_RectangularMesh_Hex8 Line 430  Finley_Mesh* Finley_RectangularMesh_Hex8
430    }    }
431    return out;    return out;
432  }  }
   
 /*  
 * Revision 1.3  2005/09/01 03:31:35  jgs  
 * Merge of development branch dev-02 back to main trunk on 2005-09-01  
 *  
 * Revision 1.2.2.2  2005/09/07 06:26:19  gross  
 * the solver from finley are put into the standalone package paso now  
 *  
 * Revision 1.2.2.1  2005/08/24 02:02:18  gross  
 * timing output switched off. solver output can be swiched through getSolution(verbose=True) now.  
 *  
 * Revision 1.2  2005/07/08 04:07:52  jgs  
 * Merge of development branch back to main trunk on 2005-07-08  
 *  
 * Revision 1.1.1.1.2.1  2005/06/29 02:34:52  gross  
 * some changes towards 64 integers in finley  
 *  
 * Revision 1.1.1.1  2004/10/26 06:53:57  jgs  
 * initial import of project esys2  
 *  
 * Revision 1.1.1.1  2004/06/24 04:00:40  johng  
 * Initial version of eys using boost-python.  
 *  
 *  
 */  
   

Legend:
Removed from v.152  
changed lines
  Added in v.153

  ViewVC Help
Powered by ViewVC 1.1.26