Commit b2d17c6f authored by Igor Konshin's avatar Igor Konshin

interface to new linear solvers was added

parent 2d42caac
...@@ -60,6 +60,27 @@ else() ...@@ -60,6 +60,27 @@ else()
set(HAVE_SOLVER_MPTILU2 FALSE) set(HAVE_SOLVER_MPTILU2 FALSE)
endif() endif()
if( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/solver_fcbiilu2.h" AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/solver_fcbiilu2.cpp" AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/fcbiilu2.cpp" )
add_definitions(-DHAVE_SOLVER_FCBIILU2)
set(HAVE_SOLVER_FCBIILU2 TRUE)
list(APPEND HEADER solver_fcbiilu2.h)
list(APPEND SOURCE solver_fcbiilu2.cpp fcbiilu2.cpp)
else()
set(HAVE_SOLVER_FCBIILU2 FALSE)
endif()
if( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/solver_k3biilu2.h" AND EXISTS
"${CMAKE_CURRENT_SOURCE_DIR}/solver_k3biilu2.cpp" AND EXISTS
"${CMAKE_CURRENT_SOURCE_DIR}/k3d.h" AND EXISTS
"${CMAKE_CURRENT_SOURCE_DIR}/k3d.cpp" )
add_definitions(-DHAVE_SOLVER_K3BIILU2)
set(HAVE_SOLVER_K3BIILU2 TRUE)
list(APPEND HEADER solver_k3biilu2.h k3d.h)
list(APPEND SOURCE solver_k3biilu2.cpp k3d.cpp)
else()
set(HAVE_SOLVER_K3BIILU2 FALSE)
endif()
add_library(inmost STATIC ${SOURCE} ${HEADER}) add_library(inmost STATIC ${SOURCE} ${HEADER})
option(USE_MPI "Compile with MPI support" ON) option(USE_MPI "Compile with MPI support" ON)
......
...@@ -4,5 +4,5 @@ add_subdirectory(DrawMatrix) ...@@ -4,5 +4,5 @@ add_subdirectory(DrawMatrix)
add_subdirectory(MatSolve) add_subdirectory(MatSolve)
add_subdirectory(GridGen) add_subdirectory(GridGen)
add_subdirectory(FVDiscr) add_subdirectory(FVDiscr)
add_subdirectory(OctreeCutcell) #add_subdirectory(OctreeCutcell)
add_subdirectory(Solver) add_subdirectory(Solver)
...@@ -42,15 +42,17 @@ namespace INMOST ...@@ -42,15 +42,17 @@ namespace INMOST
enum Type enum Type
{ {
INNER_ILU2, ///< inner Solver based on BiCGStab(L) solver with second order ILU factorization as preconditioner. INNER_ILU2, ///< inner Solver based on BiCGStab(L) solver with second order ILU factorization as preconditioner.
INNER_DDPQILUC, ///< inner Solver based on BiCGStab(L) solver with second order Crout-ILU with inversed-based condition estimation and unsymmetric reordering for diagonal dominance as preconditioner. INNER_DDPQILUC, ///< inner Solver based on BiCGStab(L) solver with second order Crout-ILU with inversed-based condition estimation and unsymmetric reordering for diagonal dominance as preconditioner.
INNER_MPTILUC, ///< inner Solver based on BiCGStab(L) solver with second order Crout-ILU with inversed-based condition estimation and maximum product transversal reordering as preconditioner. INNER_MPTILUC, ///< inner Solver based on BiCGStab(L) solver with second order Crout-ILU with inversed-based condition estimation and maximum product transversal reordering as preconditioner.
INNER_MPTILU2, ///< inner Solver based on BiCGStab(L) solver with second order ILU and maximum product transversal reordering as preconditioner. INNER_MPTILU2, ///< inner Solver based on BiCGStab(L) solver with second order ILU and maximum product transversal reordering as preconditioner.
Trilinos_Aztec, ///< external Solver AztecOO from Trilinos package Trilinos_Aztec, ///< external Solver AztecOO from Trilinos package.
Trilinos_Belos, ///< external Solver Belos from Trilinos package, currently without preconditioner Trilinos_Belos, ///< external Solver Belos from Trilinos package, currently without preconditioner.
Trilinos_ML, ///< external Solver AztecOO with ML preconditioner Trilinos_ML, ///< external Solver AztecOO with ML preconditioner.
Trilinos_Ifpack,///< external Solver AztecOO with Ifpack preconditioner Trilinos_Ifpack,///< external Solver AztecOO with Ifpack preconditioner.
PETSc, ///< external Solver PETSc, @see http://www.mcs.anl.gov/petsc/. PETSc, ///< external Solver PETSc, @see http://www.mcs.anl.gov/petsc/
ANI ///< external Solver from ANI3D based on ILU2 (sequential Fortran version). ANI, ///< external Solver from ANI3D based on ILU2 (sequential Fortran version), @see http://ani3d.sourceforge.net/
FCBIILU2, // external FCBIILU2 Solver (BIILU2 parallel F2C version).
K3BIILU2 // inner K3BIILU2 Solver (BIILU2 parallel version).
}; };
static INMOST_MPI_Type & GetRowEntryType() {return RowEntryType;} static INMOST_MPI_Type & GetRowEntryType() {return RowEntryType;}
...@@ -464,14 +466,14 @@ namespace INMOST ...@@ -464,14 +466,14 @@ namespace INMOST
INMOST_DATA_ENUM_TYPE Nonzeros; ///< Number of nonzero in linked list. INMOST_DATA_ENUM_TYPE Nonzeros; ///< Number of nonzero in linked list.
interval< INMOST_DATA_ENUM_TYPE, Row::entry > LinkedList; ///< Storage for linked list. interval< INMOST_DATA_ENUM_TYPE, Row::entry > LinkedList; ///< Storage for linked list.
public: public:
/// Default constructor without size specfied. /// Default constructor without size specified.
RowMerger(); RowMerger();
/// Constructor with size specified. /// Constructor with size specified.
/// @param interval_begin First index in linked list. /// @param interval_begin First index in linked list.
/// @param interval_end Last index in linked list. /// @param interval_end Last index in linked list.
/// @param Sorted Result should be sorted. /// @param Sorted Result should be sorted or not.
RowMerger(INMOST_DATA_ENUM_TYPE interval_begin, INMOST_DATA_ENUM_TYPE interval_end, bool Sorted = true); RowMerger(INMOST_DATA_ENUM_TYPE interval_begin, INMOST_DATA_ENUM_TYPE interval_end, bool Sorted = true);
/// Constructor that gets sizes from matrix /// Constructor that gets sizes from the matrix.
/// @param A Matrix to get sizes from. /// @param A Matrix to get sizes from.
/// @param Sorted Result should be sorted. /// @param Sorted Result should be sorted.
RowMerger(Matrix & A, bool Sorted = true); RowMerger(Matrix & A, bool Sorted = true);
...@@ -483,14 +485,14 @@ namespace INMOST ...@@ -483,14 +485,14 @@ namespace INMOST
/// This behavior may be changed in future. /// This behavior may be changed in future.
/// @param interval_begin First index in linked list. /// @param interval_begin First index in linked list.
/// @param interval_end Last index in linked list. /// @param interval_end Last index in linked list.
/// @param Sorted Result should be sorted. /// @param Sorted Result should be sorted or not.
void Resize(INMOST_DATA_ENUM_TYPE interval_begin, INMOST_DATA_ENUM_TYPE interval_end, bool Sorted = true); void Resize(INMOST_DATA_ENUM_TYPE interval_begin, INMOST_DATA_ENUM_TYPE interval_end, bool Sorted = true);
/// Resize linked list for new matrix. /// Resize linked list for new matrix.
/// \warning /// \warning
/// All contents of linked list will be lost after resize. /// All contents of linked list will be lost after resize.
/// This behavior may be changed in future. /// This behavior may be changed in future.
/// @param A Matrix to get sizes from. /// @param A Matrix to get sizes from.
/// @param Sorted Result should be sorted. /// @param Sorted Result should be sorted or not.
void Resize(Matrix & A, bool Sorted = true); void Resize(Matrix & A, bool Sorted = true);
/// Clear linked list. /// Clear linked list.
void Clear(); void Clear();
...@@ -587,7 +589,7 @@ namespace INMOST ...@@ -587,7 +589,7 @@ namespace INMOST
/// works for: /// works for:
/// INNER_MLILUC /// INNER_MLILUC
/// - "adapt_ddpq_tolerance" - adapt ddpq tolerance depending from the complexity /// - "adapt_ddpq_tolerance" - adapt ddpq tolerance depending from the complexity
// of calculation of Schur complement, /// of calculation of Schur complement,
/// works for: /// works for:
/// INNER_MLILUC /// INNER_MLILUC
void SetParameterEnum(std::string name, INMOST_DATA_ENUM_TYPE value); void SetParameterEnum(std::string name, INMOST_DATA_ENUM_TYPE value);
...@@ -632,12 +634,6 @@ namespace INMOST ...@@ -632,12 +634,6 @@ namespace INMOST
/// Get the package Type. /// Get the package Type.
Type GetPackage() const {return _pack;} Type GetPackage() const {return _pack;}
/// Return the number of iterations performed by the last solution.
/// @see Solver::Solve
INMOST_DATA_ENUM_TYPE Iterations();
/// Return the final residual achieved by the last solution.
/// @see Solver::Solve
INMOST_DATA_REAL_TYPE Residual();
/// Set the matrix and construct the preconditioner. /// Set the matrix and construct the preconditioner.
/// @param A Matrix A in linear problem Ax = b /// @param A Matrix A in linear problem Ax = b
/// @param OldPreconditioner If this parameter is set to true, /// @param OldPreconditioner If this parameter is set to true,
...@@ -662,6 +658,12 @@ namespace INMOST ...@@ -662,6 +658,12 @@ namespace INMOST
/// ///
/// @see Solver::SetMatrix /// @see Solver::SetMatrix
bool Solve(Vector & RHS, Vector & SOL); bool Solve(Vector & RHS, Vector & SOL);
/// Return the number of iterations performed by the last solution.
/// @see Solver::Solve
INMOST_DATA_ENUM_TYPE Iterations();
/// Return the final residual achieved by the last solution.
/// @see Solver::Solve
INMOST_DATA_REAL_TYPE Residual();
/// Get the reason of convergence or divergence of the last solution. /// Get the reason of convergence or divergence of the last solution.
/// @see Solver::Solve /// @see Solver::Solve
std::string GetReason(); std::string GetReason();
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment