From 3afe9cca7f20c706c7038dc8e28942f28b0a5690 Mon Sep 17 00:00:00 2001 From: kronbichler Date: Fri, 13 Nov 2009 16:04:45 +0000 Subject: [PATCH] Cleanup Trilinos sparsity pattern. Make Slepc compile again. git-svn-id: https://svn.dealii.org/trunk@20108 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/slepc_solver.h | 1 + .../lac/slepc_spectral_transformation.h | 48 +++++++++---------- .../source/slepc_spectral_transformation.cc | 24 +++++----- .../lac/source/trilinos_sparsity_pattern.cc | 11 ++--- 4 files changed, 41 insertions(+), 43 deletions(-) diff --git a/deal.II/lac/include/lac/slepc_solver.h b/deal.II/lac/include/lac/slepc_solver.h index 8d97aa42bf..fc9f847f7f 100644 --- a/deal.II/lac/include/lac/slepc_solver.h +++ b/deal.II/lac/include/lac/slepc_solver.h @@ -22,6 +22,7 @@ # include # include +# include # include # include diff --git a/deal.II/lac/include/lac/slepc_spectral_transformation.h b/deal.II/lac/include/lac/slepc_spectral_transformation.h index 41722c635d..608d794635 100644 --- a/deal.II/lac/include/lac/slepc_spectral_transformation.h +++ b/deal.II/lac/include/lac/slepc_spectral_transformation.h @@ -21,14 +21,12 @@ #ifdef DEAL_II_USE_SLEPC # include -# include -# include # include # include # include -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 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 ------------------*/ diff --git a/deal.II/lac/source/slepc_spectral_transformation.cc b/deal.II/lac/source/slepc_spectral_transformation.cc index a406a2bded..b1e6b67636 100644 --- a/deal.II/lac/source/slepc_spectral_transformation.cc +++ b/deal.II/lac/source/slepc_spectral_transformation.cc @@ -17,10 +17,10 @@ #ifdef DEAL_II_USE_SLEPC +# include # include # include # include -# include # include # include @@ -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) diff --git a/deal.II/lac/source/trilinos_sparsity_pattern.cc b/deal.II/lac/source/trilinos_sparsity_pattern.cc index 82d6ac235f..3ee3bb103e 100644 --- a/deal.II/lac/source/trilinos_sparsity_pattern.cc +++ b/deal.II/lac/source/trilinos_sparsity_pattern.cc @@ -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 row_indices; + const unsigned int n_rows = sp.n_rows(); for (unsigned int row=0; row 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 row_indices; - for (unsigned int row=input_row_map.MinMyGID(); - row(input_row_map.MaxMyGID()+1); - ++row) + for (unsigned int row=0; row