← Back to team overview

dolfin team mailing list archive

A small patch

 

Hi,

please find enclosed a small patch that:

* Fixes a bug in the XML parser for matrices
* Adds the method binary_dump to PETScMatrix
* Adds the method set_deflation_space to SLEPcEigenSolver


Best,
-- 
Ola Skavhaug
Research Programmer
Simula Research Laboratory
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: skavhaug@xxxxxxxxx-20101012074511-ak140s0eubannkra
# target_branch: lp:dolfin
# testament_sha1: ac95ed6dee01d940746fd9092baad8b836c0f7b7
# timestamp: 2010-10-12 09:49:35 +0200
# source_branch: .
# base_revision_id: hake.dev@xxxxxxxxx-20101007215305-pn914tgx9h7si08v
# 
# Begin patch
=== modified file 'dolfin/io/XMLMatrix.cpp'
--- dolfin/io/XMLMatrix.cpp	2010-03-07 20:36:41 +0000
+++ dolfin/io/XMLMatrix.cpp	2010-10-12 07:34:44 +0000
@@ -2,7 +2,7 @@
 // Licensed under the GNU LGPL Version 2.1.
 //
 // First added:  2009-03-11
-// Last changed: 2009-03-17
+// Last changed: 2010-10-12
 
 #include <dolfin/la/GenericMatrix.h>
 #include <dolfin/log/dolfin_log.h>
@@ -64,6 +64,7 @@
     {
       A.apply("add");
       state = DONE;
+      release();
     }
 
     break;

=== modified file 'dolfin/la/PETScMatrix.cpp'
--- dolfin/la/PETScMatrix.cpp	2010-08-18 11:18:07 +0000
+++ dolfin/la/PETScMatrix.cpp	2010-10-12 07:35:29 +0000
@@ -398,6 +398,14 @@
   return *this;
 }
 //-----------------------------------------------------------------------------
+void PETScMatrix::binary_dump(std::string file_name) const
+{
+  PetscViewer view_out;
+  PetscViewerBinaryOpen(PETSC_COMM_WORLD, file_name.c_str(), FILE_MODE_WRITE, &view_out);
+  MatView(*(A.get()), view_out);
+  PetscViewerDestroy(view_out);
+}
+//-----------------------------------------------------------------------------
 std::string PETScMatrix::str(bool verbose) const
 {
   std::stringstream s;

=== modified file 'dolfin/la/PETScMatrix.h'
--- dolfin/la/PETScMatrix.h	2010-07-21 17:31:22 +0000
+++ dolfin/la/PETScMatrix.h	2010-10-12 07:35:29 +0000
@@ -130,6 +130,9 @@
     /// Assignment operator
     const PETScMatrix& operator= (const PETScMatrix& A);
 
+    /// Dump matrix to PETSc binary format
+    void binary_dump(std::string file_name) const;
+
   private:
 
     // PETSc norm types

=== modified file 'dolfin/la/SLEPcEigenSolver.cpp'
--- dolfin/la/SLEPcEigenSolver.cpp	2010-09-30 18:38:35 +0000
+++ dolfin/la/SLEPcEigenSolver.cpp	2010-10-12 07:35:58 +0000
@@ -122,6 +122,11 @@
   return num_conv;
 }
 //-----------------------------------------------------------------------------
+void SLEPcEigenSolver::set_deflation_space(const PETScVector& deflation_space)
+{
+  EPSSetDeflationSpace(eps, 1, const_cast<Vec*>(deflation_space.vec().get()));
+}
+//-----------------------------------------------------------------------------
 void SLEPcEigenSolver::solve(const PETScMatrix* A,
                              const PETScMatrix* B,
                              uint n)

=== modified file 'dolfin/la/SLEPcEigenSolver.h'
--- dolfin/la/SLEPcEigenSolver.h	2010-10-01 08:47:12 +0000
+++ dolfin/la/SLEPcEigenSolver.h	2010-10-12 07:35:58 +0000
@@ -149,6 +149,9 @@
     // Get the number of converged eigenvalues
     int get_number_converged();
 
+    // Set deflation space
+    void set_deflation_space(const PETScVector& deflation_space);
+
     /// Default parameter values
     static Parameters default_parameters()
     {

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWeljvloABprfgFAQUXf//38m
3cC////6YAppmr55PAUAALO73et3ae5gAAeIA0SanpiRink1P1NT9TRHqAGgaDI0B6TTyIJJAmQa
AEQJPU09TINADQAAHqCUEQEjJtEMj0RpoAGjJoMgAAJNSk00mU9TymMNUPSaaANNNNqPUNGQAAcw
BGCYgGATBNGQ0MAmCMTCKRACJk0xMT0nqmmTyNCnqYo9QA0DQQEMQnoodvvBccQNzE/ELmMp0CwP
GcJlUwVNgvBfozbIbDvMzzZnotvhs1aw7a7oGZBCxwlJQKZPgD7Wti/Wd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