Commit 71033460 authored by GILLES Sebastien's avatar GILLES Sebastien

#1465 Make the string and the variant cases work.

parent a817ead4
......@@ -14,6 +14,7 @@
# include "Core/MoReFEMData/MoReFEMData.hpp"
# include "Core/InputData/Instances/Reaction/ReactionCoefficient.hpp"
# include "Core/InputData/Instances/Geometry/Mesh.hpp"
# include "Core/InputData/Instances/Parameter/Source/ScalarTransientSource.hpp"
# include "Core/InputData/Instances/Parameter/Source/VectorialTransientSource.hpp"
......@@ -34,6 +35,7 @@ namespace MoReFEM
InputDataNS::Mesh<5>,
InputDataNS::ScalarTransientSource<72>,
InputDataNS::VectorialTransientSource<4>
>;
......
......@@ -84,6 +84,7 @@ ReactionCoefficient = 1.
TransientSource4 = {
-- #1468 nature = { "lua_function", "constant", "piecewise_constant_by_domain"},
nature = { "lua_function", "constant", "constant"},
value = {
......@@ -92,6 +93,22 @@ TransientSource4 = {
return 100. * math.exp(-((x - 0.5)^2 + (y - 0.5)^2)/(0.1^2));
end
]],
0., 0. }
0.,
0. }
-- #1468 { [1] = 0., [3] = 14.5, [4] = -31.231 } }
} -- TransientSource4
TransientSource72 = {
nature = "lua_function",
value =
[[
function (x, y, z)
return 100. * math.exp(-((x - 0.5)^2 + (y - 0.5)^2)/(0.1^2));
end
]],
} -- TransientSource72
......@@ -15,6 +15,7 @@
# include <variant>
# include <vector>
# include <map>
# include <sstream>
# include "Utilities/InputData/LuaFunction.hpp"
# include "Utilities/Miscellaneous.hpp"
......
......@@ -21,11 +21,20 @@ namespace MoReFEM::Internal::InputDataNS
{
if constexpr(Utilities::IsSpecializationOf
<
std::variant,
T
std::variant,
T
>())
{
return "Variant case!";
std::ostringstream oconv;
oconv << "\n[[\n"
<< std::visit([](auto&& arg)
{
return ConvertEntryToString(arg);
},
entry)
<< "\n]]";
return oconv.str();
}
else if constexpr (std::is_same<T, bool>())
{
......@@ -33,7 +42,9 @@ namespace MoReFEM::Internal::InputDataNS
}
else if constexpr (std::is_same<T, std::string>())
{
return entry;
std::ostringstream oconv;
oconv << "'" << entry << "'";
return oconv.str();
}
else if constexpr (std::is_integral<T>())
{
......
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