/[escript]/trunk/finley/src/Mesh_prepare.cpp
ViewVC logotype

Diff of /trunk/finley/src/Mesh_prepare.cpp

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

trunk/finley/src/Mesh_prepare.c revision 3981 by jfenwick, Fri Sep 21 02:47:54 2012 UTC trunk/finley/src/Mesh_prepare.cpp revision 4428 by caltinay, Thu May 30 06:39:10 2013 UTC
# Line 1  Line 1 
1    
2  /*****************************************************************************  /*****************************************************************************
3  *  *
4  * Copyright (c) 2003-2012 by University of Queensland  * Copyright (c) 2003-2013 by University of Queensland
5  * http://www.uq.edu.au  * http://www.uq.edu.au
6  *  *
7  * Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
# Line 34  void Finley_Mesh_prepare(Finley_Mesh* in Line 34  void Finley_Mesh_prepare(Finley_Mesh* in
34    
35       /* first step is to distribute the elements according to a global distribution of DOF */       /* first step is to distribute the elements according to a global distribution of DOF */
36    
37       distribution=TMPMEMALLOC(in->MPIInfo->size+1,index_t);       distribution=new index_t[in->MPIInfo->size+1];
38       node_distribution=TMPMEMALLOC(in->MPIInfo->size+1,index_t);       node_distribution=new index_t[in->MPIInfo->size+1];
39       if (! (Finley_checkPtr(distribution) || Finley_checkPtr(node_distribution))) {       if (! (Finley_checkPtr(distribution) || Finley_checkPtr(node_distribution))) {
40          /* first we create dense labeling for the DOFs */          /* first we create dense labeling for the DOFs */
41    
42          newGlobalNumDOFs=Finley_NodeFile_createDenseDOFLabeling(in->Nodes);          newGlobalNumDOFs=in->Nodes->createDenseDOFLabeling();
43    
44          /* create a distribution of the global DOFs and determine          /* create a distribution of the global DOFs and determine
45             the MPI_rank controling the DOFs on this processor      */             the MPI_rank controlling the DOFs on this processor      */
46          Esys_MPIInfo_setDistribution(in->MPIInfo,0,newGlobalNumDOFs-1,distribution);          Esys_MPIInfo_setDistribution(in->MPIInfo,0,newGlobalNumDOFs-1,distribution);
47    
48          /* now the mesh is re-distributed according to the mpiRankOfDOF vector */          /* now the mesh is re-distributed according to the mpiRankOfDOF vector */
# Line 57  void Finley_Mesh_prepare(Finley_Mesh* in Line 57  void Finley_Mesh_prepare(Finley_Mesh* in
57           Finley_Mesh_optimizeDOFDistribution(in,distribution);           Finley_Mesh_optimizeDOFDistribution(in,distribution);
58           if (Finley_noError()) Finley_Mesh_distributeByRankOfDOF(in,distribution);           if (Finley_noError()) Finley_Mesh_distributeByRankOfDOF(in,distribution);
59       }       }
60       /* the local labeling of the degrees of freedom is optimized */       /* the local labelling of the degrees of freedom is optimized */
61       if (Finley_noError() && optimize) {       if (Finley_noError() && optimize) {
62         Finley_Mesh_optimizeDOFLabeling(in,distribution);         Finley_Mesh_optimizeDOFLabeling(in,distribution);
63       }       }
# Line 69  void Finley_Mesh_prepare(Finley_Mesh* in Line 69  void Finley_Mesh_prepare(Finley_Mesh* in
69       if (Finley_noError()) {       if (Finley_noError()) {
70    
71    
72          maskReducedNodes=TMPMEMALLOC(in->Nodes->numNodes,index_t);          maskReducedNodes=new index_t[in->Nodes->numNodes];
73          indexReducedNodes=TMPMEMALLOC(in->Nodes->numNodes,index_t);          indexReducedNodes=new index_t[in->Nodes->numNodes];
74          if (! ( Finley_checkPtr(maskReducedNodes) ||  Finley_checkPtr(indexReducedNodes) ) ) {          if (! ( Finley_checkPtr(maskReducedNodes) ||  Finley_checkPtr(indexReducedNodes) ) ) {
75    
76  /* useful DEBUG:  /* useful DEBUG:
77  {index_t MIN_id,MAX_id;  {index_t MIN_id,MAX_id;
78  printf("Mesh_prepare: global DOF : %d\n",newGlobalNumDOFs);  printf("Mesh_prepare: global DOF : %d\n",newGlobalNumDOFs);
79  Finley_NodeFile_setGlobalIdRange(&MIN_id,&MAX_id,in->Nodes);  in->Nodes->setGlobalIdRange(&MIN_id,&MAX_id);
80  printf("Mesh_prepare: global node id range = %d :%d\n", MIN_id,MAX_id);  printf("Mesh_prepare: global node id range = %d :%d\n", MIN_id,MAX_id);
81  Finley_NodeFile_setIdRange(&MIN_id,&MAX_id,in->Nodes);  in->Nodes->setIdRange(&MIN_id,&MAX_id);
82  printf("Mesh_prepare: local node id range = %d :%d\n", MIN_id,MAX_id);  printf("Mesh_prepare: local node id range = %d :%d\n", MIN_id,MAX_id);
83  }  }
84  */  */
# Line 89  printf("Mesh_prepare: local node id rang Line 89  printf("Mesh_prepare: local node id rang
89        
90            numReducedNodes=Finley_Util_packMask(in->Nodes->numNodes,maskReducedNodes,indexReducedNodes);            numReducedNodes=Finley_Util_packMask(in->Nodes->numNodes,maskReducedNodes,indexReducedNodes);
91    
92            Finley_NodeFile_createDenseNodeLabeling(in->Nodes, node_distribution, distribution);            in->Nodes->createDenseNodeLabeling(node_distribution, distribution);
93            Finley_NodeFile_createDenseReducedDOFLabeling(in->Nodes,maskReducedNodes);            // created reduced DOF labeling
94            Finley_NodeFile_createDenseReducedNodeLabeling(in->Nodes,maskReducedNodes);            in->Nodes->createDenseReducedLabeling(maskReducedNodes, false);
95            /* create the missing mappings */            // created reduced node labeling
96              in->Nodes->createDenseReducedLabeling(maskReducedNodes, true);
97    
98              /* create the missing mappings */
99            if (Finley_noError()) Finley_Mesh_createNodeFileMappings(in,numReducedNodes,indexReducedNodes,distribution, node_distribution);            if (Finley_noError()) Finley_Mesh_createNodeFileMappings(in,numReducedNodes,indexReducedNodes,distribution, node_distribution);
100          }          }
101    
102          TMPMEMFREE(maskReducedNodes);          delete[] maskReducedNodes;
103          TMPMEMFREE(indexReducedNodes);          delete[] indexReducedNodes;
104       }       }
105    
106       TMPMEMFREE(distribution);       delete[] distribution;
107       TMPMEMFREE(node_distribution);       delete[] node_distribution;
108    
109       Finley_Mesh_setTagsInUse(in);       Finley_Mesh_setTagsInUse(in);
      return;  
