/[escript]/branches/doubleplusgood/finley/src/Mesh_createNodeFileMappings.cpp
ViewVC logotype

Diff of /branches/doubleplusgood/finley/src/Mesh_createNodeFileMappings.cpp

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

revision 4326 by jfenwick, Wed Feb 27 06:09:33 2013 UTC revision 4327 by jfenwick, Wed Mar 20 05:09:11 2013 UTC
# Line 80  void Finley_Mesh_createDOFMappingAndCoup Line 80  void Finley_Mesh_createDOFMappingAndCoup
80        Finley_setError(SYSTEM_ERROR, "Local elements do not span local degrees of freedom.");        Finley_setError(SYSTEM_ERROR, "Local elements do not span local degrees of freedom.");
81        return;        return;
82    }    }
83    rcv_len=TMPMEMALLOC(mpiSize,dim_t);    rcv_len=new dim_t[mpiSize];
84    snd_len=TMPMEMALLOC(mpiSize,dim_t);    snd_len=new dim_t[mpiSize];
85    #ifdef ESYS_MPI    #ifdef ESYS_MPI
86      mpi_requests=MEMALLOC(mpiSize*2,MPI_Request);      mpi_requests=new MPI_Request[mpiSize*2];
87      mpi_stati=MEMALLOC(mpiSize*2,MPI_Status);      mpi_stati=new MPI_Status[mpiSize*2];
88    #else    #else
89      mpi_requests=MEMALLOC(mpiSize*2,int);      mpi_requests=new int[mpiSize*2];
90      mpi_stati=MEMALLOC(mpiSize*2,int);      mpi_stati=new int[mpiSize*2];
91    #endif    #endif
92    wanted_DOFs=TMPMEMALLOC(numNodes,index_t);    wanted_DOFs=new index_t[numNodes];
93    nodeMask=TMPMEMALLOC(numNodes,index_t);    nodeMask=new index_t[numNodes];
94    neighbor=TMPMEMALLOC(mpiSize,Esys_MPI_rank);    neighbor=new Esys_MPI_rank[mpiSize];
95    shared=TMPMEMALLOC(numNodes*(p_max-p_min+1),index_t);    shared=new index_t[numNodes*(p_max-p_min+1)];
96    offsetInShared=TMPMEMALLOC(mpiSize+1,index_t);    offsetInShared=new index_t[mpiSize+1];
97    locDOFMask=TMPMEMALLOC(len_loc_dof, index_t);    locDOFMask=new  index_t[len_loc_dof];
98    if (! ( Finley_checkPtr(neighbor) || Finley_checkPtr(shared) || Finley_checkPtr(offsetInShared) || Finley_checkPtr(locDOFMask) ||    if (! ( Finley_checkPtr(neighbor) || Finley_checkPtr(shared) || Finley_checkPtr(offsetInShared) || Finley_checkPtr(locDOFMask) ||
99       Finley_checkPtr(nodeMask) || Finley_checkPtr(rcv_len) || Finley_checkPtr(snd_len) || Finley_checkPtr(mpi_requests) || Finley_checkPtr(mpi_stati) ||       Finley_checkPtr(nodeMask) || Finley_checkPtr(rcv_len) || Finley_checkPtr(snd_len) || Finley_checkPtr(mpi_requests) || Finley_checkPtr(mpi_stati) ||
100       Finley_checkPtr(mpi_stati) )) {       Finley_checkPtr(mpi_stati) )) {
# Line 229  void Finley_Mesh_createDOFMappingAndCoup Line 229  void Finley_Mesh_createDOFMappingAndCoup
229      Paso_SharedComponents_free(rcv_shcomp);      Paso_SharedComponents_free(rcv_shcomp);
230      Paso_SharedComponents_free(snd_shcomp);      Paso_SharedComponents_free(snd_shcomp);
231    }    }
232    TMPMEMFREE(rcv_len);    delete[] rcv_len;
233    TMPMEMFREE(snd_len);    delete[] snd_len;
234    TMPMEMFREE(mpi_requests);    delete[] mpi_requests;
235    TMPMEMFREE(mpi_stati);    delete[] mpi_stati;
236    TMPMEMFREE(wanted_DOFs);    delete[] wanted_DOFs;
237    TMPMEMFREE(nodeMask);    delete[] nodeMask;
238    TMPMEMFREE(neighbor);    delete[] neighbor;
239    TMPMEMFREE(shared);    delete[] shared;
240    TMPMEMFREE(offsetInShared);    delete[] offsetInShared;
241    TMPMEMFREE(locDOFMask);    delete[] locDOFMask;
242    if (Finley_noError()) {    if (Finley_noError()) {
243       if (use_reduced_elements) {       if (use_reduced_elements) {
244          in->Nodes->reducedDegreesOfFreedomMapping=this_mapping;          in->Nodes->reducedDegreesOfFreedomMapping=this_mapping;
# Line 259  void Finley_Mesh_createMappings(Finley_M Line 259  void Finley_Mesh_createMappings(Finley_M
259    index_t *maskReducedNodes=NULL, *indexReducedNodes=NULL;    index_t *maskReducedNodes=NULL, *indexReducedNodes=NULL;
260    dim_t numReducedNodes;    dim_t numReducedNodes;
261    
262    maskReducedNodes=TMPMEMALLOC(mesh->Nodes->numNodes,index_t);    maskReducedNodes=new index_t[mesh->Nodes->numNodes];
263    indexReducedNodes=TMPMEMALLOC(mesh->Nodes->numNodes,index_t);    indexReducedNodes=new index_t[mesh->Nodes->numNodes];
264    
265    if (! ( Finley_checkPtr(maskReducedNodes) || Finley_checkPtr(indexReducedNodes) ) ) {    if (! ( Finley_checkPtr(maskReducedNodes) || Finley_checkPtr(indexReducedNodes) ) ) {
266      #pragma omp parallel for private(i) schedule(static)      #pragma omp parallel for private(i) schedule(static)
# Line 271  void Finley_Mesh_createMappings(Finley_M Line 271  void Finley_Mesh_createMappings(Finley_M
271      if (Finley_noError()) Finley_Mesh_createNodeFileMappings(mesh,numReducedNodes,indexReducedNodes,dof_distribution, node_distribution);      if (Finley_noError()) Finley_Mesh_createNodeFileMappings(mesh,numReducedNodes,indexReducedNodes,dof_distribution, node_distribution);
272    }    }
273    
274    TMPMEMFREE(maskReducedNodes);    delete[] maskReducedNodes;
275    TMPMEMFREE(indexReducedNodes);    delete[] indexReducedNodes;
276  }  }
277    
278  void Finley_Mesh_createNodeFileMappings(Finley_Mesh* in, dim_t numReducedNodes, index_t* indexReducedNodes, index_t* dof_first_component, index_t* nodes_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) {
# Line 288  void Finley_Mesh_createNodeFileMappings( Line 288  void Finley_Mesh_createNodeFileMappings(
288    
289    /* mark the nodes used by the reduced mesh */    /* mark the nodes used by the reduced mesh */
290    
291    reduced_dof_first_component=TMPMEMALLOC(mpiSize+1,index_t);    reduced_dof_first_component=new index_t[mpiSize+1];
292    reduced_nodes_first_component=TMPMEMALLOC(mpiSize+1,index_t);    reduced_nodes_first_component=new index_t[mpiSize+1];
293    
294    if (! ( Finley_checkPtr(reduced_dof_first_component) || Finley_checkPtr(reduced_nodes_first_component) ) ) {    if (! ( Finley_checkPtr(reduced_dof_first_component) || Finley_checkPtr(reduced_nodes_first_component) ) ) {
295    
# Line 301  void Finley_Mesh_createNodeFileMappings( Line 301  void Finley_Mesh_createNodeFileMappings(
301       myLastNode=nodes_first_component[myRank+1];       myLastNode=nodes_first_component[myRank+1];
302       myNumNodes=myLastNode-myFirstNode;       myNumNodes=myLastNode-myFirstNode;
303    
304       maskMyReducedDOF=TMPMEMALLOC(myNumDOF,index_t);       maskMyReducedDOF=new index_t[myNumDOF];
305       indexMyReducedDOF=TMPMEMALLOC(myNumDOF,index_t);       indexMyReducedDOF=new index_t[myNumDOF];
306       maskMyReducedNodes=TMPMEMALLOC(myNumNodes,index_t);       maskMyReducedNodes=new index_t[myNumNodes];
307       indexMyReducedNodes=TMPMEMALLOC(myNumNodes,index_t);       indexMyReducedNodes=new index_t[myNumNodes];
308    
309       if (! ( Finley_checkPtr(maskMyReducedDOF) || Finley_checkPtr(indexMyReducedDOF) || Finley_checkPtr(maskMyReducedNodes) || Finley_checkPtr(indexMyReducedNodes)  ) ) {       if (! ( Finley_checkPtr(maskMyReducedDOF) || Finley_checkPtr(indexMyReducedDOF) || Finley_checkPtr(maskMyReducedNodes) || Finley_checkPtr(indexMyReducedNodes)  ) ) {
310    
# Line 359  void Finley_Mesh_createNodeFileMappings( Line 359  void Finley_Mesh_createNodeFileMappings(
359          /* ==== distribution of reduced DOF ===============================*/          /* ==== distribution of reduced DOF ===============================*/
360          in->Nodes->reducedDegreesOfFreedomDistribution=Paso_Distribution_alloc(in->Nodes->MPIInfo,reduced_dof_first_component,1,0);          in->Nodes->reducedDegreesOfFreedomDistribution=Paso_Distribution_alloc(in->Nodes->MPIInfo,reduced_dof_first_component,1,0);
361       }       }
362       TMPMEMFREE(maskMyReducedDOF);       delete[] maskMyReducedDOF;
363       TMPMEMFREE(indexMyReducedDOF);       delete[] indexMyReducedDOF;
364       TMPMEMFREE(maskMyReducedNodes);       delete[] maskMyReducedNodes;
365       TMPMEMFREE(indexMyReducedNodes);       delete[] indexMyReducedNodes;
366    }    }
367    TMPMEMFREE(reduced_dof_first_component);    delete[] reduced_dof_first_component;
368    TMPMEMFREE(reduced_nodes_first_component);    delete[] reduced_nodes_first_component;
369    
370    nodeMask=TMPMEMALLOC(in->Nodes->numNodes,index_t);    nodeMask=new index_t[in->Nodes->numNodes];
371    if (! Finley_checkPtr(nodeMask) && Finley_noError()) {    if (! Finley_checkPtr(nodeMask) && Finley_noError()) {
372    
373      /* ==== nodes mapping which is a dummy structure ======== */      /* ==== nodes mapping which is a dummy structure ======== */
# Line 382  void Finley_Mesh_createNodeFileMappings( Line 382  void Finley_Mesh_createNodeFileMappings(
382      for (i=0;i<numReducedNodes;++i) nodeMask[indexReducedNodes[i]]=i;      for (i=0;i<numReducedNodes;++i) nodeMask[indexReducedNodes[i]]=i;
383      in->Nodes->reducedNodesMapping=Finley_NodeMapping_alloc(in->Nodes->numNodes,nodeMask,UNUSED);      in->Nodes->reducedNodesMapping=Finley_NodeMapping_alloc(in->Nodes->numNodes,nodeMask,UNUSED);
384    }    }
385    TMPMEMFREE(nodeMask);    delete[] nodeMask;
386    /* ==== mapping between nodes and DOFs + DOF connector ========== */    /* ==== mapping between nodes and DOFs + DOF connector ========== */
387    if ( Finley_noError()) Finley_Mesh_createDOFMappingAndCoupling(in,FALSE);    if ( Finley_noError()) Finley_Mesh_createDOFMappingAndCoupling(in,FALSE);
388    /* ==== mapping between nodes and reduced DOFs + reduced DOF connector ========== */    /* ==== mapping between nodes and reduced DOFs + reduced DOF connector ========== */

Legend:
Removed from v.4326  
changed lines
  Added in v.4327

  ViewVC Help
Powered by ViewVC 1.1.26