Maj terminée. Pour consulter la release notes associée voici le lien :
https://about.gitlab.com/releases/2021/07/07/critical-security-release-gitlab-14-0-4-released/

Commit 864d2654 authored by DIAZ Jerome's avatar DIAZ Jerome Committed by GILLES Sebastien
Browse files

#20

- Switch from an assert for the test to an exception at run time, handle by a singleton which is initiliazed from a value read in the input file.
- Make the field related to the check for inverted elements optional (some tests and models do not require it) and modify testing suite accordingly for the tests for which this option is relevant.

Integrator note: I merged here two commits, as the first one alone didn't compile.
parent ca2d92f8
......@@ -856,6 +856,7 @@
BE6341F0236A363B00028688 /* CheckInvertedElements.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE6341EC236A363A00028688 /* CheckInvertedElements.hxx */; };
BE6341F1236A363B00028688 /* EnumInvertedElements.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE6341ED236A363A00028688 /* EnumInvertedElements.hpp */; };
BE6341F2236A363B00028688 /* CheckInvertedElements.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE6341EE236A363A00028688 /* CheckInvertedElements.cpp */; };
BE6341F4236A38CE00028688 /* CheckInvertedElements.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE6341F3236A38CD00028688 /* CheckInvertedElements.cpp */; };
BE63B4131F4F165700F03800 /* Factory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE63B4101F4F165700F03800 /* Factory.cpp */; };
BE63B4141F4F165700F03800 /* Factory.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE63B4111F4F165700F03800 /* Factory.hpp */; };
BE63B4151F4F165700F03800 /* Factory.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE63B4121F4F165700F03800 /* Factory.hxx */; };
......@@ -3637,6 +3638,7 @@
BE6341EC236A363A00028688 /* CheckInvertedElements.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CheckInvertedElements.hxx; sourceTree = "<group>"; };
BE6341ED236A363A00028688 /* EnumInvertedElements.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = EnumInvertedElements.hpp; sourceTree = "<group>"; };
BE6341EE236A363A00028688 /* CheckInvertedElements.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CheckInvertedElements.cpp; sourceTree = "<group>"; };
BE6341F3236A38CD00028688 /* CheckInvertedElements.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CheckInvertedElements.cpp; sourceTree = "<group>"; };
BE63B4101F4F165700F03800 /* Factory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Factory.cpp; sourceTree = "<group>"; };
BE63B4111F4F165700F03800 /* Factory.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Factory.hpp; sourceTree = "<group>"; };
BE63B4121F4F165700F03800 /* Factory.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Factory.hxx; sourceTree = "<group>"; };
......@@ -7052,6 +7054,7 @@
BE6341E9236A361300028688 /* PlaneStressStrain.cpp */,
BE4D0CD121A2E4F900E0D4E7 /* Kappa1.cpp */,
BE4D0CD021A2E4F900E0D4E7 /* Kappa2.cpp */,
BE6341F3236A38CD00028688 /* CheckInvertedElements.cpp */,
);
path = Solid;
sourceTree = "<group>";
......@@ -12019,6 +12022,7 @@
BE3D3ABC22F1BDA300E7794E /* GracefulExit.cpp in Sources */,
BE4D0D5F21A2E4F900E0D4E7 /* Solid.cpp in Sources */,
BE7E553B22EF2D0000BEA053 /* Parallelism.cpp in Sources */,
BE6341F4236A38CE00028688 /* CheckInvertedElements.cpp in Sources */,
BE4D0D7C21A2E4F900E0D4E7 /* LightweightDomainList.cpp in Sources */,
BE4D0D7E21A2E4F900E0D4E7 /* Domain.cpp in Sources */,
BE4D0D1C21A2E4F900E0D4E7 /* ReactionCoefficient.cpp in Sources */,
......@@ -62,6 +62,10 @@
<CommandLineArguments>
<CommandLineArgument
argument = "-i ${HOME}/Codes/MoReFEM/CoreLibrary/Sources/ModelInstances/Hyperelasticity/demo_input_hyperelasticity.lua"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "-i ${HOME}/Codes/MoReFEM/CoreLibrary/Sources/ModelInstances/Hyperelasticity/demo_test.lua"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
......
......@@ -40,7 +40,7 @@
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
......
//
// CheckInvertedElements.cpp
// MoReFEM
//
// Created by Jerôme Diaz on 17/10/2019.
// Copyright © 2019 Inria. All rights reserved.
//
#include "Core/InputData/Instances/Parameter/Solid/Solid.hpp"
namespace MoReFEM
{
namespace InputDataNS
{
const std::string& Solid::CheckInvertedElements::NameInFile()
{
static std::string ret("CheckInvertedElements");
return ret;
}
const std::string& Solid::CheckInvertedElements::Description()
{
static std::string ret("If the displacement induced by the applied loading is strong enough"
"it can lead to inverted elements: some vertices of the element are moved"
"such that the volume of the finite element becomes negative. This means"
"that the resulting deformed mesh is no longer valid. This parameter enables a"
"computationally expensive test on all quadrature points to check that the volume"
"of all finite elements remains positive throughout the computation.");
return ret;
}
const std::string& Solid::CheckInvertedElements::Constraint()
{
return Utilities::EmptyString();
}
const std::string& Solid::CheckInvertedElements::DefaultValue()
{
static std::string ret("false");
return ret;
}
} // namespace InputDataNS
} // namespace MoReFEM
/// @} // addtogroup CoreGroup
......@@ -1067,6 +1067,49 @@ namespace MoReFEM
static const std::string& DefaultValue();
};
//! Holds information related to the input parameter Solid::CheckInvertedElements.
struct CheckInvertedElements : public Crtp::InputData<CheckInvertedElements, self, bool>
{
//! Name of the input parameter in Lua input file.
static const std::string& NameInFile();
//! Description of the input parameter.
static const std::string& Description();
/*!
* \return Constraint to fulfill.
*
* Might be left empty; if not the format to respect is the \a LuaOptionFile one. Hereafter some text from \a LuaOptionFile example file:
*
* An age should be greater than 0 and less than, say, 150. It is possible
* to check it with a logical expression (written in Lua). The expression
* should be written with 'v' being the variable to be checked.
* \a constraint = "v >= 0 and v < 150"
*
* It is possible to check whether a variable is in a set of acceptable
* value. This is performed with 'value_in' (a Lua function defined by \a LuaOptionFile).
* \a constraint = "value_in(v, {'Messiah', 'Water Music'})"
*
* If a vector is retrieved, the constraint must be satisfied on every
* element of the vector.
*/
static const std::string& Constraint();
/*!
* \return Default value.
*
* This is intended to be used only when the class is used to create a default file; never when no value has been given
* in the input data file (doing so is too much error prone...)
*
* This is given as a string; if no default value return an empty string. The value must be \a LuaOptionFile-formatted.
*/
static const std::string& DefaultValue();
};
//! Alias to the tuple of structs.
using section_content_type = std::tuple
......@@ -1088,7 +1131,8 @@ namespace MoReFEM
C2,
C3,
C4,
C5
C5,
CheckInvertedElements
>;
......
......@@ -11,6 +11,7 @@ target_sources(${MOREFEM_CORE}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/C_i_Mu_i.cpp"
"${CMAKE_CURRENT_LIST_DIR}/CheckInvertedElements.cpp"
"${CMAKE_CURRENT_LIST_DIR}/HyperelasticBulk.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Kappa1.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Kappa2.cpp"
......
......@@ -34,6 +34,8 @@
# include "Core/MoReFEMData/Internal/Parallelism.hpp"
# include "Core/MoReFEMData/Internal/Helper.hpp"
# include "Core/InputData/Instances/Parameter/Solid/Solid.hpp"
# include "FiniteElement/FiniteElementSpace/Internal/CheckInvertedElements.hpp"
namespace MoReFEM
{
......
......@@ -98,6 +98,15 @@ namespace MoReFEM
const auto& binary_output = ipl::Extract<Result::BinaryOutput>::Value(*input_data_);
Utilities::OutputFormat::CreateOrGetInstance(__FILE__, __LINE__, binary_output);
if constexpr (InputDataT::template Find<InputDataNS::Solid::CheckInvertedElements>())
{
const auto& do_check_inverted_elements = ipl::Extract<InputDataNS::Solid::CheckInvertedElements>
::Value(*input_data_);
MoReFEM::Internal::FEltSpaceNS::CheckInvertedElements
::CreateOrGetInstance(__FILE__, __LINE__, do_check_inverted_elements);
}
}
catch(const ExceptionNS::GracefulExit& e)
{
......
......@@ -9,5 +9,16 @@
#ifndef MOREFEM_x_FINITE_ELEMENT_x_FINITE_ELEMENT_SPACE_x_INTERNAL_x_CHECK_INVERTED_ELEMENTS_HXX_
# define MOREFEM_x_FINITE_ELEMENT_x_FINITE_ELEMENT_SPACE_x_INTERNAL_x_CHECK_INVERTED_ELEMENTS_HXX_
namespace MoReFEM::Internal::FEltSpaceNS
{
inline check_inverted_elements_policy CheckInvertedElements::DoCheckInvertedElements() const noexcept
{
return check_inverted_elements_policy_;
}
} // namepsace MoReFEM::Internal::FEltSpaceNS
#endif // MOREFEM_x_FINITE_ELEMENT_x_FINITE_ELEMENT_SPACE_x_INTERNAL_x_CHECK_INVERTED_ELEMENTS_HXX_
......@@ -121,6 +121,7 @@ namespace MoReFEM
InputDataNS::Solid::HyperelasticBulk,
InputDataNS::Solid::Kappa1,
InputDataNS::Solid::Kappa2,
InputDataNS::Solid::CheckInvertedElements,
InputDataNS::Parallelism,
InputDataNS::Result
......
......@@ -516,6 +516,13 @@ Solid = {
}, -- Kappa2
-- If the displacement induced by the applied loading is strong enough it can lead to inverted elements:
-- some vertices of the element are moved such that the volume of the finite element becomes negative.
-- This means that the resulting deformed mesh is no longer valid.
-- This parameter enables a computationally expensive test on all quadrature points to check that the volume
-- of all finite elements remains positive throughout the computation.
CheckInvertedElements = false
} -- Solid
......
-- Comment lines are introduced by "--".
-- In a section (i.e. within braces), all entries must be separated by a comma.
transient = {
-- Time at the beginning of the code (in seconds).
-- Expected format: VALUE
-- Constraint: v >= 0.
init_time = 0.,
-- Time step between two iterations, in seconds.
-- Expected format: VALUE
-- Constraint: v > 0.
timeStep = 0.1,
-- Maximum time, if set to zero run a static case.
-- Expected format: VALUE
-- Constraint: v >= 0.
timeMax = No default value was provided!
} -- transient
NumberingSubset1 = {
-- Name of the numbering subset (not really used; at the moment I just need one input parameter to ground
-- the possible values to choose elsewhere).
-- Expected format: "VALUE"
name = No default value was provided!,
-- Whether a vector defined on this numbering subset might be used to compute a movemesh. If true, a
-- FEltSpace featuring this numbering subset will compute additional quantities to enable fast computation.
-- This should be false for most numbering subsets, and when it's true the sole unknown involved should be a
-- displacement.
-- Expected format: 'true' or 'false' (without the quote)
do_move_mesh = false
} -- NumberingSubset1
Unknown1 = {
-- Name of the unknown (used for displays in output).
-- Expected format: "VALUE"
name = No default value was provided!,
-- Index of the god of dof into which the finite element space is defined.
-- Expected format: "VALUE"
-- Constraint: value_in(v, {'scalar', 'vectorial'})
nature = No default value was provided!
} -- Unknown1
Mesh1 = {
-- Path of the mesh file to use.
-- Expected format: "VALUE"
mesh = No default value was provided!,
-- Format of the input mesh.
-- Expected format: "VALUE"
-- Constraint: value_in(v, {'Ensight', 'Medit'})
format = "Medit",
-- Highest dimension of the input mesh. This dimension might be lower than the one effectively read in the
-- mesh file; in which case Coords will be reduced provided all the dropped values are 0. If not, an
-- exception is thrown.
-- Expected format: VALUE
-- Constraint: v <= 3 and v > 0
dimension = No default value was provided!,
-- Space unit of the mesh.
-- Expected format: VALUE
space_unit = 1.
} -- Mesh1
Domain1 = {
-- Index of the geometric mesh upon which the domain is defined (as defined in the present file). Might be
-- left empty if domain not limited to one mesh; at most one value is expected here.
-- Expected format: { VALUE1, VALUE2, ...}
mesh_index = No default value was provided!,
-- List of dimensions encompassed by the domain. Might be left empty if no restriction at all upon
-- dimensions.
-- Expected format: { VALUE1, VALUE2, ...}
-- Constraint: value_in(v, {0, 1, 2, 3})
dimension_list = No default value was provided!,
-- List of mesh labels encompassed by the domain. Might be left empty if no restriction at all upon mesh
-- labels. This parameter does not make sense if no mesh is defined for the domain.
-- Expected format: { VALUE1, VALUE2, ...}
mesh_label_list = No default value was provided!,
-- List of geometric element types considered in the domain. Might be left empty if no restriction upon
-- these. No constraint is applied at  LuaOptionFile level, as some geometric element types could be added
-- after generation of current input data file. Current list is below; if an incorrect value is put there it
-- will be detected a bit later when the domain object is built.
-- The known types when this file was generated are:
-- . Point1
-- . Segment2, Segment3
-- . Triangle3, Triangle6
-- . Quadrangle4, Quadrangle8, Quadrangle9
-- . Tetrahedron4, Tetrahedron10
-- . Hexahedron8, Hexahedron20, Hexahedron27.
-- Expected format: {"VALUE1", "VALUE2", ...}
geometric_element_type_list = No default value was provided!
} -- Domain1
Domain2 = {
-- Index of the geometric mesh upon which the domain is defined (as defined in the present file). Might be
-- left empty if domain not limited to one mesh; at most one value is expected here.
-- Expected format: { VALUE1, VALUE2, ...}
mesh_index = No default value was provided!,
-- List of dimensions encompassed by the domain. Might be left empty if no restriction at all upon
-- dimensions.
-- Expected format: { VALUE1, VALUE2, ...}
-- Constraint: value_in(v, {0, 1, 2, 3})
dimension_list = No default value was provided!,
-- List of mesh labels encompassed by the domain. Might be left empty if no restriction at all upon mesh
-- labels. This parameter does not make sense if no mesh is defined for the domain.
-- Expected format: { VALUE1, VALUE2, ...}
mesh_label_list = No default value was provided!,
-- List of geometric element types considered in the domain. Might be left empty if no restriction upon
-- these. No constraint is applied at  LuaOptionFile level, as some geometric element types could be added
-- after generation of current input data file. Current list is below; if an incorrect value is put there it
-- will be detected a bit later when the domain object is built.
-- The known types when this file was generated are:
-- . Point1
-- . Segment2, Segment3
-- . Triangle3, Triangle6
-- . Quadrangle4, Quadrangle8, Quadrangle9
-- . Tetrahedron4, Tetrahedron10
-- . Hexahedron8, Hexahedron20, Hexahedron27.
-- Expected format: {"VALUE1", "VALUE2", ...}
geometric_element_type_list = No default value was provided!
} -- Domain2
Domain3 = {
-- Index of the geometric mesh upon which the domain is defined (as defined in the present file). Might be
-- left empty if domain not limited to one mesh; at most one value is expected here.
-- Expected format: { VALUE1, VALUE2, ...}
mesh_index = No default value was provided!,
-- List of dimensions encompassed by the domain. Might be left empty if no restriction at all upon
-- dimensions.
-- Expected format: { VALUE1, VALUE2, ...}
-- Constraint: value_in(v, {0, 1, 2, 3})
dimension_list = No default value was provided!,
-- List of mesh labels encompassed by the domain. Might be left empty if no restriction at all upon mesh
-- labels. This parameter does not make sense if no mesh is defined for the domain.
-- Expected format: { VALUE1, VALUE2, ...}
mesh_label_list = No default value was provided!,
-- List of geometric element types considered in the domain. Might be left empty if no restriction upon
-- these. No constraint is applied at  LuaOptionFile level, as some geometric element types could be added
-- after generation of current input data file. Current list is below; if an incorrect value is put there it
-- will be detected a bit later when the domain object is built.
-- The known types when this file was generated are:
-- . Point1
-- . Segment2, Segment3
-- . Triangle3, Triangle6
-- . Quadrangle4, Quadrangle8, Quadrangle9
-- . Tetrahedron4, Tetrahedron10
-- . Hexahedron8, Hexahedron20, Hexahedron27.
-- Expected format: {"VALUE1", "VALUE2", ...}
geometric_element_type_list = No default value was provided!
} -- Domain3
Domain4 = {
-- Index of the geometric mesh upon which the domain is defined (as defined in the present file). Might be
-- left empty if domain not limited to one mesh; at most one value is expected here.
-- Expected format: { VALUE1, VALUE2, ...}
mesh_index = No default value was provided!,
-- List of dimensions encompassed by the domain. Might be left empty if no restriction at all upon
-- dimensions.
-- Expected format: { VALUE1, VALUE2, ...}
-- Constraint: value_in(v, {0, 1, 2, 3})
dimension_list = No default value was provided!,
-- List of mesh labels encompassed by the domain. Might be left empty if no restriction at all upon mesh
-- labels. This parameter does not make sense if no mesh is defined for the domain.
-- Expected format: { VALUE1, VALUE2, ...}
mesh_label_list = No default value was provided!,
-- List of geometric element types considered in the domain. Might be left empty if no restriction upon
-- these. No constraint is applied at  LuaOptionFile level, as some geometric element types could be added
-- after generation of current input data file. Current list is below; if an incorrect value is put there it
-- will be detected a bit later when the domain object is built.
-- The known types when this file was generated are:
-- . Point1
-- . Segment2, Segment3
-- . Triangle3, Triangle6
-- . Quadrangle4, Quadrangle8, Quadrangle9
-- . Tetrahedron4, Tetrahedron10
-- . Hexahedron8, Hexahedron20, Hexahedron27.
-- Expected format: {"VALUE1", "VALUE2", ...}
geometric_element_type_list = No default value was provided!
} -- Domain4
EssentialBoundaryCondition1 = {
-- Name of the boundary condition (must be unique).
-- Expected format: "VALUE"
name = No default value was provided!,
-- Comp1, Comp2 or Comp3
-- Expected format: "VALUE"
-- Constraint: value_in(v, {'Comp1', 'Comp2', 'Comp3', 'Comp12', 'Comp23', 'Comp13', 'Comp123'})
component = No default value was provided!,
-- Name of the unknown addressed by the boundary condition.
-- Expected format: "VALUE"
unknown = No default value was provided!,
-- Values at each of the relevant component.
-- Expected format: { VALUE1, VALUE2, ...}
value = No default value was provided!,
-- Index of the domain onto which essential boundary condition is defined.
-- Expected format: VALUE
domain_index = No default value was provided!,
-- Whether the values of the boundary condition may vary over time.
-- Expected format: 'true' or 'false' (without the quote)
is_mutable = false,
-- Whether a dof of this boundary condition may also belong to another one. This highlights an ill-defined
-- model in most cases, but I nonetheless need it for FSI/ALE.
-- Expected format: 'true' or 'false' (without the quote)
may_overlap = false
} -- EssentialBoundaryCondition1
FiniteElementSpace1 = {
-- Index of the god of dof into which the finite element space is defined.
-- Expected format: VALUE
god_of_dof_index = No default value was provided!,
-- Index of the domain onto which the finite element space is defined. This domain must be unidimensional.
-- Expected format: VALUE
domain_index = No default value was provided!,
-- List of all unknowns defined in the finite element space. Unknowns here must be defined in this file as
-- an 'Unknown' block; expected name/identifier is the name given there.
-- Expected format: {"VALUE1", "VALUE2", ...}
unknown_list = No default value was provided!,
-- List of the shape function to use for each unknown;
-- Expected format: {"VALUE1", "VALUE2", ...}
shape_function_list = No default value was provided!,
-- List of the numbering subset to use for each unknown;
-- Expected format: { VALUE1, VALUE2, ...}
numbering_subset_list = No default value was provided!
} -- FiniteElementSpace1
FiniteElementSpace2 = {
-- Index of the god of dof into which the finite element space is defined.
-- Expected format: VALUE
god_of_dof_index = No default value was provided!,
-- Index of the domain onto which the finite element space is defined. This domain must be unidimensional.
-- Expected format: VALUE
domain_index = No default value was provided!,
-- List of all unknowns defined in the finite element space. Unknowns here must be defined in this file as
-- an 'Unknown' block; expected name/identifier is the name given there.
-- Expected format: {"VALUE1", "VALUE2", ...}
unknown_list = No default value was provided!,
-- List of the shape function to use for each unknown;
-- Expected format: {"VALUE1", "VALUE2", ...}
shape_function_list = No default value was provided!,
-- List of the numbering subset to use for each unknown;
-- Expected format: { VALUE1, VALUE2, ...}
numbering_subset_list = No default value was provided!
} -- FiniteElementSpace2
Petsc1 = {
-- Absolute tolerance
-- Expected format: VALUE
-- Constraint: v > 0.
absoluteTolerance = 1e-50,
-- gmresStart
-- Expected format: VALUE
-- Constraint: v >= 0