110  }  }
111    
112  /*                                                      */  /*                                                      */
# Line 127  void Finley_Mesh_optimizeElementOrdering Line 128  void Finley_Mesh_optimizeElementOrdering
128    if (Finley_noError()) Finley_ElementFile_optimizeOrdering(&(in->ContactElements));    if (Finley_noError()) Finley_ElementFile_optimizeOrdering(&(in->ContactElements));
129  }  }
130    
 /*                                                                    */  
 /*  redistribute elements to minimize communication during assemblage */  
131  void Finley_Mesh_setTagsInUse(Finley_Mesh* in)  void Finley_Mesh_setTagsInUse(Finley_Mesh* in)
132  {  {
133      if (Finley_noError()) Finley_NodeFile_setTagsInUse(in->Nodes);      if (Finley_noError()) in->Nodes->updateTagList();
134      if (Finley_noError()) Finley_ElementFile_setTagsInUse(in->Elements);      if (Finley_noError()) Finley_ElementFile_setTagsInUse(in->Elements);
135      if (Finley_noError()) Finley_ElementFile_setTagsInUse(in->FaceElements);      if (Finley_noError()) Finley_ElementFile_setTagsInUse(in->FaceElements);
136      if (Finley_noError()) Finley_ElementFile_setTagsInUse(in->Points);      if (Finley_noError()) Finley_ElementFile_setTagsInUse(in->Points);
137      if (Finley_noError()) Finley_ElementFile_setTagsInUse(in->ContactElements);      if (Finley_noError()) Finley_ElementFile_setTagsInUse(in->ContactElements);
138  }  }
139    

Legend:
Removed from v.3981  
changed lines
  Added in v.4428

  ViewVC Help
Powered by ViewVC 1.1.26