[cig-commits] r5991 - short/3D/PyLith/trunk/libsrc/feassemble
brad at geodynamics.org
brad at geodynamics.org
Thu Feb 8 21:55:58 PST 2007
Author: brad
Date: 2007-02-08 21:55:57 -0800 (Thu, 08 Feb 2007)
New Revision: 5991
Added:
short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.cc
short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.hh
Modified:
short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.cc
short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.hh
short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.hh
short/3D/PyLith/trunk/libsrc/feassemble/Makefile.am
Log:
Added ParameterManager for managing parameters for finite-element integrators.
Modified: short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.cc 2007-02-09 04:07:11 UTC (rev 5990)
+++ short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.cc 2007-02-09 05:55:57 UTC (rev 5991)
@@ -285,13 +285,13 @@
} // integrateLumped
// ----------------------------------------------------------------------
-// Initialize, get material property parameters from database.
+// Setup material property parameters by querying database.
void
-pylith::feassemble::DynExplicitElasticity::initialize(
+pylith::feassemble::DynExplicitElasticity::setupMatProp(
ALE::Obj<ALE::Mesh>& mesh,
spatialdata::geocoords::CoordSys* cs,
spatialdata::spatialdb::SpatialDB* db)
-{ // initialize
+{ // setupMatProp
assert(0 != cs);
assert(0 != db);
@@ -353,7 +353,7 @@
// Close database
db->close();
-} // initialize
+} // setupMatProp
// End of file
Modified: short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.hh 2007-02-09 04:07:11 UTC (rev 5990)
+++ short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.hh 2007-02-09 05:55:57 UTC (rev 5991)
@@ -45,6 +45,15 @@
} // feassemble
} // pylith
+namespace spatialdata {
+ namespace spatialdb {
+ class SpatialDB; // USES SpatialDB
+ } // spatialdb
+ namespace geocoords {
+ class CoordSys; // USES CoordSys
+ } // geocoords
+} // spatialdata
+
class pylith::feassemble::DynExplicitElasticity : public IntegratorDynExplicit
{ // DynExplicitElasticity
friend class TestDynExplicitElasticity; // unit testing
@@ -94,15 +103,15 @@
const ALE::Obj<real_section_type>& dispT,
const ALE::Obj<real_section_type>& coordinates);
- /** Initialize, get material property parameters from database.
+ /** Setup material property parameters by querying database.
*
* @param mesh PETSc mesh
* @param cs Pointer to coordinate system of vertices
* @param db Pointer to spatial database with material property parameters
*/
- void initialize(ALE::Obj<ALE::Mesh>& mesh,
- spatialdata::geocoords::CoordSys* cs,
- spatialdata::spatialdb::SpatialDB* db);
+ void setupMatProp(ALE::Obj<ALE::Mesh>& mesh,
+ spatialdata::geocoords::CoordSys* cs,
+ spatialdata::spatialdb::SpatialDB* db);
// PROTECTED METHODS ////////////////////////////////////////////////////
protected :
Modified: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.hh 2007-02-09 04:07:11 UTC (rev 5990)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.hh 2007-02-09 05:55:57 UTC (rev 5991)
@@ -40,15 +40,6 @@
} // feassemble
} // pylith
-namespace spatialdata {
- namespace spatialdb {
- class SpatialDB; // USES SpatialDB
- } // spatialdb
- namespace geocoords {
- class CoordSys; // USES CoordSys
- } // geocoords
-} // spatialdata
-
class pylith::feassemble::IntegratorDynExplicit : public Integrator
{ // Integrator
friend class TestIntegratorDynExplicit; // unit testing
@@ -103,17 +94,6 @@
const ALE::Obj<real_section_type>& fieldIn,
const ALE::Obj<real_section_type>& coordinates) = 0;
- /** Initialize, get material property parameters from database.
- *
- * @param mesh PETSc mesh
- * @param cs Pointer to coordinate system of vertices
- * @param db Pointer to spatial database with material property parameters
- */
- virtual
- void initialize(ALE::Obj<ALE::Mesh>& mesh,
- spatialdata::geocoords::CoordSys* cs,
- spatialdata::spatialdb::SpatialDB* db) = 0;
-
// PROTECTED METHODS ////////////////////////////////////////////////////
protected :
Modified: short/3D/PyLith/trunk/libsrc/feassemble/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Makefile.am 2007-02-09 04:07:11 UTC (rev 5990)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Makefile.am 2007-02-09 05:55:57 UTC (rev 5991)
@@ -31,7 +31,8 @@
Quadrature2Din3D.hh \
Quadrature2Din3D.icc \
Quadrature3D.hh \
- Quadrature3D.icc
+ Quadrature3D.icc \
+ ParameterManager.hh
noinst_HEADERS =
Added: short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.cc 2007-02-09 04:07:11 UTC (rev 5990)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.cc 2007-02-09 05:55:57 UTC (rev 5991)
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "ParameterManager.hh" // implementation of class methods
+
+#include <stdexcept> // USES std::runtime_error
+#include <sstream> // USES std::ostringstream
+#include <assert.h> // USES assert()
+
+// ----------------------------------------------------------------------
+// Constructor
+pylith::feassemble::ParameterManager::ParameterManager(void)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+pylith::feassemble::ParameterManager::~ParameterManager(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Add parameter.
+void
+pylith::feassemble::ParameterManager::addReal(const char* name)
+{ // addReal
+ map_real_type::iterator iter = _real.find(name);
+ if (iter != _real.end()) {
+ std::ostringstream msg;
+ msg << "Could not add parameter '" << name
+ << "'. Parameter already exists.";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ // :QUESTION:
+ // How do we get the topology information we need here?
+
+#if 0
+ ALE::Obj<real_section_type> parameter = new real_section_type(_topology);
+ _real[name] = parameter;
+#endif
+} // addReal
+
+// ----------------------------------------------------------------------
+// Get parameter.
+const ALE::Obj<ALE::Mesh::real_section_type>&
+pylith::feassemble::ParameterManager::getReal(const char* name)
+{ // getReal
+ map_real_type::const_iterator iter = _real.find(name);
+ if (iter == _real.end()) {
+ std::ostringstream msg;
+ msg << "Could not find parameter '" << name << "'.";
+ throw std::runtime_error(msg.str());
+ } // if
+ return _real[name];
+} // getReal
+
+
+// End of file
Added: short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.hh 2007-02-09 04:07:11 UTC (rev 5990)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.hh 2007-02-09 05:55:57 UTC (rev 5991)
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/feassemble/ParameterManager.hh
+ *
+ * @brief Object for managing fields associated with parameters for
+ * finite-elements.
+ *
+ * The parameter manager stores the fields associated with parameters
+ * for physical properties or boundary conditions.
+ *
+ * :QUESTION: Should there be only one parameter manager for all
+ * element families or one per element family? If we can easily create
+ * a section that pertains only to an element family, then one per
+ * family would make the most sense.
+ */
+
+#if !defined(pylith_feassemble_parametermanager_hh)
+#define pylith_feassemble_parametermanager_hh
+
+#include <map> // HASA std::map
+#include <string> // USES std::string
+
+#include <petscmesh.h> // USES Mesh
+
+namespace pylith {
+ namespace feassemble {
+ class ParameterManager;
+ class TestParameterManager;
+ } // feassemble
+} // pylith
+
+class pylith::feassemble::ParameterManager
+{ // Integrator
+ friend class TestParameterManager; // unit testing
+
+// PUBLIC TYPEDEFS //////////////////////////////////////////////////////
+public :
+
+ typedef ALE::Mesh Mesh;
+ typedef Mesh::topology_type topology_type;
+ typedef topology_type::point_type point_type;
+ typedef Mesh::real_section_type real_section_type;
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public :
+
+ /// Constructor
+ ParameterManager(void);
+
+ /// Destructor
+ ~ParameterManager(void);
+
+ /** Add parameter.
+ *
+ * @param name Name of parameter field
+ */
+ void addReal(const char* name);
+
+ /** Get parameter.
+ *
+ * @param name Name of parameter field
+ */
+ const ALE::Obj<real_section_type>& getReal(const char* name);
+
+// PRIVATE METHODS //////////////////////////////////////////////////////
+private :
+
+ /// Not implemented
+ ParameterManager(const ParameterManager& m);
+
+ /// Not implemented
+ const ParameterManager& operator=(const ParameterManager&);
+
+// PRIVATE TYPEDEFS /////////////////////////////////////////////////////
+private :
+
+ typedef std::map< std::string, ALE::Obj<real_section_type> > map_real_type;
+
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private :
+
+ /// Map for parameters stored as real fields
+ map_real_type _real;
+
+}; // ParameterManager
+
+#endif // pylith_feassemble_parametermanager_hh
+
+
+// End of file
More information about the cig-commits
mailing list