/[escript]/trunk/esys2/finley/src/finleyC/Mesh_hex20.c
ViewVC logotype

Diff of /trunk/esys2/finley/src/finleyC/Mesh_hex20.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 33  Line 33 
33  /**************************************************************/  /**************************************************************/
34    
35  Finley_Mesh* Finley_RectangularMesh_Hex20(dim_t* numElements,double* Length,bool_t* periodic,index_t order,bool_t useElementsOnFace) {  Finley_Mesh* Finley_RectangularMesh_Hex20(dim_t* numElements,double* Length,bool_t* periodic,index_t order,bool_t useElementsOnFace) {
36    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;
37    index_t node0;    index_t node0;
38    Finley_Mesh* out;    Finley_Mesh* out;
39    char name[50];    char name[50];
# Line 46  Finley_Mesh* Finley_RectangularMesh_Hex2 Line 46  Finley_Mesh* Finley_RectangularMesh_Hex2
46    N1=2*NE1+1;    N1=2*NE1+1;
47    N2=2*NE2+1;    N2=2*NE2+1;
48    
49      if (N0<=MIN(N1,N2)) {
50         if (N1 <= N2) {
51            M0=1;
52            M1=N0;
53            M2=N0*N1;
54         } else {
55            M0=1;
56            M2=N0;
57            M1=N0*N2;
58         }
59      } else if (N1<=MIN(N2,N0)) {
60         if (N2 <= N0) {
61            M1=1;
62            M2=N1;
63            M0=N2*N1;
64         } else {
65            M1=1;
66            M0=N1;
67            M2=N1*N0;
68         }
69      } else {
70         if (N0 <= N1) {
71            M2=1;
72            M0=N2;
73            M1=N2*N0;
74         } else {
75            M2=1;
76            M1=N2;
77            M0=N1*N2;
78         }
79      }
80    
81    NFaceElements=0;    NFaceElements=0;
82    if (!periodic[0]) {    if (!periodic[0]) {
83        NDOF0=N0;        NDOF0=N0;
# Line 96  Finley_Mesh* Finley_RectangularMesh_Hex2 Line 128  Finley_Mesh* Finley_RectangularMesh_Hex2
128        Finley_Mesh_dealloc(out);        Finley_Mesh_dealloc(out);
129        return NULL;        return NULL;
130    }    }
131      
132    #pragma omp parallel for private(i0,i1,i2,k)    #pragma omp parallel for private(i0,i1,i2,k)
133    for (i2=0;i2<N2;i2++) {    for (i2=0;i2<N2;i2++) {
134      for (i1=0;i1<N1;i1++) {      for (i1=0;i1<N1;i1++) {
135        for (i0=0;i0<N0;i0++) {        for (i0=0;i0<N0;i0++) {
136          k=i0+N0*i1+N0*N1*i2;          k=M0*i0+M1*i1+M2*i2;
137          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];
138          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];
139          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];
140          out->Nodes->Id[k]=k;          out->Nodes->Id[k]=i0+N0*i1+N0*N1*i2;
141          out->Nodes->Tag[k]=0;          out->Nodes->Tag[k]=0;
142          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);
143        }        }
144      }      }
145    }    }
146    
147      
148    /* tags for the faces: */    /* 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    }    }
# Line 526  Finley_Mesh* Finley_RectangularMesh_Hex2 Line 559  Finley_Mesh* Finley_RectangularMesh_Hex2
559    return out;    return out;
560  }  }
561    
 /*  
 * 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:51  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