[cig-commits] r7533 - in short/3D/PyLith/trunk: libsrc/feassemble modulesrc/topology pylith/problems

knepley at geodynamics.org knepley at geodynamics.org
Wed Jun 27 11:25:57 PDT 2007


Author: knepley
Date: 2007-06-27 11:25:56 -0700 (Wed, 27 Jun 2007)
New Revision: 7533

Modified:
   short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc
   short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src
   short/3D/PyLith/trunk/pylith/problems/Explicit.py
   short/3D/PyLith/trunk/pylith/problems/Formulation.py
   short/3D/PyLith/trunk/pylith/problems/Implicit.py
Log:
Fixes for completion of the residual


Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc	2007-06-27 16:50:29 UTC (rev 7532)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc	2007-06-27 18:25:56 UTC (rev 7533)
@@ -232,7 +232,6 @@
     // Assemble cell contribution into field
     mesh->updateAdd(residual, *c_iter, _cellVector);
   } // for
-  ALE::Distribution<Mesh>::completeSection(mesh, residual);
 } // integrateResidual
 
 

Modified: short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src	2007-06-27 16:50:29 UTC (rev 7532)
+++ short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src	2007-06-27 18:25:56 UTC (rev 7533)
@@ -899,6 +899,41 @@
 
 
 # ----------------------------------------------------------------------
+def completeSection(mesh, section):
+  """
+  Complete the section across the mesh overlap.
+  """
+  # create shim for method 'completeSection'
+  #embed{ void Section_complete(void* sectionVptr, void* meshVptr)
+  try {
+    assert(0 != sectionVptr);
+    assert(0 != meshVptr);
+    ALE::Obj<ALE::Mesh>* mesh =
+      (ALE::Obj<ALE::Mesh>*) meshVptr;
+    ALE::Obj<pylith::real_section_type>* section =
+      (ALE::Obj<pylith::real_section_type>*) sectionVptr;
+    ALE::Distribution<ALE::Mesh>::completeSection(*mesh, *section);
+  } 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 mesh.name != "pylith_topology_Mesh":
+    print mesh.name
+    raise TypeError, \
+          "Argument must be extension module type 'Mesh'."
+  Section_complete(PyCObject_AsVoidPtr(section),
+                   ptrFromHandle(mesh))
+  return
+
+
+# ----------------------------------------------------------------------
 def addRealSections(dst, srcA, srcB):
   """
   Add two sections, storing result in third section.

Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py	2007-06-27 16:50:29 UTC (rev 7532)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py	2007-06-27 18:25:56 UTC (rev 7533)
@@ -133,6 +133,8 @@
       integrator.timeStep(dt)
       integrator.integrateResidual(residual, t, self.fields)
 
+    self._info.log("Completing residual.")
+    bindings.completeSection(self.mesh.cppHandle, residual)
     self._info.log("Solving equations.")
     self.solver.solve(self.fields.getReal("dispTpdt"), self.jacobian, residual)
     return

Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py	2007-06-27 16:50:29 UTC (rev 7532)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py	2007-06-27 18:25:56 UTC (rev 7533)
@@ -82,6 +82,7 @@
 
     from pylith.topology.FieldsManager import FieldsManager
     self.fields = FieldsManager(mesh)
+    self.mesh   = mesh
     self.integrators = []
     self.constraints = []
 

Modified: short/3D/PyLith/trunk/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Implicit.py	2007-06-27 16:50:29 UTC (rev 7532)
+++ short/3D/PyLith/trunk/pylith/problems/Implicit.py	2007-06-27 18:25:56 UTC (rev 7533)
@@ -155,6 +155,8 @@
       integrator.timeStep(dt)
       integrator.integrateResidual(residual, t+dt, self.fields)
 
+    self._info.log("Completing residual.")
+    bindings.completeSection(self.mesh.cppHandle, residual)
     import pylith.utils.petsc as petsc
     self._info.log("Solving equations.")
     self.solver.solve(dispIncr, self.jacobian, residual)



More information about the cig-commits mailing list