[cig-commits] r22091 - in short/3D/PyLith/trunk/libsrc/pylith: meshio topology
brad at geodynamics.org
brad at geodynamics.org
Fri May 17 11:40:13 PDT 2013
Author: brad
Date: 2013-05-17 11:40:13 -0700 (Fri, 17 May 2013)
New Revision: 22091
Modified:
short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.cc
short/3D/PyLith/trunk/libsrc/pylith/topology/Field.cc
short/3D/PyLith/trunk/libsrc/pylith/topology/Field.hh
Log:
Remove deprecated stuff from ScatterInfo structure. Updated reuse test accordingly.
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.cc 2013-05-17 10:29:20 UTC (rev 22090)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.cc 2013-05-17 18:40:13 UTC (rev 22091)
@@ -81,8 +81,8 @@
void
pylith::meshio::DataWriterHDF5::open(const topology::Mesh& mesh,
const int numTimeSteps,
- const char* label,
- const int labelId)
+ const char* label,
+ const int labelId)
{ // open
PYLITH_METHOD_BEGIN;
@@ -421,7 +421,7 @@
// Write time stamp to file.
void
pylith::meshio::DataWriterHDF5::_writeTimeStamp(const PylithScalar t,
- const int commRank)
+ const int commRank)
{ // _writeTimeStamp
assert(_tstamp);
PetscErrorCode err = 0;
Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/Field.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/Field.cc 2013-05-17 10:29:20 UTC (rev 22090)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/Field.cc 2013-05-17 18:40:13 UTC (rev 22091)
@@ -76,8 +76,8 @@
// ----------------------------------------------------------------------
// Constructor with mesh, DM, and metadata
pylith::topology::Field::Field(const Mesh& mesh,
- PetscDM dm,
- const Metadata& metadata) :
+ PetscDM dm,
+ const Metadata& metadata) :
_mesh(mesh),
_dm(dm),
_globalVec(NULL),
@@ -283,8 +283,8 @@
// points.
void
pylith::topology::Field::newSection(const PetscInt *points,
- const PetscInt num,
- const int fiberDim)
+ const PetscInt num,
+ const int fiberDim)
{ // newSection
PYLITH_METHOD_BEGIN;
@@ -464,25 +464,12 @@
++s_iter) {
ScatterInfo sinfo;
sinfo.vector = 0;
- sinfo.scatter = 0;
- sinfo.scatterVec = 0;
// Copy DM
sinfo.dm = s_iter->second.dm;
err = PetscObjectReference((PetscObject) sinfo.dm);
PYLITH_CHECK_ERROR(err);
- // Copy scatter
- if (s_iter->second.scatter) {
- sinfo.scatter = s_iter->second.scatter;
- err = PetscObjectReference((PetscObject) sinfo.scatter);
- PYLITH_CHECK_ERROR(err);
- } // if
-
- // Create scatter Vec
- sinfo.scatterVec = _localVec;
- err = PetscObjectReference((PetscObject) sinfo.scatterVec);PYLITH_CHECK_ERROR(err);
-
// Create vector using sizes from source section
PetscInt vecLocalSize = 0;
PetscInt vecGlobalSize = 0, vecGlobalSize2 = 0;
@@ -527,10 +514,6 @@
err = DMDestroy(&s_iter->second.dm);PYLITH_CHECK_ERROR(err);
err = VecDestroy(&s_iter->second.vector);PYLITH_CHECK_ERROR(err);
- if (s_iter->second.scatter) {
- err = VecScatterDestroy(&s_iter->second.scatter);PYLITH_CHECK_ERROR(err);
- } // if
- err = VecDestroy(&s_iter->second.scatterVec);PYLITH_CHECK_ERROR(err);
} // for
_scatters.clear();
@@ -906,8 +889,7 @@
const bool createScatterOk = true;
ScatterInfo& sinfo = _getScatter(context, createScatterOk);
- if (sinfo.scatter) {
- assert(sinfo.scatterVec);
+ if (sinfo.dm) {
assert(sinfo.vector);
PYLITH_METHOD_END;
} // if
@@ -938,7 +920,7 @@
// the PETSc vector.
void
pylith::topology::Field::createScatterWithBC(const Mesh& mesh,
- const char* context)
+ const char* context)
{ // createScatterWithBC
PYLITH_METHOD_BEGIN;
@@ -947,8 +929,7 @@
const bool createScatterOk = true;
ScatterInfo& sinfo = _getScatter(context, createScatterOk);
- if (sinfo.scatter) {
- assert(sinfo.scatterVec);
+ if (sinfo.dm) {
assert(sinfo.vector);
PYLITH_METHOD_END;
} // if
@@ -1000,12 +981,14 @@
ScatterInfo& sinfo = _getScatter(context, createScatterOk);
// Only create if scatter and scatterVec do not alreay exist.
- if (sinfo.scatter) {
- assert(sinfo.scatterVec);
+ if (sinfo.dm) {
+ std::cout << "Reusing scatter '" << context << "'" << std::endl;
assert(sinfo.vector);
PYLITH_METHOD_END;
} // if
+ std::cout << "Setup scatter '" << context << "'" << std::endl;
+
PetscDM dm = mesh.dmMesh();assert(dm);
PetscSection section, newSection, gsection, subSection = NULL;
PetscSF sf;
@@ -1092,8 +1075,6 @@
<< ", global order size: " << order->getGlobalSize()
<< ", local numbering size: " << numbering->getLocalSize()
<< ", local order size: " << order->getLocalSize()
- << ", scatter from size: " << sinfo.scatter->from_n
- << ", scatter: " << sinfo.scatter
<< std::endl;
#endif
@@ -1152,14 +1133,6 @@
assert(context);
const ScatterInfo& sinfo = _getScatter(context);
PetscErrorCode err = 0;
-#if 0 // OBSOLETE??
- if (!_section.isNull()) {
- err = VecScatterBegin(sinfo.scatter, sinfo.scatterVec, vector,
- INSERT_VALUES, SCATTER_FORWARD);PYLITH_CHECK_ERROR(err);
- err = VecScatterEnd(sinfo.scatter, sinfo.scatterVec, vector,
- INSERT_VALUES, SCATTER_FORWARD);PYLITH_CHECK_ERROR(err);
- }
-#endif
if (sinfo.dm) {
err = DMLocalToGlobalBegin(sinfo.dm, _localVec, INSERT_VALUES, vector);PYLITH_CHECK_ERROR(err);
err = DMLocalToGlobalEnd(sinfo.dm, _localVec, INSERT_VALUES, vector);PYLITH_CHECK_ERROR(err);
@@ -1198,14 +1171,6 @@
const ScatterInfo& sinfo = _getScatter(context);
PetscErrorCode err = 0;
-#if 0 // OBSOLETE??
- if (!_section.isNull()) {
- err = VecScatterBegin(sinfo.scatter, vector, sinfo.scatterVec,
- INSERT_VALUES, SCATTER_REVERSE); PYLITH_CHECK_ERROR(err);
- err = VecScatterEnd(sinfo.scatter, vector, sinfo.scatterVec,
- INSERT_VALUES, SCATTER_REVERSE); PYLITH_CHECK_ERROR(err);
- }
-#endif
if (sinfo.dm) {
err = DMGlobalToLocalBegin(sinfo.dm, vector, INSERT_VALUES, _localVec);PYLITH_CHECK_ERROR(err);
err = DMGlobalToLocalEnd(sinfo.dm, vector, INSERT_VALUES, _localVec);PYLITH_CHECK_ERROR(err);
@@ -1260,9 +1225,8 @@
PetscErrorCode err = 0;
err = DMDestroy(&sinfo.dm);PYLITH_CHECK_ERROR(err);
err = VecDestroy(&sinfo.vector);PYLITH_CHECK_ERROR(err);
- err = VecScatterDestroy(&sinfo.scatter);PYLITH_CHECK_ERROR(err);
- err = VecDestroy(&sinfo.scatterVec);PYLITH_CHECK_ERROR(err);
+ std::cout << "Removing scatter '" << context << "'" << std::endl;
_scatters.erase(context);
isNewScatter = true;
} // if
@@ -1275,10 +1239,9 @@
ScatterInfo& sinfo = _scatters[context];
if (isNewScatter) {
+ std::cout << "Creating scatter '" << context << "'" << std::endl;
sinfo.dm = 0;
sinfo.vector = 0;
- sinfo.scatter = 0;
- sinfo.scatterVec = 0;
} // if
assert(_scatters.find(context) != _scatters.end());
Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/Field.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/Field.hh 2013-05-17 10:29:20 UTC (rev 22090)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/Field.hh 2013-05-17 18:40:13 UTC (rev 22091)
@@ -428,9 +428,6 @@
struct ScatterInfo {
PetscDM dm; ///< PETSc DM defining the communication pattern
PetscVec vector; ///< PETSc vector associated with field.
- // Deprecated
- PetscVecScatter scatter; ///< PETSc scatter associated with field.
- PetscVec scatterVec; ///< PETSC vector used in scattering.
}; // ScatterInfo
// PRIVATE TYPEDEFS /////////////////////////////////////////////////////
More information about the CIG-COMMITS
mailing list