deal2lkit: A ToolKit library for Deal.II
ParsedZeroAverageConstraints< dim, spacedim > Class Template Reference

ParsedZeroAverageConstraints class. More...

#include <parsed_zero_average_constraints.h>

Inheritance diagram for ParsedZeroAverageConstraints< dim, spacedim >:
ParameterAcceptor Subscriptor

Public Member Functions

 ParsedZeroAverageConstraints (const std::string &name, const unsigned int &n_components=1, const std::string &component_names="", const std::string &default_components="", const std::string &default_boundary_components="")
 Constructor. More...
 
void apply_zero_average_constraints (const DoFHandler< dim, spacedim > &dof_handler, ConstraintMatrix &constraints) const
 Compute the zero average constraints and apply them on the given constraint matrix. More...
 
ComponentMask get_boundary_mask () const
 return the ComponentMask at boundary More...
 
ComponentMask get_mask () const
 return the ComponentMask More...
 
virtual void declare_parameters (ParameterHandler &prm)
 declare_parameters is inherithed by ParameterAcceptor More...
 
virtual void parse_parameters_call_back ()
 parse_parameters_call_back is inherithed by ParameterAcceptor More...
 
 DeclException2 (ExcWrongComponent, unsigned int, unsigned int,<< "Wrong component number has been used: "<< arg1<< " is not in the range [0, "<< arg2<<").")
 Wrong number of component mask. More...
 
 DeclException2 (ExcWrongVariable, std::string, std::vector< std::string >,<< "Wrong variabile name has been used: "<< arg1<< " does not belong to the knwon variables: "<< print(unique(arg2))<<".")
 Wrong variable name. More...
 
- Public Member Functions inherited from ParameterAcceptor
 ParameterAcceptor (const std::string section_name="")
 The constructor adds derived classes to the list of acceptors. More...
 
virtual ~ParameterAcceptor ()
 The destructor sets to zero the pointer relative to this index, so that it is safe to destroy the mother class. More...
 
virtual void parse_parameters (ParameterHandler &prm)
 Parse the parameter file. More...
 
std::string get_section_name () const
 Return the section name of this class. More...
 
std::vector< std::string > get_section_path () const
 Travers all registered classes, and figure out what subsections we need to enter. More...
 
template<class T >
void add_parameter (ParameterHandler &prm, T *parameter, const std::string &entry, const std::string &default_value, const Patterns::PatternBase &pattern=Patterns::Anything(), const std::string &documentation=std::string())
 Add a parameter the given parameter list. More...
 
template<class T >
void add_parameter (T &parameter, const std::string &entry, const std::string &documentation=std::string(), ParameterHandler &prm=ParameterAcceptor::prm)
 Add a parameter to the global parameter handler ParameterAcceptor::prm. More...
 
void enter_my_subsection (ParameterHandler &prm)
 Make sure we enter the right subsection of the global parameter file. More...
 
void leave_my_subsection (ParameterHandler &prm)
 This function undoes what the enter_my_subsection() function did. More...
 
template<>
std_cxx11::shared_ptr< Patterns::PatternBaseto_pattern (const double &)
 double More...
 
template<>
std::string to_string (const double &entry)
 
template<>
double to_type (const std::string &parameter)
 
template<>
std_cxx11::shared_ptr< Patterns::PatternBaseto_pattern (const int &)
 int More...
 
template<>
std::string to_string (const int &entry)
 
template<>
int to_type (const std::string &parameter)
 
template<>
std_cxx11::shared_ptr< Patterns::PatternBaseto_pattern (const unsigned int &)
 unsigned int More...
 
template<>
std::string to_string (const unsigned int &entry)
 
template<>
unsigned int to_type (const std::string &parameter)
 
template<>
std_cxx11::shared_ptr< Patterns::PatternBaseto_pattern (const bool &)
 bool More...
 
template<>
std::string to_string (const bool &entry)
 
template<>
bool to_type (const std::string &parameter)
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
 Subscriptor (Subscriptor &&)
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
Subscriptoroperator= (Subscriptor &&)
 
void subscribe (const char *identifier=0) const
 
void unsubscribe (const char *identifier=0) const
 
unsigned int n_subscriptions () const
 
void list_subscribers () const
 
void serialize (Archive &ar, const unsigned int version)
 

Protected Member Functions

void internal_zero_average_constraints (const DoFHandler< dim, spacedim > &dof_handler, const ComponentMask mask, const bool at_boundary, ConstraintMatrix &constraints) const
 
template<>
void internal_zero_average_constraints (const DoFHandler< 1, 1 > &, const ComponentMask, const bool, ConstraintMatrix &) const
 
template<>
void internal_zero_average_constraints (const DoFHandler< 1, 2 > &, const ComponentMask, const bool, ConstraintMatrix &) const
 
