[cig-commits] r20024 - in short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith: meshio topology
brad at geodynamics.org
brad at geodynamics.org
Wed May 2 10:22:04 PDT 2012
Author: brad
Date: 2012-05-02 10:22:04 -0700 (Wed, 02 May 2012)
New Revision: 20024
Modified:
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterHDF5.cc
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterHDF5.hh
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterVTK.cc
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshBuilder.cc
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshIOAscii.cc
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshIOCubit.cc
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshIOHDF5.cc
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshIOLagrit.cc
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/Distributor.cc
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/Mesh.hh
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/Mesh.icc
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/RefineEdges2.cc
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/ReverseCuthillMcKee.cc
Log:
Cleanup. Use commRank() convenience function instead of MPI_Comm_rank().
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterHDF5.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterHDF5.cc 2012-05-02 17:20:57 UTC (rev 20023)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterHDF5.cc 2012-05-02 17:22:04 UTC (rev 20024)
@@ -96,8 +96,8 @@
_timesteps.clear();
_tstampIndex = 0;
- const int rank = sieveMesh->commRank();
- const int localSize = (!rank) ? 1 : 0;
+ const int commRank = sieveMesh->commRank();
+ const int localSize = (!commRank) ? 1 : 0;
err = VecCreateMPI(mesh.comm(), localSize, 1, &_tstamp);
CHECK_PETSC_ERROR(err);
assert(_tstamp);
@@ -295,9 +295,9 @@
_timesteps[field.label()] += 1;
const int istep = _timesteps[field.label()];
// Add time stamp to "/time" if necessary.
- const int rank = sieveMesh->commRank();
+ const int commRank = sieveMesh->commRank();
if (_tstampIndex == istep)
- _writeTimeStamp(t, rank);
+ _writeTimeStamp(t, commRank);
#if 0 // debugging
field.view("writeVertexField");
@@ -375,9 +375,9 @@
_timesteps[field.label()] += 1;
const int istep = _timesteps[field.label()];
// Add time stamp to "/time" if necessary.
- const int rank = sieveMesh->commRank();
+ const int commRank = sieveMesh->commRank();
if (_tstampIndex == istep)
- _writeTimeStamp(t, rank);
+ _writeTimeStamp(t, commRank);
err = PetscViewerHDF5PushGroup(_viewer, "/cell_fields");CHECK_PETSC_ERROR(err);
err = PetscViewerHDF5SetTimestep(_viewer, istep);CHECK_PETSC_ERROR(err);
@@ -430,12 +430,12 @@
void
pylith::meshio::DataWriterHDF5<mesh_type,field_type>::_writeTimeStamp(
const PylithScalar t,
- const int rank)
+ const int commRank)
{ // _writeTimeStamp
assert(_tstamp);
PetscErrorCode err = 0;
- if (0 == rank) {
+ if (0 == commRank) {
const PylithScalar tDim = t * DataWriter<mesh_type, field_type>::_timeScale;
err = VecSetValue(_tstamp, 0, tDim, INSERT_VALUES); CHECK_PETSC_ERROR(err);
} // if
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterHDF5.hh
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterHDF5.hh 2012-05-02 17:20:57 UTC (rev 20023)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterHDF5.hh 2012-05-02 17:22:04 UTC (rev 20024)
@@ -135,10 +135,10 @@
/** Write time stamp to file.
*
* @param t Time in seconds.
- * @param rank Processor rank in MPI communicator.
+ * @param commRank Processor rank in MPI communicator.
*/
void _writeTimeStamp(const PylithScalar t,
- const int rank);
+ const int commRank);
// NOT IMPLEMENTED //////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc 2012-05-02 17:20:57 UTC (rev 20023)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc 2012-05-02 17:22:04 UTC (rev 20024)
@@ -92,10 +92,11 @@
DataWriter<mesh_type, field_type>::open(mesh, numTimeSteps, label, labelId);
const char* context = DataWriter<mesh_type, field_type>::_context.c_str();
- int rank = 0;
- MPI_Comm_rank(mesh.comm(), &rank);
-
- if (!rank) {
+ const ALE::Obj<typename mesh_type::SieveMesh>& sieveMesh = mesh.sieveMesh();
+ assert(!sieveMesh.isNull());
+
+ const int commRank = sieveMesh->commRank();
+ if (!commRank) {
_h5->open(_hdf5Filename().c_str(), H5F_ACC_TRUNC);
// Create groups
@@ -110,9 +111,6 @@
const hid_t scalartype = (sizeof(double) == sizeof(PylithScalar)) ?
H5T_IEEE_F64BE : H5T_IEEE_F32BE;
- const ALE::Obj<typename mesh_type::SieveMesh>& sieveMesh = mesh.sieveMesh();
- assert(!sieveMesh.isNull());
-
// Write vertex coordinates
const ALE::Obj<typename mesh_type::RealSection>& coordinatesSection =
sieveMesh->hasRealSection("coordinates_dimensioned") ?
@@ -149,7 +147,7 @@
err = PetscViewerDestroy(&binaryViewer); CHECK_PETSC_ERROR(err);
// Create external dataset for coordinates
- if (!rank) {
+ if (!commRank) {
const hsize_t ndims = 2;
hsize_t dims[ndims];
dims[0] = vNumbering->getGlobalSize();
@@ -240,7 +238,7 @@
err = PetscViewerDestroy(&binaryViewer); CHECK_PETSC_ERROR(err);
// Create external dataset for cells
- if (!rank) {
+ if (!commRank) {
const hsize_t ndims = 2;
hsize_t dims[ndims];
dims[0] = cNumbering->getGlobalSize();
@@ -277,9 +275,9 @@
_tstampIndex = 0;
deallocate();
- int rank = 0;
- MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
- if (!rank) {
+ int commRank = 0;
+ MPI_Comm_rank(PETSC_COMM_WORLD, &commRank);
+ if (!commRank) {
Xdmf metafile;
const std::string& hdf5filename = _hdf5Filename();
const int indexExt = hdf5filename.find(".h5");
@@ -304,11 +302,11 @@
try {
const char* context = DataWriter<mesh_type, field_type>::_context.c_str();
- int rank = 0;
- MPI_Comm_rank(mesh.comm(), &rank);
-
const ALE::Obj<typename mesh_type::SieveMesh>& sieveMesh = mesh.sieveMesh();
assert(!sieveMesh.isNull());
+
+ const int commRank = sieveMesh->commRank();
+
const std::string labelName =
(sieveMesh->hasLabel("censored depth")) ? "censored depth" : "depth";
ALE::Obj<numbering_type> vNumbering =
@@ -364,7 +362,7 @@
field.mesh().comm());
assert(fiberDim > 0);
- if (!rank) {
+ if (!commRank) {
if (createdExternalDataset) {
// Add new external dataset to HDF5 file.
const int numTimeSteps
@@ -441,12 +439,12 @@
const char* context = DataWriter<mesh_type, field_type>::_context.c_str();
PetscErrorCode err = 0;
- int rank = 0;
- err = MPI_Comm_rank(field.mesh().comm(), &rank);CHECK_PETSC_ERROR(err);
-
const ALE::Obj<typename mesh_type::SieveMesh>& sieveMesh =
field.mesh().sieveMesh();
assert(!sieveMesh.isNull());
+
+ const int commRank = sieveMesh->commRank();
+
int cellDepthLocal = (sieveMesh->depth() == -1) ? -1 : 1;
int cellDepth = 0;
err = MPI_Allreduce(&cellDepthLocal, &cellDepth, 1, MPI_INT, MPI_MAX,
@@ -506,7 +504,7 @@
assert(fiberDim > 0);
- if (!rank) {
+ if (!commRank) {
if (createdExternalDataset) {
// Add new external dataset to HDF5 file.
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterVTK.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterVTK.cc 2012-05-02 17:20:57 UTC (rev 20023)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterVTK.cc 2012-05-02 17:22:04 UTC (rev 20024)
@@ -184,11 +184,9 @@
typedef typename field_type::Mesh::RealSection RealSection;
try {
- int rank = 0;
- MPI_Comm_rank(field.mesh().comm(), &rank);
-
const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
assert(!sieveMesh.isNull());
+
const std::string labelName =
(sieveMesh->hasLabel("censored depth")) ? "censored depth" : "depth";
const ALE::Obj<typename SieveMesh::numbering_type>& numbering =
@@ -248,8 +246,6 @@
try {
PetscErrorCode err = 0;
- int rank = 0;
- err = MPI_Comm_rank(field.mesh().comm(), &rank);CHECK_PETSC_ERROR(err);
// Correctly handle boundary and fault meshes
// Cannot just use mesh->depth() because boundaries report the wrong thing
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshBuilder.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshBuilder.cc 2012-05-02 17:20:57 UTC (rev 20023)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshBuilder.cc 2012-05-02 17:22:04 UTC (rev 20024)
@@ -53,7 +53,7 @@
assert(coordinates);
MPI_Comm comm = mesh->comm();
int dim = meshDim;
- int rank = 0;
+ const int commRank = mesh->commRank();
{ // Check to make sure every vertex is in at least one cell.
// This is required by Sieve
@@ -82,13 +82,12 @@
new SieveMesh::sieve_type(mesh->comm());
sieveMesh->setSieve(sieve);
- MPI_Comm_rank(comm, &rank);
// Memory debugging
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
//logger.setDebug(1);
logger.stagePush("MeshCreation");
- if (0 == rank || isParallel) {
+ if (0 == commRank || isParallel) {
assert(coordinates->size() == numVertices*spaceDim);
assert(cells.size() == numCells*numCorners);
if (!interpolate) {
@@ -209,7 +208,6 @@
const int meshDim)
{ // buildFaultMesh
int dim = meshDim;
- int rank = 0;
assert(!fault.isNull());
@@ -217,15 +215,15 @@
new SieveMesh::sieve_type(fault->comm());
fault->setDebug(fault->debug());
fault->setSieve(sieve);
+
+ const int commRank = fault->commRank();
- MPI_Comm_rank(fault->comm(), &rank);
-
// Memory logging
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
//logger.setDebug(fault->debug()/2);
logger.stagePush("Creation");
- if (0 == rank) {
+ if (0 == commRank) {
assert(coordinates.size() == numVertices*spaceDim);
assert(cells.size() == numCells*numCorners);
ALE::Obj<SieveFlexMesh::sieve_type> s =
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshIOAscii.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshIOAscii.cc 2012-05-02 17:20:57 UTC (rev 20023)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshIOAscii.cc 2012-05-02 17:22:04 UTC (rev 20024)
@@ -69,8 +69,7 @@
void
pylith::meshio::MeshIOAscii::_read(void)
{ // _read
- MPI_Comm comm = _mesh->comm();
- int rank = 0;
+ const int commRank = _mesh->commRank();
int meshDim = 0;
int spaceDim = 0;
int numVertices = 0;
@@ -80,8 +79,7 @@
int_array cells;
int_array materialIds;
- MPI_Comm_rank(comm, &rank);
- if (0 == rank) {
+ if (0 == commRank) {
std::ifstream filein(_filename.c_str());
if (!filein.is_open() || !filein.good()) {
std::ostringstream msg;
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshIOCubit.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshIOCubit.cc 2012-05-02 17:20:57 UTC (rev 20023)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshIOCubit.cc 2012-05-02 17:22:04 UTC (rev 20024)
@@ -62,7 +62,7 @@
{ // _read
assert(_mesh);
- int rank = 0;
+ const int commRank = _mesh->commRank();
int meshDim = 0;
int spaceDim = 0;
int numVertices = 0;
@@ -72,8 +72,7 @@
int_array cells;
int_array materialIds;
- MPI_Comm_rank(_mesh->comm(), &rank);
- if (0 == rank) {
+ if (0 == commRank) {
try {
ExodusII exofile(_filename.c_str());
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshIOHDF5.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshIOHDF5.cc 2012-05-02 17:20:57 UTC (rev 20023)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshIOHDF5.cc 2012-05-02 17:22:04 UTC (rev 20024)
@@ -49,8 +49,7 @@
MeshIOHDF5::read(ALE::Obj<ALE::PetscMesh>* pMesh)
{ // read
assert(0 != pMesh);
- MPI_Comm comm = PETSC_COMM_WORLD;
- int rank;
+ const int commRank = pMesh->commRank();
int meshDim = 0;
int numDims = 0;
int numVertices = 0;
@@ -59,8 +58,7 @@
PylithScalar* coordinates = 0;
int* elements = 0;
- MPI_Comm_rank(comm, &rank);
- if (!rank) {
+ if (!commRank) {
hid_t filein = H5Fopen(_filename.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
if (filein < 0) {
std::ostringstream msg;
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshIOLagrit.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshIOLagrit.cc 2012-05-02 17:20:57 UTC (rev 20023)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/MeshIOLagrit.cc 2012-05-02 17:22:04 UTC (rev 20024)
@@ -63,8 +63,7 @@
void
pylith::meshio::MeshIOLagrit::_read(void)
{ // _read
- MPI_Comm comm = _mesh->comm();
- int rank;
+ const int commRank = _mesh->commRank();
int meshDim = 0;
int spaceDim = 0;
int numVertices = 0;
@@ -74,8 +73,7 @@
int_array cells;
int_array materialIds;
- MPI_Comm_rank(comm, &rank);
- if (!rank) {
+ if (!commRank) {
if (GMVFile::isAscii(_filenameGmv.c_str())) {
GMVFileAscii filein(_filenameGmv.c_str());
filein.read(&coordinates, &cells, &materialIds,
@@ -93,7 +91,7 @@
_interpolate);
_setMaterials(materialIds);
- if (0 == rank) {
+ if (0 == commRank) {
std::vector<PsetFile::Pset> groups;
if (PsetFile::isAscii(_filenamePset.c_str())) {
PsetFileAscii filein(_filenamePset.c_str());
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/Distributor.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/Distributor.cc 2012-05-02 17:20:57 UTC (rev 20023)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/Distributor.cc 2012-05-02 17:22:04 UTC (rev 20024)
@@ -58,22 +58,21 @@
{ // distribute
assert(0 != newMesh);
- int rank = 0;
- MPI_Comm_rank(origMesh.comm(), &rank);
+ const int commRank = origMesh.commRank();
journal::info_t info("distributor");
newMesh->coordsys(origMesh.coordsys());
if (0 == strcasecmp(partitioner, "")) {
- if (0 == rank) {
+ if (0 == commRank) {
info << journal::at(__HERE__)
<< "Distributing mesh using dumb partitioner." << journal::endl;
} // if
_distribute<ALE::DistributionNew<SieveMesh> >(newMesh, origMesh);
#if defined(PETSC_HAVE_CHACO)
} else if (0 == strcasecmp(partitioner, "chaco")) {
- if (0 == rank) {
+ if (0 == commRank) {
info << journal::at(__HERE__)
<< "Distributing mesh using 'chaco' partitioner." << journal::endl;
} // if
@@ -81,14 +80,14 @@
#endif
#if defined(PETSC_HAVE_PARMETIS)
} else if (0 == strcasecmp(partitioner, "parmetis")) {
- if (0 == rank) {
+ if (0 == commRank) {
info << journal::at(__HERE__)
<< "Distributing mesh using 'parmetis' partitioner." << journal::endl;
} // if
_distribute<ALE::DistributionNew<SieveMesh, ALE::Partitioner<ALE::ParMetis::Partitioner<> > > >(newMesh, origMesh);
#endif
} else {
- if (0 == rank) {
+ if (0 == commRank) {
info << journal::at(__HERE__)
<< "Unknown partitioner '" << partitioner
<< "', distribution mesh using dumb partitioner." << journal::endl;
@@ -107,9 +106,8 @@
journal::info_t info("distributor");
- int rank = 0;
- MPI_Comm_rank(mesh.comm(), &rank);
- if (0 == rank) {
+ const int commRank = mesh.commRank();
+ if (0 == commRank) {
info << journal::at(__HERE__)
<< "Writing partition." << journal::endl;
} // if
@@ -127,7 +125,7 @@
const ALE::Obj<SieveMesh> sieveMesh = mesh.sieveMesh();
assert(!sieveMesh.isNull());
- PylithScalar rankReal = PylithScalar(sieveMesh->commRank());
+ PylithScalar rankReal = PylithScalar(commRank);
assert(sieveMesh->height() > 0);
const ALE::Obj<SieveMesh::label_sequence>& cells =
sieveMesh->heightStratum(0);
@@ -167,9 +165,8 @@
journal::info_t info("distributor");
- int rank = 0;
- MPI_Comm_rank(origMesh.comm(), &rank);
- if (0 == rank) {
+ const int commRank = origMesh.commRank();
+ if (0 == commRank) {
info << journal::at(__HERE__)
<< "Partitioning and distributing the mesh." << journal::endl;
} // if
@@ -206,18 +203,18 @@
renumbering,
sendMeshOverlap, recvMeshOverlap);
if (origSieveMesh->debug()) {
- std::cout << "["<<origSieveMesh->commRank()<<"]: Mesh Renumbering:"
+ std::cout << "["<<commRank<<"]: Mesh Renumbering:"
<< std::endl;
for (SieveMesh::renumbering_type::const_iterator r_iter = renumbering.begin();
r_iter != renumbering.end();
++r_iter) {
- std::cout << "["<<origSieveMesh->commRank()<<"]: global point "
+ std::cout << "["<<commRank<<"]: global point "
<< r_iter->first << " --> " << " local point "
<< r_iter->second << std::endl;
} // for
} // if
- if (0 == rank) {
+ if (0 == commRank) {
info << journal::at(__HERE__)
<< "Checking the overlap." << journal::endl;
} // if
@@ -246,7 +243,7 @@
logger.stagePush("DistributedMeshCoordinates");
// Distribute the coordinates
- if (0 == rank) {
+ if (0 == commRank) {
info << journal::at(__HERE__)
<< "Distribution the vertex coordinates." << journal::endl;
} // if
@@ -267,7 +264,7 @@
logger.stagePush("DistributedMeshRealSections");
// Distribute other sections
- if (0 == rank) {
+ if (0 == commRank) {
info << journal::at(__HERE__)
<< "Distribution other sections." << journal::endl;
} // if
@@ -347,7 +344,7 @@
logger.stagePush("DistributedMeshLabels");
// Distribute labels
- if (0 == rank) {
+ if (0 == commRank) {
info << journal::at(__HERE__)
<< "Distributing labels." << journal::endl;
} // if
@@ -395,7 +392,7 @@
logger.stagePush("DistributedMeshOverlap");
// Create the parallel overlap
- if (0 == rank) {
+ if (0 == commRank) {
info << journal::at(__HERE__)
<< "Creating the parallel overlap." << journal::endl;
} // if
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/Mesh.hh
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/Mesh.hh 2012-05-02 17:20:57 UTC (rev 20023)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/Mesh.hh 2012-05-02 17:22:04 UTC (rev 20024)
@@ -167,6 +167,12 @@
*/
const MPI_Comm comm(void) const;
+ /** Get MPI rank.
+ *
+ * @returns MPI rank.
+ */
+ int commRank(void) const;
+
/** Initialize the finite-element mesh.
*
* @param normalizer Nondimensionalizer.
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/Mesh.icc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/Mesh.icc 2012-05-02 17:20:57 UTC (rev 20023)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/Mesh.icc 2012-05-02 17:22:04 UTC (rev 20024)
@@ -101,6 +101,15 @@
return _comm;
}
+// Get MPI rank.
+inline
+int
+pylith::topology::Mesh::commRank(void) const {
+ int rank = 0;
+ MPI_Comm_rank(_comm, &rank);
+ return rank;
+}
+
// Print mesh to stdout.
inline
void
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/RefineEdges2.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/RefineEdges2.cc 2012-05-02 17:20:57 UTC (rev 20023)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/RefineEdges2.cc 2012-05-02 17:22:04 UTC (rev 20024)
@@ -170,8 +170,7 @@
const Obj<mesh_type::recv_overlap_type>& oldRecvOverlap = oldMesh->getRecvOverlap();
assert(!oldRecvOverlap.isNull());
- int myrank = 0;
- MPI_Comm_rank(oldMesh->comm(), &myrank);
+ const int commRank = oldMesh->commRank();
// Check edges in edgeToVertex for both endpoints sent to same process
// Put it in section with point being the lowest numbered vertex and value (other endpoint, new vertex)
@@ -198,12 +197,12 @@
std::insert_iterator<std::set<int> >(ranks, ranks.begin()));
#if 0 // DEBUGGING
- std::cout << "[" << myrank << "] Checking edge " << e_iter->first << std::endl;
+ std::cout << "[" << commRank << "] Checking edge " << e_iter->first << std::endl;
for(std::set<int>::const_iterator r_iter = leftRanks.begin(); r_iter != leftRanks.end(); ++r_iter) {
- std::cout << "[" << myrank << "] left rank " << *r_iter << std::endl;
+ std::cout << "[" << commRank << "] left rank " << *r_iter << std::endl;
}
for(std::set<int>::const_iterator r_iter = rightRanks.begin(); r_iter != rightRanks.end(); ++r_iter) {
- std::cout << "[" << myrank << "] right rank " << *r_iter << std::endl;
+ std::cout << "[" << commRank << "] right rank " << *r_iter << std::endl;
}
#endif
if (ranks.size()) {
@@ -215,7 +214,7 @@
#if 0 // DEBUGGING
const point_type edgeMax = std::max(e_iter->first.first, e_iter->first.second);
const int localMaxOffset = (orderOldMesh.verticesNormal().hasPoint(edgeMax)) ? localNormalOffset : localCensoredOffset;
- std::cout << "[" << myrank << "] Added edge " << e_iter->first << " now (" << edgeMin+localMinOffset << ", " << edgeMax+localMaxOffset << ") with rank " << *r_iter << std::endl;
+ std::cout << "[" << commRank << "] Added edge " << e_iter->first << " now (" << edgeMin+localMinOffset << ", " << edgeMax+localMaxOffset << ") with rank " << *r_iter << std::endl;
#endif
} // for
} // if
@@ -292,7 +291,7 @@
} // for
#if 0 // DEBUGGING
if (-1 == newRemotePoint) {
- std::cout << "["<< myrank << "] DISMISSING newLocalPoint: " << newLocalPoint
+ std::cout << "["<< commRank << "] DISMISSING newLocalPoint: " << newLocalPoint
<< ", remoteLeft: " << remoteLeft
<< ", remoteRight: " << remoteRight
<< ", rank: " << rank
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/ReverseCuthillMcKee.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/ReverseCuthillMcKee.cc 2012-05-02 17:20:57 UTC (rev 20023)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/topology/ReverseCuthillMcKee.cc 2012-05-02 17:22:04 UTC (rev 20024)
@@ -39,10 +39,8 @@
//logger.setDebug(1);
logger.stagePush("MeshReordering");
- int rank = 0;
- MPI_Comm_rank(mesh->comm(), &rank);
-
- if (0 == rank) {
+ const int commRank = mesh->commRank();
+ if (0 == commRank) {
const ALE::Obj<SieveMesh>& sieveMesh = mesh->sieveMesh();
assert(!sieveMesh.isNull());
ALE::Obj<ALE::Ordering<>::perm_type> perm =
More information about the CIG-COMMITS
mailing list