Revision 669859a8b0b5dc60272c17ecc50f71e532205d71 authored by Lars Bilke on 01 February 2021, 21:09:22 UTC, committed by Lars Bilke on 02 February 2021, 11:40:24 UTC
1 parent 3c2c815
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 ...