template<>
void internal_zero_average_constraints (const DoFHandler< 1, 3 > &, const ComponentMask, const bool, ConstraintMatrix &) const
 

Protected Attributes

std::string name
 
std::string str_components
 
std::string str_boundary_components
 
std::string str_component_names
 
std::vector< std::string > _component_names
 
std::vector< std::string > boundary_components
 
std::vector< std::string > components
 
std::vector< bool > mask
 
std::vector< bool > boundary_mask
 
const unsigned int n_components
 
- Protected Attributes inherited from ParameterAcceptor
const std::string section_name
 The subsection name for this class. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ParameterAcceptor
static void initialize (const std::string filename="", const std::string outfilename="")
 Call declare_all_parameters(), read filename (if it is present as input parameter) and parse_all_parameters() on the static member prm. More...
 
static void clear ()
 Clear class list and global parameter file. More...
 
static void parse_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm)
 Parse the given ParameterHandler. More...
 
static void log_info ()
 Print information about all stored classes. More...
 
static void declare_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm)
 Initialize the ParameterHandler with all derived classes parameters.This function enters the subsection returned by get_section_name() for each derived class, and declares all parameters that were added using add_parameter(). More...
 
template<class T >
static std_cxx11::shared_ptr< Patterns::PatternBaseto_pattern (const T &)
 Given a class T, construct its default pattern to be used when declaring parameters. More...
 
template<class T >
static T to_type (const std::string &)
 Given a string, fill the value of the given parameter. More...
 
template<class T >
static std::string to_string (const T &)
 Given a parameter, return a string containing the given parameter. More...
 
- Static Public Member Functions inherited from Subscriptor
static::ExceptionBase & ExcInUse (int arg1, char *arg2, std::string &arg3)
 
static::ExceptionBase & ExcNoSubscriber (char *arg1, char *arg2)
 
- Static Public Attributes inherited from ParameterAcceptor
static ParameterHandler prm
 Static parameter. More...
 

Detailed Description

template<int dim, int spacedim = dim>
class ParsedZeroAverageConstraints< dim, spacedim >

ParsedZeroAverageConstraints class.

It allows you to set a zero average constraint to a ConstraintMatrix. The variable to be constrained (e.g. the pressure for Stokes problem) can be specified in the parameter file either by its component name (e.g. "p") or by the component number.

The zero mean value can be set on the whole domain, or on the boundary.

A typical usage of this class is as follows:

ParsedZeroAverageConstraints<dim> pnac("Parsed Zero Average Constraints",
dim+1,
(dim==2?"u,u,p":"u,u,u,p"),
"p");
pnac.apply_zero_average_constraints(dof_handler,cm);

Definition at line 65 of file parsed_zero_average_constraints.h.

Constructor & Destructor Documentation

§ ParsedZeroAverageConstraints()

template<int dim, int spacedim>
ParsedZeroAverageConstraints< dim, spacedim >::ParsedZeroAverageConstraints ( const std::string &  name,
const unsigned int &  n_components = 1,
const std::string &  component_names = "",
const std::string &  default_components = "",
const std::string &  default_boundary_components = "" 
)

Constructor.

It takes:

  • the name for the section of the Parameter Handler to use
  • the number of components that this function has
  • the default names of known components that can be used instead of component numbers. If empty, in the parameter file will be filled with n_components 'u'
  • a list of components, separated by a "," (i.e. 0,p,5), that are to be constrained on the whole domain
  • a list of components, separated by a "," (i.e. 0,p,5), that are to be constrained on the boundary

Definition at line 25 of file parsed_zero_average_constraints.cc.

Member Function Documentation

§ apply_zero_average_constraints()

template<int dim, int spacedim>
void ParsedZeroAverageConstraints< dim, spacedim >::apply_zero_average_constraints ( const DoFHandler< dim, spacedim > &  dof_handler,
ConstraintMatrix constraints 
) const

Compute the zero average constraints and apply them on the given constraint matrix.

Definition at line 203 of file parsed_zero_average_constraints.cc.

§ declare_parameters()

template<int dim, int spacedim>
void ParsedZeroAverageConstraints< dim, spacedim >::declare_parameters ( ParameterHandler prm)
virtual

declare_parameters is inherithed by ParameterAcceptor

Reimplemented from ParameterAcceptor.

Definition at line 103 of file parsed_zero_average_constraints.cc.

§ DeclException2() [1/2]

template<int dim, int spacedim = dim>
ParsedZeroAverageConstraints< dim, spacedim >::DeclException2 ( ExcWrongComponent  ,
unsigned  int,
unsigned  int,
<< "Wrong component number has been used: "<< arg1<< " is not in the range [  0,
"<< arg2<<"   
)

Wrong number of component mask.

§ DeclException2() [2/2]

