GetFEM++  5.3
getfem::mesh_fem Class Reference

Describe a finite element method linked to a mesh. More...

#include <getfem_mesh_fem.h>

Inherits getfem::context_dependencies, and dal::static_stored_object.

Inherited by getfem::mesh_fem_global_function, getfem::mesh_fem_level_set, getfem::mesh_fem_product, getfem::mesh_fem_sum, getfem::partial_mesh_fem, and getfem::torus_mesh_fem.

Public Member Functions

void update_from_context () const
 this function has to be defined and should update the object when the context is modified. More...
 
const dal::bit_vector & convex_index () const
 Get the set of convexes where a finite element has been assigned.
 
bool is_reduced () const
 Return true if a reduction matrix is applied to the dofs.
 
const REDUCTION_MATRIX & reduction_matrix () const
 Return the reduction matrix applied to the dofs.
 
const EXTENSION_MATRIX & extension_matrix () const
 Return the extension matrix corresponding to reduction applied (RE=I).
 
template<typename MATR , typename MATE >
void set_reduction_matrices (const MATR &RR, const MATE &EE)
 Allows to set the reduction and the extension matrices. More...
 
void reduce_to_basic_dof (const dal::bit_vector &kept_basic_dof)
 Allows to set the reduction and the extension matrices in order to keep only a certain number of dof. More...
 
void set_reduction (bool r)
 Validate or invalidate the reduction (keeping the reduction matrices).
 
const meshlinked_mesh () const
 Return a reference to the underlying mesh.
 
void set_auto_add (dim_type K, bool disc=false, scalar_type alpha=scalar_type(0), bool complete=false)
 Set the degree of the fem for automatic addition of element option. More...
 
void set_auto_add (pfem pf)
 Set the fem for automatic addition of element option. More...
 
virtual dim_type get_qdim () const
 Return the Q dimension. More...
 
virtual void set_qdim (dim_type q)
 Change the Q dimension.
 
virtual void set_qdim (dim_type M, dim_type N)
 Set the dimension for a matrix field. More...
 
virtual void set_qdim (dim_type M, dim_type N, dim_type O, dim_type P)
 Set the dimension for a fourth order tensor field. More...
 
virtual void set_qdim (const bgeot::multi_index &mii)
 Set the dimension for an arbitrary order tensor field. More...
 
dim_type get_qdim_m () const IS_DEPRECATED
 for matrix fields, return the number of rows. More...
 
dim_type get_qdim_n () const IS_DEPRECATED
 for matrix fields, return the number of columns. More...
 
void set_finite_element (size_type cv, pfem pf)
 Set the finite element method of a convex. More...
 
void set_finite_element (const dal::bit_vector &cvs, pfem pf)
 Set the finite element on a set of convexes. More...
 
void set_finite_element (pfem pf)
 shortcut for set_finite_element(linked_mesh().convex_index(),pf); and set_auto_add(pf). More...
 
