Commit 3cbe1ef4 authored by Kirill Terekhov's avatar Kirill Terekhov
Browse files

Fix

Fix introduced bug - parameters are set after inner solvers were
initialized.
parent 8fa00d6a
...@@ -441,7 +441,7 @@ namespace INMOST ...@@ -441,7 +441,7 @@ namespace INMOST
INMOST_DATA_REAL_TYPE preconditioner_reuse_tolerance; INMOST_DATA_REAL_TYPE preconditioner_reuse_tolerance;
INMOST_DATA_REAL_TYPE preconditioner_ddpq_tolerance; INMOST_DATA_REAL_TYPE preconditioner_ddpq_tolerance;
INMOST_DATA_ENUM_TYPE preconditioner_reorder_nonzero; INMOST_DATA_ENUM_TYPE preconditioner_reorder_nonzero;
INMOST_DATA_ENUM_TYPE preconditioner_fill_level; INMOST_DATA_REAL_TYPE preconditioner_fill_level;
INMOST_DATA_ENUM_TYPE preconditioner_rescale_iterations; INMOST_DATA_ENUM_TYPE preconditioner_rescale_iterations;
INMOST_DATA_ENUM_TYPE preconditioner_condition_estimation; INMOST_DATA_ENUM_TYPE preconditioner_condition_estimation;
INMOST_DATA_ENUM_TYPE preconditioner_adapt_ddpq_tolerance; INMOST_DATA_ENUM_TYPE preconditioner_adapt_ddpq_tolerance;
...@@ -473,10 +473,6 @@ namespace INMOST ...@@ -473,10 +473,6 @@ namespace INMOST
/// "gmres_substeps" - number of gmres steps performed after each bicgstab step /// "gmres_substeps" - number of gmres steps performed after each bicgstab step
/// works for: /// works for:
/// INNER_ILU2, INNER_MLILUC /// INNER_ILU2, INNER_MLILUC
/// "fill_level" - level of fill for ILU-type preconditioners
/// works for:
/// INNER_ILU2 (if LFILL is defined in solver_ilu2.hpp)
/// Trilinos_Ifpack
/// "reorder_nonzeros" - place sparser rows at the beggining of matrix during reordering /// "reorder_nonzeros" - place sparser rows at the beggining of matrix during reordering
/// works for: /// works for:
/// INNER_MLILUC /// INNER_MLILUC
...@@ -504,7 +500,7 @@ namespace INMOST ...@@ -504,7 +500,7 @@ namespace INMOST
/// "drop_tolerance" - tolerance for dropping values during incomplete factorization /// "drop_tolerance" - tolerance for dropping values during incomplete factorization
/// works for: /// works for:
/// INNER_ILU2, INNER_MLILUC /// INNER_ILU2, INNER_MLILUC
/// Trilinos_Aztec, Trilinos_ML, Trilinos_Ifpack /// Trilinos_Aztec, Trilinos_Ifpack
/// PETSc /// PETSc
/// "reuse_tolerance" - tolerance for reusing values during incomplete factorization /// "reuse_tolerance" - tolerance for reusing values during incomplete factorization
/// these values are used only during calculation of L and U factors /// these values are used only during calculation of L and U factors
...@@ -521,6 +517,10 @@ namespace INMOST ...@@ -521,6 +517,10 @@ namespace INMOST
/// where on imax, jmax maximum is reached. /// where on imax, jmax maximum is reached.
/// works for: /// works for:
/// INNER_MLILUC /// INNER_MLILUC
/// "fill_level" - level of fill for ILU-type preconditioners
/// works for:
/// INNER_ILU2 (if LFILL is defined in solver_ilu2.hpp)
/// Trilinos, Trilinos_Ifpack
void SetParameterReal(std::string name, INMOST_DATA_REAL_TYPE value); void SetParameterReal(std::string name, INMOST_DATA_REAL_TYPE value);
/// Get the used defined name of the Solver. /// Get the used defined name of the Solver.
std::string GetName() {return name;} std::string GetName() {return name;}
......
...@@ -1202,12 +1202,10 @@ namespace INMOST ...@@ -1202,12 +1202,10 @@ namespace INMOST
preconditioner_condition_estimation = val; preconditioner_condition_estimation = val;
else if( name == "adapt_ddpq_tolerance" ) else if( name == "adapt_ddpq_tolerance" )
preconditioner_adapt_ddpq_tolerance = val; preconditioner_adapt_ddpq_tolerance = val;
else if( name == "scwartz_overlap" ) else if( name == "schwartz_overlap" )
additive_schwartz_overlap = val; additive_schwartz_overlap = val;
else if( name == "gmres_substeps" ) else if( name == "gmres_substeps" )
solver_gmres_substeps = val; solver_gmres_substeps = val;
else if( name == "fill_level" )
preconditioner_fill_level = val;
else if( name == "reorder_nonzeros" ) else if( name == "reorder_nonzeros" )
preconditioner_reorder_nonzero = val; preconditioner_reorder_nonzero = val;
else if( _pack == INNER_ILU2 || _pack == INNER_MLILUC ) else if( _pack == INNER_ILU2 || _pack == INNER_MLILUC )
...@@ -1241,6 +1239,8 @@ namespace INMOST ...@@ -1241,6 +1239,8 @@ namespace INMOST
preconditioner_reuse_tolerance = val; preconditioner_reuse_tolerance = val;
else if( name == "ddpq_tolerance" ) else if( name == "ddpq_tolerance" )
preconditioner_ddpq_tolerance = val; preconditioner_ddpq_tolerance = val;
else if( name == "fill_level" )
preconditioner_fill_level = val;
else if( _pack == INNER_ILU2 || _pack == INNER_MLILUC ) else if( _pack == INNER_ILU2 || _pack == INNER_MLILUC )
{ {
try try
...@@ -1765,10 +1765,10 @@ namespace INMOST ...@@ -1765,10 +1765,10 @@ namespace INMOST
sol->ReplaceMAT(*mat); sol->ReplaceMAT(*mat);
if( matrix_data != NULL ) delete (Solver::Matrix *)matrix_data; if( matrix_data != NULL ) delete (Solver::Matrix *)matrix_data;
matrix_data = (void *)mat; matrix_data = (void *)mat;
if (!sol->isInitialized()) //if (!sol->isInitialized())
{ //{
sol->Initialize(); // sol->Initialize();
} //}
ok = true; ok = true;
} }
...@@ -1884,16 +1884,16 @@ namespace INMOST ...@@ -1884,16 +1884,16 @@ namespace INMOST
problem->SetRHS(&VectorRHS); problem->SetRHS(&VectorRHS);
problem->SetLHS(&VectorSOL); problem->SetLHS(&VectorSOL);
AztecOO AztecSolver(*problem); AztecOO AztecSolver(*problem);
//AztecSolver.SetAztecOption(AZ_diagnostics,AZ_none); AztecSolver.SetAztecOption(AZ_diagnostics,AZ_none);
//AztecSolver.SetAztecOption(AZ_output,AZ_none); AztecSolver.SetAztecOption(AZ_output,AZ_none);
AztecSolver.SetAztecOption(AZ_solver,AZ_bicgstab); AztecSolver.SetAztecOption(AZ_solver,AZ_bicgstab);
AztecSolver.SetAztecOption(AZ_overlap,additive_schwartz_overlap); AztecSolver.SetAztecOption(AZ_overlap,additive_schwartz_overlap);
void * precinfo = NULL; void * precinfo = NULL;
if( _pack == Trilinos_Aztec ) if( _pack == Trilinos_Aztec )
{ {
AztecSolver.SetAztecParam(AZ_tol,preconditioner_drop_tolerance); AztecSolver.SetAztecParam(AZ_drop,preconditioner_drop_tolerance);
AztecSolver.SetAztecParam(AZ_drop,preconditioner_fill_level); AztecSolver.SetAztecParam(AZ_ilut_fill,preconditioner_fill_level);
//AztecSolver.SetAztecOption(AZ_solver,AZ_tfqmr); //AztecSolver.SetAztecOption(AZ_solver,AZ_tfqmr);
//AztecSolver.SetAztecOption(AZ_precond,AZ_Neumann); //AztecSolver.SetAztecOption(AZ_precond,AZ_Neumann);
//AztecSolver.SetAztecOption(AZ_poly_ord,3); //AztecSolver.SetAztecOption(AZ_poly_ord,3);
...@@ -2052,10 +2052,6 @@ namespace INMOST ...@@ -2052,10 +2052,6 @@ namespace INMOST
if(_pack == INNER_ILU2 ) if(_pack == INNER_ILU2 )
{ {
IterativeMethod * sol = static_cast<IterativeMethod *>(solver_data); IterativeMethod * sol = static_cast<IterativeMethod *>(solver_data);
if (!sol->isInitialized())
{
sol->Initialize();
}
sol->EnumParameter("maxits") = maximum_iterations; sol->EnumParameter("maxits") = maximum_iterations;
sol->EnumParameter("levels") = solver_gmres_substeps; sol->EnumParameter("levels") = solver_gmres_substeps;
sol->RealParameter("rtol") = relative_tolerance; sol->RealParameter("rtol") = relative_tolerance;
...@@ -2065,6 +2061,11 @@ namespace INMOST ...@@ -2065,6 +2061,11 @@ namespace INMOST
sol->RealParameter(":tau2") = preconditioner_reuse_tolerance; sol->RealParameter(":tau2") = preconditioner_reuse_tolerance;
sol->EnumParameter(":fill") = preconditioner_fill_level; sol->EnumParameter(":fill") = preconditioner_fill_level;
sol->EnumParameter(":scale_iters") = preconditioner_rescale_iterations; sol->EnumParameter(":scale_iters") = preconditioner_rescale_iterations;
if (!sol->isInitialized())
{
sol->Initialize();
}
bool ret = sol->Solve(RHS,SOL); bool ret = sol->Solve(RHS,SOL);
last_it = sol->GetIterations(); last_it = sol->GetIterations();
last_resid = sol->GetResidual(); last_resid = sol->GetResidual();
...@@ -2074,10 +2075,6 @@ namespace INMOST ...@@ -2074,10 +2075,6 @@ namespace INMOST
if(_pack == INNER_MLILUC ) if(_pack == INNER_MLILUC )
{ {
IterativeMethod * sol = static_cast<IterativeMethod *>(solver_data); IterativeMethod * sol = static_cast<IterativeMethod *>(solver_data);
if (!sol->isInitialized())
{
sol->Initialize();
}
sol->EnumParameter("maxits") = maximum_iterations; sol->EnumParameter("maxits") = maximum_iterations;
sol->EnumParameter("levels") = solver_gmres_substeps; sol->EnumParameter("levels") = solver_gmres_substeps;
sol->RealParameter("rtol") = relative_tolerance; sol->RealParameter("rtol") = relative_tolerance;
...@@ -2090,6 +2087,11 @@ namespace INMOST ...@@ -2090,6 +2087,11 @@ namespace INMOST
sol->EnumParameter(":scale_iters") = preconditioner_rescale_iterations; sol->EnumParameter(":scale_iters") = preconditioner_rescale_iterations;
sol->EnumParameter(":estimator") = preconditioner_condition_estimation; sol->EnumParameter(":estimator") = preconditioner_condition_estimation;
sol->EnumParameter(":ddpq_tau_adapt") = preconditioner_adapt_ddpq_tolerance; sol->EnumParameter(":ddpq_tau_adapt") = preconditioner_adapt_ddpq_tolerance;
if (!sol->isInitialized())
{
sol->Initialize();
}
bool ret = sol->Solve(RHS,SOL); bool ret = sol->Solve(RHS,SOL);
last_it = sol->GetIterations(); last_it = sol->GetIterations();
last_resid = sol->GetResidual(); last_resid = sol->GetResidual();
......
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