Revision 26050545dead5afe52e6ac9a764a900b9bc67e2e authored by Dmitri Naumov on 13 December 2020, 22:12:02 UTC, committed by Dmitri Naumov on 20 February 2021, 11:10:53 UTC
1 parent 26e1ea9
TestMPL.cpp
/**
* \file
* \author Norbert Grunwald
* \date Oct 22, 2018
* \brief
*
* \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 "TestMPL.h"
#include "BaseLib/ConfigTree.h"
#include "MaterialLib/MPL/CreateMedium.h"
#include "MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h"
#include "ParameterLib/Parameter.h"
#include "Tests/TestTools.h"
namespace Tests
{
std::unique_ptr<MPL::Medium> createTestMaterial(std::string const& xml,
int const geometry_dimension)
{
auto const ptree = Tests::readXml(xml.c_str());
BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
BaseLib::ConfigTree::onwarning);
auto const& config = conf.getConfigSubtree("medium");
std::vector<std::unique_ptr<ParameterLib::ParameterBase>> parameters;
std::map<std::string,
std::unique_ptr<MathLib::PiecewiseLinearInterpolation>>
curves;
return MPL::createMedium(geometry_dimension, config, parameters, nullptr,
curves);
}
std::unique_ptr<MaterialPropertyLib::Property> createTestProperty(
const char xml[],
std::function<std::unique_ptr<MaterialPropertyLib::Property>(
BaseLib::ConfigTree const& config)>
createProperty)
{
auto const ptree = Tests::readXml(xml);
BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
BaseLib::ConfigTree::onwarning);
auto const& sub_config = conf.getConfigSubtree("property");
// Parsing the property name:
auto const property_name =
sub_config.getConfigParameter<std::string>("name");
return createProperty(sub_config);
}
} // namespace Tests
Computing file changes ...