Fluid structure interaction suite
finite_element.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2022 by Luca Heltai
4 //
5 // This file is part of the FSI-suite platform, based on the deal.II library.
6 //
7 // The FSI-suite platform is free software; you can use it, redistribute it,
8 // and/or modify it under the terms of the GNU Lesser General Public License as
9 // published by the Free Software Foundation; either version 3.0 of the License,
10 // or (at your option) any later version. The full text of the license can be
11 // found in the file LICENSE at the top level of the FSI-suite platform
12 // distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef parsed_tools_finite_element_h
17 #define parsed_tools_finite_element_h
18 
20 
21 #include <deal.II/fe/fe.h>
22 
23 namespace ParsedTools
24 {
55  template <int dim, int spacedim = dim>
56  class FiniteElement : public dealii::ParameterAcceptor
57  {
58  public:
96  FiniteElement(const std::string &section_name = "",
97  const std::string &component_names = "u",
98  const std::string &fe_name = "FE_Q(1)");
99 
103  operator dealii::FiniteElement<dim, spacedim> &();
104 
108  operator const dealii::FiniteElement<dim, spacedim> &() const;
109 
110 
114  dealii::FiniteElement<dim, spacedim> &
115  operator()();
116 
120  const dealii::FiniteElement<dim, spacedim> &
121  operator()() const;
122 
126  const std::string &
128 
129 
133  const std::vector<std::string> &
134  get_component_names() const;
135 
141  std::vector<unsigned int>
142  get_component_blocks() const;
143 
144 
148  std::string
149  get_block_names() const;
150 
154  unsigned int
155  n_components() const;
156 
162  unsigned int
163  n_blocks() const;
164 
169  unsigned int
170  get_first_occurence(const std::string &var) const;
171 
175  bool
176  is_vector(const std::string &var) const;
177 
178  protected:
182  const std::string joint_component_names;
183 
194  const std::vector<std::string> component_names;
195 
199  std::string fe_name;
200 
205  std::vector<unsigned int> component_blocks;
206 
211  std::vector<std::string> block_names;
212 
214  std::unique_ptr<dealii::FiniteElement<dim, spacedim>> fe;
215  };
216 
217 } // namespace ParsedTools
218 
219 #endif
const std::string section_name
Parsed FiniteElement.
const std::vector< std::string > & get_component_names() const
Return the component names for this Finite Element.
const std::string joint_component_names
Component names as a single comma separated string.
unsigned int n_blocks() const
Return the number of blocks of the Finite Element, i.e., the number of variables.
std::vector< unsigned int > component_blocks
The subdivision, in terms of component indices.
FiniteElement(const std::string &section_name="", const std::string &component_names="u", const std::string &fe_name="FE_Q(1)")
Constructor.
std::unique_ptr< FiniteElement< dim, spacedim > > fe
The actual FiniteElement object.
std::string fe_name
Finite Element Name.
std::vector< std::string > block_names
The subdivision, in terms of block names.
std::string get_block_names() const
Return the block names for this Finite Element.
std::vector< unsigned int > get_component_blocks() const
Return the blocking of the components for this finite element.
unsigned int n_components() const
Return the number of components of the Finite Element.
FiniteElement< dim, spacedim > & operator()()
Return a reference to the Finite Element.
unsigned int get_first_occurence(const std::string &var) const
Return the first occurence of var in default_component_names.
const std::vector< std::string > component_names
Component names.
const std::string & get_joint_component_names() const
Return the component names for this Finite Element.
bool is_vector(const std::string &var) const
Return true if var is vector, false otherwise.
We collect in this namespace some wrappers around commonly used deal.II classes, derived from the Par...