Feel++ 0.111.0-preview.14
Finite Element Embedded Library in C++
Feel::FeelModels::ModelMesh< IndexType > Class Template Reference

Mesh Model class. More...

+ Collaboration diagram for Feel::FeelModels::ModelMesh< IndexType >:

Classes

struct  MeshAdaptation
 

Public Types

using collection_data_by_mesh_entity_type = CollectionOfDataByMeshEntity< index_type >
 
using function_apply_remesh = std::function< void(mesh_base_ptrtype, mesh_base_ptrtype)>
 
using import_config_type = typename ModelMeshCommon< IndexType >::ImportConfig
 
using index_type = IndexType
 
using mesh_base_ptrtype = std::shared_ptr< mesh_base_type >
 
using mesh_base_type = MeshBase< index_type >
 
using partitioning_setup_type = typename ModelMeshCommon< IndexType >::PartitioningSetup
 

Public Member Functions

template<typename MeshType >
void applyRemesh (std::shared_ptr< MeshType > const &newMesh)
 
std::map< std::string, collection_data_by_mesh_entity_type > const & collectionOfDataByMeshEntity () const
 
bool hasMeshMotion () const
 
import_config_type & importConfig ()
 
import_config_type const & importConfig () const
 
template<typename MeshType >
void initMeasurePointsEvaluationTool ()
 
template<typename MeshType >
auto measurePointsEvaluationTool ()
 
template<typename MeshType = mesh_base_type>
auto mesh () const
 
template<typename MeshType >
auto meshMotionTool () const
 
nl::json const & metadata () const
 return json metadata
 
template<typename MeshType >
auto modelFields (std::string const &prefix_field="", std::string const &prefix_symbol="") const
 Returns a tuple of model fields for a given mesh. More...
 
 ModelMesh (ModelMesh &&)=default
 
 ModelMesh (ModelMesh const &)=default
 
 ModelMesh (std::string const &name)
 
 ModelMesh (std::string const &name, ModelMeshes< IndexType > const &mMeshes)
 
partitioning_setup_type const & partitioningSetup () const
 
bool removeField (std::string const &name)
 Removes a field given its name from the map. More...
 
void setAsShared (ModelMesh< IndexType > const &m)
 
void setFunctionApplyRemesh (function_apply_remesh f)
 
void setMesh (mesh_base_ptrtype m, std::string const &meshFilename="")
 
void setParameterValues (std::map< std::string, double > const &paramValues)
 
void setup (nl::json const &jarg, ModelMeshes< IndexType > const &mMeshes)
 
void setupRestart (ModelMeshes< IndexType > const &mMeshes)
 
template<typename MeshType = mesh_base_type, bool AddFields = true>
auto symbolsExpr (std::string const &prefix_symbol="") const
 
template<typename MeshType >
void updateDistanceToRange ()
 
template<typename MeshType , typename ExprTypr , typename RangeType , std::enable_if_t< is_filter_v< std::decay_t< RangeType > >, bool > = true>
void updateField (std::string const &name, Expr< ExprTypr > const &expr, RangeType const &range, std::string const &basis="", bool initZero=false)
 Updates a field in a model mesh based on an expression and a range of elements. More...
 
template<typename MeshType , typename ExprTypr >
void updateField (std::string const &name, Expr< ExprTypr > const &expr, std::string const &basis="")
 Updates a field with a given name and expression on all mesh elements. More...
 
template<typename MeshType , typename FieldType , std::enable_if_t< is_functionspace_element_v< std::decay_t< FieldType > >, bool > = true>
void updateField (std::string const &name, FieldType const &u, std::string const &basis="")
 Updates a field with data from another field. More...
 
template<typename MeshType >
void updateForUse (ModelMeshes< IndexType > const &mMeshes)
 
void updateInformationObject (nl::json &p, std::string const &prefix_symbol) const
 
template<typename MeshType , typename SymbolsExprType >
void updateMeshAdaptation (std::shared_ptr< typename MeshAdaptation::Event > event, SymbolsExprType const &se)
 
template<typename MeshType , typename SymbolsExprType >
void updateMeshMotion (SymbolsExprType const &se)
 
void updateTime (double time)
 

Static Public Member Functions

template<typename MeshType >
static constexpr auto basisFieldTypeSupported ()
 Returns a tuple of tuples containing the names and types of the basis fields supported by a mesh. More...
 
static tabulate_informations_ptr_t tabulateInformations (nl::json const &p, TabulateInformationProperties const &tabInfoProp)
 

Detailed Description

template<typename IndexType>
class Feel::FeelModels::ModelMesh< IndexType >

Mesh Model class.

Template Parameters
IndexType

Member Function Documentation

◆ basisFieldTypeSupported()

template<typename IndexType >
template<typename MeshType >
static constexpr auto Feel::FeelModels::ModelMesh< IndexType >::basisFieldTypeSupported ( )
staticconstexpr

Returns a tuple of tuples containing the names and types of the basis fields supported by a mesh.

