Skip to content

Commit 98ce74f

Browse files
committed
Merge branch 'master' into 147-create-an-integrate_debug-function-which-could-generate-mtest-files-on-integration-errors
2 parents 36abf57 + 2203ee0 commit 98ce74f

116 files changed

Lines changed: 12943 additions & 199 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/check.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ jobs:
3030
shell: spack-sh {0}
3131
run: |
3232
# spack load python py-numpy py-pybind11
33+
# loading TFEL
3334
spack load tfel
34-
cmake -DCMAKE_BUILD_TYPE=Release . \
35-
-Denable-c-bindings=ON \
36-
-Denable-fortran-bindings=ON \
37-
-Denable-python-bindings=OFF \
38-
-Denable-portable-build=ON \
39-
-Denable-julia-bindings=OFF
35+
cmake -DCMAKE_BUILD_TYPE=Release . \
36+
-Denable-c-bindings=ON \
37+
-Denable-fortran-bindings=ON \
38+
-Denable-python-bindings=OFF \
39+
-Denable-portable-build=ON \
40+
-Denable-julia-bindings=OFF \
41+
-DTFEL_DIR=`spack location -i tfel`/share/tfel/cmake
4042
- name: make
4143
shell: spack-sh {0}
4244
run: |

CMakeLists.txt

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ project("mfront-generic-interface"
1111
DESCRIPTION "${MFrontGenericInterfaceSupportDescription}"
1212
HOMEPAGE_URL "https://thelfer.github.io/mgis/web/index.html")
1313

14+
write_basic_package_version_file(
15+
"${PROJECT_BINARY_DIR}/mgis-config-version.cmake"
16+
VERSION "${VERSION}"
17+
COMPATIBILITY SameMinorVersion)
18+
install(FILES "${PROJECT_BINARY_DIR}/mgis-config-version.cmake"
19+
DESTINATION "${mgis_export_install_path}")
20+
1421
set(CMAKE_CXX_STANDARD 20)
1522
set(CXX_STANDARD_REQUIRED ON)
1623

