[cig-commits] [commit] knepley/upgrade-petsc-interface: Fixed const correctness for getting field metadata. (166d20d)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Fri Jan 17 17:20:38 PST 2014
Repository : ssh://geoshell/pylith
On branch : knepley/upgrade-petsc-interface
Link : https://github.com/geodynamics/pylith/compare/7a219dfd15d0b9fda084e39111a258bc97b47814...a289b5b9fb88708d2d1cdfbaf7bd2f3b7c8d91a4
>---------------------------------------------------------------
commit 166d20d979cfa2c139d58887c5059788c38d4a93
Author: Brad Aagaard <baagaard at usgs.gov>
Date: Fri Jan 17 17:16:53 2014 -0800
Fixed const correctness for getting field metadata.
>---------------------------------------------------------------
166d20d979cfa2c139d58887c5059788c38d4a93
libsrc/pylith/topology/Field.cc | 9 ++++-----
libsrc/pylith/topology/Field.hh | 2 +-
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/libsrc/pylith/topology/Field.cc b/libsrc/pylith/topology/Field.cc
index 7748899..db82229 100644
--- a/libsrc/pylith/topology/Field.cc
+++ b/libsrc/pylith/topology/Field.cc
@@ -248,7 +248,6 @@ pylith::topology::Field::setupSolnChart(void)
{ // setupSolnChart
PYLITH_METHOD_BEGIN;
- clear();
assert(_dm);
// :TODO: Update this to use discretization information after removing FIAT.
@@ -292,7 +291,6 @@ void
{ // setupSolnDof
PYLITH_METHOD_BEGIN;
- clear();
assert(_dm);
// :TODO: Update this to use discretization information after removing FIAT.
@@ -1331,17 +1329,18 @@ pylith::topology::Field::subfieldSetDof(const char *name,
// ----------------------------------------------------------------------
// Get metadata for subfield.
const pylith::topology::FieldBase::Metadata&
-pylith::topology::Field::subfieldMetadata(const char* name)
+pylith::topology::Field::subfieldMetadata(const char* name) const
{ // subfieldMetadata
PYLITH_METHOD_BEGIN;
- if (!_metadata.count(name)) {
+ map_type::const_iterator iter = _metadata.find(name);
+ if (_metadata.end() == iter) {
std::ostringstream msg;
msg << "Could not find subfield '" << name << "' in field '" << label() << "'." << std::endl;
throw std::runtime_error(msg.str());
} // if
- PYLITH_METHOD_RETURN(_metadata[name]);
+ PYLITH_METHOD_RETURN(iter->second);
} // subfieldmetadata
diff --git a/libsrc/pylith/topology/Field.hh b/libsrc/pylith/topology/Field.hh
index c67a269..e9c7158 100644
--- a/libsrc/pylith/topology/Field.hh
+++ b/libsrc/pylith/topology/Field.hh
@@ -326,7 +326,7 @@ public :
* @param name Name of subfield.
* @returns Metadata for subfield.
*/
- const Metadata& subfieldMetadata(const char* name);
+ const Metadata& subfieldMetadata(const char* name) const;
/// Clear variables associated with section.
void clear(void);
More information about the CIG-COMMITS
mailing list