The function template takes a template parameter MeshType which is a type that represents a mesh. The function returns a tuple of tuples, where each inner tuple contains a string and a type. The string represents the name of a basis field type supported by the mesh, and the type represents the type of the basis field.

The function template is a static member function of the class that it is defined in. It is a constexpr function, which means that it can be evaluated at compile-time if the template parameter MeshType is a constant expression.

The function template uses a C++17 feature called structured bindings to create the tuple of tuples. It uses the hana library to create the tuples and the type_c function to create the type objects.

The function template is specialized for different types of meshes, depending on their dimension and the number of real dimensions. For example, for a 1D mesh with 1 real dimension, the function returns a tuple of tuples containing the names and types of the Lagrange basis fields with 1, 2, 0, and 1 DoFs. For a 2D mesh with 2 real dimensions, the function returns a tuple of tuples containing the names and types of the Lagrange basis fields (continuous order 1,2 and discontinuous 0,1 and vectorial continuous order 1,2 as well as Nedelec basis field 1st family of order 1)

Template Parameters
MeshTypeThe type of the mesh.
Returns
A tuple of tuples containing the names and types of the basis fields supported by the mesh.

◆ modelFields()

template<typename IndexType >
template<typename MeshType >
auto Feel::FeelModels::ModelMesh< IndexType >::modelFields ( std::string const &  prefix_field = "",
std::string const &  prefix_symbol = "" 
) const

Returns a tuple of model fields for a given mesh.

Template Parameters
MeshTypeThe type of mesh for which to return the model fields.
Parameters
prefix_fieldA string prefix to use for the field names.
prefix_symbolA string prefix to use for the symbol names.
Returns
A tuple of model fields for the given mesh.

◆ removeField()

template<typename IndexType >
bool Feel::FeelModels::ModelMesh< IndexType >::removeField ( std::string const &  name)

Removes a field given its name from the map.

This function removes the field with the given name from the M_fields map and returns true if the field was successfully removed, or false if the field was not found in the map.

Parameters
nameThe name of the field to remove.
Returns
true if the field was successfully removed, or false if the field was not found in the map.

◆ updateField() [1/3]

template<typename IndexType >
template<typename MeshType , typename ExprTypr , typename RangeType , std::enable_if_t< is_filter_v< std::decay_t< RangeType > >, bool > = true>
void Feel::FeelModels::ModelMesh< IndexType >::updateField ( std::string const &  name,
Expr< ExprTypr > const &  expr,
RangeType const &  range,
std::string const &  basis = "",
bool  initZero = false 
)

Updates a field in a model mesh based on an expression and a range of elements.

This function template updates a field in a model mesh based on an expression and a range of elements. The function takes several parameters:

Parameters
nameA string representing the name of the field to be updated.
exprAn expression that represents the value to be assigned to the field.
rangeA range of elements over which the field should be updated.
basisA string representing the basis function space to be used for the field. If no basis is provided, the function will default to a scalar or vectorial function space based on the expression type.
initZeroA boolean flag indicating whether the field should be initialized to zero before being updated.

The function template uses Hana library to iterate over a tuple of supported basis function spaces for the given mesh type. For each basis function space, it checks if it matches the provided basis parameter.

  • If a match is found, it creates a function space of the appropriate type using the provided basis and checks if the field already exists in the mesh.
  • If the field does not exist, it is created using the function space.
  • If the field already exists but has a different basis, the field is rebuilt.
  • Finally, the function applies the expression to the field over the specified range of elements.

◆ updateField() [2/3]

template<typename IndexType >
template<typename MeshType , typename ExprTypr >
void Feel::FeelModels::ModelMesh< IndexType >::updateField ( std::string const &  name,
Expr< ExprTypr > const &  expr,
std::string const &  basis = "" 
)

Updates a field with a given name and expression on all mesh elements.

This function template is specialized for a given MeshType and ExprType and is used to update a field with a given name on all mesh elements.

Parameters
nameThe name of the field to update.
exprThe expression used to update the field.
basisThe basis used to update the field.
Template Parameters
MeshTypeThe type of mesh to update the field on.
ExprTypeThe type of expression used to update the field.

◆ updateField() [3/3]

template<typename IndexType >
template<typename MeshType , typename FieldType , std::enable_if_t< is_functionspace_element_v< std::decay_t< FieldType > >, bool > = true>
void Feel::FeelModels::ModelMesh< IndexType >::updateField ( std::string const &  name,
FieldType const &  u,
std::string const &  basis = "" 
)

Updates a field with data from another field.

This function template is specialized for a function space element FieldType and a mesh type MeshType The purpose of this function is to update a field with data from another field. The function takes in the name of the field to be updated, the field to be used for the update, and an optional basis string.

Parameters
nameThe name of the field to be updated.
uThe field to be used for the update.
basisAn optional basis string.
Todo:
get a default basis if empty (iterate over all space, maybe one will match or use also continuity property)