@@ -22,6 +29,11 @@ option(enable-portable-build "produce binary that can be shared between various
2229
# find_package (Eigen3 REQUIRED)
2330
# endif (enable-eigen-bindings)
2431

32+
# enable mgis-function
33+
option(enable-mgis-function "enable mgis function" ON)
34+
# enable exceptions usage
35+
option(enable-exceptions "use exceptions to report contract violation and error reporting" OFF)
36+
2537
# C-bindings (placed before compiler detection)
2638
option(enable-c-bindings "enable c bindings support")
2739

@@ -136,13 +148,16 @@ if(CMAKE_BUILD_TYPE STREQUAL "Coverage")
136148
endif(CMAKE_BUILD_TYPE STREQUAL "Coverage")
137149

138150
#detecting TFEL and MFront
139-
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
140-
find_package(TFEL)
141-
if(TFEL_FOUND)
142-
include(tfel)
143-
include(material-properties)
144-
include(behaviours)
145-
endif(TFEL_FOUND)
151+
option(disable-tfel "explicitly disable TFEL support. By default, MGIS tries to use TFEL for tests and MGIS/Function" OFF)
152+
if(NOT disable-tfel)
153+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
154+
find_package(TFEL)
155+
if(TFEL_FOUND)
156+
include(tfel)
157+
include(material-properties)
158+
include(behaviours)
159+
endif(TFEL_FOUND)
160+
endif(NOT disable-tfel)
146161

147162
#documentations
148163
option(enable-doxygen-doc "enable generation of the Doxygen documentation" OFF)
@@ -217,9 +232,7 @@ endif(CMAKE_CONFIGURATION_TYPES)
217232

218233
add_subdirectory(include)
219234
add_subdirectory(src)
220-
if(MGIS_HAVE_TFEL)
221-
add_subdirectory(tests)
222-
endif(MGIS_HAVE_TFEL)
235+
add_subdirectory(tests)
223236
add_subdirectory(bindings)
224237

225238
# Packaging

INSTALL-cmake.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ Options
5555
- `enable-static`: compiles static libraries
5656
- `enable-doxygen-doc`: enable the generation of the API documentation
5757
using with `Doxygen`.
58+
- `disable-tfel`: by default, `MGIS` tries to add support for `TFEL`,
59+
notably if `tfel-config` is found in the `PATH`. This option disables
60+
this behaviour.
5861

5962
`cmake` usefull variables
6063
=======================
@@ -67,6 +70,7 @@ Options
6770
version of python shall be passed, not
6871
the revision version or the detection
6972
fails.
73+
- `TFEL_DIR` : specify the directory where to find TFEL
7074

7175
`cmake` typical usage
7276
=====================

bindings/c/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
add_subdirectory(include)
22
add_subdirectory(src)
3-
if(MGIS_HAVE_TFEL)
3+
if(MGIS_HAVE_MFRONT_SUPPORT)
44
add_subdirectory(tests)
5-
endif(MGIS_HAVE_TFEL)
5+
endif(MGIS_HAVE_MFRONT_SUPPORT)

bindings/c/tests/BoundsCheckTest-c.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ int main(const int argc, const char* const* argv) {
8383
long double lowerBound;
8484
check_status(
8585
mgis_bv_behaviour_get_lower_bound(&lowerBound, b, "YoungModulus"));
86-
check(fabs(lowerBound - yg_min) < eps * yg_min,
86+
check(fabsl(lowerBound - yg_min) < eps * yg_min,
8787
"invalid lower bound for 'YoungModulus'");
8888
int hasUpperBound;
8989
check_status(mgis_bv_behaviour_has_upper_bound(&hasUpperBound, b, "YoungModulus"));
9090
check(hasUpperBound, "'YoungModulus' shall have an upper bound");
9191
long double upperBound;
9292
check_status(
9393
mgis_bv_behaviour_get_upper_bound(&upperBound, b, "YoungModulus"));
94-
check(fabs(upperBound - yg_max) < eps * yg_max,
94+
check(fabsl(upperBound - yg_max) < eps * yg_max,
9595
"invalid upper bound for 'YoungModulus'");
9696
// physical bounds
9797
int hasPhysicalBounds;
@@ -103,7 +103,7 @@ int main(const int argc, const char* const* argv) {
103103
long double lowerPhysicalBound;
104104
check_status(mgis_bv_behaviour_get_lower_physical_bound(&lowerPhysicalBound,
105105
b, "YoungModulus"));
106-
check(fabs(lowerPhysicalBound) < eps * yg_min,
106+
check(fabsl(lowerPhysicalBound) < eps * yg_min,
107107
"invalid physical lower bound for 'YoungModulus'");
108108
int hasUpperPhysicalBound;
109109
check_status(mgis_bv_behaviour_has_upper_physical_bound(&hasUpperPhysicalBound, b, "YoungModulus"));

bindings/fortran/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
add_subdirectory(src)
22
add_subdirectory(modules)
3-
if(MGIS_HAVE_TFEL)
3+
if(MGIS_HAVE_MFRONT_SUPPORT)
44
add_subdirectory(tests)
5-
endif(MGIS_HAVE_TFEL)
5+
endif(MGIS_HAVE_MFRONT_SUPPORT)
66

bindings/julia/src/Behaviour.cxx

Lines changed: 45 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include "MGIS/Julia/JuliaUtilities.hxx"
1919

2020
void declareBehaviour(jlcxx::Module &m) {
21-
using mgis::behaviour::BehaviourDescription;
2221
using mgis::behaviour::Behaviour;
22+
using mgis::behaviour::BehaviourDescription;
2323
using mgis::behaviour::FiniteStrainBehaviourOptions;
2424
using mgis::behaviour::Hypothesis;
2525
//
@@ -32,9 +32,11 @@ void declareBehaviour(jlcxx::Module &m) {
3232
&mgis::behaviour::setParameter;
3333
void (*setParameter2)(const Behaviour &, const std::string &, const int) =
3434
&mgis::behaviour::setParameter;
35-
double (*getParameterDefaultValue1)(const BehaviourDescription &, const std::string &) =
35+
double (*getParameterDefaultValue1)(const BehaviourDescription &,
36+
const std::string &) =
3637
&mgis::behaviour::getParameterDefaultValue<double>;
37-
int (*getParameterDefaultValue2)(const BehaviourDescription &, const std::string &) =
38+
int (*getParameterDefaultValue2)(const BehaviourDescription &,
39+
const std::string &) =
3840
&mgis::behaviour::getParameterDefaultValue<int>;
3941
unsigned short (*getParameterDefaultValue3)(const BehaviourDescription &,
4042
const std::string &) =
@@ -45,19 +47,25 @@ void declareBehaviour(jlcxx::Module &m) {
4547
mgis::behaviour::hasLowerBound;
4648
bool (*hasUpperBound)(const BehaviourDescription &, const std::string &) =
4749
mgis::behaviour::hasUpperBound;
48-
long double (*getLowerBound)(const BehaviourDescription &, const std::string &) =
50+
long double (*getLowerBound)(const BehaviourDescription &,
51+
const std::string &) =
4952
mgis::behaviour::getLowerBound;
50-
long double (*getUpperBound)(const BehaviourDescription &, const std::string &) =
53+
long double (*getUpperBound)(const BehaviourDescription &,
54+
const std::string &) =
5155
mgis::behaviour::getUpperBound;
5256
bool (*hasPhysicalBounds)(const BehaviourDescription &, const std::string &) =
5357
mgis::behaviour::hasPhysicalBounds;
54-
bool (*hasLowerPhysicalBound)(const BehaviourDescription &, const std::string &) =
58+
bool (*hasLowerPhysicalBound)(const BehaviourDescription &,
59+
const std::string &) =
5560
mgis::behaviour::hasLowerPhysicalBound;
56-
bool (*hasUpperPhysicalBound)(const BehaviourDescription &, const std::string &) =
61+
bool (*hasUpperPhysicalBound)(const BehaviourDescription &,
62+
const std::string &) =
5763
mgis::behaviour::hasUpperPhysicalBound;
58-
long double (*getLowerPhysicalBound)(const BehaviourDescription &, const std::string &) =
64+
long double (*getLowerPhysicalBound)(const BehaviourDescription &,
65+
const std::string &) =
5966
mgis::behaviour::getLowerPhysicalBound;
60-
long double (*getUpperPhysicalBound)(const BehaviourDescription &, const std::string &) =
67+
long double (*getUpperPhysicalBound)(const BehaviourDescription &,
68+
const std::string &) =
6169
mgis::behaviour::getUpperPhysicalBound;
6270
//!
6371
m.add_bits<FiniteStrainBehaviourOptions::StressMeasure>(
@@ -89,20 +97,22 @@ void declareBehaviour(jlcxx::Module &m) {
8997
[](const FiniteStrainBehaviourOptions &o) noexcept {
9098
return o.stress_measure;
9199
})
92-
.method("set_stress_measure!",
93-
[](FiniteStrainBehaviourOptions &o,
94-
const FiniteStrainBehaviourOptions::StressMeasure &s) noexcept {
95-
o.stress_measure = s;
96-
})
100+
.method(
101+
"set_stress_measure!",
102+
[](FiniteStrainBehaviourOptions &o,
103+
const FiniteStrainBehaviourOptions::StressMeasure &s) noexcept {
104+
o.stress_measure = s;
105+
})
97106
.method("get_tangent_operator",
98107
[](const FiniteStrainBehaviourOptions &o) noexcept {
99108
return o.tangent_operator;
100109
})
101-
.method("set_tangent_operator!",
102-
[](FiniteStrainBehaviourOptions &o,
103-
const FiniteStrainBehaviourOptions::TangentOperator &to) noexcept {
104-
o.tangent_operator = to;
105-
});
110+
.method(
111+
"set_tangent_operator!",
112+
[](FiniteStrainBehaviourOptions &o,
113+
const FiniteStrainBehaviourOptions::TangentOperator &to) noexcept {
114+
o.tangent_operator = to;
115+
});
106116
//
107117
m.add_bits<Behaviour::BehaviourType>("BehaviourType");
108118
m.set_const("GENERALBEHAVIOUR", Behaviour::GENERALBEHAVIOUR);
@@ -135,16 +145,24 @@ void declareBehaviour(jlcxx::Module &m) {
135145
Behaviour::FINITESTRAINKINEMATIC_F_CAUCHY);
136146
//
137147
m.add_type<Behaviour>("Behaviour")
138-
.method("get_library", [](const Behaviour &b) noexcept { return b.library; })
139-
.method("get_behaviour", [](const Behaviour &b) noexcept { return b.behaviour; })
140-
.method("get_hypothesis", [](const Behaviour &b) noexcept { return b.hypothesis; })
141-
.method("get_function", [](const Behaviour &b) noexcept { return b.function; })
142-
.method("get_source", [](const Behaviour &b) noexcept { return b.source; })
148+
.method("get_library",
149+
[](const Behaviour &b) noexcept { return b.library; })
150+
.method("get_behaviour",
151+
[](const Behaviour &b) noexcept { return b.behaviour; })
152+
.method("get_hypothesis",
153+
[](const Behaviour &b) noexcept { return b.hypothesis; })
154+
.method("get_function",
155+
[](const Behaviour &b) noexcept { return b.function; })
156+
.method("get_source",
157+
[](const Behaviour &b) noexcept { return b.source; })
143158
.method("get_tfel_version",
144159
[](const Behaviour &b) noexcept { return b.tfel_version; })
145-
.method("get_behaviour_type", [](const Behaviour &b) noexcept { return b.btype; })
146-
.method("get_symmetry", [](const Behaviour &b) noexcept { return b.symmetry; })
147-
.method("get_kinematic", [](const Behaviour &b) noexcept { return b.kinematic; })
160+
.method("get_behaviour_type",
161+
[](const Behaviour &b) noexcept { return b.btype; })
162+
.method("get_symmetry",
163+
[](const Behaviour &b) noexcept { return b.symmetry; })
164+
.method("get_kinematic",
165+
[](const Behaviour &b) noexcept { return b.kinematic; })
148166
.method("get_material_properties",
149167
[](const Behaviour &b) { return b.mps; })
150168
.method("get_internal_state_variables",

bindings/julia/src/BehaviourData.cxx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,30 @@ void declareBehaviourData(jlcxx::Module& m) {
3030
.method("set_time_increment!",
3131
[](BehaviourData& d, const mgis::real v) noexcept { d.dt = v; })
3232
.method("get_tangent_operator",
33-
[](BehaviourData& d) noexcept -> std::vector<mgis::real>& { return d.K; })
33+
[](BehaviourData& d) noexcept -> std::vector<mgis::real>& {
34+
return d.K;
35+
})
3436
.method("set_tangent_operator!",
3537
[](BehaviourData& d, const jlcxx::ArrayRef<mgis::real>& a) {
3638
mgis::julia::assign(d.K, a);
3739
})
3840
.method("get_time_increment_increase_factor",
3941
[](BehaviourData& d) noexcept -> mgis::real& { return d.rdt; })
4042
.method("set_time_increment_increase_factor!",
41-
[](BehaviourData& d, const mgis::real& v) noexcept -> void { d.rdt = v; })
42-
.method("get_s0", [](BehaviourData& d) noexcept -> State& { return d.s0; })
43-
.method("get_s1", [](BehaviourData& d) noexcept -> State& { return d.s1; })
43+
[](BehaviourData& d, const mgis::real& v) noexcept -> void {
44+
d.rdt = v;
45+
})
46+
.method("get_s0",
47+
[](BehaviourData& d) noexcept -> State& { return d.s0; })
48+
.method("get_s1",
49+
[](BehaviourData& d) noexcept -> State& { return d.s1; })
4450
.method("get_initial_state",
4551
[](BehaviourData& d) noexcept -> State& { return d.s0; })
4652
.method("get_final_state",
4753
[](BehaviourData& d) noexcept -> State& { return d.s1; })
48-
.method("update", [](BehaviourData& d) { update(d); })
49-
.method("revert", [](BehaviourData& d) { revert(d); })
50-
.method("make_view", [](BehaviourData& d) -> BehaviourDataView {
51-
return make_view(d);})
52-
;
54+
.method("update", [](BehaviourData& d) { update(d); })
55+
.method("revert", [](BehaviourData& d) { revert(d); })
56+
.method("make_view", [](BehaviourData& d) -> BehaviourDataView {
57+
return make_view(d);
58+
});
5359
} // end of declareBehaviourData

bindings/julia/src/State.cxx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,22 @@ void declareState(jlcxx::Module& m) {
2323
using mgis::behaviour::State;
2424
m.add_type<State>("State")
2525
.constructor<const Behaviour&>()
26-
.method("set_stored_energy!",
27-
[](State& s, const mgis::real v) noexcept { s.stored_energy = v; })
26+
.method(
27+
"set_stored_energy!",
28+
[](State& s, const mgis::real v) noexcept { s.stored_energy = v; })
2829
.method("get_stored_energy",
2930
[](State& s) noexcept -> mgis::real& { return s.stored_energy; })
3031
.method("set_dissipated_energy!",
31-
[](State& s, const mgis::real v) noexcept { s.dissipated_energy = v; })
32-
.method("get_dissipated_energy",
33-
[](State& s) noexcept -> mgis::real& { return s.dissipated_energy; })
32+
[](State& s, const mgis::real v) noexcept {
33+
s.dissipated_energy = v;
34+
})
35+
.method(
36+
"get_dissipated_energy",
37+
[](State& s) noexcept -> mgis::real& { return s.dissipated_energy; })
3438
.method("get_gradients",
35-
[](State& s) noexcept -> std::vector<mgis::real>& { return s.gradients; })
39+
[](State& s) noexcept -> std::vector<mgis::real>& {
40+
return s.gradients;
41+
})
3642
.method("set_gradients!",
3743
[](State& s, const jlcxx::ArrayRef<mgis::real>& a) {
3844
mgis::julia::assign(s.gradients, a);

bindings/python/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ endif(MGIS_APPEND_SUFFIX)
1919

2020
add_subdirectory(src)
2121
add_subdirectory(mgis)
22-
if(MGIS_HAVE_TFEL)
22+
if(MGIS_HAVE_MFRONT_SUPPORT)
2323
add_subdirectory(tests)
24-
endif(MGIS_HAVE_TFEL)
24+
endif(MGIS_HAVE_MFRONT_SUPPORT)

0 commit comments

Comments
 (0)