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

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

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

revision 1741 by gross, Mon Sep 1 04:06:41 2008 UTC revision 1749 by gross, Wed Sep 3 07:25:01 2008 UTC
# Line 255  void Mesh_createDOFMappingAndCoupling(Fi Line 255  void Mesh_createDOFMappingAndCoupling(Fi
255    }    }
256  }  }
257    
258  void Finley_Mesh_createMappings(Finley_Mesh* mesh, index_t* distribution) {  void Finley_Mesh_createMappings(Finley_Mesh* mesh, index_t* dof_distribution, index_t* node_distribution) {
259    int i;    int i;
260    index_t *maskReducedNodes=NULL, *indexReducedNodes=NULL;    index_t *maskReducedNodes=NULL, *indexReducedNodes=NULL;
261    dim_t numReducedNodes;    dim_t numReducedNodes;
# Line 268  void Finley_Mesh_createMappings(Finley_M Line 268  void Finley_Mesh_createMappings(Finley_M
268      for (i=0;i<mesh->Nodes->numNodes;++i) maskReducedNodes[i]=-1;      for (i=0;i<mesh->Nodes->numNodes;++i) maskReducedNodes[i]=-1;
269      Finley_Mesh_markNodes(maskReducedNodes,0,mesh,TRUE);      Finley_Mesh_markNodes(maskReducedNodes,0,mesh,TRUE);
270      numReducedNodes=Finley_Util_packMask(mesh->Nodes->numNodes,maskReducedNodes,indexReducedNodes);      numReducedNodes=Finley_Util_packMask(mesh->Nodes->numNodes,maskReducedNodes,indexReducedNodes);
271      if (Finley_noError()) Finley_Mesh_createNodeFileMappings(mesh,numReducedNodes,indexReducedNodes,distribution);      if (Finley_noError()) Finley_Mesh_createNodeFileMappings(mesh,numReducedNodes,indexReducedNodes,dof_distribution, node_distribution);
272    }    }
273    
274    TMPMEMFREE(maskReducedNodes);    TMPMEMFREE(maskReducedNodes);
275    TMPMEMFREE(indexReducedNodes);    TMPMEMFREE(indexReducedNodes);
276  }  }
277    
278  void Finley_Mesh_createNodeFileMappings(Finley_Mesh* in, dim_t numReducedNodes, index_t* indexReducedNodes, index_t* dof_first_component) {  void Finley_Mesh_createNodeFileMappings(Finley_Mesh* in, dim_t numReducedNodes, index_t* indexReducedNodes, index_t* dof_first_component, index_t* nodes_first_component) {
279    
280    
281    index_t myFirstDOF, myLastDOF, myFirstNode, myLastNode, *reduced_dof_first_component=NULL, *nodeMask=NULL,    index_t myFirstDOF, myLastDOF, myFirstNode, myLastNode, *reduced_dof_first_component=NULL, *nodeMask=NULL,
282           *reduced_nodes_first_component=NULL, *nodes_first_component=NULL,k,           *reduced_nodes_first_component=NULL, k,*maskMyReducedDOF=NULL, *indexMyReducedDOF=NULL, *maskMyReducedNodes=NULL, *indexMyReducedNodes=NULL;
          *maskMyReducedDOF=NULL, *indexMyReducedDOF=NULL, *maskMyReducedNodes=NULL, *indexMyReducedNodes=NULL;  
283    dim_t myNumDOF, myNumNodes, myNumReducedNodes, myNumReducedDOF, globalNumReducedNodes, globalNumReducedDOF,i,mpiSize, minGlobalNodeIndex,maxGlobalNodeIndex;    dim_t myNumDOF, myNumNodes, myNumReducedNodes, myNumReducedDOF, globalNumReducedNodes, globalNumReducedDOF,i,mpiSize, minGlobalNodeIndex,maxGlobalNodeIndex;
284    Paso_MPI_rank myRank;    Paso_MPI_rank myRank;
285    
# Line 290  void Finley_Mesh_createNodeFileMappings( Line 289  void Finley_Mesh_createNodeFileMappings(
289    
290    reduced_dof_first_component=TMPMEMALLOC(mpiSize+1,index_t);    reduced_dof_first_component=TMPMEMALLOC(mpiSize+1,index_t);
291    reduced_nodes_first_component=TMPMEMALLOC(mpiSize+1,index_t);    reduced_nodes_first_component=TMPMEMALLOC(mpiSize+1,index_t);
   nodes_first_component=TMPMEMALLOC(mpiSize+1,index_t);  
292    
293    if (! ( Finley_checkPtr(reduced_dof_first_component) || Finley_checkPtr(reduced_nodes_first_component) || Finley_checkPtr(nodes_first_component)  ) ) {    if (! ( Finley_checkPtr(reduced_dof_first_component) || Finley_checkPtr(reduced_nodes_first_component) ) ) {
   
      Finley_NodeFile_setGlobalNodeIDIndexRange(&minGlobalNodeIndex,&maxGlobalNodeIndex,in->Nodes);  
      Paso_MPIInfo_setDistribution(in->Nodes->MPIInfo,minGlobalNodeIndex,maxGlobalNodeIndex,nodes_first_component);  
294    
295       myFirstDOF=dof_first_component[myRank];       myFirstDOF=dof_first_component[myRank];
296       myLastDOF=dof_first_component[myRank+1];       myLastDOF=dof_first_component[myRank+1];
297       myNumDOF=myLastDOF-myFirstDOF;       myNumDOF=myLastDOF-myFirstDOF;
298    
299       myFirstNode=nodes_first_component[myRank];       myFirstNode=nodes_first_component[myRank];
300       myLastNode=nodes_first_component[myRank+1];       myLastNode=nodes_first_component[myRank+1];
301       myNumNodes=myLastNode-myFirstNode;       myNumNodes=myLastNode-myFirstNode;
# Line 351  void Finley_Mesh_createNodeFileMappings( Line 347  void Finley_Mesh_createNodeFileMappings(
347          reduced_nodes_first_component[mpiSize]=globalNumReducedNodes;          reduced_nodes_first_component[mpiSize]=globalNumReducedNodes;
348          reduced_dof_first_component[mpiSize]=globalNumReducedDOF;          reduced_dof_first_component[mpiSize]=globalNumReducedDOF;
349          /* ==== distribution of Nodes ===============================*/          /* ==== distribution of Nodes ===============================*/
         Paso_MPIInfo_setDistribution(in->Nodes->MPIInfo,minGlobalNodeIndex,maxGlobalNodeIndex,nodes_first_component);  
350          in->Nodes->nodesDistribution=Paso_Distribution_alloc(in->Nodes->MPIInfo,nodes_first_component,1,0);          in->Nodes->nodesDistribution=Paso_Distribution_alloc(in->Nodes->MPIInfo,nodes_first_component,1,0);
351            
352          /* ==== distribution of Nodes ===============================*/          /* ==== distribution of DOFs ===============================*/
353          in->Nodes->degreesOfFreedomDistribution=Paso_Distribution_alloc(in->Nodes->MPIInfo,dof_first_component,1,0);          in->Nodes->degreesOfFreedomDistribution=Paso_Distribution_alloc(in->Nodes->MPIInfo,dof_first_component,1,0);
354            
355          /* ==== distribution of reduced Nodes ===============================*/          /* ==== distribution of reduced Nodes ===============================*/
         reduced_nodes_first_component[mpiSize]=globalNumReducedNodes;  
356          in->Nodes->reducedNodesDistribution=Paso_Distribution_alloc(in->Nodes->MPIInfo,reduced_nodes_first_component,1,0);          in->Nodes->reducedNodesDistribution=Paso_Distribution_alloc(in->Nodes->MPIInfo,reduced_nodes_first_component,1,0);
357            
358          /* ==== distribution of reduced DOF ===============================*/          /* ==== distribution of reduced DOF ===============================*/
# Line 371  void Finley_Mesh_createNodeFileMappings( Line 365  void Finley_Mesh_createNodeFileMappings(
365    }    }
366    TMPMEMFREE(reduced_dof_first_component);    TMPMEMFREE(reduced_dof_first_component);
367    TMPMEMFREE(reduced_nodes_first_component);    TMPMEMFREE(reduced_nodes_first_component);
   TMPMEMFREE(nodes_first_component);  
368    
369    nodeMask=TMPMEMALLOC(in->Nodes->numNodes,index_t);    nodeMask=TMPMEMALLOC(in->Nodes->numNodes,index_t);
370    if (! Finley_checkPtr(nodeMask) && Finley_noError()) {    if (! Finley_checkPtr(nodeMask) && Finley_noError()) {

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

  ViewVC Help
Powered by ViewVC 1.1.26