[cig-commits] [commit] knepley/upgrade-petsc-interface: Topology: Added optimizeClosure() to visitors - Creates a closure index associated with the DM only if one does not already exist (a9a1eb4)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Mon Nov 25 17:42:43 PST 2013
Repository : ssh://geoshell/pylith
On branch : knepley/upgrade-petsc-interface
Link : https://github.com/geodynamics/pylith/compare/0b9b0aaf3cbf745e5b76f3177a1ddddb5bf75fe7...5b37d1ea08e0a69bd51ffc02ad5050e32f819f3d
>---------------------------------------------------------------
commit a9a1eb44139677150c746c60dca6665e991ff671
Author: Matthew G. Knepley <knepley at gmail.com>
Date: Mon Nov 25 19:44:47 2013 -0600
Topology: Added optimizeClosure() to visitors
- Creates a closure index associated with the DM only if one does not already exist
>---------------------------------------------------------------
a9a1eb44139677150c746c60dca6665e991ff671
libsrc/pylith/topology/CoordsVisitor.hh | 4 ++++
libsrc/pylith/topology/CoordsVisitor.icc | 14 +++++++++++++-
libsrc/pylith/topology/VisitorMesh.hh | 4 ++++
libsrc/pylith/topology/VisitorMesh.icc | 14 +++++++++++++-
4 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/libsrc/pylith/topology/CoordsVisitor.hh b/libsrc/pylith/topology/CoordsVisitor.hh
index e89c765..7136dd7 100644
--- a/libsrc/pylith/topology/CoordsVisitor.hh
+++ b/libsrc/pylith/topology/CoordsVisitor.hh
@@ -76,6 +76,10 @@ public :
*/
PetscInt sectionOffset(const PetscInt point) const;
+ /** Optimize the closure operator by using extra storage.
+ */
+ void optimizeClosure();
+
/** Get coordinates array associated with closure.
*
* @pre Must be followed by call to restoreClosure().
diff --git a/libsrc/pylith/topology/CoordsVisitor.icc b/libsrc/pylith/topology/CoordsVisitor.icc
index 1bd7898..3f9b13d 100644
--- a/libsrc/pylith/topology/CoordsVisitor.icc
+++ b/libsrc/pylith/topology/CoordsVisitor.icc
@@ -53,7 +53,6 @@ pylith::topology::CoordsVisitor::initialize(void)
PetscInt size;
PetscErrorCode err;
err = DMPlexGetCoordinateSection(_dm, &_section);PYLITH_CHECK_ERROR(err);assert(_section);
- err = DMPlexCreateClosureIndex(_dm, _section);PYLITH_CHECK_ERROR(err);
err = DMGetCoordinatesLocal(_dm, &_localVec);PYLITH_CHECK_ERROR(err);assert(_localVec);
err = VecGetLocalSize(_localVec, &size);PYLITH_CHECK_ERROR(err);
err = VecGetArray(_localVec, &_localArray);PYLITH_CHECK_ERROR(err);assert(!size || _localArray);
@@ -108,6 +107,19 @@ pylith::topology::CoordsVisitor::sectionOffset(const PetscInt point) const
} // sectionOffset
// ----------------------------------------------------------------------
+// Optimize the closure operation.
+inline
+void
+pylith::topology::CoordsVisitor::optimizeClosure()
+{ // optimizeClosure
+ PetscSection clSection;
+ PetscErrorCode err;
+
+ err = PetscSectionGetClosureIndex(_section, (PetscObject) _dm, &clSection, NULL);PYLITH_CHECK_ERROR(err);
+ if (!clSection) {err = DMPlexCreateClosureIndex(_dm, _section);PYLITH_CHECK_ERROR(err);}
+} // optimizeClosure
+
+// ----------------------------------------------------------------------
// Get coordinates array associated with closure.
inline
void
diff --git a/libsrc/pylith/topology/VisitorMesh.hh b/libsrc/pylith/topology/VisitorMesh.hh
index a86e2f0..c71c776 100644
--- a/libsrc/pylith/topology/VisitorMesh.hh
+++ b/libsrc/pylith/topology/VisitorMesh.hh
@@ -100,6 +100,10 @@ public :
*/
PetscInt sectionOffset(const PetscInt point) const;
+ /** Optimize the closure operator by using extra storage.
+ */
+ void optimizeClosure();
+
/** Get array of values associated with closure.
*
* @pre Must be followed by call to restoreClosure().
diff --git a/libsrc/pylith/topology/VisitorMesh.icc b/libsrc/pylith/topology/VisitorMesh.icc
index 2ee889f..429c319 100644
--- a/libsrc/pylith/topology/VisitorMesh.icc
+++ b/libsrc/pylith/topology/VisitorMesh.icc
@@ -59,7 +59,6 @@ pylith::topology::VecVisitorMesh::initialize(const Field& field)
_localVec = field.localVector();assert(_localVec);
PetscErrorCode err = VecGetArray(_localVec, &_localArray);PYLITH_CHECK_ERROR(err);
- err = DMPlexCreateClosureIndex(_dm, _section);PYLITH_CHECK_ERROR(err);
} // initialize
// ----------------------------------------------------------------------
@@ -140,6 +139,19 @@ pylith::topology::VecVisitorMesh::sectionOffset(const PetscInt point) const
} // sectionOffset
// ----------------------------------------------------------------------
+// Optimize the closure operation.
+inline
+void
+pylith::topology::VecVisitorMesh::optimizeClosure()
+{ // optimizeClosure
+ PetscSection clSection;
+ PetscErrorCode err;
+
+ err = PetscSectionGetClosureIndex(_section, (PetscObject) _dm, &clSection, NULL);PYLITH_CHECK_ERROR(err);
+ if (!clSection) {err = DMPlexCreateClosureIndex(_dm, _section);PYLITH_CHECK_ERROR(err);}
+} // optimizeClosure
+
+// ----------------------------------------------------------------------
// Get coordinates array associated with closure.
inline
void
More information about the CIG-COMMITS
mailing list