void set_classical_finite_element (size_type cv, dim_type fem_degree, bool complete=false)
 Set a classical (i.e. More...
 
void set_classical_finite_element (const dal::bit_vector &cvs, dim_type fem_degree, bool complete=false)
 Set a classical (i.e. More...
 
void set_classical_discontinuous_finite_element (size_type cv, dim_type fem_degree, scalar_type alpha=0, bool complete=false)
 Similar to set_classical_finite_element, but uses discontinuous lagrange elements. More...
 
void set_classical_discontinuous_finite_element (const dal::bit_vector &cvs, dim_type fem_degree, scalar_type alpha=0, bool complete=false)
 Similar to set_classical_finite_element, but uses discontinuous lagrange elements. More...
 
void set_classical_finite_element (dim_type fem_degree, bool complete=false)
 Shortcut for set_classical_finite_element(linked_mesh().convex_index(),...)
 
void set_classical_discontinuous_finite_element (dim_type fem_degree, scalar_type alpha=0, bool complete=false)
 Shortcut for set_classical_discontinuous_finite_element(linked_mesh().convex_index() ,...)
 
virtual pfem fem_of_element (size_type cv) const
 Return the basic fem associated with an element (if no fem is associated, the function will crash! use the convex_index() of the mesh_fem to check that a fem is associated to a given convex). More...
 
virtual ind_dof_ct ind_basic_dof_of_element (size_type cv) const
 Give an array of the dof numbers a of convex. More...
 
virtual ind_dof_face_ct ind_basic_dof_of_face_of_element (size_type cv, short_type f) const
 Give an array of the dof numbers lying of a convex face (all degrees of freedom whose associated base function is non-zero on the convex face). More...
 
virtual size_type nb_basic_dof_of_face_of_element (size_type cv, short_type f) const
 Return the number of dof lying on the given convex face. More...
 
virtual size_type nb_basic_dof_of_element (size_type cv) const
 Return the number of degrees of freedom attached to a given convex. More...
 
virtual base_node point_of_basic_dof (size_type cv, size_type i) const
 Return the geometrical location of a degree of freedom. More...
 
virtual base_node point_of_basic_dof (size_type d) const
 Return the geometrical location of a degree of freedom. More...
 
virtual dim_type basic_dof_qdim (size_type d) const
 Return the dof component number (0<= x <Qdim)
 
virtual size_type first_convex_of_basic_dof (size_type d) const
 Shortcut for convex_to_dof(d)[0]. More...
 
virtual const mesh::ind_cv_ct & convex_to_basic_dof (size_type d) const
 Return the list of convexes attached to the specified dof. More...
 
virtual void get_global_dof_index (std::vector< size_type > &ind) const
 Give an array that contains the global dof indices corresponding to the mesh_fem dofs or size_type(-1) if a dof is not global. More...
 
virtual void enumerate_dof () const
 Renumber the degrees of freedom. More...
 
virtual size_type nb_basic_dof () const
 Return the total number of basic degrees of freedom (before the optional reduction). More...
 
virtual size_type nb_dof () const
 Return the total number of degrees of freedom.
 
virtual dal::bit_vector basic_dof_on_region (const mesh_region &b) const
 Get a list of basic dof lying on a given mesh_region. More...
 
dal::bit_vector dof_on_region (const mesh_region &b) const
 Get a list of dof lying on a given mesh_region. More...
 
 mesh_fem (const mesh &me, dim_type Q=1)
 Build a new mesh_fem. More...
 
virtual void read_from_file (std::istream &ist)
 Read the mesh_fem from a stream. More...
 
void read_from_file (const std::string &name)
 Read the mesh_fem from a file. More...
 
virtual void write_to_file (std::ostream &ost) const
 Write the mesh_fem to a stream. More...
 
void write_to_file (const std::string &name, bool with_mesh=false) const
 Write the mesh_fem to a file. More...
 
- Public Member Functions inherited from getfem::context_dependencies
bool context_check () const
 return true if update_from_context was called
 

Detailed Description

Describe a finite element method linked to a mesh.

See also
mesh
mesh_im

Definition at line 148 of file getfem_mesh_fem.h.

Constructor & Destructor Documentation

getfem::mesh_fem::mesh_fem ( const mesh me,
dim_type  Q = 1 
)
explicit

Build a new mesh_fem.

A mesh object must be supplied.

Parameters
methe linked mesh.
Qthe Q dimension (see mesh_fem::get_qdim).

Definition at line 528 of file getfem_mesh_fem.cc.

Member Function Documentation

void getfem::mesh_fem::update_from_context ( ) const
virtual

this function has to be defined and should update the object when the context is modified.

Implements getfem::context_dependencies.

Reimplemented in getfem::mesh_fem_sum, and getfem::partial_mesh_fem.

Definition at line 30 of file getfem_mesh_fem.cc.

template<typename MATR , typename MATE >
void getfem::mesh_fem::set_reduction_matrices ( const MATR &  RR,
const MATE &  EE 
)
inline

Allows to set the reduction and the extension matrices.

Should satify (RR*EE=I).

Definition at line 206 of file getfem_mesh_fem.h.

void getfem::mesh_fem::reduce_to_basic_dof ( const dal::bit_vector &  kept_basic_dof)

Allows to set the reduction and the extension matrices in order to keep only a certain number of dof.

Definition at line 450 of file getfem_mesh_fem.cc.

void getfem::mesh_fem::set_auto_add ( dim_type  K,
bool  disc = false,
scalar_type  alpha = scalar_type(0),
bool  complete = false 
)
inline

Set the degree of the fem for automatic addition of element option.

K=-1 disables the automatic addition.

Definition at line 286 of file getfem_mesh_fem.h.

void getfem::mesh_fem::set_auto_add ( pfem  pf)
inline

Set the fem for automatic addition of element option.

pf=0 disables the automatic addition.

Definition at line 299 of file getfem_mesh_fem.h.

virtual dim_type getfem::mesh_fem::get_qdim ( ) const
inlinevirtual

Return the Q dimension.

A mesh_fem used for scalar fields has Q=1, for vector fields, Q is typically equal to linked_mesh().dim().

Reimplemented in getfem::partial_mesh_fem.

Definition at line 311 of file getfem_mesh_fem.h.

virtual void getfem::mesh_fem::set_qdim ( dim_type  M,
dim_type  N 
)
inlinevirtual

Set the dimension for a matrix field.

Reimplemented in getfem::partial_mesh_fem.

Definition at line 323 of file getfem_mesh_fem.h.

virtual void getfem::mesh_fem::set_qdim ( dim_type  M,
dim_type  N,
dim_type  O,
dim_type  P 
)
inlinevirtual

Set the dimension for a fourth order tensor field.

Reimplemented in getfem::partial_mesh_fem.

Definition at line 331 of file getfem_mesh_fem.h.

virtual void getfem::mesh_fem::set_qdim ( const bgeot::multi_index &  mii)
inlinevirtual

Set the dimension for an arbitrary order tensor field.

Reimplemented in getfem::partial_mesh_fem.

Definition at line 341 of file getfem_mesh_fem.h.

dim_type getfem::mesh_fem::get_qdim_m ( ) const
inline

for matrix fields, return the number of rows.

Definition at line 360 of file getfem_mesh_fem.h.

dim_type getfem::mesh_fem::get_qdim_n ( ) const
inline

for matrix fields, return the number of columns.

Definition at line 362 of file getfem_mesh_fem.h.

void getfem::mesh_fem::set_finite_element ( size_type  cv,
pfem  pf 
)

Set the finite element method of a convex.

Parameters
cvthe convex number.
pfthe finite element.

Definition at line 127 of file getfem_mesh_fem.cc.

void getfem::mesh_fem::set_finite_element ( const dal::bit_vector &  cvs,
pfem  pf 
)

Set the finite element on a set of convexes.

Parameters
cvsthe set of convex indexes, as a dal::bit_vector.
pfthe finite element, typically obtained with
getfem::fem_descriptor("FEM_SOMETHING(..)")

Definition at line 166 of file getfem_mesh_fem.cc.

void getfem::mesh_fem::set_finite_element ( pfem  pf)

shortcut for set_finite_element(linked_mesh().convex_index(),pf); and set_auto_add(pf).

Definition at line 171 of file getfem_mesh_fem.cc.

void getfem::mesh_fem::set_classical_finite_element ( size_type  cv,
dim_type  fem_degree,
bool  complete = false 
)

Set a classical (i.e.

lagrange polynomial) finite element on a convex.

Parameters
cvis the convex number.
fem_degreethe polynomial degree of the finite element.
completeis a flag for excluding incomplete element irrespective of the element geometric transformation.

Definition at line 174 of file getfem_mesh_fem.cc.

void getfem::mesh_fem::set_classical_finite_element ( const dal::bit_vector &  cvs,
dim_type  fem_degree,
bool  complete = false 
)

Set a classical (i.e.

lagrange polynomial) finite element on a set of convexes.

Parameters
cvsthe set of convexes, as a dal::bit_vector.
fem_degreethe polynomial degree of the finite element.

Definition at line 182 of file getfem_mesh_fem.cc.

void getfem::mesh_fem::set_classical_discontinuous_finite_element ( size_type  cv,
dim_type  fem_degree,
scalar_type  alpha = 0,
bool  complete = false 
)

Similar to set_classical_finite_element, but uses discontinuous lagrange elements.

Parameters
cvthe convex index.
fem_degreethe polynomial degree of the finite element.
alphathe node inset, 0 <= alpha < 1, where 0 implies usual dof nodes, greater values move the nodes toward the center of gravity, and 1 means that all degrees of freedom collapse on the center of gravity.

Definition at line 200 of file getfem_mesh_fem.cc.

void getfem::mesh_fem::set_classical_discontinuous_finite_element ( const dal::bit_vector &  cvs,
dim_type  fem_degree,
scalar_type  alpha = 0,
bool  complete = false 
)

Similar to set_classical_finite_element, but uses discontinuous lagrange elements.

Parameters
cvsthe set of convexes, as a dal::bit_vector.
fem_degreethe polynomial degree of the finite element.
alphathe node inset, 0 <= alpha < 1, where 0 implies usual dof nodes, greater values move the nodes toward the center of gravity, and 1 means that all degrees of freedom collapse on the center of gravity.

Definition at line 207 of file getfem_mesh_fem.cc.

virtual pfem getfem::mesh_fem::fem_of_element ( size_type  cv) const
inlinevirtual

Return the basic fem associated with an element (if no fem is associated, the function will crash! use the convex_index() of the mesh_fem to check that a fem is associated to a given convex).

This fem does not take into account the optional vectorization due to qdim nor the optional reduction.

Reimplemented in getfem::partial_mesh_fem.

Definition at line 443 of file getfem_mesh_fem.h.

virtual ind_dof_ct getfem::mesh_fem::ind_basic_dof_of_element ( size_type  cv) const
inlinevirtual

Give an array of the dof numbers a of convex.

Parameters
cvthe convex number.
Returns
a pseudo-container of the dof number.

Reimplemented in getfem::partial_mesh_fem.

Definition at line 449 of file getfem_mesh_fem.h.

virtual ind_dof_face_ct getfem::mesh_fem::ind_basic_dof_of_face_of_element ( size_type  cv,
short_type  f 
) const
inlinevirtual

Give an array of the dof numbers lying of a convex face (all degrees of freedom whose associated base function is non-zero on the convex face).

Parameters
cvthe convex number.
fthe face number.
Returns
a pseudo-container of the dof number.

Reimplemented in getfem::partial_mesh_fem.

Definition at line 467 of file getfem_mesh_fem.h.

virtual size_type getfem::mesh_fem::nb_basic_dof_of_face_of_element ( size_type  cv,
short_type  f 
) const
inlinevirtual

Return the number of dof lying on the given convex face.

Parameters
cvthe convex number.
fthe face number.

Reimplemented in getfem::partial_mesh_fem.

Definition at line 480 of file getfem_mesh_fem.h.

virtual size_type getfem::mesh_fem::nb_basic_dof_of_element ( size_type  cv) const
inlinevirtual

Return the number of degrees of freedom attached to a given convex.

Parameters
cvthe convex number.

Reimplemented in getfem::partial_mesh_fem.

Definition at line 493 of file getfem_mesh_fem.h.

base_node getfem::mesh_fem::point_of_basic_dof ( size_type  cv,
size_type  i 
) const
virtual

Return the geometrical location of a degree of freedom.

Parameters
cvthe convex number.
ithe local dof number.

Reimplemented in getfem::partial_mesh_fem.

Definition at line 223 of file getfem_mesh_fem.cc.

base_node getfem::mesh_fem::point_of_basic_dof ( size_type  d) const
virtual

Return the geometrical location of a degree of freedom.

Parameters
dthe global dof number.

Reimplemented in getfem::partial_mesh_fem.

Definition at line 231 of file getfem_mesh_fem.cc.

size_type getfem::mesh_fem::first_convex_of_basic_dof ( size_type  d) const
virtual

Shortcut for convex_to_dof(d)[0].

Parameters
dthe global dof number.

Reimplemented in getfem::partial_mesh_fem.

Definition at line 258 of file getfem_mesh_fem.cc.

const mesh::ind_cv_ct & getfem::mesh_fem::convex_to_basic_dof ( size_type  d) const
virtual

Return the list of convexes attached to the specified dof.

Parameters
dthe global dof number.
Returns
an array of convex numbers.

Reimplemented in getfem::partial_mesh_fem.

Definition at line 267 of file getfem_mesh_fem.cc.

void getfem::mesh_fem::get_global_dof_index ( std::vector< size_type > &  ind) const
virtual

Give an array that contains the global dof indices corresponding to the mesh_fem dofs or size_type(-1) if a dof is not global.

Parameters
indthe returned global dof indices array.

Definition at line 293 of file getfem_mesh_fem.cc.

void getfem::mesh_fem::enumerate_dof ( void  ) const
virtual

Renumber the degrees of freedom.

Enumeration of dofs.

You should not have to call this function, as it is done automatically

Reimplemented in getfem::torus_mesh_fem.

Definition at line 321 of file getfem_mesh_fem.cc.

virtual size_type getfem::mesh_fem::nb_basic_dof ( void  ) const
inlinevirtual

Return the total number of basic degrees of freedom (before the optional reduction).

Reimplemented in getfem::partial_mesh_fem.

Definition at line 555 of file getfem_mesh_fem.h.

dal::bit_vector getfem::mesh_fem::basic_dof_on_region ( const mesh_region b) const
virtual

Get a list of basic dof lying on a given mesh_region.

Parameters
bthe mesh_region.
Returns
the list in a dal::bit_vector.

Reimplemented in getfem::partial_mesh_fem.

Definition at line 77 of file getfem_mesh_fem.cc.

dal::bit_vector getfem::mesh_fem::dof_on_region ( const mesh_region b) const

Get a list of dof lying on a given mesh_region.

For a reduced mesh_fem a dof is lying on a region if its potential corresponding shape function is nonzero on this region. The extension matrix is used to make the correspondance between basic and reduced dofs.

Parameters
bthe mesh_region.
Returns
the list in a dal::bit_vector.

Definition at line 114 of file getfem_mesh_fem.cc.

void getfem::mesh_fem::read_from_file ( std::istream &  ist)
virtual

Read the mesh_fem from a stream.

Parameters
istthe stream.

Reimplemented in getfem::partial_mesh_fem.

Definition at line 540 of file getfem_mesh_fem.cc.

void getfem::mesh_fem::read_from_file ( const std::string &  name)

Read the mesh_fem from a file.

Parameters
namethe file name.

Definition at line 704 of file getfem_mesh_fem.cc.

void getfem::mesh_fem::write_to_file ( std::ostream &  ost) const
virtual

Write the mesh_fem to a stream.

Reimplemented in getfem::partial_mesh_fem.

Definition at line 777 of file getfem_mesh_fem.cc.

void getfem::mesh_fem::write_to_file ( const std::string &  name,
bool  with_mesh = false 
) const

Write the mesh_fem to a file.

Parameters
namethe file name
with_meshif set, then the linked_mesh() will also be saved to the file.

Definition at line 786 of file getfem_mesh_fem.cc.


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