/[escript]/branches/doubleplusgood/dudley/src/Mesh.cpp
ViewVC logotype

Diff of /branches/doubleplusgood/dudley/src/Mesh.cpp

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

revision 730 by bcumming, Mon May 15 04:03:49 2006 UTC revision 1062 by gross, Mon Mar 26 06:17:53 2007 UTC
# Line 10  Line 10 
10   ************************************************************   ************************************************************
11  */  */
12    
13    
14  /**************************************************************/  /**************************************************************/
15    
16  /*   Finley: Mesh */  /*   Finley: Mesh */
# Line 31  Line 32 
32  extern Finley_RefElementInfo Finley_RefElement_InfoList[];  extern Finley_RefElementInfo Finley_RefElement_InfoList[];
33    
34  #ifndef PASO_MPI  #ifndef PASO_MPI
35  Finley_Mesh* Finley_Mesh_alloc(char* name,dim_t numDim, index_t order)  Finley_Mesh* Finley_Mesh_alloc(char* name,dim_t numDim, index_t order, index_t reduced_order)
36  #else  #else
37  Finley_Mesh* Finley_Mesh_alloc(char* name,dim_t numDim, index_t order, Paso_MPIInfo *mpi_info)  Finley_Mesh* Finley_Mesh_alloc(char* name,dim_t numDim, index_t order, index_t reduced_order, Paso_MPIInfo *mpi_info)
38  #endif  #endif
39  {  {
40    Finley_Mesh *out;    Finley_Mesh *out;
# Line 48  Finley_Mesh* Finley_Mesh_alloc(char* nam Line 49  Finley_Mesh* Finley_Mesh_alloc(char* nam
49    out->FaceElements=NULL;    out->FaceElements=NULL;
50    out->Points=NULL;          out->Points=NULL;      
51    out->ContactElements=NULL;          out->ContactElements=NULL;      
52      out->TagMap=NULL;      
53    out->reference_counter=0;    out->reference_counter=0;
54    
55    out->FullFullPattern=NULL;    out->FullFullPattern=NULL;
# Line 85  Finley_Mesh* Finley_Mesh_alloc(char* nam Line 87  Finley_Mesh* Finley_Mesh_alloc(char* nam
87        return NULL;        return NULL;
88    }    }
89    out->order=order;    out->order=order;
90      out->reduced_order=reduced_order;
91    out->Elements=NULL;    out->Elements=NULL;
92    out->FaceElements=NULL;    out->FaceElements=NULL;
93    out->Points=NULL;    out->Points=NULL;
# Line 119  void Finley_Mesh_dealloc(Finley_Mesh* in Line 122  void Finley_Mesh_dealloc(Finley_Mesh* in
122         Finley_ElementFile_dealloc(in->FaceElements);         Finley_ElementFile_dealloc(in->FaceElements);
123         Finley_ElementFile_dealloc(in->ContactElements);         Finley_ElementFile_dealloc(in->ContactElements);
124         Finley_ElementFile_dealloc(in->Points);         Finley_ElementFile_dealloc(in->Points);
125           Finley_TagMap_free(in->TagMap);
126         Paso_SystemMatrixPattern_dealloc(in->FullFullPattern);         Paso_SystemMatrixPattern_dealloc(in->FullFullPattern);
127         Paso_SystemMatrixPattern_dealloc(in->FullReducedPattern);         Paso_SystemMatrixPattern_dealloc(in->FullReducedPattern);
128         Paso_SystemMatrixPattern_dealloc(in->ReducedFullPattern);         Paso_SystemMatrixPattern_dealloc(in->ReducedFullPattern);
# Line 160  dim_t Finley_Mesh_getNumDegreesOfFreedom Line 164  dim_t Finley_Mesh_getNumDegreesOfFreedom
164  dim_t Finley_Mesh_getReducedNumDegreesOfFreedom(Finley_Mesh *in) {  dim_t Finley_Mesh_getReducedNumDegreesOfFreedom(Finley_Mesh *in) {
165    return in->Nodes->reducedNumDegreesOfFreedom;    return in->Nodes->reducedNumDegreesOfFreedom;
166  }  }
167    
168    #ifdef PASO_MPI
169    void print_mesh_statistics( Finley_Mesh *out, bool_t reduced )
170    {
171      index_t i, r, j, N, M, dim;
172        int *ref;  
173        dim = out->Nodes->numDim;
174    
175        if( !reduced ){
176            printf( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\nMESH STATISTICS\n\nFULL MESH\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" );
177            printf( "\nNodes\n========\n\n" );
178            printf( "\t%d internal DOF\n\t%d boundary DOF\n\t%d local DOF\n\t%d external DOF\n", out->Nodes->degreeOfFreedomDistribution->numInternal, out->Nodes->degreeOfFreedomDistribution->numBoundary, out->Nodes->degreeOfFreedomDistribution->numLocal, out->Nodes->degreeOfFreedomDistribution->numExternal);
179            for( i=0; i<out->Nodes->numNodes; i++ ){
180                printf( "node %d\t: id %d   \tDOF %d   \t: tag %d  \t: Dom %d  \t: coordinates [%3g", i, out->Nodes->Id[i], out->Nodes->degreeOfFreedom[i], out->Nodes->Tag[i], out->Nodes->Dom[i], out->Nodes->Coordinates[INDEX2(0,i,dim)] );
181                for( j=1; j<dim; j++ )
182                    printf( ", %3g",  out->Nodes->Coordinates[INDEX2(j,i,dim)]);
183                printf( " ]\n" );
184            }
185    
186            printf( "Elements\n=========\n\n" );
187            printf( "\t%d internal\n\t%d boundary\n\t%d local\n", out->Elements->elementDistribution->numInternal, out->Elements->elementDistribution->numBoundary, out->Elements->elementDistribution->numLocal );
188            N = out->Elements->ReferenceElement->Type->numNodes;
189            for( i=0; i<out->Elements->numElements; i++ ){
190                printf( "element %d    \t: id %d  \t: dom %d  \t: nodes [ %2d", i, out->Elements->Id[i], out->Elements->Dom[i], out->Elements->Nodes[INDEX2(0,i,N)] );
191                for( j=1; j<N; j++ )
192                    printf( ", %2d", out->Elements->Nodes[INDEX2(j,i,N)]);  
193                printf( " ] -> " );
194                if( N>8 )
195                    printf( "\n\t\t\t\t\t\t" );
196                printf( ": DOF   [ %2d", out->Nodes->degreeOfFreedom[out->Elements->Nodes[INDEX2(0,i,N)]] );    
197                for( j=1; j<N; j++ )
198                    printf( ", %2d", out->Nodes->degreeOfFreedom[out->Elements->Nodes[INDEX2(j,i,N)]]);
199                printf( " ]\n" );  
200            }
201    
202            printf( "\nFace Elements\n==========\n\n" );
203            printf( "\t%d internal\n\t%d boundary\n\t%d local\n", out->FaceElements->elementDistribution->numInternal, out->FaceElements->elementDistribution->numBoundary, out->FaceElements->elementDistribution->numLocal );
204            N = out->FaceElements->ReferenceElement->Type->numNodes;
205            for( i=0; i<out->FaceElements->numElements; i++ ){
206                printf( "face element %d \t: id %d  \t: dom %d  \t: nodes [ %2d", i, out->FaceElements->Id[i], out->FaceElements->Dom[i], out->FaceElements->Nodes[INDEX2(0,i,N)] );
207                for( j=1; j<N; j++ )
208                    printf( ", %2d", out->FaceElements->Nodes[INDEX2(j,i,N)]  );    
209                printf( " ] -> " );
210                if( N>8 )
211                    printf( "\n\t\t\t\t\t\t" );
212                printf( ": DOF   [ %2d", out->Nodes->degreeOfFreedom[out->FaceElements->Nodes[INDEX2(0,i,N)]]);
213                for( j=1; j<N; j++ )
214                    printf( ", %2d", out->Nodes->degreeOfFreedom[out->FaceElements->Nodes[INDEX2(j,i,N)]]);
215                printf( " ]\n" );  
216            }
217            printf( "\nDistribution Data\n==========\n\n" );
218            Finley_NodeDistribution_print( out->Nodes->degreeOfFreedomDistribution, stdout );
219        }
220        else{
221            printf( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\nMESH STATISTICS\n\nREDUCED MESH\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" );
222            printf( "\nNodes\n========\n\n" );
223            printf( "\t%d internal DOF\n\t%d boundary DOF\n\t%d local DOF\n\t%d external DOF\n", out->Nodes->reducedDegreeOfFreedomDistribution->numInternal, out->Nodes->reducedDegreeOfFreedomDistribution->numBoundary, out->Nodes->reducedDegreeOfFreedomDistribution->numLocal, out->Nodes->reducedDegreeOfFreedomDistribution->numExternal);
224            for( i=0, r=0; i<out->Nodes->numNodes; i++ ){
225                if( out->Nodes->toReduced[i]>=0 ){
226                    printf( "node %d   \t: id %d   \tDOF %d   \t: tag %d  \t: Dom %d  \t: coordinates [%3g", r, out->Nodes->Id[i], out->Nodes->reducedDegreeOfFreedom[i], out->Nodes->Tag[i], out->Nodes->Dom[i], out->Nodes->Coordinates[INDEX2(0,i,dim)] );
227                    for( j=1; j<dim; j++ )
228                        printf( ", %3g",  out->Nodes->Coordinates[INDEX2(j,i,dim)]);
229                    printf( " ]\n" );
230                    r++;
231                }
232            }
233    
234            printf( "Elements\n=========\n\n" );
235            printf( "\t%d internal\n\t%d boundary\n\t%d local\n", out->Elements->elementDistribution->numInternal, out->Elements->elementDistribution->numBoundary, out->Elements->elementDistribution->numLocal );
236            N = out->Elements->LinearReferenceElement->Type->numNodes;
237            M = out->Elements->ReferenceElement->Type->numNodes;
238            ref = out->Elements->ReferenceElement->Type->linearNodes;
239            for( i=0; i<out->Elements->numElements; i++ ){
240                printf( "element %d    \t: id %d  \t: dom %d  \t: nodes [ %3d", i, out->Elements->Id[i], out->Elements->Dom[i], out->Nodes->toReduced[out->Elements->Nodes[INDEX2(ref[0],i,M)]] );
241                for( j=1; j<N; j++ ){
242                    printf( ", %3d", out->Nodes->toReduced[out->Elements->Nodes[INDEX2(ref[j],i,M)]] );
243                }
244                printf( " ] DOF [ %3d", out->Nodes->reducedDegreeOfFreedom[out->Elements->Nodes[INDEX2(ref[0],i,M)]] );
245                for( j=1; j<N; j++ )
246                    printf( ", %3d", out->Nodes->reducedDegreeOfFreedom[out->Elements->Nodes[INDEX2(ref[j],i,M)]]);
247                printf( " ]\n" );  
248            }
249    
250            printf( "\nFace Elements\n=================================================\n\n" );
251            printf( "\t%d internal\n\t%d boundary\n\t%d local\n", out->FaceElements->elementDistribution->numInternal, out->FaceElements->elementDistribution->numBoundary, out->FaceElements->elementDistribution->numLocal );
252            N = out->FaceElements->LinearReferenceElement->Type->numNodes;
253            M = out->FaceElements->ReferenceElement->Type->numNodes;
254            ref = out->FaceElements->ReferenceElement->Type->linearNodes;
255            for( i=0; i<out->FaceElements->numElements; i++ ){
256                printf( "face element %d \t: id %d  \t: dom %d  \t: nodes [ %3d", i, out->FaceElements->Id[i], out->FaceElements->Dom[i], out->Nodes->toReduced[out->FaceElements->Nodes[INDEX2(ref[0],i,M)]] );
257                for( j=1; j<N; j++ )
258                    printf( ", %3d", out->Nodes->toReduced[out->FaceElements->Nodes[INDEX2(j,i,M)]]  );
259                printf( " ] DOF [ %3d", out->Nodes->reducedDegreeOfFreedom[out->FaceElements->Nodes[INDEX2(ref[0],i,M)]]);  
260                for( j=1; j<N; j++ )
261                    printf( ", %3d", out->Nodes->reducedDegreeOfFreedom[out->FaceElements->Nodes[INDEX2(j,i,M)]]);  
262                printf( " ]\n" );  
263            }
264    
265            printf( "\nDistribution Data\n==================\n\n" );
266            Finley_NodeDistribution_print( out->Nodes->reducedDegreeOfFreedomDistribution, stdout );
267        }
268    }
269    #endif
270  /*  /*
271  * $Log$  * $Log$
272  * Revision 1.6  2005/09/15 03:44:22  jgs  * Revision 1.6  2005/09/15 03:44:22  jgs

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

  ViewVC Help
Powered by ViewVC 1.1.26