Commit e27b412e authored by GILLES Sebastien's avatar GILLES Sebastien

#1474 Add a Find() method in InputData to check whether a field is present or...

#1474 Add a Find() method in InputData to check whether a field is present or not (thus allowing optional fields).
parent 303497a5
......@@ -171,6 +171,18 @@ namespace MoReFEM
//! \return Path to the input data file.
const std::string& GetInputFile() const;
/*!
* \brief Whether \a ItemT is present in the tuple or not.
*
* \tparam ItemT Field sought in the tuple.
*
* \return True if present.
*/
template<class ItemT>
constexpr static bool Find();
private:
......
......@@ -297,6 +297,15 @@ namespace MoReFEM
}
template<class DerivedT, class TupleT>
template<class ItemT>
constexpr bool Base<DerivedT, TupleT>::Find()
{
return tuple_iteration::template Find<ItemT>();
}
} // namespace InputDataNS
......
......@@ -46,10 +46,7 @@ namespace MoReFEM
constexpr bool SectionOrParameter<TupleEltTypeT, Nature::section, TupleEltTypeT>
::Find()
{
static_assert(std::is_same<std::false_type, TupleEltTypeT>::value,
"Extract() methods from InputData shouldn't act on a section, only "
"on end parameters.");
return false;
return true;
}
......
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