]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Cleanup Trilinos sparsity pattern. Make Slepc compile again.
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Fri, 13 Nov 2009 16:04:45 +0000 (16:04 +0000)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Fri, 13 Nov 2009 16:04:45 +0000 (16:04 +0000)
git-svn-id: https://svn.dealii.org/trunk@20108 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/slepc_solver.h
deal.II/lac/include/lac/slepc_spectral_transformation.h
deal.II/lac/source/slepc_spectral_transformation.cc
deal.II/lac/source/trilinos_sparsity_pattern.cc

index 8d97aa42bf0a58530a4ef6d8df16f2ddedee8b89..fc9f847f7fb97110a8874b8259cf6aecb17ba9e7 100644 (file)
@@ -22,6 +22,7 @@
 
 #  include <lac/exceptions.h>
 #  include <lac/solver_control.h>
+#  include <lac/petsc_matrix_base.h>
 #  include <lac/slepc_spectral_transformation.h>
 #  include <boost/shared_ptr.hpp>
 
index 41722c635ddeee0cc9fa99b5fcecd36ac6b10e63..608d794635cac54c19d53729727cd6286fb83dc3 100644 (file)
 #ifdef DEAL_II_USE_SLEPC
 
 #  include <lac/exceptions.h>
-#  include <lac/solver_control.h>
-#  include <lac/slepc_solver.h>
 #  include <boost/shared_ptr.hpp>
 
 #  include <petscksp.h>
 #  include <slepceps.h>
 
-DEAL_II_NAMESPACE_OPEN 
+DEAL_II_NAMESPACE_OPEN
 
 
 namespace SLEPcWrappers
@@ -56,7 +54,7 @@ namespace SLEPcWrappers
                                    /**
                                     * Destructor.
                                     */
-      virtual ~TransformationBase ();      
+      virtual ~TransformationBase ();
 
                                    /**
                                    * Record the EPS object that is associated
@@ -85,7 +83,7 @@ namespace SLEPcWrappers
                                     */
       struct TransformationData
       {
-       
+
                                    /**
                                    * Destructor.
                                    */
@@ -95,14 +93,14 @@ namespace SLEPcWrappers
                                     * Objects for Eigenvalue Problem
                                     * Solver.
                                     */
-       ST st;  
+       ST st;
       };
 
       boost::shared_ptr<TransformationData> transformation_data;
     };
 
 /**
- * An implementation of the transformation interface using the SLEPc 
+ * An implementation of the transformation interface using the SLEPc
  * Shift.
  *
  * @ingroup SLEPcWrappers
@@ -111,7 +109,7 @@ namespace SLEPcWrappers
   class TransformationShift : public TransformationBase
     {
     public:
-      
+
                                    /**
                                     * Standardized data struct to
                                     * pipe additional data to the
@@ -132,7 +130,7 @@ namespace SLEPcWrappers
        const double shift_parameter;
       };
 
-        
+
                                    /**
                                     * Constructor.
                                     */
@@ -154,11 +152,11 @@ namespace SLEPcWrappers
                                     * transformationthat is
                                     * appropriate for this class.
                                     */
-      virtual void set_transformation_type (ST &st) const; 
+      virtual void set_transformation_type (ST &st) const;
     };
 
 /**
- * An implementation of the transformation interface using the SLEPc 
+ * An implementation of the transformation interface using the SLEPc
  * Shift and Invert.
  *
  * @ingroup SLEPcWrappers
@@ -167,7 +165,7 @@ namespace SLEPcWrappers
   class TransformationShiftInvert : public TransformationBase
     {
     public:
-     
+
                                    /**
                                     * Standardized data struct to
                                     * pipe additional data to the
@@ -187,7 +185,7 @@ namespace SLEPcWrappers
        const double shift_parameter;
       };
 
-        
+
                                    /**
                                     * Constructor.
                                     */
@@ -208,11 +206,11 @@ namespace SLEPcWrappers
                                     * transformationthat is
                                     * appropriate for this class.
                                     */
-      virtual void set_transformation_type (ST &st) const; 
+      virtual void set_transformation_type (ST &st) const;
     };
 
 /**
- * An implementation of the transformation interface using the SLEPc 
+ * An implementation of the transformation interface using the SLEPc
  * Spectrum Folding.
  *
  * @ingroup SLEPcWrappers
@@ -221,7 +219,7 @@ namespace SLEPcWrappers
   class TransformationSpectrumFolding : public TransformationBase
     {
     public:
-      
+
                                    /**
                                     * Standardized data struct to
                                     * pipe additional data to the
@@ -241,7 +239,7 @@ namespace SLEPcWrappers
        const double shift_parameter;
       };
 
-        
+
                                    /**
                                     * Constructor.
                                     */
@@ -262,11 +260,11 @@ namespace SLEPcWrappers
                                     * transformationthat is
                                     * appropriate for this class.
                                     */
-      virtual void set_transformation_type (ST &st) const; 
+      virtual void set_transformation_type (ST &st) const;
     };
 
 /**
- * An implementation of the transformation interface using the SLEPc 
+ * An implementation of the transformation interface using the SLEPc
  * Cayley.
  *
  * @ingroup SLEPcWrappers
@@ -275,7 +273,7 @@ namespace SLEPcWrappers
   class TransformationCayley : public TransformationBase
     {
     public:
-      
+
                                    /**
                                     * Standardized data struct to pipe
                                     * additional data to the solver.
@@ -286,7 +284,7 @@ namespace SLEPcWrappers
                                     * Constructor. Requires two shift
                                     * parameters
                                     */
