Revision 5e0bec1c9e1a1f9a60d928045b9280f3816e3803 authored by Tobias Meisel on 07 October 2021, 13:35:01 UTC, committed by Tobias Meisel on 07 October 2021, 13:35:01 UTC
[cpm] Update xdmf to fix CMake warnings. See merge request ogs/ogs!3830
ConvergenceCriterion.cpp
/**
* \file
* \copyright
* Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#include "ConvergenceCriterion.h"
#include "BaseLib/ConfigTree.h"
#include "BaseLib/Error.h"
#include "ConvergenceCriterionDeltaX.h"
#include "ConvergenceCriterionPerComponentDeltaX.h"
#include "ConvergenceCriterionPerComponentResidual.h"
#include "ConvergenceCriterionResidual.h"
namespace NumLib
{
std::unique_ptr<ConvergenceCriterion> createConvergenceCriterion(
const BaseLib::ConfigTree& config)
{
//! \ogs_file_param{prj__time_loop__processes__process__convergence_criterion__type}
auto const type = config.peekConfigParameter<std::string>("type");
if (type == "DeltaX")
{
return createConvergenceCriterionDeltaX(config);
}
if (type == "Residual")
{
return createConvergenceCriterionResidual(config);
}
if (type == "PerComponentDeltaX")
{
return createConvergenceCriterionPerComponentDeltaX(config);
}
if (type == "PerComponentResidual")
{
return createConvergenceCriterionPerComponentResidual(config);
}
OGS_FATAL("There is no convergence criterion of type `{:s}'.", type);
}
bool checkRelativeTolerance(const double reltol, const double numerator,
const double denominator)
{
auto const eps = std::numeric_limits<double>::epsilon();
return std::abs(numerator) <
std::abs(reltol) * (std::abs(denominator) + eps);
}
} // namespace NumLib
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...