/[escript]/trunk/finley/src/CPPAdapter/MeshAdapter.cpp
ViewVC logotype

Diff of /trunk/finley/src/CPPAdapter/MeshAdapter.cpp

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

revision 1796 by jfenwick, Wed Sep 17 01:45:46 2008 UTC revision 1800 by ksteube, Thu Sep 18 05:28:20 2008 UTC
# Line 19  Line 19 
19  #ifdef USE_NETCDF  #ifdef USE_NETCDF
20  #include <netcdfcpp.h>  #include <netcdfcpp.h>
21  #endif  #endif
22    #ifdef PASO_MPI
23    #include <mpi.h>
24    #include "paso/Paso_MPI.h"
25    #endif
26  extern "C" {  extern "C" {
27  #include "escript/blocktimer.h"  #include "escript/blocktimer.h"
28  }  }
# Line 83  int MeshAdapter::getMPIRank() const Line 87  int MeshAdapter::getMPIRank() const
87  {  {
88     return m_finleyMesh.get()->MPIInfo->rank;     return m_finleyMesh.get()->MPIInfo->rank;
89  }  }
90    MPI_Comm MeshAdapter::getMPIComm() const
91    {
92       return m_finleyMesh.get()->MPIInfo->comm;
93    }
94    
95    
96  Finley_Mesh* MeshAdapter::getFinley_Mesh() const {  Finley_Mesh* MeshAdapter::getFinley_Mesh() const {
# Line 123  void MeshAdapter::dump(const std::string Line 131  void MeshAdapter::dump(const std::string
131     int num_Elements_numNodes        = mesh->Elements->numNodes;     int num_Elements_numNodes        = mesh->Elements->numNodes;
132     int num_FaceElements_numNodes    = mesh->FaceElements->numNodes;     int num_FaceElements_numNodes    = mesh->FaceElements->numNodes;
133     int num_ContactElements_numNodes = mesh->ContactElements->numNodes;     int num_ContactElements_numNodes = mesh->ContactElements->numNodes;
134    #ifdef PASO_MPI
135       MPI_Status status;
136    #endif
137    
138    /* Incoming token indicates it's my turn to write */
139    #ifdef PASO_MPI
140       if (mpi_rank>0) MPI_Recv(&num_Tags, 0, MPI_INT, mpi_rank-1, 81800, mesh->MPIInfo->comm, &status);
141    #endif
142    
143     char *newFileName = Paso_MPI_appendRankToFileName(fileName.c_str(),     char *newFileName = Paso_MPI_appendRankToFileName(fileName.c_str(),
144                                                       mpi_size, mpi_rank);                                                       mpi_size, mpi_rank);
145    
146     /* Figure out how much storage is required for tags */     /* Figure out how much storage is required for tags */
147     tag_map = mesh->TagMap;     tag_map = mesh->TagMap;
148       num_Tags = 0;
149     if (tag_map) {     if (tag_map) {
150        while (tag_map) {        while (tag_map) {
151           num_Tags++;           num_Tags++;
# Line 492  void MeshAdapter::dump(const std::string Line 509  void MeshAdapter::dump(const std::string
509    
510     }     }
511    
512    /* Send token to next MPI process so he can take his turn */
513    #ifdef PASO_MPI
514       if (mpi_rank<mpi_size-1) MPI_Send(&num_Tags, 0, MPI_INT, mpi_rank+1, 81800, mesh->MPIInfo->comm);
515    #endif
516    
517     // NetCDF file is closed by destructor of NcFile object     // NetCDF file is closed by destructor of NcFile object
518    
519  #else  #else
520     Finley_setError(IO_ERROR, "MeshAdapter::dump: not configured with NetCDF. Please contact your installation manager.");     Finley_setError(IO_ERROR, "MeshAdapter::dump: not configured with NetCDF. Please contact your installation manager.");
521  #endif  /* USE_NETCDF */  #endif  /* USE_NETCDF */

Legend:
Removed from v.1796  
changed lines
  Added in v.1800

  ViewVC Help
Powered by ViewVC 1.1.26