[cig-commits] r11174 - in short/3D/PyLith/trunk: examples/3d/tet4 examples/twocells/twoquad4 libsrc libsrc/meshio modulesrc/bc modulesrc/meshio pylith pylith/bc pylith/meshio pylith/problems
brad at geodynamics.org
brad at geodynamics.org
Fri Feb 15 17:04:22 PST 2008
Author: brad
Date: 2008-02-15 17:04:21 -0800 (Fri, 15 Feb 2008)
New Revision: 11174
Added:
short/3D/PyLith/trunk/libsrc/meshio/OutputSolnSubset.cc
short/3D/PyLith/trunk/libsrc/meshio/OutputSolnSubset.hh
short/3D/PyLith/trunk/pylith/meshio/DoubleOutput.py
short/3D/PyLith/trunk/pylith/meshio/OutputSolnSubset.py
Modified:
short/3D/PyLith/trunk/examples/3d/tet4/README
short/3D/PyLith/trunk/examples/3d/tet4/pylithapp.cfg
short/3D/PyLith/trunk/examples/3d/tet4/shearxy.cfg
short/3D/PyLith/trunk/examples/twocells/twoquad4/dislocation.cfg
short/3D/PyLith/trunk/libsrc/Makefile.am
short/3D/PyLith/trunk/libsrc/meshio/Makefile.am
short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc
short/3D/PyLith/trunk/libsrc/meshio/OutputManager.hh
short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src
short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src
short/3D/PyLith/trunk/pylith/Makefile.am
short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py
short/3D/PyLith/trunk/pylith/meshio/OutputDirichlet.py
short/3D/PyLith/trunk/pylith/meshio/OutputFaultKin.py
short/3D/PyLith/trunk/pylith/meshio/OutputMatElastic.py
short/3D/PyLith/trunk/pylith/meshio/OutputNeumann.py
short/3D/PyLith/trunk/pylith/meshio/OutputSoln.py
short/3D/PyLith/trunk/pylith/meshio/SingleOutput.py
short/3D/PyLith/trunk/pylith/meshio/__init__.py
short/3D/PyLith/trunk/pylith/problems/Formulation.py
Log:
Added ability to output solution over subdomain.
Modified: short/3D/PyLith/trunk/examples/3d/tet4/README
===================================================================
--- short/3D/PyLith/trunk/examples/3d/tet4/README 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/examples/3d/tet4/README 2008-02-16 01:04:21 UTC (rev 11174)
@@ -1,7 +1,8 @@
The examples in this directory include (1) simple shearing of a box
-and (2) slip on a through-going, vertical, strike-slip fault in a box
-that is 6 km x 6 km x 4 km with linear tetrahedral cells that have
-edges nominally 1.0 km long.
+and (2) slip on a through-going, vertical, strike-slip fault in a
+box. In each problem the domain is 6 km x 6 km x 4 km and is
+discretized with linear tetrahedral cells that have edges nominally
+1.0 km long.
The box spans the volume:
@@ -19,7 +20,7 @@
DESCRIPTION OF FILES
-dislocation.cfg - Simulation parameters for fault slip problem
+dislocation.cfg - Simulation parameters for strike-slip fault problem.
finalslip.spatialdb - Spatial database for spatial variation of final slip
Modified: short/3D/PyLith/trunk/examples/3d/tet4/pylithapp.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/3d/tet4/pylithapp.cfg 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/examples/3d/tet4/pylithapp.cfg 2008-02-16 01:04:21 UTC (rev 11174)
@@ -13,8 +13,7 @@
meshiolagrit = 1
implicitelasticity = 1
faultcohesivekin = 1
-#quadrature3d = 1
-#fiatsimplex = 1
+fiatsimplex = 1
# ----------------------------------------------------------------------
# mesh_generator
@@ -31,15 +30,15 @@
filename_pset = tet4_1000m_binary.pset
# If using provided mesh or importing the mesh on a machine with a
-# different endian type than the one which created the mesh uncomment
-# the following line
+# different endian type than the one which created the mesh, then
+# uncomment the following line
#flip_endian = True
# ----------------------------------------------------------------------
# materials
# ----------------------------------------------------------------------
[pylithapp.timedependent]
-# Use the local (user-defined) 4 item materials container
+# Use the local (user-defined) container with 4 materials.
materials = fourmaterials
[pylithapp.timedependent.materials]
Modified: short/3D/PyLith/trunk/examples/3d/tet4/shearxy.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/3d/tet4/shearxy.cfg 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/examples/3d/tet4/shearxy.cfg 2008-02-16 01:04:21 UTC (rev 11174)
@@ -1,14 +1,13 @@
# -*- Python -*-
[pylithapp]
-
# This is not a self-contained simulation configuration file. This
# file only specifies parameters specific to the boundary
# conditions. The general parameters are specificed in the pylithapp.cfg
# file which is read by default.
#
# To run the simulation:
-# pylith cfg shearxy.cfg
+# pylith shearxy.cfg
# ----------------------------------------------------------------------
# problem
@@ -17,9 +16,14 @@
total_time = 0.0*s ; total time of simulation
default_dt = 1.0*s ; time step
-# Use the predefined 6 item BC container
+# Select a boundary condition container with 6 BCs.
bc = pylith.bc.BCSixSides
+[pylithapp.timedependent.implicit]
+# Select an output condition container with 2 output managers.
+# We will output the solution over the domain and the ground surface.
+output = pylith.meshio.DoubleOutput
+
# ----------------------------------------------------------------------
# boundary conditions
# ----------------------------------------------------------------------
@@ -34,7 +38,7 @@
# We fix the x and y degrees of freedom on the +x and -x faces, and
# fix the z degree of freedom on the bottom face.
-# The label corresponds to the nodeset ID in CUBIT.
+# The label corresponds to the name of the pset in LaGriT.
[pylithapp.timedependent.bc.x_pos]
fixed_dof = [0, 1]
@@ -60,7 +64,11 @@
# ----------------------------------------------------------------------
# output
# ----------------------------------------------------------------------
-# Set the root name for output.
+# Give basename for VTK domain output of solution over domain.
+[pylithapp.problem.formulation.output.domain.writer]
+filename = shear.vtk
-[pylithapp.problem.formulation.output.output.writer]
-filename = shear.vtk
+# Give basename for VTK domain output of solution over ground surface.
+[pylithapp.problem.formulation.output.subdomain]
+label = boundary_zp
+writer.filename = shear-groundsurf.vtk
Modified: short/3D/PyLith/trunk/examples/twocells/twoquad4/dislocation.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/twocells/twoquad4/dislocation.cfg 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/examples/twocells/twoquad4/dislocation.cfg 2008-02-16 01:04:21 UTC (rev 11174)
@@ -30,7 +30,7 @@
# We want an implicit formulation.
formulation = pylith.problems.Implicit
-# This is a container for a boundary condition specified at a point.
+# Select a boundary condition container with 4 BCs.
bc = pylith.bc.BCFourSides
# This is a container for a single fault.
Modified: short/3D/PyLith/trunk/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/Makefile.am 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/libsrc/Makefile.am 2008-02-16 01:04:21 UTC (rev 11174)
@@ -83,6 +83,7 @@
meshio/MeshIOAscii.cc \
meshio/MeshIOLagrit.cc \
meshio/OutputManager.cc \
+ meshio/OutputSolnSubset.cc \
meshio/PsetFile.cc \
meshio/PsetFileAscii.cc \
meshio/PsetFileBinary.cc \
Modified: short/3D/PyLith/trunk/libsrc/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/Makefile.am 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/libsrc/meshio/Makefile.am 2008-02-16 01:04:21 UTC (rev 11174)
@@ -26,6 +26,7 @@
MeshIOLagrit.hh \
MeshIOLagrit.icc \
OutputManager.hh \
+ OutputSolnSubset.hh \
VertexFilter.hh
if ENABLE_CUBIT
Modified: short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc 2008-02-16 01:04:21 UTC (rev 11174)
@@ -26,8 +26,7 @@
_coordsys(0),
_writer(0),
_vertexFilter(0),
- _cellFilter(0),
- _isInfo(false)
+ _cellFilter(0)
{ // constructor
} // constructor
Modified: short/3D/PyLith/trunk/libsrc/meshio/OutputManager.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/OutputManager.hh 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/libsrc/meshio/OutputManager.hh 2008-02-16 01:04:21 UTC (rev 11174)
@@ -48,6 +48,7 @@
OutputManager(void);
/// Destructor
+ virtual
~OutputManager(void);
/** Set coordinate system in output. The vertex fields in the output
@@ -144,6 +145,12 @@
const char* label =0,
const int labelId =0);
+// NOT IMPLEMENTED //////////////////////////////////////////////////////
+private :
+
+ OutputManager(const OutputManager&); ///< Not implemented.
+ const OutputManager& operator=(const OutputManager&); ///< Not implemented
+
// PRIVATE MEMBERS //////////////////////////////////////////////////////
private :
@@ -152,8 +159,6 @@
VertexFilter* _vertexFilter; ///< Filter applied to vertex data.
CellFilter* _cellFilter; ///< Filter applied to cell data.
- bool _isInfo; ///< Is output info (diagnostic stuff) or data (solution, etc).
-
}; // OutputManager
#endif // pylith_meshio_outputmanager_hh
Added: short/3D/PyLith/trunk/libsrc/meshio/OutputSolnSubset.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/OutputSolnSubset.cc (rev 0)
+++ short/3D/PyLith/trunk/libsrc/meshio/OutputSolnSubset.cc 2008-02-16 01:04:21 UTC (rev 11174)
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "OutputSolnSubset.hh" // implementation of class methods
+
+#include <Selection.hh> // USES submesh algorithms
+
+// ----------------------------------------------------------------------
+// Constructor
+pylith::meshio::OutputSolnSubset::OutputSolnSubset(void) :
+ _label("")
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+pylith::meshio::OutputSolnSubset::~OutputSolnSubset(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Set label identifier for subdomain.
+void
+pylith::meshio::OutputSolnSubset::label(const char* value)
+{ // label
+ _label = value;
+} // label
+
+// ----------------------------------------------------------------------
+// Get mesh associated with subdomain.
+const ALE::Obj<pylith::Mesh>&
+pylith::meshio::OutputSolnSubset::subdomainMesh(const ALE::Obj<Mesh>& mesh)
+{ // subdomainMesh
+ _mesh =
+ ALE::Selection<ALE::Mesh>::submesh(mesh, mesh->getIntSection(_label));
+ if (_mesh.isNull()) {
+ std::ostringstream msg;
+ msg << "Could not construct mesh of subdomain " << _label << "'.";
+ throw std::runtime_error(msg.str());
+ } // if
+ _mesh->setRealSection("coordinates",
+ mesh->getRealSection("coordinates"));
+
+ return _mesh;
+} // subdomainMesh
+
+
+// End of file
Added: short/3D/PyLith/trunk/libsrc/meshio/OutputSolnSubset.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/OutputSolnSubset.hh (rev 0)
+++ short/3D/PyLith/trunk/libsrc/meshio/OutputSolnSubset.hh 2008-02-16 01:04:21 UTC (rev 11174)
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/meshio/OutputSolnSubset.hh
+ *
+ * @brief C++ object for manager output of finite-element data over a
+ * subdomain.
+ */
+
+#if !defined(pylith_meshio_outputsolnsubset_hh)
+#define pylith_meshio_outputsolnsubset_hh
+
+#include "OutputManager.hh" // ISA OutputManager
+
+#include "pylith/utils/sievetypes.hh" // HASA ALE::Mesh
+#include <string> // HASA std::string
+
+namespace pylith {
+ namespace meshio {
+ class OutputSolnSubset;
+ } // meshio
+} // pylith
+
+class pylith::meshio::OutputSolnSubset : public OutputManager
+{ // OutputSolnSubset
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+ /// Constructor
+ OutputSolnSubset(void);
+
+ /// Destructor
+ ~OutputSolnSubset(void);
+
+ /** Set label identifier for subdomain.
+ *
+ * @param value Label of subdomain.
+ */
+ void label(const char* value);
+
+ /** Get mesh associated with subdomain.
+ *
+ * @returns Mesh associated with subdomain.
+ */
+ const ALE::Obj<Mesh>& subdomainMesh(const ALE::Obj<Mesh>& mesh);
+
+
+// NOT IMPLEMENTED //////////////////////////////////////////////////////
+private :
+
+ OutputSolnSubset(const OutputSolnSubset&); ///< Not implemented.
+ const OutputSolnSubset& operator=(const OutputSolnSubset&); ///< Not implemented
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private :
+
+ std::string _label; ///< Label of subdomain.
+ ALE::Obj<Mesh> _mesh; ///< Mesh of subdomain.
+
+}; // OutputSolnSubset
+
+#endif // pylith_meshio_outputsolnsubset_hh
+
+// End of file
Modified: short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src 2008-02-16 01:04:21 UTC (rev 11174)
@@ -1062,6 +1062,7 @@
self.thisptr = Neumann_constructor()
self.handle = self._createHandle()
+
def integrateResidual(self, residual, t, fields, mesh):
"""
Integrate contributions to residual term (r) for operator.
Modified: short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src 2008-02-16 01:04:21 UTC (rev 11174)
@@ -19,6 +19,7 @@
#include "pylith/meshio/MeshIOAscii.hh"
#include "pylith/meshio/MeshIOLagrit.hh"
#include "pylith/meshio/OutputManager.hh"
+#include "pylith/meshio/OutputSolnSubset.hh"
#include "pylith/meshio/VertexFilter.hh"
#if defined(ENABLE_CUBIT)
@@ -929,6 +930,101 @@
# ----------------------------------------------------------------------
+cdef class OutputSolnSubset(OutputManager):
+
+ def __init__(self):
+ """
+ Constructor.
+ """
+ # create shim for constructor
+ #embed{ void* OutputSolnSubset_constructor()
+ void* result = 0;
+ try {
+ result = (void*)(new pylith::meshio::OutputSolnSubset);
+ assert(0 != result);
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (const ALE::Exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.msg().c_str()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ return result;
+ #}embed
+
+ self.name = "pylith_meshio_OutputSolnSubset"
+ self.thisptr = OutputSolnSubset_constructor()
+ self.handle = self._createHandle()
+ return
+
+
+ def mesh(self, submesh, mesh):
+ """
+ Get mesh associated with subdomain.
+ """
+ # create shim for method 'subdomainMesh'
+ #embed{ void OutputSolnSubset_subdomainMesh(void* objVptr, void* submeshVptr, void* meshVptr)
+ try {
+ assert(0 != objVptr);
+ assert(0 != submeshVptr);
+ assert(0 != meshVptr);
+ ALE::Obj<ALE::Mesh>* submesh = (ALE::Obj<ALE::Mesh>*) submeshVptr;
+ ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
+ *submesh =
+ ((pylith::meshio::OutputSolnSubset*) objVptr)->subdomainMesh(*mesh);
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (const ALE::Exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.msg().c_str()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ #}embed
+
+ if not submesh.name == "pylith_topology_Mesh":
+ raise TypeError, \
+ "Argument 'submesh' must be extension module type " \
+ "'pylith::topology::Mesh'."
+ if not mesh.name == "pylith_topology_Mesh":
+ raise TypeError, \
+ "Argument 'mesh' must be extension module type " \
+ "'pylith::topology::Mesh'."
+ OutputSolnSubset_subdomainMesh(self.thisptr,
+ ptrFromHandle(submesh), ptrFromHandle(mesh))
+ return
+
+
+ property label:
+ def __set__(self, value):
+ """
+ Set label of subdomain.
+ """
+ # create shim for method 'label'
+ #embed{ void OutputSolnSubset_label_set(void* objVptr, char* value)
+ try {
+ assert(0 != objVptr);
+ ((pylith::meshio::OutputSolnSubset*) objVptr)->label(value);
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (const ALE::Exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.msg().c_str()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ #}embed
+ OutputSolnSubset_label_set(self.thisptr, value)
+
+
+# ----------------------------------------------------------------------
cdef void DataWriter_destructor(void* obj):
"""
Destroy DataWriter object.
Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/pylith/Makefile.am 2008-02-16 01:04:21 UTC (rev 11174)
@@ -82,6 +82,7 @@
meshio/CellFilterAvg.py \
meshio/DataWriter.py \
meshio/DataWriterVTK.py \
+ meshio/DoubleOutput.py \
meshio/MeshIO.py \
meshio/MeshIOAscii.py \
meshio/MeshIOCubit.py \
@@ -92,6 +93,7 @@
meshio/OutputFaultKin.py \
meshio/OutputMatElastic.py \
meshio/OutputNeumann.py \
+ meshio/OutputSolnSubset.py \
meshio/SingleOutput.py \
meshio/VertexFilter.py \
problems/__init__.py \
Modified: short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py 2008-02-16 01:04:21 UTC (rev 11174)
@@ -63,7 +63,7 @@
## Python object for managing BoundaryCondition facilities and properties.
##
## \b Properties
- ## @li \b name Name identifier for object face
+ ## @li \b label Label identifier for boundary.
##
## \b Facilities
## @li \b db Database of boundary condition parameters
@@ -71,7 +71,7 @@
import pyre.inventory
label = pyre.inventory.str("label", default="")
- label.meta['tip'] = "Name identifier for object face."
+ label.meta['tip'] = "Label identifier for boundary."
upDir = pyre.inventory.list("up_dir", default=[0, 0, 1],
validator=validateDir)
Added: short/3D/PyLith/trunk/pylith/meshio/DoubleOutput.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/DoubleOutput.py (rev 0)
+++ short/3D/PyLith/trunk/pylith/meshio/DoubleOutput.py 2008-02-16 01:04:21 UTC (rev 11174)
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/meshio/DoubleOutput.py
+##
+## @brief Python container with two output managers.
+##
+## Factory: object_bin
+
+from pylith.utils.ObjectBin import ObjectBin
+
+# DoubleOutput class
+class DoubleOutput(ObjectBin):
+ """
+ Python container with two output managers.
+
+ Factory: object_bin
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(ObjectBin.Inventory):
+ """
+ Python object for managing DoubleOutput facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing DoubleOutput facilities and properties.
+ ##
+ ## \b Properties
+ ## @li None
+ ##
+ ## \b Facilities
+ ## @li \b domain Output manager for domain.
+ ## @li \b subdomain Output manager for subdomain.
+
+ import pyre.inventory
+
+ from OutputSoln import OutputSoln
+ domain = pyre.inventory.facility("domain", family="output_manager",
+ factory=OutputSoln)
+ domain.meta['tip'] = "Output manager for domain."
+
+ from OutputSolnSubset import OutputSolnSubset
+ subdomain = pyre.inventory.facility("subdomain", family="output_manager",
+ factory=OutputSolnSubset)
+ subdomain.meta['tip'] = "Output manager for subdomain."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="doubleoutput"):
+ """
+ Constructor.
+ """
+ ObjectBin.__init__(self, name)
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Set attributes from inventory.
+ """
+ ObjectBin._configure(self)
+ self.bin = [self.inventory.domain,
+ self.inventory.subdomain]
+ return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def object_bin():
+ """
+ Factory associated with DoubleOutput.
+ """
+ return DoubleOutput()
+
+
+# End of file
Modified: short/3D/PyLith/trunk/pylith/meshio/OutputDirichlet.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputDirichlet.py 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputDirichlet.py 2008-02-16 01:04:21 UTC (rev 11174)
@@ -53,7 +53,7 @@
# PUBLIC METHODS /////////////////////////////////////////////////////
- def __init__(self, name="outputmanager"):
+ def __init__(self, name="outputdirichlet"):
"""
Constructor.
"""
Modified: short/3D/PyLith/trunk/pylith/meshio/OutputFaultKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputFaultKin.py 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputFaultKin.py 2008-02-16 01:04:21 UTC (rev 11174)
@@ -69,7 +69,7 @@
# PUBLIC METHODS /////////////////////////////////////////////////////
- def __init__(self, name="outputmanager"):
+ def __init__(self, name="outputfaultkin"):
"""
Constructor.
"""
Modified: short/3D/PyLith/trunk/pylith/meshio/OutputMatElastic.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputMatElastic.py 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputMatElastic.py 2008-02-16 01:04:21 UTC (rev 11174)
@@ -60,7 +60,7 @@
# PUBLIC METHODS /////////////////////////////////////////////////////
- def __init__(self, name="outputmanager"):
+ def __init__(self, name="outputmatelastic"):
"""
Constructor.
"""
Modified: short/3D/PyLith/trunk/pylith/meshio/OutputNeumann.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputNeumann.py 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputNeumann.py 2008-02-16 01:04:21 UTC (rev 11174)
@@ -53,7 +53,7 @@
# PUBLIC METHODS /////////////////////////////////////////////////////
- def __init__(self, name="outputmanager"):
+ def __init__(self, name="outputneumann"):
"""
Constructor.
"""
Modified: short/3D/PyLith/trunk/pylith/meshio/OutputSoln.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputSoln.py 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputSoln.py 2008-02-16 01:04:21 UTC (rev 11174)
@@ -52,7 +52,7 @@
# PUBLIC METHODS /////////////////////////////////////////////////////
- def __init__(self, name="outputmanager"):
+ def __init__(self, name="outputsoln"):
"""
Constructor.
"""
@@ -67,7 +67,7 @@
return
- def preinitialize(self, dataProvider=None):
+ def preinitialize(self):
"""
Do
"""
Added: short/3D/PyLith/trunk/pylith/meshio/OutputSolnSubset.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputSolnSubset.py (rev 0)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputSolnSubset.py 2008-02-16 01:04:21 UTC (rev 11174)
@@ -0,0 +1,150 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pyre/meshio/OutputSolnSubset.py
+##
+## @brief Python object for managing output of finite-element solution
+## information over a subdomain.
+##
+## Factory: output_manager
+
+from OutputManager import OutputManager
+
+# OutputSolnSubset class
+class OutputSolnSubset(OutputManager):
+ """
+ Python object for managing output of finite-element solution
+ information over a subdomain.
+
+ Factory: output_manager
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(OutputManager.Inventory):
+ """
+ Python object for managing OutputSolnSubset facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing OutputSolnSubset facilities and properties.
+ ##
+ ## \b Properties
+ ## @li \b vertex_data_fields Names of vertex data fields to output.
+ ## @li \b label Name identifier for subdomain.
+ ##
+ ## \b Facilities
+ ## @li None
+
+ import pyre.inventory
+
+ vertexDataFields = pyre.inventory.list("vertex_data_fields",
+ default=["displacements"])
+ vertexDataFields.meta['tip'] = "Names of vertex data fields to output."
+
+ label = pyre.inventory.str("label", default="")
+ label.meta['tip'] = "Label identifier for subdomain."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="outputsolnsubset"):
+ """
+ Constructor.
+ """
+ OutputManager.__init__(self, name)
+ self.cppHandle = None
+ self.availableFields = \
+ {'vertex': \
+ {'info': [],
+ 'data': ["displacements"]},
+ 'cell': \
+ {'info': [],
+ 'data': []}}
+ return
+
+
+ def preinitialize(self):
+ """
+ Do
+ """
+ OutputManager.preinitialize(self, dataProvider=self)
+ import meshio as bindings
+ self.cppHandle = bindings.OutputSolnSubset()
+ self.cppHandle.label = self.label
+ return
+
+
+ def initialize(self, mesh):
+ """
+ Initialize output manager.
+ """
+ logEvent = "%sinit" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
+ from pylith.topology.Mesh import Mesh
+ self.mesh = Mesh()
+ self.mesh.initialize(mesh.coordsys)
+ assert(None != self.cppHandle)
+ self.cppHandle.mesh(self.mesh.cppHandle, mesh.cppHandle)
+
+ self.mesh.view()
+
+ OutputManager.initialize(self)
+
+ self._logger.eventEnd(logEvent)
+ return
+
+
+ def getDataMesh(self):
+ """
+ Get mesh associated with data fields.
+ """
+ return (self.mesh, None, None)
+
+
+ def getVertexField(self, name, fields):
+ """
+ Get vertex field.
+ """
+ field = None
+ fieldType = None
+ if name == "displacements":
+ field = fields.getSolution()
+ fieldType = 1 # vector field
+ else:
+ raise ValueError, "Vertex field '%s' not available." % name
+ return (field, fieldType)
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Set members based using inventory.
+ """
+ OutputManager._configure(self)
+ self.vertexDataFields = self.inventory.vertexDataFields
+ self.label = self.inventory.label
+ return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def output_manager():
+ """
+ Factory associated with OutputSolnSubset.
+ """
+ return OutputSolnSubset()
+
+
+# End of file
Modified: short/3D/PyLith/trunk/pylith/meshio/SingleOutput.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/SingleOutput.py 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/pylith/meshio/SingleOutput.py 2008-02-16 01:04:21 UTC (rev 11174)
@@ -12,7 +12,7 @@
## @file pylith/meshio/SingleOutput.py
##
-## @brief Python container with one output type.
+## @brief Python container with one output manager.
##
## Factory: object_bin
@@ -21,7 +21,7 @@
# SingleOutput class
class SingleOutput(ObjectBin):
"""
- Python container with one output type.
+ Python container with one output manager.
Factory: object_bin
"""
Modified: short/3D/PyLith/trunk/pylith/meshio/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/__init__.py 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/pylith/meshio/__init__.py 2008-02-16 01:04:21 UTC (rev 11174)
@@ -18,6 +18,7 @@
'CellFilterAvg',
'DataWriter',
'DataWriterVTK',
+ 'DoubleOutput',
'MeshIO',
'MeshIOAscii',
'MeshIOCubit',
@@ -27,7 +28,8 @@
'OutputSoln',
'OutputFaultKin',
'OutputMatElastic',
- 'OutputNeumann',
+ 'OutputNeumann'
+ 'OutputSolnSubset',
'SingleOutput',
'VertexFilter']
Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py 2008-02-15 23:34:57 UTC (rev 11173)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py 2008-02-16 01:04:21 UTC (rev 11174)
@@ -46,8 +46,7 @@
##
## \b Facilities
## @li \b solver Algebraic solver.
- ## @li \b output Output manager associated with solution over the
- ## entire domain.
+ ## @li \b output Output manager associated with solution.
import pyre.inventory
@@ -59,8 +58,7 @@
from pylith.meshio.SingleOutput import SingleOutput
output = pyre.inventory.facility("output", family="object_bin",
factory=SingleOutput)
- output.meta['tip'] = "Output managers associated with solution over " \
- "the entire domain."
+ output.meta['tip'] = "Output managers associated with solution."
# PUBLIC METHODS /////////////////////////////////////////////////////
More information about the cig-commits
mailing list