[cig-commits] r14377 - short/3D/PyLith/branches/pylith-swig/libsrc/problems

brad at geodynamics.org brad at geodynamics.org
Tue Mar 17 17:01:02 PDT 2009


Author: brad
Date: 2009-03-17 17:01:01 -0700 (Tue, 17 Mar 2009)
New Revision: 14377

Added:
   short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverLinear.cc
Log:
Added missing file.

Added: short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverLinear.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverLinear.cc	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverLinear.cc	2009-03-18 00:01:01 UTC (rev 14377)
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "SolverLinear.hh" // implementation of class methods
+
+#include "pylith/topology/SolutionFields.hh" // USES SolutionFields
+
+#include <petscksp.h> // USES PetscKSP
+
+// ----------------------------------------------------------------------
+// Constructor
+pylith::problems::SolverLinear::SolverLinear(void) :
+  _ksp(0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+pylith::problems::SolverLinear::~SolverLinear(void)
+{ // destructor
+  if (0 != _ksp) {
+    PetscErrorCode err = KSPDestroy(_ksp); _ksp = 0;
+    CHECK_PETSC_ERROR(err);
+  } // if
+} // destructor
+
+// ----------------------------------------------------------------------
+// Set initial guess nonzero flag.
+void
+pylith::problems::SolverLinear::initialGuessNonzero(bool flag)
+{ // initialGuessNonzero
+  
+} // initialGuessNonzero
+
+// ----------------------------------------------------------------------
+// Initialize solver.
+void
+pylith::problems::SolverLinear::initialize(topology::SolutionFields* fields)
+{ // initialize
+  assert(0 != fields);
+
+  Solver::initialize(fields);
+
+  PetscErrorCode err = 0;
+  if (0 != _ksp) {
+    err = KSPDestroy(_ksp); _ksp = 0;
+    CHECK_PETSC_ERROR(err);
+  } // if    
+  err = KSPCreate(fields->mesh().comm(), &_ksp); CHECK_PETSC_ERROR(err);
+  err = KSPSetFromOptions(_ksp); CHECK_PETSC_ERROR(err);
+} // initialize
+
+// ----------------------------------------------------------------------
+// Solve the system.
+void
+pylith::problems::SolverLinear::solve(topology::Field<topology::Mesh>* solution,
+				      const topology::Jacobian& jacobian,
+				      const topology::Field<topology::Mesh>& residual)
+{ // solve
+} // solve
+
+
+// End of file



More information about the CIG-COMMITS mailing list