Fluid structure interaction suite
ParsedTools::FiniteElement< dim, spacedim > Class Template Reference

Parsed FiniteElement. More...

#include <finite_element.h>

Inheritance diagram for ParsedTools::FiniteElement< dim, spacedim >:
[legend]

Public Member Functions

 FiniteElement (const std::string &section_name="", const std::string &component_names="u", const std::string &fe_name="FE_Q(1)")
 Constructor. More...
 
 operator FiniteElement< dim, spacedim > & ()
 Return a reference to the Finite Element. More...
 
 operator const FiniteElement< dim, spacedim > & () const
 Return a const reference to the Finite Element. More...
 
FiniteElement< dim, spacedim > & operator() ()
 Return a reference to the Finite Element. More...
 
const FiniteElement< dim, spacedim > & operator() () const
 Return a const reference to the Finite Element. More...
 
const std::string & get_joint_component_names () const
 Return the component names for this Finite Element. More...
 
const std::vector< std::string > & get_component_names () const
 Return the component names for this Finite Element. More...
 
std::vector< unsigned int > get_component_blocks () const
 Return the blocking of the components for this finite element. More...
 
std::string get_block_names () const
 Return the block names for this Finite Element. More...
 
unsigned int n_components () const
 Return the number of components of the Finite Element. More...
 
unsigned int n_blocks () const
 Return the number of blocks of the Finite Element, i.e., the number of variables. More...
 
unsigned int get_first_occurence (const std::string &var) const
 Return the first occurence of var in default_component_names. More...
 
bool is_vector (const std::string &var) const
 Return true if var is vector, false otherwise. More...
 
- Public Member Functions inherited from ParameterAcceptor
 ParameterAcceptor (const std::string &section_name="")
 
unsigned int get_acceptor_id () const
 
virtual ~ParameterAcceptor () override
 
virtual void declare_parameters (ParameterHandler &prm)
 
virtual void parse_parameters (ParameterHandler &prm)
 
std::string get_section_name () const
 
std::vector< std::string > get_section_path () const
 
void add_parameter (const std::string &entry, ParameterType &parameter, const std::string &documentation="", ParameterHandler &prm_=prm, const Patterns::PatternBase &pattern=*Patterns::Tools::Convert< ParameterType >::to_pattern())
 
void enter_subsection (const std::string &subsection)
 
void leave_subsection ()
 
void enter_my_subsection (ParameterHandler &prm)
 
void leave_my_subsection (ParameterHandler &prm)
 
void serialize (Archive &ar, const unsigned int version)
 
void subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
void unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
unsigned int n_subscriptions () const
 
void list_subscribers (StreamType &stream) const
 
void list_subscribers () const
 
void subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
void unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
unsigned int n_subscriptions () const
 
void list_subscribers (StreamType &stream) const
 
void list_subscribers () const
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
 Subscriptor (Subscriptor &&) noexcept
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
Subscriptoroperator= (Subscriptor &&) noexcept
 
void serialize (Archive &ar, const unsigned int version)
 
void subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
void unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
unsigned int n_subscriptions () const
 
void list_subscribers (StreamType &stream) const
 
void list_subscribers () const
 
void subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
void unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
unsigned int n_subscriptions () const
 
void list_subscribers (StreamType &stream) const
 
void list_subscribers () const
 

Protected Attributes

const std::string joint_component_names
 Component names as a single comma separated string. More...
 
const std::vector< std::string > component_names
 Component names. More...
 
std::string fe_name
 Finite Element Name. More...
 
std::vector< unsigned int > component_blocks
 The subdivision, in terms of component indices. More...
 
std::vector< std::string > block_names
 The subdivision, in terms of block names. More...
 
std::unique_ptr< FiniteElement< dim, spacedim > > fe
 The actual FiniteElement object. More...
 
- Protected Attributes inherited from ParameterAcceptor
const std::string section_name
 
std::vector< std::string > subsections
 

Additional Inherited Members

- Static Public Member Functions inherited from ParameterAcceptor
static void initialize (const std::string &filename="", const std::string &output_filename="", const ParameterHandler::OutputStyle output_style_for_output_filename=ParameterHandler::Short, ParameterHandler &prm=ParameterAcceptor::prm, const ParameterHandler::OutputStyle output_style_for_filename=ParameterHandler::DefaultStyle)
 
static void initialize (std::istream &input_stream, ParameterHandler &prm=ParameterAcceptor::prm)
 
static void clear ()
 
static void parse_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm)
 
static void declare_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm)
 
static ::ExceptionBaseExcInUse (int arg1, std::string arg2, std::string arg3)
 
static ::ExceptionBaseExcNoSubscriber (std::string arg1, std::string arg2)
 
- Static Public Member Functions inherited from Subscriptor
static ::ExceptionBaseExcInUse (int arg1, std::string arg2, std::string arg3)
 
