Commit fd16f808 authored by GILLES Sebastien's avatar GILLES Sebastien

#1465 Utilities: reorganize a bit the files related to InputData.

parent 69bf24e1
......@@ -443,8 +443,6 @@
BE1D44AC22560BF000911391 /* Mpi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE1D44A822560BF000911391 /* Mpi.cpp */; };
BE1D44AF22560CD100911391 /* Environment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE1D44AE22560CD100911391 /* Environment.cpp */; };
BE1D44B122560CE100911391 /* Environment.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE1D44B022560CE100911391 /* Environment.hpp */; };
BE1E873D1B8DBF460002EE64 /* Definitions.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE1E873C1B8DBF460002EE64 /* Definitions.hpp */; };
BE1E87401B8DBF670002EE64 /* Definitions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE1E873E1B8DBF670002EE64 /* Definitions.cpp */; };
BE1EBB021CA0961000EC0EAA /* InputData.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE1EBB011CA0961000EC0EAA /* InputData.hpp */; };
BE2195191DF813290014FE44 /* Libmesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE9FE80918CE0A6900177F79 /* Libmesh.cpp */; };
BE2433A91CD0E701008175D1 /* EnumTopology.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE2433A81CD0E701008175D1 /* EnumTopology.cpp */; };
......@@ -527,6 +525,10 @@
BE3221911B4686C100F27D6C /* FElt.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE32218E1B4686C100F27D6C /* FElt.hxx */; };
BE32927D1A44702C009F0BE2 /* Exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE32927A1A44702C009F0BE2 /* Exception.cpp */; };
BE32927E1A44702C009F0BE2 /* Exception.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE32927B1A44702C009F0BE2 /* Exception.hpp */; };
BE353B9A22E7527100A06A8F /* Extract.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE353B9722E7527100A06A8F /* Extract.hxx */; };
BE353B9B22E7527100A06A8F /* Extract.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE353B9822E7527100A06A8F /* Extract.hpp */; };
BE353B9F22E7539E00A06A8F /* Enum.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE353B9C22E7539E00A06A8F /* Enum.cpp */; };
BE353BA122E7539E00A06A8F /* Enum.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE353B9E22E7539E00A06A8F /* Enum.hpp */; };
BE3AB281183503C7009E1B76 /* libCore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BE05B52916D238FE000E248D /* libCore.a */; };
BE3AB283183503C7009E1B76 /* libFiniteElement.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BE9C4D121807F5DC005B94BC /* libFiniteElement.a */; };
BE3AB284183503C7009E1B76 /* libGeometry.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BE05B4DD16D23573000E248D /* libGeometry.a */; };
......@@ -874,8 +876,8 @@
BE53FC161E0D7C6800C5D6F5 /* TupleIteration.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE53FC121E0D7C6800C5D6F5 /* TupleIteration.hxx */; };
BE53FC191E0D7D5800C5D6F5 /* TupleItem.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE53FC171E0D7D5800C5D6F5 /* TupleItem.hpp */; };
BE53FC1A1E0D7D5800C5D6F5 /* TupleItem.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE53FC181E0D7D5800C5D6F5 /* TupleItem.hxx */; };
BE53FC1E1E0D7F0500C5D6F5 /* PrepareDefaultEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE53FC1B1E0D7F0500C5D6F5 /* PrepareDefaultEntry.cpp */; };
BE53FC1F1E0D7F0500C5D6F5 /* PrepareDefaultEntry.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE53FC1C1E0D7F0500C5D6F5 /* PrepareDefaultEntry.hpp */; };
BE53FC1E1E0D7F0500C5D6F5 /* Print.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE53FC1B1E0D7F0500C5D6F5 /* Print.cpp */; };
BE53FC1F1E0D7F0500C5D6F5 /* Print.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE53FC1C1E0D7F0500C5D6F5 /* Print.hpp */; };
BE53FC251E0D81A000C5D6F5 /* Traits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE53FC221E0D81A000C5D6F5 /* Traits.cpp */; };
BE53FC261E0D81A000C5D6F5 /* Traits.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE53FC231E0D81A000C5D6F5 /* Traits.hpp */; };
BE53FC271E0D81A000C5D6F5 /* Traits.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE53FC241E0D81A000C5D6F5 /* Traits.hxx */; };
......@@ -3320,8 +3322,6 @@
BE1D44B022560CE100911391 /* Environment.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Environment.hpp; sourceTree = "<group>"; };
BE1D44BF225B906600911391 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
BE1D44C0225B907000911391 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
BE1E873C1B8DBF460002EE64 /* Definitions.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Definitions.hpp; sourceTree = "<group>"; };
BE1E873E1B8DBF670002EE64 /* Definitions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Definitions.cpp; sourceTree = "<group>"; };
BE1EBAFD1CA0957300EC0EAA /* main_test_coloring.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main_test_coloring.cpp; path = Coloring/main_test_coloring.cpp; sourceTree = "<group>"; };
BE1EBB011CA0961000EC0EAA /* InputData.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = InputData.hpp; path = Coloring/InputData.hpp; sourceTree = "<group>"; };
BE1EBB0F1CA0A59600EC0EAA /* Model.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Model.cpp; path = Coloring/Model.cpp; sourceTree = "<group>"; };
......@@ -3414,6 +3414,10 @@
BE32927A1A44702C009F0BE2 /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = Exception.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
BE32927B1A44702C009F0BE2 /* Exception.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Exception.hpp; sourceTree = "<group>"; };
BE32FE221EC259420052F4AD /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README; path = RivlinCube/README; sourceTree = "<group>"; };
BE353B9722E7527100A06A8F /* Extract.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Extract.hxx; sourceTree = "<group>"; };
BE353B9822E7527100A06A8F /* Extract.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Extract.hpp; sourceTree = "<group>"; };
BE353B9C22E7539E00A06A8F /* Enum.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Enum.cpp; sourceTree = "<group>"; };
BE353B9E22E7539E00A06A8F /* Enum.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Enum.hpp; sourceTree = "<group>"; };
BE372DDB18C4802900127212 /* main_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main_test.cpp; sourceTree = "<group>"; };
BE37EFEB1CB308340006C0AD /* FiniteElement.doxygen */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = FiniteElement.doxygen; sourceTree = "<group>"; };
BE390F142108C9BD0049CD3B /* test_input_data.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = test_input_data.cpp; sourceTree = "<group>"; };
......@@ -3830,8 +3834,8 @@
BE53FC121E0D7C6800C5D6F5 /* TupleIteration.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TupleIteration.hxx; sourceTree = "<group>"; };
BE53FC171E0D7D5800C5D6F5 /* TupleItem.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TupleItem.hpp; sourceTree = "<group>"; };
BE53FC181E0D7D5800C5D6F5 /* TupleItem.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TupleItem.hxx; sourceTree = "<group>"; };
BE53FC1B1E0D7F0500C5D6F5 /* PrepareDefaultEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrepareDefaultEntry.cpp; sourceTree = "<group>"; };
BE53FC1C1E0D7F0500C5D6F5 /* PrepareDefaultEntry.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = PrepareDefaultEntry.hpp; sourceTree = "<group>"; };
BE53FC1B1E0D7F0500C5D6F5 /* Print.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Print.cpp; sourceTree = "<group>"; };
BE53FC1C1E0D7F0500C5D6F5 /* Print.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Print.hpp; sourceTree = "<group>"; };
BE53FC221E0D81A000C5D6F5 /* Traits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Traits.cpp; sourceTree = "<group>"; };
BE53FC231E0D81A000C5D6F5 /* Traits.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Traits.hpp; sourceTree = "<group>"; };
BE53FC241E0D81A000C5D6F5 /* Traits.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Traits.hxx; sourceTree = "<group>"; };
......@@ -7296,24 +7300,24 @@
BE4D0C5821A2E4F800E0D4E7 /* Instances */ = {
isa = PBXGroup;
children = (
BE4D0CA121A2E4F900E0D4E7 /* InputData.doxygen */,
BE4D0C5921A2E4F800E0D4E7 /* SourceList.cmake */,
BE4D0C5A21A2E4F800E0D4E7 /* InitialConditionGate.hpp */,
BE4D0D0D21A2E4F900E0D4E7 /* TimeManager */,
BE4D0CF621A2E4F900E0D4E7 /* Geometry */,
BE4D0C5B21A2E4F800E0D4E7 /* InitialCondition */,
BE4D0C6321A2E4F800E0D4E7 /* Reaction */,
BE4D0CA221A2E4F900E0D4E7 /* Parameter */,
BE4D0C6E21A2E4F800E0D4E7 /* FElt */,
BE4D0C7E21A2E4F800E0D4E7 /* Interpolator */,
BE4D0C8621A2E4F800E0D4E7 /* Crtp */,
BE4D0C8B21A2E4F900E0D4E7 /* OutputDeformedMesh.hxx */,
BE4D0C8C21A2E4F900E0D4E7 /* Solver */,
BE4D0C9721A2E4F900E0D4E7 /* Result.hpp */,
BE4D0C9821A2E4F900E0D4E7 /* OutputDeformedMesh.hpp */,
BE4D0C9921A2E4F900E0D4E7 /* DirichletBoundaryCondition */,
BE4D0CA121A2E4F900E0D4E7 /* InputData.doxygen */,
BE4D0CA221A2E4F900E0D4E7 /* Parameter */,
BE4D0CF421A2E4F900E0D4E7 /* Result.cpp */,
BE4D0C9721A2E4F900E0D4E7 /* Result.hpp */,
BE4D0CF521A2E4F900E0D4E7 /* InitialConditionGate.cpp */,
BE4D0CF621A2E4F900E0D4E7 /* Geometry */,
BE4D0D0D21A2E4F900E0D4E7 /* TimeManager */,
BE4D0C5A21A2E4F800E0D4E7 /* InitialConditionGate.hpp */,
BE4D0C9821A2E4F900E0D4E7 /* OutputDeformedMesh.hpp */,
BE4D0C8B21A2E4F900E0D4E7 /* OutputDeformedMesh.hxx */,
);
path = Instances;
sourceTree = "<group>";
......@@ -7804,8 +7808,8 @@
children = (
BE53FC171E0D7D5800C5D6F5 /* TupleItem.hpp */,
BE53FC181E0D7D5800C5D6F5 /* TupleItem.hxx */,
BE53FC1B1E0D7F0500C5D6F5 /* PrepareDefaultEntry.cpp */,
BE53FC1C1E0D7F0500C5D6F5 /* PrepareDefaultEntry.hpp */,
BE53FC1B1E0D7F0500C5D6F5 /* Print.cpp */,
BE53FC1C1E0D7F0500C5D6F5 /* Print.hpp */,
);
path = Impl;
sourceTree = "<group>";
......@@ -9190,12 +9194,14 @@
BE9D3EA517CC7DBE0047D4F2 /* InputData */ = {
isa = PBXGroup;
children = (
BE1E873E1B8DBF670002EE64 /* Definitions.cpp */,
BE1E873C1B8DBF460002EE64 /* Definitions.hpp */,
BE353B9C22E7539E00A06A8F /* Enum.cpp */,
BE353B9E22E7539E00A06A8F /* Enum.hpp */,
BE9D3EAC17CC7E890047D4F2 /* Base.hpp */,
BE9D3EAD17CC7E890047D4F2 /* Base.hxx */,
BEA355D617D0971500FB643B /* LuaFunction.hpp */,
BEA355D717D0971500FB643B /* LuaFunction.hxx */,
BE353B9822E7527100A06A8F /* Extract.hpp */,
BE353B9722E7527100A06A8F /* Extract.hxx */,
BE768EBB1B835FFA009B24CB /* Crtp */,
BEB6424B17CF7A08001CEE44 /* Exceptions */,
BE53FC081E0D797500C5D6F5 /* Internal */,
......@@ -11334,6 +11340,7 @@
BE3FE9CB22C3D0D70093E95A /* LuaUtilityFunctions.hpp in Headers */,
BEC157F21A249C3D007D20EB /* Numeric.hpp in Headers */,
132BD2751C72136D008DDEE7 /* Solver.hxx in Headers */,
BE353BA122E7539E00A06A8F /* Enum.hpp in Headers */,
BE6E4EE31B2ABE8B0049BB2D /* AccessGhostContent.hxx in Headers */,
BE145A0C1E54BC49000A2BF5 /* UnlabeledMultiArg.h in Headers */,
BEC4F0F21DE2FD0C0093F397 /* UnorderedMap.hxx in Headers */,
......@@ -11355,7 +11362,7 @@
BE145A001E54BC49000A2BF5 /* CmdLineInterface.h in Headers */,
BE41A8CE1A24AA46004E4312 /* Mpi.hpp in Headers */,
BE90E1CF1A2492AA00CCAFDE /* PetscSys.hpp in Headers */,
BE53FC1F1E0D7F0500C5D6F5 /* PrepareDefaultEntry.hpp in Headers */,
BE53FC1F1E0D7F0500C5D6F5 /* Print.hpp in Headers */,
BE90E1AD1A24929A00CCAFDE /* MatrixPattern.hpp in Headers */,
BE83582B1FFD779E0009956E /* Sort.hpp in Headers */,
BE145A041E54BC49000A2BF5 /* HelpVisitor.h in Headers */,
......@@ -11368,7 +11375,6 @@
BE110E981E11513200D2D2C8 /* NonZeroPattern.hpp in Headers */,
BEDE16A8204F365600DEFE08 /* LuaOptionFile.hxx in Headers */,
BE145A051E54BC49000A2BF5 /* IgnoreRestVisitor.h in Headers */,
BE1E873D1B8DBF460002EE64 /* Definitions.hpp in Headers */,
BE41A8CA1A24AA46004E4312 /* Mpi.hpp in Headers */,
BE3D12C11D9B1FFB00F900F5 /* KspConvergenceReason.hxx in Headers */,
BE168EA41CC96DA00090AC88 /* Tetrahedron4.hxx in Headers */,
......@@ -11433,6 +11439,7 @@
BECB2E0D213FFBAC0093CB05 /* SnesMacro.hpp in Headers */,
BE3D12C01D9B1FFB00F900F5 /* KspConvergenceReason.hpp in Headers */,
BE8B5F8120778D1A00DC005E /* StringPair.hxx in Headers */,
BE353B9A22E7527100A06A8F /* Extract.hxx in Headers */,
BE5B6F8C1C3C16E9004A0284 /* MatrixOperations.hpp in Headers */,
BE168EA91CC96E020090AC88 /* Hexahedron27.hxx in Headers */,
BE3FE9CE22C3DEBE0093E95A /* LuaUtilityFunctions.hxx in Headers */,
......@@ -11461,6 +11468,7 @@
BE5AA42822E62C3A00A393DE /* RAII.hxx in Headers */,
BE145A0F1E54BC49000A2BF5 /* ValuesConstraint.h in Headers */,
BE5657421D3CD7470091F063 /* Array.hxx in Headers */,
BE353B9B22E7527100A06A8F /* Extract.hpp in Headers */,
BE6FFAD91A399E2200D048BD /* Numeric.hxx in Headers */,
BE90E1921A24929A00CCAFDE /* UniqueId.hpp in Headers */,
BE90E1C61A2492AA00CCAFDE /* SubVector_Base.hxx in Headers */,
......@@ -12735,6 +12743,7 @@
files = (
022CDB5622D4973B00504CF9 /* OutputFormat.cpp in Sources */,
BE5AA42722E62C3A00A393DE /* RAII.cpp in Sources */,
BE353B9F22E7539E00A06A8F /* Enum.cpp in Sources */,
BE90E1A71A24929A00CCAFDE /* Parmetis.cpp in Sources */,
BE8B5F8020778D1A00DC005E /* StringPair.cpp in Sources */,
BECEF92322DF4A4400D0DDE7 /* ReadBinaryFile.cpp in Sources */,
......@@ -12767,7 +12776,6 @@
BE90E1C01A2492AA00CCAFDE /* SeldonFunctions.cpp in Sources */,
BE90E1A01A24929A00CCAFDE /* Comm.cpp in Sources */,
BE3FE9C922C3D0D70093E95A /* LuaUtilityFunctions.cpp in Sources */,
BE1E87401B8DBF670002EE64 /* Definitions.cpp in Sources */,
BE6E4EE11B2ABE8B0049BB2D /* AccessGhostContent.cpp in Sources */,
BEDEB9251C3C073100B1C71B /* Mumps.cpp in Sources */,
BE90E1B21A24929A00CCAFDE /* AccessVectorContent.cpp in Sources */,
......@@ -12783,7 +12791,7 @@
BE90E1941A24929A00CCAFDE /* TimeKeep.cpp in Sources */,
BE90E1611A24926E00CCAFDE /* Exception.cpp in Sources */,
BE41A8C71A24AA35004E4312 /* Parmetis.cpp in Sources */,
BE53FC1E1E0D7F0500C5D6F5 /* PrepareDefaultEntry.cpp in Sources */,
BE53FC1E1E0D7F0500C5D6F5 /* Print.cpp in Sources */,
BE90E18E1A24929A00CCAFDE /* File.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
......@@ -31,6 +31,7 @@
# include "Utilities/String/String.hpp"
# include "Utilities/Environment/Environment.hpp"
# include "Utilities/LuaOptionFile/LuaOptionFile.hpp"
# include "Utilities/InputData/Extract.hpp"
# include "Utilities/InputData/Exceptions/InputData.hpp"
# include "Utilities/InputData/Internal/Subtuple/Subtuple.hpp"
# include "Utilities/InputData/Internal/TupleIteration/TupleIteration.hpp"
......@@ -51,34 +52,6 @@ namespace MoReFEM
{
/*!
* \brief An enum class that will basically act as a boolean.
*
* InputData::Base class takes into account which input parameters are actually used; the
* way to do so is to set a bit in a bitset when some methods are called. However, sometimes these
* methods might be called to some purposes that do not truly mean the input parameter is used.
*
* For instance, if we check at the beginning of the program that several input vectors are the same
* length it doesn't mean all of them are actually used, hence the following enum to be able to
* specify the method not to set the bit for this specific use.
*
*/
enum class CountAsUsed
{
no,
yes
};
//! Behaviour when the folder read in the input data file doesn't exist.
enum class UnexistentFolderPolicy
{
create,
throw_exception
};
/*!
* \brief Whether a field found in the file but not referenced in the tuple yields an exception or not.
*
......@@ -357,108 +330,6 @@ namespace MoReFEM
void CreateDefaultInputFile(const std::string& path);
/*!
* \brief A convenient helper to extract information from Base class.
*
* The problem with Base class is that the syntax is really hideous; for instance a derived class
* from base (named IPL for the example below) must use the following syntax to extract a value
* named Component:
*
* \code
* using Type = InputData::BoundaryCondition::Component;
* auto component_value = this->template ReadHelper<Type>();
* \endcode
*
* This template syntax is quite unusual and many C++ developers don't know it; so the helper class
* hids that and the same quantity may be extracted with:
* \code
* using Type = InputData::BoundaryCondition::Component;
* auto component_value = Extract<Type>::Value();
* \endcode
*
* This class can also be used to read Lua functions:
* \code
* decltype(auto) fct = Extract<InputData::Force::Surfacic>::Value(input_data);
* std::cout << "Value = " << fct(0, 1, 2, 3) << std::endl;
* \endcode
*/
template<class ObjectT>
struct Extract
{
//! Convenient alias over the return type.
using return_type = typename ObjectT::return_type;
/*!
* \brief Return the value of the input parameter.
*
* \tparam InputDataT The object which holds the information about input data file content.
* \tparam CountAsUsedT At the end of the program, we may sum up the input data that have not been
* used. A call to this method tally them as used unless 'no' is specified here.
* \copydoc doxygen_hide_input_data_arg
*
* \return Value of the input parameter.
*/
template<class InputDataT, CountAsUsed CountAsUsedT = CountAsUsed::yes>
static typename ConstRefOrValue<return_type>::type Value(const InputDataT& input_data);
/*!
* \brief Return a string that stands for a path; only additional operation is to replace environment
* variables by their value.
*
* For instance "${HOME}/Codes/MoReFEM" will be resolved on a Mac in /Users/ *username* /Codes/MoReFEM.
*
* \param[in] input_data Object which holds all relevant input data for the model considered.
*
* \return Path related to \a ObjectT.
*/
template<class InputDataT>
static std::string Path(const InputDataT& input_data);
/*!
* \brief Return a string that stands for a folder; several operations might be attempted if said folder
* doesn't exist.
*
* \param[in] input_data Object which holds all relevant input data for the model considered.
*
* \return Path to the folder hold by \a ObjectT.
*/
template<class InputDataT, UnexistentFolderPolicy UnexistentFolderPolicyT = UnexistentFolderPolicy::create>
static std::string Folder(const InputDataT& input_data);
/*!
* \brief Read the number of elements when the object is a vector.
*
* If not a vector, a compilation error will occur as size() method won't be defined.
* \param[in] input_data Object which hols all relevant input data for the model considered.
*
*
* \return Number of elements hold by \a ObjectT.
*/
template<class InputDataT>
static unsigned int Number(const InputDataT& input_data);
/*!
* \brief Return the \a index -th value of a vector.
*
* If the input parameter is not a vector, subscript operator will yield an error at compile time.
*
* \param[in] input_data Object which holds all relevant input data for the model considered.
* \param[in] index Index of the element sought in the vector read in the \a input_data.
*
* \return Value of the \a index -th element of \a ObjectT.
*/
template<class InputDataT, CountAsUsed CountAsUsedT = CountAsUsed::yes>
static decltype(auto) Subscript(const InputDataT& input_data,
unsigned int index);
};
} // namespace InputDataNS
......
......@@ -204,7 +204,7 @@ namespace MoReFEM
template<class DerivedT, class TupleT>
void Base<DerivedT, TupleT>::CheckUnboundInputData(const std::string& filename,
LuaOptionFile& lua_option_file,
LuaOptionFile& lua_option_file,
DoTrackUnusedFields do_track_unused_fields) const
{
// Check there are no parameters undefined in the tuple.
......@@ -284,51 +284,6 @@ namespace MoReFEM
}
template<class ObjectT>
template<class InputDataT, CountAsUsed CountAsUsedT>
typename ConstRefOrValue<typename Extract<ObjectT>::return_type>::type
Extract<ObjectT>::Value(const InputDataT& input_data)
{
return input_data.template ReadHelper<ObjectT, CountAsUsedT>();
}
template<class ObjectT>
template<class InputDataT>
std::string Extract<ObjectT>::Path(const InputDataT& input_data)
{
return input_data.template ReadHelperPath<ObjectT>();
}
template<class ObjectT>
template<class InputDataT, UnexistentFolderPolicy UnexistentFolderPolicyT>
std::string Extract<ObjectT>
::Folder(const InputDataT& input_data)
{
return input_data.template ReadHelperFolder<ObjectT, UnexistentFolderPolicyT>();
}
template<class ObjectT>
template<class InputDataT>
unsigned int Extract<ObjectT>::Number(const InputDataT& input_data)
{
return input_data.template ReadHelperNumber<ObjectT>();
}
template<class ObjectT>
template<class InputDataT, CountAsUsed CountAsUsedT>
decltype(auto)
Extract<ObjectT>::Subscript(const InputDataT& input_data,
unsigned int index)
{
return input_data.template ReadHelper<ObjectT, CountAsUsedT>(index);
}
} // namespace InputDataNS
......
......@@ -22,7 +22,7 @@
# include "Utilities/Containers/Vector.hpp"
# include "Utilities/String/String.hpp"
# include "Utilities/InputData/LuaFunction.hpp"
# include "Utilities/InputData/Definitions.hpp"
# include "Utilities/InputData/Enum.hpp"
# include "Utilities/InputData/Internal/TupleIteration/Traits/Traits.hpp"
# include "Utilities/InputData/Internal/TupleIteration/Impl/TupleItem.hpp"
......
......@@ -16,7 +16,7 @@
# define MOREFEM_x_UTILITIES_x_INPUT_DATA_x_CRTP_x_SECTION_HPP_
# include "Utilities/InputData/Definitions.hpp"
# include "Utilities/InputData/Enum.hpp"
namespace MoReFEM
......
/*!
//
// \file
//
//
// Created by Sebastien Gilles <sebastien.gilles@inria.fr> on the Wed, 26 Aug 2015 11:52:00 +0200
// Copyright (c) Inria. All rights reserved.
//
// \ingroup UtilitiesGroup
// \addtogroup UtilitiesGroup
// \{
*/
#include "Utilities/InputData/Definitions.hpp"
#include "Utilities/String/EmptyString.hpp"
namespace MoReFEM
{
namespace Utilities
{
namespace InputDataNS
{
const std::string& NoEnclosingSection::GetName()
{
return EmptyString();
}
const std::string& NoEnclosingSection::GetFullName()
{
return EmptyString();
}
} // namespace InputDataNS
} // namespace Utilities
} // namespace MoReFEM
/// @} // addtogroup UtilitiesGroup
/*!
//
// \file
//
//
// Created by Sebastien Gilles <sebastien.gilles@inria.fr> on the Tue, 18 Aug 2015 10:41:03 +0200
// Copyright (c) Inria. All rights reserved.
//
// \ingroup UtilitiesGroup
// \addtogroup UtilitiesGroup
// \{
*/
#ifndef MOREFEM_x_UTILITIES_x_INPUT_DATA_x_DEFINITIONS_HPP_
# define MOREFEM_x_UTILITIES_x_INPUT_DATA_x_DEFINITIONS_HPP_
# include <string>
namespace MoReFEM
{
namespace Utilities
{
namespace InputDataNS
{
/*!
* \brief Placeholder class to use as one of the template parameter for sections and end parameters at root level.
*
* Should be used as Crtp::Section or Crtp::InputData template argument.
*/
struct NoEnclosingSection
{
//! Returns empty string.
static const std::string& GetName();
//! Returns empty string.
static const std::string& GetFullName();
};
//! Enum to tell whether current item of input parameter list is a section or an input parameter.
enum class Nature
{
section = 0,
parameter
};
} // namespace InputDataNS
} // namespace Utilities
} // namespace MoReFEM
/// @} // addtogroup UtilitiesGroup
#endif // MOREFEM_x_UTILITIES_x_INPUT_DATA_x_DEFINITIONS_HPP_
//! \file
//
//
// Enum.cpp
// MoReFEM
//
// Created by sebastien on 23/07/2019.
//Copyright © 2019 Inria. All rights reserved.
//
#include "Utilities/InputData/Enum.hpp"
#include "Utilities/String/EmptyString.hpp"
namespace MoReFEM::Utilities::InputDataNS
{
const std::string& NoEnclosingSection::GetName()
{
return EmptyString();
}
const std::string& NoEnclosingSection::GetFullName()
{
return EmptyString();
}
} // namespace MoReFEM::Utilities::InputDataNS
//! \file
//
//
// Enum.hpp
// MoReFEM
//
// Created by sebastien on 23/07/2019.
//Copyright © 2019 Inria. All rights reserved.
//
#ifndef MOREFEM_x_UTILITIES_x_INPUT_DATA_x_ENUM_HPP_
# define MOREFEM_x_UTILITIES_x_INPUT_DATA_x_ENUM_HPP_
# include <memory>
# include <vector>
namespace MoReFEM::Utilities::InputDataNS
{
/*!
* \brief Placeholder class to use as one of the template parameter for sections and end parameters at root level.
*
* Should be used as Crtp::Section or Crtp::InputData template argument.
*/
struct NoEnclosingSection
{
//! Returns empty string.
static const std::string& GetName();
//! Returns empty string.
static const std::string& GetFullName();
};
//! Enum to tell whether current item of input parameter list is a section or an input parameter.
enum class Nature
{
section = 0,
parameter
};
/*!
* \brief An enum class that will basically act as a boolean.
*
* InputData::Base class takes into account which input parameters are actually used; the
* way to do so is to set a bit in a bitset when some methods are called. However, sometimes these
* methods might be called to some purposes that do not truly mean the input parameter is used.
*
* For instance, if we check at the beginning of the program that several input vectors are the same
* length it doesn't mean all of them are actually used, hence the following enum to be able to
* specify the method not to set the bit for this specific use.
*
*/
enum class CountAsUsed
{
no,
yes
};
//! Behaviour when the folder read in the input data file doesn't exist.
enum class UnexistentFolderPolicy
{
create,
throw_exception
};
} // namespace MoReFEM::Utilities::InputDataNS
#endif // MOREFEM_x_UTILITIES_x_INPUT_DATA_x_ENUM_HPP_
//! \file
//
//
// Extract.hpp
// MoReFEM
//
// Created by sebastien on 23/07/2019.
//Copyright © 2019 Inria. All rights reserved.
//
#ifndef MOREFEM_x_UTILITIES_x_INPUT_DATA_x_EXTRACT_HPP_
# define MOREFEM_x_UTILITIES_x_INPUT_DATA_x_EXTRACT_HPP_
# include "Utilities/Miscellaneous.hpp"
# include "Utilities/InputData/Enum.hpp"
namespace MoReFEM::Utilities::InputDataNS
{
/*!
* \brief A convenient helper to extract information from Base class.
*
* The problem with Base class is that the syntax is really hideous; for instance a derived class
* from base (named IPL for the example below) must use the following syntax to extract a value
* named Component:
*
* \code
* using Type = InputData::BoundaryCondition::Component;
* auto component_value = this->template ReadHelper<Type>();
* \endcode
*