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

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

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

revision 1749 by gross, Wed Sep 3 07:25:01 2008 UTC revision 1766 by gross, Mon Sep 8 02:51:14 2008 UTC
# Line 35  void Finley_Mesh_prepare(Finley_Mesh* in Line 35  void Finley_Mesh_prepare(Finley_Mesh* in
35       node_distribution=TMPMEMALLOC(in->MPIInfo->size+1,index_t);       node_distribution=TMPMEMALLOC(in->MPIInfo->size+1,index_t);
36       if (! (Finley_checkPtr(distribution) || Finley_checkPtr(node_distribution))) {       if (! (Finley_checkPtr(distribution) || Finley_checkPtr(node_distribution))) {
37          /* first we create dense labeling for the DOFs */          /* first we create dense labeling for the DOFs */
38    
39          newGlobalNumDOFs=Finley_NodeFile_createDenseDOFLabeling(in->Nodes);          newGlobalNumDOFs=Finley_NodeFile_createDenseDOFLabeling(in->Nodes);
40    
41          /* create a distribution of the global DOFs and determine          /* create a distribution of the global DOFs and determine
# Line 50  void Finley_Mesh_prepare(Finley_Mesh* in Line 51  void Finley_Mesh_prepare(Finley_Mesh* in
51       /* at this stage we are able to start an optimization of the DOF distribution using ParaMetis */       /* at this stage we are able to start an optimization of the DOF distribution using ParaMetis */
52       /* on return distribution is altered and new DOF ids have been assigned */       /* on return distribution is altered and new DOF ids have been assigned */
53       if (Finley_noError() && optimize && in->MPIInfo->size>1) {       if (Finley_noError() && optimize && in->MPIInfo->size>1) {
54             Finley_Mesh_optimizeDOFDistribution(in,distribution);
          Finley_Mesh_optimizeDOFDistribution(in,distribution);  
   
55           if (Finley_noError()) Finley_Mesh_distributeByRankOfDOF(in,distribution);           if (Finley_noError()) Finley_Mesh_distributeByRankOfDOF(in,distribution);
   
56       }       }
57       /* now a local labeling of the DOF is introduced */       /* the local labeling of the degrees of free is optimized */
58       if (Finley_noError() && optimize) {       if (Finley_noError() && optimize) {
59         Finley_Mesh_optimizeDOFLabeling(in,distribution);         Finley_Mesh_optimizeDOFLabeling(in,distribution);
60       }       }
# Line 66  void Finley_Mesh_prepare(Finley_Mesh* in Line 64  void Finley_Mesh_prepare(Finley_Mesh* in
64    
65       /* create the global indices */       /* create the global indices */
66       if (Finley_noError()) {       if (Finley_noError()) {
67    
68    
69          maskReducedNodes=TMPMEMALLOC(in->Nodes->numNodes,index_t);          maskReducedNodes=TMPMEMALLOC(in->Nodes->numNodes,index_t);
70          indexReducedNodes=TMPMEMALLOC(in->Nodes->numNodes,index_t);          indexReducedNodes=TMPMEMALLOC(in->Nodes->numNodes,index_t);
71          if (! ( Finley_checkPtr(maskReducedNodes) ||  Finley_checkPtr(indexReducedNodes) ) ) {          if (! ( Finley_checkPtr(maskReducedNodes) ||  Finley_checkPtr(indexReducedNodes) ) ) {
72    
73    /* useful DEBUG:
74    {index_t MIN_id,MAX_id;
75    printf("Mesh_prepare: global DOF : %d\n",newGlobalNumDOFs);
76    Finley_NodeFile_setGlobalIdRange(&MIN_id,&MAX_id,in->Nodes);
77    printf("Mesh_prepare: global node id range = %d :%d\n", MIN_id,MAX_id);
78    Finley_NodeFile_setIdRange(&MIN_id,&MAX_id,in->Nodes);
79    printf("Mesh_prepare: local node id range = %d :%d\n", MIN_id,MAX_id);
80    }
81    */
82            #pragma omp parallel for private(i) schedule(static)            #pragma omp parallel for private(i) schedule(static)
83            for (i=0;i<in->Nodes->numNodes;++i) maskReducedNodes[i]=-1;            for (i=0;i<in->Nodes->numNodes;++i) maskReducedNodes[i]=-1;
84    
85            Finley_Mesh_markNodes(maskReducedNodes,0,in,1);            Finley_Mesh_markNodes(maskReducedNodes,0,in,TRUE);
86        
87            numReducedNodes=Finley_Util_packMask(in->Nodes->numNodes,maskReducedNodes,indexReducedNodes);            numReducedNodes=Finley_Util_packMask(in->Nodes->numNodes,maskReducedNodes,indexReducedNodes);
88    
89            Finley_NodeFile_createDenseNodeLabeling(in->Nodes, node_distribution, distribution);            Finley_NodeFile_createDenseNodeLabeling(in->Nodes, node_distribution, distribution);
   
90            Finley_NodeFile_createDenseReducedDOFLabeling(in->Nodes,maskReducedNodes);            Finley_NodeFile_createDenseReducedDOFLabeling(in->Nodes,maskReducedNodes);
91            Finley_NodeFile_createDenseReducedNodeLabeling(in->Nodes,maskReducedNodes);            Finley_NodeFile_createDenseReducedNodeLabeling(in->Nodes,maskReducedNodes);
92            /* create the missing mappings */            /* create the missing mappings */
93    
94            if (Finley_noError()) Finley_Mesh_createNodeFileMappings(in,numReducedNodes,indexReducedNodes,distribution, node_distribution);            if (Finley_noError()) Finley_Mesh_createNodeFileMappings(in,numReducedNodes,indexReducedNodes,distribution, node_distribution);
95          }          }
96    
# Line 93  void Finley_Mesh_prepare(Finley_Mesh* in Line 102  void Finley_Mesh_prepare(Finley_Mesh* in
102       TMPMEMFREE(node_distribution);       TMPMEMFREE(node_distribution);
103    
104       Finley_Mesh_setTagsInUse(in);       Finley_Mesh_setTagsInUse(in);
   
105       return;       return;
106  }  }
107    

Legend:
Removed from v.1749  
changed lines
  Added in v.1766

  ViewVC Help
Powered by ViewVC 1.1.26