-       AdditionalData (const double shift_parameter     = 0, 
+       AdditionalData (const double shift_parameter     = 0,
                        const double antishift_parameter = 0);
 
                                    /**
@@ -296,11 +294,11 @@ namespace SLEPcWrappers
        const double antishift_parameter;
       };
 
-        
+
                                    /**
                                     * Constructor.
                                     */
-      TransformationCayley (const double shift, 
+      TransformationCayley (const double shift,
                            const double antishift);
 
     protected:
@@ -318,7 +316,7 @@ namespace SLEPcWrappers
                                     * transformationthat is
                                     * appropriate for this class.
                                     */
-      virtual void set_transformation_type (ST &st) const; 
+      virtual void set_transformation_type (ST &st) const;
     };
 
 }
@@ -329,6 +327,6 @@ DEAL_II_NAMESPACE_CLOSE
 
 /*--------------------   slepc_spectral_transformation.h   ------------------*/
 
-#endif 
+#endif
 
 /*--------------------   slepc_spectral_transformation.h   ------------------*/
index a406a2bded4ee9e6e68d292223a119768f72de12..b1e6b67636dc79a27ed705767e915924f7fca69e 100644 (file)
 
 #ifdef DEAL_II_USE_SLEPC
 
+#  include <lac/slepc_solver.h>
 #  include <lac/petsc_matrix_base.h>
 #  include <lac/petsc_vector_base.h>
 #  include <lac/petsc_vector.h>
-#  include <lac/slepc_solver.h>
 
 #  include <cmath>
 #  include <vector>
@@ -45,23 +45,23 @@ namespace SLEPcWrappers
 
   void TransformationBase::set_context (EPS &eps)
   {
-    AssertThrow (transformation_data == 0, 
+    AssertThrow (transformation_data == 0,
                 SolverBase::ExcSLEPcWrappersUsageError());
     transformation_data.reset (new TransformationData());
-    
+
     int ierr = EPSGetST(eps, &transformation_data->st);
     AssertThrow (ierr == 0, SolverBase::ExcSLEPcError(ierr));
-    
+
     set_transformation_type(transformation_data->st);
   }
-  
+
   /* ------------------- TransformationShift --------------------- */
   TransformationShift::AdditionalData::
   AdditionalData (const double shift_parameter)
                   :
                   shift_parameter (shift_parameter)
   {}
-  
+
   TransformationShift::TransformationShift (const AdditionalData &data)
     :
     additional_data (data)
@@ -84,7 +84,7 @@ namespace SLEPcWrappers
                   :
                   shift_parameter (shift_parameter)
   {}
-  
+
   TransformationShiftInvert::TransformationShiftInvert (const AdditionalData &data)
     :
     additional_data (data)
@@ -107,7 +107,7 @@ namespace SLEPcWrappers
                   :
                   shift_parameter (shift_parameter)
   {}
-  
+
   TransformationSpectrumFolding::TransformationSpectrumFolding (const AdditionalData &data)
     :
     additional_data (data)
@@ -124,18 +124,18 @@ namespace SLEPcWrappers
     ierr = STSetShift (st, additional_data.shift_parameter);
     AssertThrow (ierr == 0, SolverBase::ExcSLEPcError(ierr));
   }
-  
+
   /* ------------------- TransformationCayley --------------------- */
   TransformationCayley::AdditionalData::
-  AdditionalData (const double shift_parameter, 
+  AdditionalData (const double shift_parameter,
                  const double antishift_parameter)
                   :
                   shift_parameter (shift_parameter),
                  antishift_parameter (antishift_parameter)
   {
   }
-  
-  TransformationCayley::TransformationCayley (const double shift, 
+
+  TransformationCayley::TransformationCayley (const double shift,
                                              const double antishift)
     :
     additional_data (shift, antishift)
index 82d6ac235fde9604ad13d582c2bb4b2e24075590..3ee3bb103e6127e3ca318200a15dfd5b7c8c4492 100644 (file)
@@ -300,8 +300,6 @@ namespace TrilinosWrappers
     graph.reset();
     compressed = false;
 
-    const unsigned int n_rows = sp.n_rows();
-
     Assert (input_row_map.LinearMap() == true,
            ExcMessage ("This function is not efficient if the map is not contiguous."));
 
@@ -329,6 +327,7 @@ namespace TrilinosWrappers
                                  sp.n_rows()));
 
     std::vector<int>   row_indices;
+    const unsigned int n_rows = sp.n_rows();
 
     for (unsigned int row=0; row<n_rows; ++row)
       if ( input_row_map.MyGID(row) )
@@ -449,7 +448,8 @@ namespace TrilinosWrappers
     graph.reset();
     compressed = false;
 
-    const unsigned int n_rows = sp.n_rows();
+    Assert (input_row_map.LinearMap() == true,
+           ExcMessage ("This function is not efficient if the map is not contiguous."));
 
     std::vector<int> n_entries_per_row(input_row_map.MaxMyGID()-
                                       input_row_map.MinMyGID() + 1);
@@ -477,11 +477,10 @@ namespace TrilinosWrappers
                                  sp.n_rows()));
 
 
+    const unsigned int n_rows = sp.n_rows();
     std::vector<int>   row_indices;
 
-    for (unsigned int row=input_row_map.MinMyGID();
-        row<static_cast<unsigned int>(input_row_map.MaxMyGID()+1);
-        ++row)
+    for (unsigned int row=0; row<n_rows; ++row)
      if (exchange_data || input_row_map.MyGID(row))
        {
          const int row_length = sp.row_length(row);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.