[cig-commits] [commit] knepley/upgrade-petsc-interface: Remove obsolete function splitField(). (e8880aa)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Nov 6 16:02:26 PST 2013


Repository : ssh://geoshell/pylith

On branch  : knepley/upgrade-petsc-interface
Link       : https://github.com/geodynamics/pylith/compare/292dccadf75961135347ac04699dcbeea592712a...286ea25d82eb51b4fe3caff49f127074ba5b71fb

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

commit e8880aae028ad27c178810f768fa1fa1d9e8c2b1
Author: Brad Aagaard <baagaard at usgs.gov>
Date:   Wed Nov 6 15:35:00 2013 -0800

    Remove obsolete function splitField().
    
    Create field for Lagrange multipliers by default. Let solver and
    formulation decide whether to use fields.


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

e8880aae028ad27c178810f768fa1fa1d9e8c2b1
 libsrc/pylith/faults/FaultCohesiveLagrange.cc | 40 ---------------------------
 libsrc/pylith/faults/FaultCohesiveLagrange.hh |  6 ----
 libsrc/pylith/feassemble/Integrator.hh        |  7 -----
 libsrc/pylith/feassemble/Integrator.icc       |  6 ----
 pylith/problems/Formulation.py                |  8 +++---
 5 files changed, 4 insertions(+), 63 deletions(-)

diff --git a/libsrc/pylith/faults/FaultCohesiveLagrange.cc b/libsrc/pylith/faults/FaultCohesiveLagrange.cc
index 4d31945..fd86b97 100644
--- a/libsrc/pylith/faults/FaultCohesiveLagrange.cc
+++ b/libsrc/pylith/faults/FaultCohesiveLagrange.cc
@@ -125,46 +125,6 @@ pylith::faults::FaultCohesiveLagrange::initialize(const topology::Mesh& mesh,
 
 // ----------------------------------------------------------------------
 void
-pylith::faults::FaultCohesiveLagrange::splitField(topology::Field* field)
-{ // splitField
-  PYLITH_METHOD_BEGIN;
-
-  assert(field);
-
-  PetscDM dmMesh = field->dmMesh();assert(dmMesh);
-  PetscSection fieldSection  = field->petscSection();assert(fieldSection);
-  PetscInt numFields, numComp;
-
-  assert(_quadrature);
-  const int spaceDim = _quadrature->spaceDim();
-
-  PetscErrorCode err;
-  err = PetscSectionGetNumFields(fieldSection, &numFields);PYLITH_CHECK_ERROR(err);
-  if (!numFields) {
-    PYLITH_METHOD_END;
-  } // if
-
-  // :TODO: Update this.
-
-  assert(2 == numFields);
-  err = PetscSectionGetFieldComponents(fieldSection, 0, &numComp);PYLITH_CHECK_ERROR(err);assert(numComp == spaceDim);
-  err = PetscSectionGetFieldComponents(fieldSection, 1, &numComp);PYLITH_CHECK_ERROR(err);assert(numComp == spaceDim);
-
-  const int numVertices = _cohesiveVertices.size();
-  for(PetscInt iVertex = 0; iVertex < numVertices; ++iVertex) {
-    const int e_lagrange = _cohesiveVertices[iVertex].lagrange;
-
-    PetscInt dof;
-    err = PetscSectionGetDof(fieldSection, e_lagrange, &dof);PYLITH_CHECK_ERROR(err);assert(spaceDim == dof);
-    err = PetscSectionSetFieldDof(fieldSection, e_lagrange, 0, 0);PYLITH_CHECK_ERROR(err);
-    err = PetscSectionSetFieldDof(fieldSection, e_lagrange, 1, dof);PYLITH_CHECK_ERROR(err);
-  } // for
-
-  PYLITH_METHOD_END;
-} // splitField
-
-// ----------------------------------------------------------------------
-void
 pylith::faults::FaultCohesiveLagrange::setupSolnDof(topology::Field* field)
 { // setupSolnDof
   PYLITH_METHOD_BEGIN;
diff --git a/libsrc/pylith/faults/FaultCohesiveLagrange.hh b/libsrc/pylith/faults/FaultCohesiveLagrange.hh
index ad5090d..1a1217f 100644
--- a/libsrc/pylith/faults/FaultCohesiveLagrange.hh
+++ b/libsrc/pylith/faults/FaultCohesiveLagrange.hh
@@ -112,12 +112,6 @@ public :
   void initialize(const topology::Mesh& mesh,
 		  const PylithScalar upDir[3]);
 
-  /** Split solution field for separate preconditioning.
-   *
-   * @param field Solution field.
-   */
-  void splitField(topology::Field* field);
-
   /** Setup DOF on solution field.
    *
    * @param field Solution field.
diff --git a/libsrc/pylith/feassemble/Integrator.hh b/libsrc/pylith/feassemble/Integrator.hh
index cda1586..4cb339e 100644
--- a/libsrc/pylith/feassemble/Integrator.hh
+++ b/libsrc/pylith/feassemble/Integrator.hh
@@ -128,13 +128,6 @@ public :
   virtual
   void initialize(const topology::Mesh& mesh);
   
-  /** Split solution field for separate preconditioning.
-   *
-   * @param field Solution field.
-   */
-  virtual
-  void splitField(topology::Field* field);
-
   /** Integrate contributions to residual term (r) for operator.
    *
    * @param residual Field containing values for residual
diff --git a/libsrc/pylith/feassemble/Integrator.icc b/libsrc/pylith/feassemble/Integrator.icc
index a0f9d91..6c3adf5 100644
--- a/libsrc/pylith/feassemble/Integrator.icc
+++ b/libsrc/pylith/feassemble/Integrator.icc
@@ -47,12 +47,6 @@ void
 pylith::feassemble::Integrator::initialize(const topology::Mesh& mesh) {
 } // initialize
 
-// Split solution field for separate preconditioning.
-inline
-void
-pylith::feassemble::Integrator::splitField(topology::Field* field) {
-} // splitField
-  
 // Integrate contributions to residual term (r) for operator.
 inline
 void
diff --git a/pylith/problems/Formulation.py b/pylith/problems/Formulation.py
index e50644b..d548aef 100644
--- a/pylith/problems/Formulation.py
+++ b/pylith/problems/Formulation.py
@@ -500,12 +500,12 @@ class Formulation(PetscComponent, ModuleFormulation):
     lengthScale = normalizer.lengthScale()
     if 1:
       solution = self.fields.get("dispIncr(t->t+dt)")
-      solution.addField("displacement", dimension)
+      solution.subfieldAdd("displacement", dimension)
       if self.splitFields():
-        solution.addField("lagrange_multipliers", dimension)
-      solution.setupFields()
+        solution.subfieldAdd("lagrange_multipliers", dimension)
+      solution.subfieldsSetup()
       solution.newSection(solution.VERTICES_FIELD, dimension)
-      solution.updateDof("displacement", solution.VERTICES_FIELD, dimension)
+      solution.subfieldSetDof("displacement", solution.VERTICES_FIELD, dimension)
 
       solution.vectorFieldType(solution.VECTOR)
       solution.scale(lengthScale.value)



More information about the CIG-COMMITS mailing list