/[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 787 by bcumming, Wed Jul 26 01:46:45 2006 UTC revision 1062 by gross, Mon Mar 26 06:17:53 2007 UTC
# Line 115  static void domain_calculateDimension( i Line 115  static void domain_calculateDimension( i
115  #endif  #endif
116    
117  #ifdef PASO_MPI  #ifdef PASO_MPI
118  Finley_Mesh* Finley_RectangularMesh_Hex8_singleCPU(dim_t* numElements,double* Length,bool_t* periodic, index_t order,bool_t useElementsOnFace,Paso_MPIInfo *mpi_info)  Finley_Mesh* Finley_RectangularMesh_Hex8_singleCPU(dim_t* numElements,double* Length,bool_t* periodic, index_t order, index_t reduced_order, bool_t useElementsOnFace,Paso_MPIInfo *mpi_info)
119  #else  #else
120  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, index_t reduced_order, bool_t useElementsOnFace)
121  #endif  #endif
122  {  {
123    dim_t N0,N1,N2,NE0,NE1,NE2,i0,i1,i2,k,totalNECount,faceNECount,NDOF0,NDOF1,NDOF2,NFaceElements,NUMNODES,M0,M1,M2;    dim_t N0,N1,N2,NE0,NE1,NE2,i0,i1,i2,k,totalNECount,faceNECount,NDOF0,NDOF1,NDOF2,NFaceElements,NUMNODES,M0,M1,M2;
# Line 190  Finley_Mesh* Finley_RectangularMesh_Hex8 Line 190  Finley_Mesh* Finley_RectangularMesh_Hex8
190    sprintf(name,"Rectangular %d x %d x %d mesh",N0,N1,N2);    sprintf(name,"Rectangular %d x %d x %d mesh",N0,N1,N2);
191    
192  #ifndef PASO_MPI  #ifndef PASO_MPI
193    out=Finley_Mesh_alloc(name,3,order);    out=Finley_Mesh_alloc(name,3,order,reduced_order);
194  #else  #else
195    out=Finley_Mesh_alloc(name,3,order,mpi_info);    out=Finley_Mesh_alloc(name,3,order,reduced_order,mpi_info);
196  #endif  #endif
197    if (! Finley_noError()) return NULL;    if (! Finley_noError()) return NULL;
198    
199  #ifdef PASO_MPI  #ifdef PASO_MPI
200    out->Elements=Finley_ElementFile_alloc(Hex8,out->order,mpi_info);    out->Elements=Finley_ElementFile_alloc(Hex8,out->order,out->reduced_order,mpi_info);
201    if (useElementsOnFace) {    if (useElementsOnFace) {
202       out->FaceElements=Finley_ElementFile_alloc(Hex8Face,out->order,mpi_info);       out->FaceElements=Finley_ElementFile_alloc(Hex8Face,out->order,out->reduced_order,mpi_info);
203       out->ContactElements=Finley_ElementFile_alloc(Hex8Face_Contact,out->order,mpi_info);       out->ContactElements=Finley_ElementFile_alloc(Hex8Face_Contact,out->order,out->reduced_order,mpi_info);
204    } else {    } else {
205       out->FaceElements=Finley_ElementFile_alloc(Rec4,out->order,mpi_info);       out->FaceElements=Finley_ElementFile_alloc(Rec4,out->order,out->reduced_order,mpi_info);
206       out->ContactElements=Finley_ElementFile_alloc(Rec4_Contact,out->order,mpi_info);       out->ContactElements=Finley_ElementFile_alloc(Rec4_Contact,out->order,out->reduced_order,mpi_info);
207    }    }
208    out->Points=Finley_ElementFile_alloc(Point1,out->order,mpi_info);    out->Points=Finley_ElementFile_alloc(Point1,out->order,out->reduced_order,mpi_info);
209  #else  #else
210    out->Elements=Finley_ElementFile_alloc(Hex8,out->order);    out->Elements=Finley_ElementFile_alloc(Hex8,out->order, out->reduced_order);
211    if (useElementsOnFace) {    if (useElementsOnFace) {
212       out->FaceElements=Finley_ElementFile_alloc(Hex8Face,out->order);       out->FaceElements=Finley_ElementFile_alloc(Hex8Face,out->order,out->reduced_order);
213       out->ContactElements=Finley_ElementFile_alloc(Hex8Face_Contact,out->order);       out->ContactElements=Finley_ElementFile_alloc(Hex8Face_Contact,out->order, out->reduced_order);
214    } else {    } else {
215       out->FaceElements=Finley_ElementFile_alloc(Rec4,out->order);       out->FaceElements=Finley_ElementFile_alloc(Rec4,out->order, out->reduced_order);
216       out->ContactElements=Finley_ElementFile_alloc(Rec4_Contact,out->order);       out->ContactElements=Finley_ElementFile_alloc(Rec4_Contact,out->order, out->reduced_order);
217    }    }
218    out->Points=Finley_ElementFile_alloc(Point1,out->order);    out->Points=Finley_ElementFile_alloc(Point1,out->order, out->reduced_order);
219  #endif  #endif
220    if (! Finley_noError()) {    if (! Finley_noError()) {
221        Finley_Mesh_dealloc(out);        Finley_Mesh_dealloc(out);
# Line 225  Finley_Mesh* Finley_RectangularMesh_Hex8 Line 225  Finley_Mesh* Finley_RectangularMesh_Hex8
225        
226    /*  allocate tables: */    /*  allocate tables: */
227    Finley_NodeFile_allocTable(out->Nodes,N0*N1*N2);    Finley_NodeFile_allocTable(out->Nodes,N0*N1*N2);
228      Finley_ElementFile_allocTable(out->Elements,NE0*NE1*NE2);
229      Finley_ElementFile_allocTable(out->FaceElements,NFaceElements);
230  #ifdef PASO_MPI  #ifdef PASO_MPI
231    Finley_NodeDistribution_allocTable( out->Nodes->degreeOfFreedomDistribution, NDOF0*NDOF1*NDOF2, 0, 0 );    Finley_NodeDistribution_allocTable( out->Nodes->degreeOfFreedomDistribution, NDOF0*NDOF1*NDOF2, 0, 0 );
232      Finley_ElementDistribution_allocTable( out->Elements->elementDistribution, NE0*NE1*NE2, NE0*NE1*NE2);
233      Finley_ElementDistribution_allocTable( out->FaceElements->elementDistribution, NFaceElements, NFaceElements );
234  #endif  #endif
   Finley_ElementFile_allocTable(out->Elements,NE0*NE1*NE2);  
   Finley_ElementFile_allocTable(out->FaceElements,NFaceElements);  
235    if (! Finley_noError()) {    if (! Finley_noError()) {
236        Finley_Mesh_dealloc(out);        Finley_Mesh_dealloc(out);
237        return NULL;        return NULL;
# Line 561  Finley_Mesh* Finley_RectangularMesh_Hex8 Line 563  Finley_Mesh* Finley_RectangularMesh_Hex8
563    #ifdef Finley_TRACE    #ifdef Finley_TRACE
564    printf("timing: mesh generation: %.4e sec\n",Finley_timer()-time0);    printf("timing: mesh generation: %.4e sec\n",Finley_timer()-time0);
565    #endif    #endif
566      if (Finley_noError()) {
567    if (! Finley_noError()) {         if ( ! Finley_Mesh_isPrepared(out)) {
568              Finley_setError(SYSTEM_ERROR,"Mesh is not prepared for calculation. Contact the programmers.");
569           }
570      } else {
571        Finley_Mesh_dealloc(out);        Finley_Mesh_dealloc(out);
       return NULL;  
572    }    }
573    return out;    return out;
574  }  }
575    
576  #ifdef PASO_MPI  #ifdef PASO_MPI
577  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, index_t reduced_order, bool_t useElementsOnFace)
578  {  {
579    dim_t N0,N1,N2,N0t,NDOF0t,NE0,NE1,NE2,i0,i1,i2,kk,k,totalNECount,faceNECount,NDOF0,NDOF1,NDOF2,NFaceElements,NUMNODES;//,M0,M1,M2;    dim_t N0,N1,N2,N0t,NDOF0t,NE0,NE1,NE2,i0,i1,i2,kk,k,totalNECount,faceNECount,NDOF0,NDOF1,NDOF2,NFaceElements,NUMNODES;//,M0,M1,M2;
580    dim_t idCount, NE0_local, numNodesLocal, numDOFLocal, numElementsLocal, numElementsInternal, nodesExternal[2], DOFExternal[2], numNodesExternal;    dim_t idCount, NE0_local, numNodesLocal, numDOFLocal, numElementsLocal, numElementsInternal, nodesExternal[2], DOFExternal[2], numNodesExternal;
# Line 607  Finley_Mesh* Finley_RectangularMesh_Hex8 Line 611  Finley_Mesh* Finley_RectangularMesh_Hex8
611    /* use the serial version to generate the mesh for the 1-CPU case */    /* use the serial version to generate the mesh for the 1-CPU case */
612    if( mpi_info->size==1 )    if( mpi_info->size==1 )
613    {    {
614      out =  Finley_RectangularMesh_Hex8_singleCPU( numElements, Length, periodic, order, useElementsOnFace, mpi_info );      out =  Finley_RectangularMesh_Hex8_singleCPU( numElements, Length, periodic, order, reduced_order, useElementsOnFace, mpi_info );
615          return out;          return out;
616    }        }    
617    
# Line 646  Finley_Mesh* Finley_RectangularMesh_Hex8 Line 650  Finley_Mesh* Finley_RectangularMesh_Hex8
650    /*  allocate mesh: */    /*  allocate mesh: */
651    sprintf(name,"Rectangular %d x %d x %d mesh",N0,N1,N2);    sprintf(name,"Rectangular %d x %d x %d mesh",N0,N1,N2);
652    
653    out=Finley_Mesh_alloc(name,3,order,mpi_info);    out=Finley_Mesh_alloc(name,3,order,reduced_order,mpi_info);
654    if (! Finley_noError()) return NULL;    if (! Finley_noError()) return NULL;
655    
656    out->Elements=Finley_ElementFile_alloc(Hex8,out->order,mpi_info);    out->Elements=Finley_ElementFile_alloc(Hex8,out->order,out->reduced_order, mpi_info);
657    if (useElementsOnFace) {    if (useElementsOnFace) {
658       out->FaceElements=Finley_ElementFile_alloc(Hex8Face,out->order,mpi_info);       out->FaceElements=Finley_ElementFile_alloc(Hex8Face,out->order,out->reduced_order, mpi_info);
659       out->ContactElements=Finley_ElementFile_alloc(Hex8Face_Contact,out->order,mpi_info);       out->ContactElements=Finley_ElementFile_alloc(Hex8Face_Contact,out->order,out->reduced_order, mpi_info);
660    } else {    } else {
661       out->FaceElements=Finley_ElementFile_alloc(Rec4,out->order,mpi_info);       out->FaceElements=Finley_ElementFile_alloc(Rec4,out->order,out->reduced_order, mpi_info);
662       out->ContactElements=Finley_ElementFile_alloc(Rec4_Contact,out->order,mpi_info);       out->ContactElements=Finley_ElementFile_alloc(Rec4_Contact,out->order,out->reduced_order, mpi_info);
663    }    }
664    out->Points=Finley_ElementFile_alloc(Point1,out->order,mpi_info);    out->Points=Finley_ElementFile_alloc(Point1,out->order,out->reduced_order, mpi_info);
665    
666    if (! Finley_noError()) {    if (! Finley_noError()) {
667        Finley_Mesh_dealloc(out);        Finley_Mesh_dealloc(out);
# Line 666  Finley_Mesh* Finley_RectangularMesh_Hex8 Line 670  Finley_Mesh* Finley_RectangularMesh_Hex8
670        
671    /*  allocate tables: */    /*  allocate tables: */
672    Finley_NodeFile_allocTable(out->Nodes,N0t*N1*N2);    Finley_NodeFile_allocTable(out->Nodes,N0t*N1*N2);
   Finley_NodeDistribution_allocTable( out->Nodes->degreeOfFreedomDistribution, numDOFLocal*NDOF1*NDOF2, NDOF1*NDOF2*2, 0 );  
673    Finley_ElementFile_allocTable(out->Elements,(numElementsLocal)*NE1*NE2);    Finley_ElementFile_allocTable(out->Elements,(numElementsLocal)*NE1*NE2);
674    Finley_ElementFile_allocTable(out->FaceElements,NFaceElements);    Finley_ElementFile_allocTable(out->FaceElements,NFaceElements);
675    
676      Finley_NodeDistribution_allocTable( out->Nodes->degreeOfFreedomDistribution, numDOFLocal*NDOF1*NDOF2, NDOF1*NDOF2*2, 0 );
677      Finley_ElementDistribution_allocTable( out->Elements->elementDistribution, numElementsLocal*NE1*NE2, NE1*NE2*(numElementsLocal-boundaryRight*(!periodic[1])) );
678      Finley_ElementDistribution_allocTable( out->FaceElements->elementDistribution, NFaceElements, NFaceElements-2*boundaryRight*(NE2*(!periodic[1])+NE1*(!periodic[2])) );
679    if (! Finley_noError()) {    if (! Finley_noError()) {
680        Finley_Mesh_dealloc(out);        Finley_Mesh_dealloc(out);
681        return NULL;        return NULL;
# Line 1054  Finley_Mesh* Finley_RectangularMesh_Hex8 Line 1061  Finley_Mesh* Finley_RectangularMesh_Hex8
1061    #ifdef Finley_TRACE    #ifdef Finley_TRACE
1062    printf("timing: mesh generation: %.4e sec\n",Finley_timer()-time0);    printf("timing: mesh generation: %.4e sec\n",Finley_timer()-time0);
1063    #endif    #endif
1064      if (Finley_noError()) {
1065           if ( ! Finley_Mesh_isPrepared(out) ) {
1066              Finley_setError(SYSTEM_ERROR,"Mesh is not prepared for calculation. Contact the programmers.");
1067           }
1068      }
1069    return out;    return out;
1070  }  }
1071  #endif  #endif

Legend:
Removed from v.787  
changed lines
  Added in v.1062

  ViewVC Help
Powered by ViewVC 1.1.26