Commit ccbf4446 authored by Kirill Terekhov's avatar Kirill Terekhov

fixes

Fix error in solver option name
Fix newer version of autodiff
parent eefb44d8
......@@ -20,7 +20,7 @@ namespace INMOST
{
INMOST_DATA_ENUM_TYPE voffset = var.values_offset(element), doffset = var.derivatives_offset(element);
INMOST_DATA_ENUM_TYPE k = var.data.size()-1;
Storage * e = var.current_stencil[element].first;
Storage e = Storage(m,var.current_stencil[element].first);
INMOST_DATA_REAL_TYPE lval, rval, ret;
var.values[doffset+k] = multval;
expr::expr_data * arr = &var.data[0], *it;
......@@ -99,7 +99,7 @@ namespace INMOST
{
expr & next = *it->right.e;
next.current_stencil.resize(1);
next.current_stencil[0] = stencil_pair(e,1.0);
next.current_stencil[0] = stencil_pair(e->GetHandle(),1.0);
next.resize_for_stencil();
var.values[doffset+it->left.i] += var.values[doffset+k] * EvaluateSub(next,0,element,user_data);
break;
......@@ -133,7 +133,7 @@ namespace INMOST
INMOST_DATA_REAL_TYPE Automatizator::EvaluateSub(expr & var, INMOST_DATA_ENUM_TYPE element, INMOST_DATA_ENUM_TYPE parent, void * user_data)
{
INMOST_DATA_ENUM_TYPE k = 0, offset = var.values_offset(element);
Storage * e = var.current_stencil[element].first;
Storage e = Storage(m,var.current_stencil[element].first);
expr::expr_data * arr = &var.data[0], *it;
//for (expr::data_type::iterator it = var.data.begin(); it != var.data.end(); ++it)
do
......@@ -149,7 +149,7 @@ namespace INMOST
{
expr & next = var.values[offset+it->left.i] > 0.0 ? *it->right.q->left.e : *it->right.q->right.e;
next.current_stencil.resize(1);
next.current_stencil[0] = stencil_pair(e,1.0);
next.current_stencil[0] = stencil_pair(e->GetHandle(),1.0);
next.resize_for_stencil();
var.values[offset+k] = EvaluateSub(next, 0,element, user_data);
}
......@@ -168,7 +168,7 @@ namespace INMOST
case AD_CONST: var.values[offset+k] = it->left.r; break;
case AD_COND_TYPE: var.values[offset+k] = ((e->GetElementType() & it->left.i)? 1.0 : -1.0); break;
case AD_COND_MARK: var.values[offset+k] = e->GetMarker(it->left.i) ? 1.0 : -1.0; break;
case AD_MES: assert(!(e->GetElementType() & (ESET | MESH))); m->GetGeometricData(static_cast<Element *>(e), MEASURE, &var.values[offset+k]); break;
case AD_MES: assert(!(e->GetElementType() & (ESET | MESH))); m->GetGeometricData(e->GetHandle(), MEASURE, &var.values[offset+k]); break;
case AD_VAL: var.values[offset+k] = var.values[offset+it->left.i]; break;
default:
if (it->op >= AD_FUNC) var.values[offset+k] = reg_funcs[it->op-AD_FUNC].func(e, user_data);
......@@ -191,19 +191,19 @@ namespace INMOST
return var.values[offset+var.data.size()-1];
}
INMOST_DATA_REAL_TYPE Automatizator::Evaluate(expr & var, Storage * e, void * user_data)
INMOST_DATA_REAL_TYPE Automatizator::Evaluate(expr & var, const Storage & e, void * user_data)
{
var.current_stencil.resize(1);
var.current_stencil[0] = stencil_pair(e,1.0);
var.current_stencil[0] = stencil_pair(e->GetHandle(),1.0);
var.resize_for_stencil();
return EvaluateSub(var,0,ENUMUNDEF,user_data);
}
INMOST_DATA_REAL_TYPE Automatizator::Derivative(expr & var, Storage * e, Solver::Row & out, Storage::real multiply, void * user_data)
INMOST_DATA_REAL_TYPE Automatizator::Derivative(expr & var, const Storage & e, Solver::Row & out, Storage::real multiply, void * user_data)
{
INMOST_DATA_REAL_TYPE ret;
var.current_stencil.resize(1);
var.current_stencil[0] = stencil_pair(e,1.0);
var.current_stencil[0] = stencil_pair(e->GetHandle(),1.0);
var.resize_for_stencil();
ret = EvaluateSub(var,0,ENUMUNDEF,user_data);
DerivativeFill(var, 0, ENUMUNDEF, out, multiply, user_data);
......
......@@ -1278,8 +1278,8 @@ namespace INMOST
absolute_tolerance = val;
else if( name == "relative_tolerance" )
relative_tolerance = val;
else if( name == "divergance_tolerance" )
divergance_tolerance = val;
else if( name == "divergence_tolerance" )
divergence_tolerance = val;
else if( name == "drop_tolerance" )
preconditioner_drop_tolerance = val;
else if( name == "reuse_tolerance" )
......@@ -1311,7 +1311,7 @@ namespace INMOST
maximum_iterations = DEFAULT_MAXIMUM_ITERATIONS;
absolute_tolerance = DEFAULT_ABSOLUTE_TOLERANCE;
relative_tolerance = DEFAULT_RELATIVE_TOLERANCE;
divergance_tolerance = DEFAULT_DIVERGENCE_TOLERANCE;
divergence_tolerance = DEFAULT_DIVERGENCE_TOLERANCE;
preconditioner_ddpq_tolerance = DEFAULT_PRECONDITIONER_DDPQ_TOLERANCE;
preconditioner_drop_tolerance = DEFAULT_PRECONDITIONER_DROP_TOLERANCE;
preconditioner_reuse_tolerance = DEFAULT_PRECONDITIONER_REUSE_TOLERANCE;
......@@ -1904,7 +1904,7 @@ namespace INMOST
}
if( petsc_database_file == "" ) //set parameters if no file is set
{
SolverSetTolerancesPetsc(solver_data,relative_tolerance,absolute_tolerance,divergance_tolerance,maximum_iterations);
SolverSetTolerancesPetsc(solver_data,relative_tolerance,absolute_tolerance,divergence_tolerance,maximum_iterations);
}
bool result = SolverSolvePetsc(solver_data,rhs_data,solution_data);
if( result )
......@@ -2230,7 +2230,7 @@ namespace INMOST
sol->EnumParameter("maxits") = maximum_iterations;
sol->RealParameter("rtol") = relative_tolerance;
sol->RealParameter("atol") = absolute_tolerance;
sol->RealParameter("divtol") = divergance_tolerance;
sol->RealParameter("divtol") = divergence_tolerance;
bool ret = sol->Solve(RHS,SOL);
last_it = sol->GetIterations();
......
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