Commit dc46b322 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#478 Introduce a new input parameter block: Domain. Not yet used or even tested.

parent 073432f9
......@@ -51,7 +51,8 @@ namespace HappyHeart
const std::string& Density::Description()
{
static std::string ret("Density, coefficient in front of the time derivative of the unknown (e.g. mass density x specific heat capacity for the heat problem).");
static std::string ret("Density, coefficient in front of the time derivative of the unknown "
"(e.g. mass density x specific heat capacity for the heat problem).");
return ret;
}
......
//
// Domain.hpp
// HappyHeart
//
// Created by Sebastien Gilles on 19/03/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef _HAPPY_HEART__CORE__INPUT_PARAMETER__GEOMETRY__DOMAIN_HPP_
# define _HAPPY_HEART__CORE__INPUT_PARAMETER__GEOMETRY__DOMAIN_HPP_
# include <string>
# include "Utilities/InputParameterList/Private/InputParameter.hpp"
namespace HappyHeart
{
namespace InputParameter
{
namespace Domain
{
//! Indicates the mesh upon which the domain is defined (if any).
template<unsigned int IndexT>
struct MeshIndex : public Private::MeshIndex
{
//! Name of the section in Lua input file.
static const std::string& Section();
};
//! Indicates the list of dimensions considered in the domain (if left empty all of them).
template<unsigned int IndexT>
struct DimensionList : public Private::DimensionList
{
//! Name of the section in Lua input file.
static const std::string& Section();
};
//! Indicates the list of mesh labels considered in the domain (if left empty all of them).
template<unsigned int IndexT>
struct MeshLabelList : public Private::MeshLabelList
{
//! Name of the section in Lua input file.
static const std::string& Section();
};
//! Indicates the list of geometric element types considered in the domain (if left empty all of them).
template<unsigned int IndexT>
struct GeomEltTypeList : public Private::GeomEltTypeList
{
//! Name of the section in Lua input file.
static const std::string& Section();
};
} //namespace Domain
} //namespace InputParameter
} // namespace HappyHeart
# include "Core/InputParameter/Geometry/Domain.hxx"
#endif // _HAPPY_HEART__CORE__INPUT_PARAMETER__GEOMETRY__DOMAIN_HPP_
//
// Domain.hxx
// HappyHeart
//
// Created by Sebastien Gilles on 19/03/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef _HAPPY_HEART__CORE__INPUT_PARAMETER__GEOMETRY__DOMAIN_HXX_
# define _HAPPY_HEART__CORE__INPUT_PARAMETER__GEOMETRY__DOMAIN_HXX_
namespace HappyHeart
{
namespace InputParameter
{
namespace Domain
{
namespace // anonymous
{
inline static const std::string& SectionNameWithoutIndex()
{
static std::string ret("Domain");
return ret;
}
//! Name of the section for all classes declared below.
template<unsigned int IndexT>
static const std::string& SectionNameWithIndex()
{
static std::string ret = SectionNameWithoutIndex() + std::to_string(IndexT);
return ret;
};
} // namespace anonymous
template<unsigned int IndexT>
const std::string& MeshIndex<IndexT>::Section()
{
return SectionNameWithIndex();
}
template<unsigned int IndexT>
const std::string& DimensionList<IndexT>::Section()
{
return SectionNameWithIndex();
}
template<unsigned int IndexT>
const std::string& MeshLabelList<IndexT>::Section()
{
return SectionNameWithIndex();
}
template<unsigned int IndexT>
const std::string& GeomEltTypeList<IndexT>::Section()
{
return SectionNameWithIndex();
}
} //namespace Domain
} //namespace InputParameter
} // namespace HappyHeart
#endif // _HAPPY_HEART__CORE__INPUT_PARAMETER__GEOMETRY__DOMAIN_HXX_
......@@ -64,8 +64,6 @@ namespace HappyHeart
}
template<unsigned int IndexT>
const std::string& Dimension<IndexT>::Section()
{
......
//
// Domain.cpp
// HappyHeart
//
// Created by Sebastien Gilles on 19/03/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#include "Core/InputParameter/Geometry/Private/Domain.hpp"
namespace HappyHeart
{
namespace InputParameter
{
namespace Domain
{
namespace Private
{
const std::string& MeshIndex::NameInFile()
{
static std::string ret("Mesh_index");
return ret;
}
const std::string& MeshIndex::Description()
{
static std::string ret("Index of the geometric mesh upon which the domain is defined. Might be "
"left empty if domain not limited to one mesh.");
return ret;
}
const std::string& MeshIndex::Constraint()
{
static std::string ret;
return ret;
}
const std::string& MeshIndex::DefaultValue()
{
static std::string ret;
return ret;
}
const std::string& DimensionList::NameInFile()
{
static std::string ret("Dimension_list");
return ret;
}
const std::string& DimensionList::Description()
{
static std::string ret("List of dimensions encompassed by the domain. Might be left empty if no "
"restriction at all upon dimensions.");
return ret;
}
const std::string& DimensionList::Constraint()
{
static std::string ret("ops_in(v, {1, 2, 3}");
return ret;
}
const std::string& DimensionList::DefaultValue()
{
static std::string ret;
return ret;
}
const std::string& MeshLabelList::NameInFile()
{
static std::string ret("Mesh_label_list");
return ret;
}
const std::string& MeshLabelList::Description()
{
static std::string ret("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.");
return ret;
}
const std::string& MeshLabelList::Constraint()
{
static std::string ret;
return ret;
}
const std::string& MeshLabelList::DefaultValue()
{
static std::string ret;
return ret;
}
const std::string& GeomEltTypeList::NameInFile()
{
static std::string ret("Geometric_element_type_list");
return ret;
}
const std::string& GeomEltTypeList::Description()
{
static std::string ret("List of geometric element types considered in the domain. Might be left "
"empty if no restriction upon these.");
return ret;
}
const std::string& GeomEltTypeList::Constraint()
{
static std::string ret;
return ret;
}
const std::string& GeomEltTypeList::DefaultValue()
{
static std::string ret;
return ret;
}
} //namespace Private
} //namespace Domain
} //namespace InputParameter
} // namespace HappyHeart
//
// Domain.hpp
// HappyHeart
//
// Created by Sebastien Gilles on 19/03/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef __HappyHeart__Domain__HPP
# define __HappyHeart__Domain__HPP
# include <memory>
# include <vector>
# include "Utilities/InputParameterList/Private/InputParameter.hpp"
namespace HappyHeart
{
namespace InputParameter
{
namespace Domain
{
namespace Private
{
//! Helper class that defines non template static functions of namesake class in Domain namespace.
struct MeshIndex : public Utilities::InputParameterListNS::Private::InputParameter<unsigned int>
{
//! 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 Ops one. Hereafter some text from Ops 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 'ops_in' (a Lua function defined by Ops).
* \a constraint = "ops_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 parameter 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 Ops-formatted.
*/
static const std::string& DefaultValue();
};
//! Helper class that defines non template static functions of namesake class in Domain namespace.
struct DimensionList
: public Utilities::InputParameterListNS::Private::InputParameter<std::vector<unsigned int>>
{
//! 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 Ops one. Hereafter some text from Ops 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 'ops_in' (a Lua function defined by Ops).
* \a constraint = "ops_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 parameter 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 Ops-formatted.
*/
static const std::string& DefaultValue();
};
//! Helper class that defines non template static functions of namesake class in Domain namespace.
struct MeshLabelList
: public Utilities::InputParameterListNS::Private::InputParameter<std::vector<unsigned int>>
{
//! 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 Ops one. Hereafter some text from Ops 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 'ops_in' (a Lua function defined by Ops).
* \a constraint = "ops_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 parameter 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 Ops-formatted.
*/
static const std::string& DefaultValue();
};
//! Helper class that defines non template static functions of namesake class in Domain namespace.
struct GeomEltTypeList
: public Utilities::InputParameterListNS::Private::InputParameter<std::vector<std::string>>
{
//! 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 Ops one. Hereafter some text from Ops 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 'ops_in' (a Lua function defined by Ops).
* \a constraint = "ops_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 parameter 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 Ops-formatted.
*/
static const std::string& DefaultValue();
};
} //namespace Private
} //namespace Domain
} //namespace InputParameter
} // namespace HappyHeart
#endif /* defined(__HappyHeart__Domain__HPP) */
......@@ -9,7 +9,7 @@ InputParameter/Diffusion.cpp
InputParameter/Fluid.cpp
InputParameter/Force.cpp
InputParameter/InitialCondition.cpp
InputParameter/Geometry/Mesh.cpp
InputParameter/Geometry/Private/Mesh.cpp
InputParameter/Miscellaneous.cpp
InputParameter/Petsc.cpp
InputParameter/Result.cpp
......
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