/[escript]/trunk-mpi-branch/finley/src/Mesh_prepare.c
ViewVC logotype

Diff of /trunk-mpi-branch/finley/src/Mesh_prepare.c

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

revision 1222 by ksteube, Tue Feb 13 22:56:57 2007 UTC revision 1223 by gross, Fri Aug 3 02:40:39 2007 UTC
# Line 27  Line 27 
27    
28  void Finley_Mesh_prepare(Finley_Mesh* in) {  void Finley_Mesh_prepare(Finley_Mesh* in) {
29    
30         /* set the labeling vectors in node files: */       dim_t newGlobalNumDOFs=0;
31         Paso_MPI_rank* mpiRankOfDOF=NULL;
32         index_t* distribution=NULL;
33         if (in==NULL) return;
34         if (in->Nodes == NULL) return;
35    
36         /* first step is to distribute the elements according to a global distribution of DOF */
37    
38         mpiRankOfDOF=TMPMEMALLOC(in->Nodes->numNodes,Paso_MPI_rank);
39         distribution=TMPMEMALLOC(in->MPIInfo->size+1,index_t);
40         if (!(Finley_checkPtr(mpiRankOfDOF) || Finley_checkPtr(distribution))) {
41            /* first we create dense labeling for the DOFs */
42            newGlobalNumDOFs=Finley_NodeFile_createDenseDOFLabeling(in->Nodes);
43            /* create a distribution of the global DOFs and determine
44               the MPI_rank controling the DOFs on this processor      */
45            Paso_MPIInfo_setDistribution(in->MPIInfo,0,newGlobalNumDOFs-1,distribution);
46            Finley_NodeFile_assignMPIRankToDOFs(in->Nodes,mpiRankOfDOF,distribution);
47    
48            /* now the mesh is re-distributed according to the mpiRankOfDOF vector */
49            /* this will redistribute the Nodes and Elements including overlap and will create an element coloring
50               but will not create any mappings (see later in this function)                                   */
51            if (Finley_noError()) Finley_Mesh_distributeByRankOfDOF(in,mpiRankOfDOF);
52         }
53         TMPMEMFREE(mpiRankOfDOF);
54         TMPMEMFREE(distribution);
55         if (!Finley_noError()) return;
56    
57         /* at this stage we are able to start an optimization of the DOF distribution using ParaMetis */
58        
59         /* now a local labeling of the DOF is introduced */
60    return;
61    
62          /* set the labeling vectors in node files: */
63         Finley_Mesh_prepareNodes(in);         Finley_Mesh_prepareNodes(in);
64    
 #ifndef PASO_MPI  
65         /* rearrange elements: */         /* rearrange elements: */
66         Finley_Mesh_optimizeElementDistribution(in);         Finley_Mesh_optimizeElementDistribution(in);
67    
68         /* improve coloring */         /* improve coloring */
69           /* precoloring! */
70         Finley_Mesh_improveColoring(in);         Finley_Mesh_improveColoring(in);
 #endif  
71  }  }
72    
73  bool_t Finley_Mesh_isPrepared(Finley_Mesh* in) {  bool_t Finley_Mesh_isPrepared(Finley_Mesh* in) {
# Line 54  bool_t Finley_Mesh_isPrepared(Finley_Mes Line 85  bool_t Finley_Mesh_isPrepared(Finley_Mes
85  /*  tries to reduce the coloring for all element files: */  /*  tries to reduce the coloring for all element files: */
86  /*                                                      */  /*                                                      */
87  void Finley_Mesh_improveColoring(Finley_Mesh* in) {  void Finley_Mesh_improveColoring(Finley_Mesh* in) {
88    Finley_ElementFile_improveColoring(in->Elements,in->Nodes->numNodes,in->Nodes->degreeOfFreedom);    Finley_ElementFile_improveColoring(in->Elements,in->Nodes->degreesOfFreedomMapping->numNodes,in->Nodes->degreesOfFreedomMapping->target);
89    Finley_ElementFile_improveColoring(in->FaceElements,in->Nodes->numNodes,in->Nodes->degreeOfFreedom);    Finley_ElementFile_improveColoring(in->FaceElements,in->Nodes->degreesOfFreedomMapping->numNodes,in->Nodes->degreesOfFreedomMapping->target);
90    Finley_ElementFile_improveColoring(in->Points,in->Nodes->numNodes,in->Nodes->degreeOfFreedom);    Finley_ElementFile_improveColoring(in->Points,in->Nodes->degreesOfFreedomMapping->numNodes,in->Nodes->degreesOfFreedomMapping->target);
91    Finley_ElementFile_improveColoring(in->ContactElements,in->Nodes->numNodes,in->Nodes->degreeOfFreedom);    Finley_ElementFile_improveColoring(in->ContactElements,in->Nodes->degreesOfFreedomMapping->numNodes,in->Nodes->degreesOfFreedomMapping->target);
92  }  }
93  /*                                                                    */  /*                                                                    */
94  /*  redistribute elements to minimize communication during assemblage */  /*  redistribute elements to minimize communication during assemblage */
# Line 68  void Finley_Mesh_optimizeElementDistribu Line 99  void Finley_Mesh_optimizeElementDistribu
99    Finley_ElementFile_optimizeDistribution(&(in->Points));    Finley_ElementFile_optimizeDistribution(&(in->Points));
100    Finley_ElementFile_optimizeDistribution(&(in->ContactElements));    Finley_ElementFile_optimizeDistribution(&(in->ContactElements));
101  }  }
   
 /*  
 * $Log$  
 * Revision 1.2  2005/09/15 03:44:22  jgs  
 * Merge of development branch dev-02 back to main trunk on 2005-09-15  
 *  
 * Revision 1.1.1.1.6.1  2005/09/07 06:26:19  gross  
 * the solver from finley are put into the standalone package paso now  
 *  
 * 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.1222  
changed lines
  Added in v.1223

  ViewVC Help
Powered by ViewVC 1.1.26