static ::ExceptionBaseExcNoSubscriber (std::string arg1, std::string arg2)
 
- Public Attributes inherited from ParameterAcceptor
boost::signals2::signal< void()> declare_parameters_call_back
 
boost::signals2::signal< void()> parse_parameters_call_back
 
- Static Public Attributes inherited from ParameterAcceptor
static ParameterHandler prm
 

Detailed Description

template<int dim, int spacedim = dim>
class ParsedTools::FiniteElement< dim, spacedim >

Parsed FiniteElement.

Read from a parameter file the name of a finite element, generate one for you, and return a pointer to it.

The name must be in the form which is returned by the FiniteElement::get_name() function, where dimension template parameters <2> etc. can be omitted. Alternatively, the explicit number can be replaced by dim or d. If a number is given, it must match the template parameter of this function.

The names of FESystem elements follow the pattern FESystem[FE_Base1^p1-FE_Base2^p2] The powers p1 etc. may either be numbers or can be replaced by dim or d.

If no finite element can be reconstructed from this string, an exception of type FETools::ExcInvalidFEName is thrown.

The operator() returns a pointer to a newly create finite element. It is in the caller's responsibility to destroy the object pointed to at an appropriate later time.

Since the value of the template argument can't be deduced from the (string) argument given to this function, you have to explicitly specify it when you call this function.

This function knows about all the standard elements defined in the library. However, it doesn't by default know about elements that you may have defined in your program. To make your own elements known to this function, use the add_fe_name() function.

Definition at line 56 of file finite_element.h.

Constructor & Destructor Documentation

◆ FiniteElement()

template<int dim, int spacedim>
FiniteElement< dim, spacedim >::FiniteElement ( const std::string &  section_name = "",
const std::string &  component_names = "u",
const std::string &  fe_name = "FE_Q(1)" 
)

Constructor.

Takes a name for the section of the Parameter Handler to use.

This class is derived from ParameterAcceptor. See the documentation of ParameterAcceptor for a guide on how section names and parameters are parsed by this class.

The optional parameters specify the component names as a comma separated list of component names, and the default FiniteElement space name to use. This class will throw an exception if the number of components does not match the number of component names.

The FiniteElement space name must be in the form which is returned by the FiniteElement::get_name function, where dimension template parameters <2> etc. can be omitted. Alternatively, the explicit number can be replaced by dim or d. If a number is given, it must match the template parameter of this function.

The names of FESystem elements follow the pattern FESystem[FE_Base1^p1-FE_Base2^p2] The powers p1 etc. may either be numbers or can be replaced by dim or d.

If no finite element can be reconstructed from this string, an exception of type FETools::ExcInvalidFEName is thrown.

Explicit conversion to the stored FiniteElement is possible after parsing has occurred.

If a component name is repeated, then that component is assumed to be part of a vector or Tensor field, and it is treated as a single block. User classes can use this information to construct block matrices and vectors, or to group solution names according to components. For example, a Stokes problem may have "u,u,p" for dim = 2 or "u, u, u, p" for dim = 3, resulting in a vector-valued system with two blocks (one for the velocity, and one for the pressure), and dim+1 components.

Definition at line 33 of file finite_element.cc.

References ParameterHandler::add_action(), ParameterAcceptor::add_parameter(), Assert, ParsedTools::FiniteElement< dim, spacedim >::block_names, ParsedTools::FiniteElement< dim, spacedim >::component_blocks, ParsedTools::FiniteElement< dim, spacedim >::component_names, ParameterAcceptor::enter_my_subsection(), StandardExceptions::ExcMessage(), ParsedTools::FiniteElement< dim, spacedim >::fe, ParsedTools::FiniteElement< dim, spacedim >::joint_component_names, ParameterAcceptor::leave_my_subsection(), and ParameterAcceptor::prm.

Member Function Documentation

◆ operator FiniteElement< dim, spacedim > &()

template<int dim, int spacedim>
FiniteElement< dim, spacedim >::operator FiniteElement< dim, spacedim > &

Return a reference to the Finite Element.

Definition at line 89 of file finite_element.cc.

References AssertThrow, and StandardExceptions::ExcNotInitialized().

◆ operator const FiniteElement< dim, spacedim > &()

template<int dim, int spacedim>
FiniteElement< dim, spacedim >::operator const FiniteElement< dim, spacedim > &

Return a const reference to the Finite Element.

Definition at line 99 of file finite_element.cc.

References AssertThrow, and StandardExceptions::ExcNotInitialized().

◆ operator()() [1/2]

template<int dim, int spacedim>
FiniteElement< dim, spacedim > & FiniteElement< dim, spacedim >::operator()

Return a reference to the Finite Element.

Definition at line 110 of file finite_element.cc.

References AssertThrow, and StandardExceptions::ExcNotInitialized().

