[cig-commits] r17281 - short/3D/PyLith/trunk/libsrc/topology
brad at geodynamics.org
brad at geodynamics.org
Fri Oct 15 11:56:49 PDT 2010
Author: brad
Date: 2010-10-15 11:56:49 -0700 (Fri, 15 Oct 2010)
New Revision: 17281
Modified:
short/3D/PyLith/trunk/libsrc/topology/Field.cc
short/3D/PyLith/trunk/libsrc/topology/Field.icc
Log:
Cleanup of updating field labels. Use label() method to propagate value to section and PETSc vector.
Modified: short/3D/PyLith/trunk/libsrc/topology/Field.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Field.cc 2010-10-15 18:03:18 UTC (rev 17280)
+++ short/3D/PyLith/trunk/libsrc/topology/Field.cc 2010-10-15 18:56:49 UTC (rev 17281)
@@ -283,9 +283,9 @@
logger.stagePush("Field");
deallocate();
- std::string label = _metadata.label;
+ std::string origLabel = _metadata.label;
_metadata = src._metadata;
- _metadata.label = label;
+ label(origLabel.c_str());
const ALE::Obj<section_type>& srcSection = src.section();
if (!srcSection.isNull() && _section.isNull()) {
@@ -460,7 +460,7 @@
} // for
} // if
- _metadata.label = field._metadata.label;
+ label(field._metadata.label.c_str()); // Update label
_metadata.scale = field._metadata.scale;
} // copy
Modified: short/3D/PyLith/trunk/libsrc/topology/Field.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Field.icc 2010-10-15 18:03:18 UTC (rev 17280)
+++ short/3D/PyLith/trunk/libsrc/topology/Field.icc 2010-10-15 18:56:49 UTC (rev 17281)
@@ -20,6 +20,8 @@
#error "Field.icc must be included only from Field.hh"
#else
+#include "pylith/utils/petscerror.h" // USES CHECK_PETSC_ERROR
+
// Get Sieve section.
template<typename mesh_type, typename section_type>
inline
@@ -43,6 +45,13 @@
void
pylith::topology::Field<mesh_type, section_type>::label(const char* value) {
_metadata.label = value;
+ if (!_section.isNull()) {
+ _section->setName(value);
+ } // if
+ if (_vector) {
+ PetscErrorCode err = PetscObjectSetName((PetscObject)_vector, value);
+ CHECK_PETSC_ERROR(err);
+ } // if
}
// Get label for field.
More information about the CIG-COMMITS
mailing list