Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
DIAZ Jerome
MoReFEM
Commits
71033460
Commit
71033460
authored
Jul 23, 2019
by
GILLES Sebastien
Browse files
#1465 Make the string and the variant cases work.
parent
a817ead4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Sources/Test/Core/MoReFEMData/WriteLuaFile/InputData.hpp
View file @
71033460
...
...
@@ -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
>
>
;
...
...
Sources/Test/Core/MoReFEMData/WriteLuaFile/demo.lua
View file @
71033460
...
...
@@ -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
Sources/Utilities/InputData/Internal/ConvertEntryToString/ConvertEntryToString.hpp
View file @
71033460
...
...
@@ -15,6 +15,7 @@
# include <variant>
# include <vector>
# include <map>
# include <sstream>
# include "Utilities/InputData/LuaFunction.hpp"
# include "Utilities/Miscellaneous.hpp"
...
...
Sources/Utilities/InputData/Internal/ConvertEntryToString/ConvertEntryToString.hxx
View file @
71033460
...
...
@@ -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
>
())
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment