[cig-commits] [commit] knepley/upgrade-petsc-interface: Extract displacement/velocity subfield from solution for output. (bda5253)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu Nov 14 13:22:31 PST 2013


Repository : ssh://geoshell/pylith

On branch  : knepley/upgrade-petsc-interface
Link       : https://github.com/geodynamics/pylith/compare/e07734d32415380de05c5d97fd96009562f76035...bda5253a1aeb4b2402473b3320d6af6fb6d45ece

>---------------------------------------------------------------

commit bda5253a1aeb4b2402473b3320d6af6fb6d45ece
Author: Brad Aagaard <baagaard at usgs.gov>
Date:   Thu Nov 14 13:24:53 2013 -0800

    Extract displacement/velocity subfield from solution for output.


>---------------------------------------------------------------

bda5253a1aeb4b2402473b3320d6af6fb6d45ece
 pylith/meshio/OutputSoln.py       | 17 +++++++++++++++--
 pylith/meshio/OutputSolnSubset.py | 18 +++++++++++++++---
 2 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/pylith/meshio/OutputSoln.py b/pylith/meshio/OutputSoln.py
index e880ccc..f341371 100644
--- a/pylith/meshio/OutputSoln.py
+++ b/pylith/meshio/OutputSoln.py
@@ -106,14 +106,27 @@ class OutputSoln(OutputManager):
     """
     Get vertex field.
     """
-    field = None
+    # :TODO: Clean this up for multiple fields
+
+    buffer = None
     if name == "displacement":
       field = fields.get("disp(t)")
+      if not fields.hasField("buffer (vector)"):
+        fields.add("buffer (vector)", "buffer")
+      buffer = fields.get("buffer (vector)")
+      buffer.copySubfield(field, "displacement")
+      buffer.scale(field.scale()) # :KLUDGE: Fix for multiple fields
     elif name == "velocity":
       field = fields.get("velocity(t)")
+      if not fields.hasField("buffer (vector)"):
+        fields.add("buffer (vector)", "buffer")
+      buffer = fields.get("buffer (vector)")
+      buffer.copySubfield(field, "displacement")
+      buffer.label(field.label()) # :KLUDGE: Fix for multiple fields
+      buffer.scale(field.scale()) # :KLUDGE: Fix for multiple fields
     else:
       raise ValueError, "Vertex field '%s' not available." % name
-    return field
+    return buffer
 
 
   # PRIVATE METHODS ////////////////////////////////////////////////////
diff --git a/pylith/meshio/OutputSolnSubset.py b/pylith/meshio/OutputSolnSubset.py
index 63b7b12..c526461 100644
--- a/pylith/meshio/OutputSolnSubset.py
+++ b/pylith/meshio/OutputSolnSubset.py
@@ -125,15 +125,27 @@ class OutputSolnSubset(OutputManager, ModuleOutputSolnSubset):
     """
     Get vertex field.
     """
-    field = None
-    fieldType = None
+    # :TODO: Clean this up for multiple fields
+
+    buffer = None
     if name == "displacement":
       field = fields.get("disp(t)")
+      if not fields.hasField("buffer (vector)"):
+        fields.add("buffer (vector)", "buffer")
+      buffer = fields.get("buffer (vector)")
+      buffer.copySubfield(field, "displacement")
+      buffer.scale(field.scale()) # :KLUDGE: Fix for multiple fields
     elif name == "velocity":
       field = fields.get("velocity(t)")
+      if not fields.hasField("buffer (vector)"):
+        fields.add("buffer (vector)", "buffer")
+      buffer = fields.get("buffer (vector)")
+      buffer.copySubfield(field, "displacement")
+      buffer.label(field.label()) # :KLUDGE: Fix for multiple fields
+      buffer.scale(field.scale()) # :KLUDGE: Fix for multiple fields
     else:
       raise ValueError, "Vertex field '%s' not available." % name
-    return field
+    return buffer
 
 
   # PRIVATE METHODS ////////////////////////////////////////////////////



More information about the CIG-COMMITS mailing list