Skip to content
Snippets Groups Projects
Commit eaedf12c authored by Christoph Lehmann's avatar Christoph Lehmann
Browse files

[MatL] Expose path modification setting in prj file

parent 5223b486
No related branches found
No related tags found
No related merge requests found
......@@ -29,9 +29,7 @@ std::unique_ptr<MechanicsBase<DisplacementDim>> createMFront(
local_coordinate_system,
BaseLib::ConfigTree const& config)
{
bool const library_path_is_relative_to_prj_file = true;
auto conf = createMFrontConfig(DisplacementDim, parameters, config,
library_path_is_relative_to_prj_file);
auto conf = createMFrontConfig(DisplacementDim, parameters, config);
return std::make_unique<MFront<DisplacementDim>>(
std::move(conf.behaviour), std::move(conf.material_properties),
......
......@@ -324,23 +324,31 @@ namespace MaterialLib::Solids::MFront
MFrontConfig createMFrontConfig(
int const displacement_dim,
std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
BaseLib::ConfigTree const& config,
bool const library_path_is_relative_to_prj_file)
BaseLib::ConfigTree const& config)
{
INFO("### MFRONT ########################################################");
//! \ogs_file_param{material__solid__constitutive_relation__type}
config.checkConfigParameter("type", "MFront");
auto const library_name =
//! \ogs_file_param{material__solid__constitutive_relation__MFront__library}
config.getConfigParameterOptional<std::string>("library");
//! \ogs_file_param{material__solid__constitutive_relation__MFront__library}
auto const library = config.getConfigSubtreeOptional("library");
bool const library_path_is_relative_to_prj_file =
library /* If no library tag is specified in the prj file, the lib
shipped with OGS is used, whose path is not relative to the
project file. */
&&
//! \ogs_file_attr{material__solid__constitutive_relation__MFront__library__path_is_relative_to_prj_file}
library->getConfigAttribute("path_is_relative_to_prj_file", true);
std::string const library_name =
library ? library->getValue<std::string>() : "libOgsMFrontBehaviour";
auto const lib_path =
library_name ? (library_path_is_relative_to_prj_file
? BaseLib::joinPaths(BaseLib::getProjectDirectory(),
*library_name)
: *library_name)
: "libOgsMFrontBehaviour";
library_path_is_relative_to_prj_file
? BaseLib::joinPaths(BaseLib::getProjectDirectory(), library_name)
: library_name;
mgis::behaviour::Hypothesis hypothesis;
if (displacement_dim == 2)
......
......@@ -26,8 +26,7 @@ struct MFrontConfig
MFrontConfig createMFrontConfig(
int const displacement_dim,
std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
BaseLib::ConfigTree const& config,
bool const library_path_is_relative_to_prj_file);
BaseLib::ConfigTree const& config);
template <int DisplacementDim, typename Gradients, typename TDynForces,
typename ExtStateVars>
......@@ -37,11 +36,9 @@ createMFrontGeneric(
std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
std::optional<ParameterLib::CoordinateSystem> const&
local_coordinate_system,
BaseLib::ConfigTree const& config,
bool const library_path_is_relative_to_prj_file)
BaseLib::ConfigTree const& config)
{
auto conf = createMFrontConfig(DisplacementDim, parameters, config,
library_path_is_relative_to_prj_file);
auto conf = createMFrontConfig(DisplacementDim, parameters, config);
return std::make_unique<
MFrontGeneric<DisplacementDim, Gradients, TDynForces, ExtStateVars>>(
......
......@@ -26,13 +26,10 @@ std::unique_ptr<SolidConstitutiveRelation<DisplacementDim>> createMFrontGeneric(
namespace MSM = MaterialLib::Solids::MFront;
using namespace boost::mp11;
bool const library_path_is_relative_to_prj_file = true;
return MSM::createMFrontGeneric<
DisplacementDim, mp_list<MSM::DeformationGradient>,
mp_list<MSM::SecondPiolaKirchhoffStress>, mp_list<MSM::Temperature>>(
parameters, local_coordinate_system, config,
library_path_is_relative_to_prj_file);
parameters, local_coordinate_system, config);
}
template <int DisplacementDim>
......
......@@ -27,13 +27,10 @@ std::unique_ptr<SolidConstitutiveRelation<DisplacementDim>> createMFrontGeneric(
namespace MSM = MaterialLib::Solids::MFront;
using namespace boost::mp11;
bool const library_path_is_relative_to_prj_file = true;
return MSM::createMFrontGeneric<
DisplacementDim, mp_list<MSM::Strain, MSM::LiquidPressure>,
mp_list<MSM::Stress, MSM::Saturation>, mp_list<MSM::Temperature>>(
parameters, local_coordinate_system, config,
library_path_is_relative_to_prj_file);
parameters, local_coordinate_system, config);
}
template <int DisplacementDim>
......
......@@ -97,7 +97,7 @@ auto createMFront(
const char* xml = R"XML(
<type>MFront</type>
<behaviour>CheckParamPassing1</behaviour>
<library>libOgsMFrontBehaviourForUnitTests</library>
<library path_is_relative_to_prj_file="false">libOgsMFrontBehaviourForUnitTests</library>
<material_properties>
<material_property name="YoungModulus" parameter="E"/>
<material_property name="PoissonRatio" parameter="nu"/>
......@@ -113,7 +113,7 @@ auto createMFront(
3, boost::mp11::mp_list<MSM::Strain, MSM::LiquidPressure>,
boost::mp11::mp_list<MSM::Stress, MSM::Saturation>,
boost::mp11::mp_list<MSM::Temperature>>(
parameters, local_coordinate_system, config_tree, false);
parameters, local_coordinate_system, config_tree);
}
TEST(MaterialLib_CheckParamPassingMFront, SuccessTest)
......
......@@ -29,7 +29,7 @@ auto createMFront(std::string const& behaviour)
auto const xml = fmt::format(R"XML(
<type>MFront</type>
<behaviour>{}</behaviour>
<library>libOgsMFrontBehaviourForUnitTests</library>
<library path_is_relative_to_prj_file="false">libOgsMFrontBehaviourForUnitTests</library>
<material_properties />
)XML",
behaviour);
......@@ -41,7 +41,7 @@ auto createMFront(std::string const& behaviour)
return MSM::createMFrontGeneric<
3, boost::mp11::mp_list<MSM::Strain, MSM::LiquidPressure>,
boost::mp11::mp_list<MSM::Stress, MSM::Saturation>, ExtStateVars>(
parameters, local_coordinate_system, config_tree, false);
parameters, local_coordinate_system, config_tree);
}
struct TestDataBase
......
......@@ -131,7 +131,7 @@ static auto createMFront(
3, boost::mp11::mp_list<MSM::Strain, MSM::LiquidPressure>,
boost::mp11::mp_list<MSM::Stress, MSM::Saturation>,
boost::mp11::mp_list<MSM::Temperature>>(
parameters, local_coordinate_system, config_tree, false);
parameters, local_coordinate_system, config_tree);
}
TEST(MaterialLib_ThermoPoroElasticityMFront, IsochoricDrainedHeating)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment