# 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>
#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
/**
* Destructor.
*/
- virtual ~TransformationBase ();
+ virtual ~TransformationBase ();
/**
* Record the EPS object that is associated
*/
struct TransformationData
{
-
+
/**
* Destructor.
*/
* 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
class TransformationShift : public TransformationBase
{
public:
-
+
/**
* Standardized data struct to
* pipe additional data to the
const double shift_parameter;
};
-
+
/**
* Constructor.
*/
* 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
class TransformationShiftInvert : public TransformationBase
{
public:
-
+
/**
* Standardized data struct to
* pipe additional data to the
const double shift_parameter;
};
-
+
/**
* Constructor.
*/
* 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
class TransformationSpectrumFolding : public TransformationBase
{
public:
-
+
/**
* Standardized data struct to
* pipe additional data to the
const double shift_parameter;
};
-
+
/**
* Constructor.
*/
* 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
class TransformationCayley : public TransformationBase
{
public:
-
+
/**
* Standardized data struct to pipe
* additional data to the solver.
* Constructor. Requires two shift
* parameters
*/
- AdditionalData (const double shift_parameter = 0,
+ AdditionalData (const double shift_parameter = 0,
const double antishift_parameter = 0);
/**
const double antishift_parameter;
};
-
+
/**
* Constructor.
*/
- TransformationCayley (const double shift,
+ TransformationCayley (const double shift,
const double antishift);
protected:
* transformationthat is
* appropriate for this class.
*/
- virtual void set_transformation_type (ST &st) const;
+ virtual void set_transformation_type (ST &st) const;
};
}
/*-------------------- slepc_spectral_transformation.h ------------------*/
-#endif
+#endif
/*-------------------- slepc_spectral_transformation.h ------------------*/
#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>
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)
:
shift_parameter (shift_parameter)
{}
-
+
TransformationShiftInvert::TransformationShiftInvert (const AdditionalData &data)
:
additional_data (data)
:
shift_parameter (shift_parameter)
{}
-
+
TransformationSpectrumFolding::TransformationSpectrumFolding (const AdditionalData &data)
:
additional_data (data)
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)
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."));
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) )
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);
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);