template<int dim, int spacedim = dim>
ParsedZeroAverageConstraints< dim, spacedim >::DeclException2 ( ExcWrongVariable  ,
std::string  ,
std::vector< std::string >  ,
<< "Wrong variabile name has been used: "<< arg1<< " does not belong to the knwon variables: "<< print(unique(arg2))<<"."   
)

Wrong variable name.

§ get_boundary_mask()

template<int dim, int spacedim>
ComponentMask ParsedZeroAverageConstraints< dim, spacedim >::get_boundary_mask ( ) const

return the ComponentMask at boundary

Definition at line 96 of file parsed_zero_average_constraints.cc.

§ get_mask()

template<int dim, int spacedim>
ComponentMask ParsedZeroAverageConstraints< dim, spacedim >::get_mask ( ) const

return the ComponentMask

Definition at line 89 of file parsed_zero_average_constraints.cc.

§ internal_zero_average_constraints() [1/4]

template<int dim, int spacedim>
void ParsedZeroAverageConstraints< dim, spacedim >::internal_zero_average_constraints ( const DoFHandler< dim, spacedim > &  dof_handler,
const ComponentMask  mask,
const bool  at_boundary,
ConstraintMatrix constraints 
) const
protected

Definition at line 171 of file parsed_zero_average_constraints.cc.

§ internal_zero_average_constraints() [2/4]

template<>
void ParsedZeroAverageConstraints< 1, 1 >::internal_zero_average_constraints ( const DoFHandler< 1, 1 > &  ,
const ComponentMask  ,
const bool  ,
ConstraintMatrix  
) const
protected

Definition at line 140 of file parsed_zero_average_constraints.cc.

§ internal_zero_average_constraints() [3/4]

template<>
void ParsedZeroAverageConstraints< 1, 2 >::internal_zero_average_constraints ( const DoFHandler< 1, 2 > &  ,
const ComponentMask  ,
const bool  ,
ConstraintMatrix  
) const
protected

Definition at line 150 of file parsed_zero_average_constraints.cc.

§ internal_zero_average_constraints() [4/4]

template<>
void ParsedZeroAverageConstraints< 1, 3 >::internal_zero_average_constraints ( const DoFHandler< 1, 3 > &  ,
const ComponentMask  ,
const bool  ,
ConstraintMatrix  
) const
protected

Definition at line 160 of file parsed_zero_average_constraints.cc.

§ parse_parameters_call_back()

template<int dim, int spacedim>
void ParsedZeroAverageConstraints< dim, spacedim >::parse_parameters_call_back ( )
virtual

parse_parameters_call_back is inherithed by ParameterAcceptor

Reimplemented from ParameterAcceptor.

Definition at line 41 of file parsed_zero_average_constraints.cc.

Member Data Documentation

§ _component_names

template<int dim, int spacedim = dim>
std::vector<std::string> ParsedZeroAverageConstraints< dim, spacedim >::_component_names
protected

Definition at line 148 of file parsed_zero_average_constraints.h.

§ boundary_components

template<int dim, int spacedim = dim>
std::vector<std::string> ParsedZeroAverageConstraints< dim, spacedim >::boundary_components
protected

Definition at line 149 of file parsed_zero_average_constraints.h.

§ boundary_mask

template<int dim, int spacedim = dim>
std::vector<bool> ParsedZeroAverageConstraints< dim, spacedim >::boundary_mask
protected

Definition at line 153 of file parsed_zero_average_constraints.h.

§ components

template<int dim, int spacedim = dim>
std::vector<std::string> ParsedZeroAverageConstraints< dim, spacedim >::components
protected

Definition at line 150 of file parsed_zero_average_constraints.h.

§ mask

template<int dim, int spacedim = dim>
std::vector<bool> ParsedZeroAverageConstraints< dim, spacedim >::mask
protected

Definition at line 152 of file parsed_zero_average_constraints.h.

§ n_components

template<int dim, int spacedim = dim>
const unsigned int ParsedZeroAverageConstraints< dim, spacedim >::n_components
protected

Definition at line 155 of file parsed_zero_average_constraints.h.

§ name

template<int dim, int spacedim = dim>
std::string ParsedZeroAverageConstraints< dim, spacedim >::name
protected

Definition at line 144 of file parsed_zero_average_constraints.h.

§ str_boundary_components

template<int dim, int spacedim = dim>
std::string ParsedZeroAverageConstraints< dim, spacedim >::str_boundary_components
protected

Definition at line 146 of file parsed_zero_average_constraints.h.

§ str_component_names

template<int dim, int spacedim = dim>
std::string ParsedZeroAverageConstraints< dim, spacedim >::str_component_names
protected

Definition at line 147 of file parsed_zero_average_constraints.h.

§ str_components

template<int dim, int spacedim = dim>
std::string ParsedZeroAverageConstraints< dim, spacedim >::str_components
protected

Definition at line 145 of file parsed_zero_average_constraints.h.


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