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

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

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

revision 4331 by jfenwick, Wed Feb 27 06:09:33 2013 UTC revision 4332 by jfenwick, Thu Mar 21 04:21:14 2013 UTC
# Line 88  void Dudley_Mesh_createDOFMappingAndCoup Line 88  void Dudley_Mesh_createDOFMappingAndCoup
88      Dudley_setError(SYSTEM_ERROR, "Local elements do not span local degrees of freedom.");      Dudley_setError(SYSTEM_ERROR, "Local elements do not span local degrees of freedom.");
89      return;      return;
90      }      }
91      rcv_len = TMPMEMALLOC(mpiSize, dim_t);      rcv_len = new  dim_t[mpiSize];
92      snd_len = TMPMEMALLOC(mpiSize, dim_t);      snd_len = new  dim_t[mpiSize];
93  #ifdef ESYS_MPI  #ifdef ESYS_MPI
94      mpi_requests = MEMALLOC(mpiSize * 2, MPI_Request);      mpi_requests = MEMALLOC(mpiSize * 2, MPI_Request);
95      mpi_stati = MEMALLOC(mpiSize * 2, MPI_Status);      mpi_stati = MEMALLOC(mpiSize * 2, MPI_Status);
# Line 97  void Dudley_Mesh_createDOFMappingAndCoup Line 97  void Dudley_Mesh_createDOFMappingAndCoup
97      mpi_requests = MEMALLOC(mpiSize * 2, int);      mpi_requests = MEMALLOC(mpiSize * 2, int);
98      mpi_stati = MEMALLOC(mpiSize * 2, int);      mpi_stati = MEMALLOC(mpiSize * 2, int);
99  #endif  #endif
100      wanted_DOFs = TMPMEMALLOC(numNodes, index_t);      wanted_DOFs = new  index_t[numNodes];
101      nodeMask = TMPMEMALLOC(numNodes, index_t);      nodeMask = new  index_t[numNodes];
102      neighbor = TMPMEMALLOC(mpiSize, Esys_MPI_rank);      neighbor = new  Esys_MPI_rank[mpiSize];
103      shared = TMPMEMALLOC(numNodes * (p_max - p_min + 1), index_t);      shared = new  index_t[numNodes * (p_max - p_min + 1)];
104      offsetInShared = TMPMEMALLOC(mpiSize + 1, index_t);      offsetInShared = new  index_t[mpiSize + 1];
105      locDOFMask = TMPMEMALLOC(len_loc_dof, index_t);      locDOFMask = new  index_t[len_loc_dof];
106      if (!      if (!
107      (Dudley_checkPtr(neighbor) || Dudley_checkPtr(shared) || Dudley_checkPtr(offsetInShared)      (Dudley_checkPtr(neighbor) || Dudley_checkPtr(shared) || Dudley_checkPtr(offsetInShared)
108       || Dudley_checkPtr(locDOFMask) || Dudley_checkPtr(nodeMask) || Dudley_checkPtr(rcv_len)       || Dudley_checkPtr(locDOFMask) || Dudley_checkPtr(nodeMask) || Dudley_checkPtr(rcv_len)
# Line 291  void Dudley_Mesh_createDOFMappingAndCoup Line 291  void Dudley_Mesh_createDOFMappingAndCoup
291      Paso_SharedComponents_free(rcv_shcomp);      Paso_SharedComponents_free(rcv_shcomp);
292      Paso_SharedComponents_free(snd_shcomp);      Paso_SharedComponents_free(snd_shcomp);
293      }      }
294      TMPMEMFREE(rcv_len);      delete[] rcv_len;
295      TMPMEMFREE(snd_len);      delete[] snd_len;
296      TMPMEMFREE(mpi_requests);      delete[] mpi_requests;
297      TMPMEMFREE(mpi_stati);      delete[] mpi_stati;
298      TMPMEMFREE(wanted_DOFs);      delete[] wanted_DOFs;
299      TMPMEMFREE(nodeMask);      delete[] nodeMask;
300      TMPMEMFREE(neighbor);      delete[] neighbor;
301      TMPMEMFREE(shared);      delete[] shared;
302      TMPMEMFREE(offsetInShared);      delete[] offsetInShared;
303      TMPMEMFREE(locDOFMask);      delete[] locDOFMask;
304      if (Dudley_noError())      if (Dudley_noError())
305      {      {
306      if (use_reduced_elements)      if (use_reduced_elements)
# Line 328  void Dudley_Mesh_createMappings(Dudley_M Line 328  void Dudley_Mesh_createMappings(Dudley_M
328      index_t *maskReducedNodes = NULL, *indexReducedNodes = NULL;      index_t *maskReducedNodes = NULL, *indexReducedNodes = NULL;
329      dim_t numReducedNodes;      dim_t numReducedNodes;
330    
331      maskReducedNodes = TMPMEMALLOC(mesh->Nodes->numNodes, index_t);      maskReducedNodes = new  index_t[mesh->Nodes->numNodes];
332      indexReducedNodes = TMPMEMALLOC(mesh->Nodes->numNodes, index_t);      indexReducedNodes = new  index_t[mesh->Nodes->numNodes];
333    
334      if (!(Dudley_checkPtr(maskReducedNodes) || Dudley_checkPtr(indexReducedNodes)))      if (!(Dudley_checkPtr(maskReducedNodes) || Dudley_checkPtr(indexReducedNodes)))
335      {      {
# Line 344  void Dudley_Mesh_createMappings(Dudley_M Line 344  void Dudley_Mesh_createMappings(Dudley_M
344                             node_distribution);                             node_distribution);
345      }      }
346    
347      TMPMEMFREE(maskReducedNodes);      delete[] maskReducedNodes;
348      TMPMEMFREE(indexReducedNodes);      delete[] indexReducedNodes;
349  }  }
350    
351  void Dudley_Mesh_createNodeFileMappings(Dudley_Mesh * in, dim_t numReducedNodes, index_t * indexReducedNodes,  void Dudley_Mesh_createNodeFileMappings(Dudley_Mesh * in, dim_t numReducedNodes, index_t * indexReducedNodes,
# Line 364  void Dudley_Mesh_createNodeFileMappings( Line 364  void Dudley_Mesh_createNodeFileMappings(
364    
365      /* mark the nodes used by the reduced mesh */      /* mark the nodes used by the reduced mesh */
366    
367      reduced_dof_first_component = TMPMEMALLOC(mpiSize + 1, index_t);      reduced_dof_first_component = new  index_t[mpiSize + 1];
368      reduced_nodes_first_component = TMPMEMALLOC(mpiSize + 1, index_t);      reduced_nodes_first_component = new  index_t[mpiSize + 1];
369    
370      if (!(Dudley_checkPtr(reduced_dof_first_component) || Dudley_checkPtr(reduced_nodes_first_component)))      if (!(Dudley_checkPtr(reduced_dof_first_component) || Dudley_checkPtr(reduced_nodes_first_component)))
371      {      {
# Line 378  void Dudley_Mesh_createNodeFileMappings( Line 378  void Dudley_Mesh_createNodeFileMappings(
378      myLastNode = nodes_first_component[myRank + 1];      myLastNode = nodes_first_component[myRank + 1];
379      myNumNodes = myLastNode - myFirstNode;      myNumNodes = myLastNode - myFirstNode;
380    
381      maskMyReducedDOF = TMPMEMALLOC(myNumDOF, index_t);      maskMyReducedDOF = new  index_t[myNumDOF];
382      indexMyReducedDOF = TMPMEMALLOC(myNumDOF, index_t);      indexMyReducedDOF = new  index_t[myNumDOF];
383      maskMyReducedNodes = TMPMEMALLOC(myNumNodes, index_t);      maskMyReducedNodes = new  index_t[myNumNodes];
384      indexMyReducedNodes = TMPMEMALLOC(myNumNodes, index_t);      indexMyReducedNodes = new  index_t[myNumNodes];
385    
386      if (!      if (!
387          (Dudley_checkPtr(maskMyReducedDOF) || Dudley_checkPtr(indexMyReducedDOF)          (Dudley_checkPtr(maskMyReducedDOF) || Dudley_checkPtr(indexMyReducedDOF)
# Line 450  void Dudley_Mesh_createNodeFileMappings( Line 450  void Dudley_Mesh_createNodeFileMappings(
450          in->Nodes->reducedDegreesOfFreedomDistribution =          in->Nodes->reducedDegreesOfFreedomDistribution =
451          Paso_Distribution_alloc(in->Nodes->MPIInfo, reduced_dof_first_component, 1, 0);          Paso_Distribution_alloc(in->Nodes->MPIInfo, reduced_dof_first_component, 1, 0);
452      }      }
453      TMPMEMFREE(maskMyReducedDOF);      delete[] maskMyReducedDOF;
454      TMPMEMFREE(indexMyReducedDOF);      delete[] indexMyReducedDOF;
455      TMPMEMFREE(maskMyReducedNodes);      delete[] maskMyReducedNodes;
456      TMPMEMFREE(indexMyReducedNodes);      delete[] indexMyReducedNodes;
457      }      }
458      TMPMEMFREE(reduced_dof_first_component);      delete[] reduced_dof_first_component;
459      TMPMEMFREE(reduced_nodes_first_component);      delete[] reduced_nodes_first_component;
460    
461      nodeMask = TMPMEMALLOC(in->Nodes->numNodes, index_t);      nodeMask = new  index_t[in->Nodes->numNodes];
462      if (!Dudley_checkPtr(nodeMask) && Dudley_noError())      if (!Dudley_checkPtr(nodeMask) && Dudley_noError())
463      {      {
464    
# Line 477  void Dudley_Mesh_createNodeFileMappings( Line 477  void Dudley_Mesh_createNodeFileMappings(
477          nodeMask[indexReducedNodes[i]] = i;          nodeMask[indexReducedNodes[i]] = i;
478      in->Nodes->reducedNodesMapping = Dudley_NodeMapping_alloc(in->Nodes->numNodes, nodeMask, UNUSED);      in->Nodes->reducedNodesMapping = Dudley_NodeMapping_alloc(in->Nodes->numNodes, nodeMask, UNUSED);
479      }      }
480      TMPMEMFREE(nodeMask);      delete[] nodeMask;
481      /* ==== mapping between nodes and DOFs + DOF connector ========== */      /* ==== mapping between nodes and DOFs + DOF connector ========== */
482      if (Dudley_noError())      if (Dudley_noError())
483          Dudley_Mesh_createDOFMappingAndCoupling(in, FALSE);          Dudley_Mesh_createDOFMappingAndCoupling(in, FALSE);

Legend:
Removed from v.4331  
changed lines
  Added in v.4332

  ViewVC Help
Powered by ViewVC 1.1.26