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

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

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

trunk/esys2/finley/src/finleyC/Mesh_hex20.c revision 150 by jgs, Thu Sep 15 03:44:45 2005 UTC trunk/finley/src/Mesh_hex20.c revision 616 by elspeth, Wed Mar 22 02:46:56 2006 UTC
# Line 1  Line 1 
1  /*  /*
2   ******************************************************************************   ************************************************************
3   *                                                                            *   *          Copyright 2006 by ACcESS MNRF                   *
4   *       COPYRIGHT  ACcESS 2003,2004,2005 -  All Rights Reserved              *   *                                                          *
5   *                                                                            *   *              http://www.access.edu.au                    *
6   * This software is the property of ACcESS. No part of this code              *   *       Primary Business: Queensland, Australia            *
7   * may be copied in any form or by any means without the expressed written    *   *  Licensed under the Open Software License version 3.0    *
8   * consent of ACcESS.  Copying, use or modification of this software          *   *     http://www.opensource.org/licenses/osl-3.0.php       *
9   * by any unauthorised person is illegal unless that person has a software    *   *                                                          *
10   * license agreement with ACcESS.                                             *   ************************************************************
  *                                                                            *  
  ******************************************************************************  
11  */  */
12    
13  /**************************************************************/  /**************************************************************/
# Line 33  Line 31 
31  /**************************************************************/  /**************************************************************/
32    
33  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) {
34    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;
35    index_t node0;    index_t node0;
36    Finley_Mesh* out;    Finley_Mesh* out;
37    char name[50];    char name[50];
# Line 46  Finley_Mesh* Finley_RectangularMesh_Hex2 Line 44  Finley_Mesh* Finley_RectangularMesh_Hex2
44    N1=2*NE1+1;    N1=2*NE1+1;
45    N2=2*NE2+1;    N2=2*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    NFaceElements=0;    NFaceElements=0;
80    if (!periodic[0]) {    if (!periodic[0]) {
81        NDOF0=N0;        NDOF0=N0;
# Line 96  Finley_Mesh* Finley_RectangularMesh_Hex2 Line 126  Finley_Mesh* Finley_RectangularMesh_Hex2
126        Finley_Mesh_dealloc(out);        Finley_Mesh_dealloc(out);
127        return NULL;        return NULL;
128    }    }
129      
130    #pragma omp parallel for private(i0,i1,i2,k)    #pragma omp parallel for private(i0,i1,i2,k)
131    for (i2=0;i2<N2;i2++) {    for (i2=0;i2<N2;i2++) {
132      for (i1=0;i1<N1;i1++) {      for (i1=0;i1<N1;i1++) {
133        for (i0=0;i0<N0;i0++) {        for (i0=0;i0<N0;i0++) {
134          k=i0+N0*i1+N0*N1*i2;          k=M0*i0+M1*i1+M2*i2;
135          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];
136          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];
137          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];
138          out->Nodes->Id[k]=k;          out->Nodes->Id[k]=i0+N0*i1+N0*N1*i2;
139          out->Nodes->Tag[k]=0;          out->Nodes->Tag[k]=0;
140          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);
141        }        }
142      }      }
143    }    }
144    
145      
146    /* tags for the faces: */    /* tags for the faces: */
147    if (!periodic[2]) {    if (!periodic[2]) {
148       for (i1=0;i1<N1;i1++) {       for (i1=0;i1<N1;i1++) {
149         for (i0=0;i0<N0;i0++) {         for (i0=0;i0<N0;i0++) {
150           out->Nodes->Tag[i0+N0*i1+N0*N1*0]+=100;           out->Nodes->Tag[M0*i0+M1*i1+M2*0]+=100;
151           out->Nodes->Tag[i0+N0*i1+N0*N1*(N2-1)]+=200;           out->Nodes->Tag[M0*i0+M1*i1+M2*(N2-1)]+=200;
152         }         }
153       }       }
154    }    }
155    if (!periodic[1]) {    if (!periodic[1]) {
156      for (i2=0;i2<N2;i2++) {      for (i2=0;i2<N2;i2++) {
157        for (i0=0;i0<N0;i0++) {        for (i0=0;i0<N0;i0++) {
158           out->Nodes->Tag[i0+N0*0+N0*N1*i2]+=10;           out->Nodes->Tag[M0*i0+M1*0+M2*i2]+=10;
159           out->Nodes->Tag[i0+N0*(N1-1)+N0*N1*i2]+=20;           out->Nodes->Tag[M0*i0+M1*(N1-1)+M2*i2]+=20;
160        }        }
161      }      }
162    }    }
163    if (!periodic[0]) {    if (!periodic[0]) {
164      for (i2=0;i2<N2;i2++) {      for (i2=0;i2<N2;i2++) {
165        for (i1=0;i1<N1;i1++) {        for (i1=0;i1<N1;i1++) {
166          out->Nodes->Tag[0+N0*i1+N0*N1*i2]+=1;          out->Nodes->Tag[M0*0+M1*i1+M2*i2]+=1;
167          out->Nodes->Tag[(N0-1)+N0*i1+N0*N1*i2]+=2;          out->Nodes->Tag[M0*(N0-1)+M1*i1+M2*i2]+=2;
168        }        }
169      }      }
170    }    }
# Line 526  Finley_Mesh* Finley_RectangularMesh_Hex2 Line 557  Finley_Mesh* Finley_RectangularMesh_Hex2
557    return out;    return out;
558  }  }
559    
 /*  
 * 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.150  
changed lines
  Added in v.616

  ViewVC Help
Powered by ViewVC 1.1.26