◆ operator()() [2/2]

template<int dim, int spacedim>
const FiniteElement< dim, spacedim > & FiniteElement< dim, spacedim >::operator()

Return a const reference to the Finite Element.

Definition at line 120 of file finite_element.cc.

References AssertThrow, and StandardExceptions::ExcNotInitialized().

◆ get_joint_component_names()

template<int dim, int spacedim>
const std::string & FiniteElement< dim, spacedim >::get_joint_component_names

Return the component names for this Finite Element.

Definition at line 146 of file finite_element.cc.

◆ get_component_names()

template<int dim, int spacedim>
const std::vector< std::string > & FiniteElement< dim, spacedim >::get_component_names

Return the component names for this Finite Element.

Definition at line 154 of file finite_element.cc.

◆ get_component_blocks()

template<int dim, int spacedim>
std::vector< unsigned int > FiniteElement< dim, spacedim >::get_component_blocks

Return the blocking of the components for this finite element.

This is what's needed by the block renumbering algorithm.

Definition at line 170 of file finite_element.cc.

◆ get_block_names()

template<int dim, int spacedim>
std::string FiniteElement< dim, spacedim >::get_block_names

Return the block names for this Finite Element.

Definition at line 162 of file finite_element.cc.

References Patterns::Tools::to_string().

◆ n_components()

template<int dim, int spacedim>
unsigned int FiniteElement< dim, spacedim >::n_components

Return the number of components of the Finite Element.

Definition at line 130 of file finite_element.cc.

◆ n_blocks()

template<int dim, int spacedim>
unsigned int FiniteElement< dim, spacedim >::n_blocks

Return the number of blocks of the Finite Element, i.e., the number of variables.

For example, simple Heat equation has 1 block, Navier-Stokes 2 blocks (u and p).

Definition at line 138 of file finite_element.cc.

◆ get_first_occurence()

template<int dim, int spacedim>
unsigned int FiniteElement< dim, spacedim >::get_first_occurence ( const std::string &  var) const

Return the first occurence of var in default_component_names.

Remark: this is the value required by FEValuesExtractors.

Definition at line 177 of file finite_element.cc.

References Assert, and StandardExceptions::ExcInternalError().

◆ is_vector()

template<int dim, int spacedim>
bool FiniteElement< dim, spacedim >::is_vector ( const std::string &  var) const

Return true if var is vector, false otherwise.

Definition at line 189 of file finite_element.cc.

References Assert, and StandardExceptions::ExcInternalError().

Member Data Documentation

◆ joint_component_names

template<int dim, int spacedim = dim>
const std::string ParsedTools::FiniteElement< dim, spacedim >::joint_component_names
protected

Component names as a single comma separated string.

Definition at line 182 of file finite_element.h.

Referenced by ParsedTools::FiniteElement< dim, spacedim >::FiniteElement().

◆ component_names

template<int dim, int spacedim = dim>
const std::vector<std::string> ParsedTools::FiniteElement< dim, spacedim >::component_names
protected

Component names.

This is comma separeted list of component names which identifies the Finite Elemenet. If a name is repeated, then that component is assumed to be part of a vector field or Tensor field, and is treated as a single block. User classes can use this information to construct block matrices and vectors, or to group solution names according to components. For example, a Stokes problem may have "u, u, p" for dim = 2 or "u, u, u, p" for dim = 3.

Definition at line 194 of file finite_element.h.

Referenced by ParsedTools::FiniteElement< dim, spacedim >::FiniteElement().

◆ fe_name

template<int dim, int spacedim = dim>
std::string ParsedTools::FiniteElement< dim, spacedim >::fe_name
protected

Finite Element Name.

Definition at line 199 of file finite_element.h.

◆ component_blocks

template<int dim, int spacedim = dim>
std::vector<unsigned int> ParsedTools::FiniteElement< dim, spacedim >::component_blocks
protected

The subdivision, in terms of component indices.

This is automatically computed from the the component names.

Definition at line 205 of file finite_element.h.

Referenced by ParsedTools::FiniteElement< dim, spacedim >::FiniteElement().

◆ block_names

template<int dim, int spacedim = dim>
std::vector<std::string> ParsedTools::FiniteElement< dim, spacedim >::block_names
protected

The subdivision, in terms of block names.

This is automatically computed from the the component names.

Definition at line 211 of file finite_element.h.

Referenced by ParsedTools::FiniteElement< dim, spacedim >::FiniteElement().

◆ fe

template<int dim, int spacedim = dim>
std::unique_ptr<FiniteElement<dim, spacedim> > ParsedTools::FiniteElement< dim, spacedim >::fe
protected

The actual FiniteElement object.

Definition at line 214 of file finite_element.h.

Referenced by ParsedTools::FiniteElement< dim, spacedim >::FiniteElement().


The documentation for this class was generated from the following files: