SolutionTransfer< dim, VectorType, DH > Class Template Reference
[Numerical algorithms]

List of all members.

Classes

class  ExcAlreadyPrepForCoarseAndRef
class  ExcAlreadyPrepForRef
class  ExcNoInVectorsGiven
class  ExcNotPrepared
class  ExcNumberOfDoFsPerCellHasChanged
class  ExcTriaPrepCoarseningNotCalledBefore
class  ExcVectorsDifferFromInVectors
class  ExcWrongVectorSize
struct  Pointerstruct

Public Member Functions

 SolutionTransfer (const DH &dof)
 ~SolutionTransfer ()
void clear ()
void prepare_for_pure_refinement ()
void prepare_for_coarsening_and_refinement (const std::vector< VectorType > &all_in)
void prepare_for_coarsening_and_refinement (const VectorType &in)
void refine_interpolate (const VectorType &in, VectorType &out) const
void interpolate (const std::vector< VectorType > &all_in, std::vector< VectorType > &all_out) const
void interpolate (const VectorType &in, VectorType &out) const
unsigned int memory_consumption () const

Private Types

enum  PreparationState { none, pure_refinement, coarsening_and_refinement }

Private Attributes

SmartPointer< const DH > dof_handler
unsigned int n_dofs_old
PreparationState prepared_for
std::vector< std::vector
< unsigned int > > 
indices_on_cell
std::map< std::pair< unsigned
int, unsigned int >
, Pointerstruct
cell_map
std::vector< std::vector
< Vector< typename
VectorType::value_type > > > 
dof_values_on_cell

Detailed Description

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
class SolutionTransfer< dim, VectorType, DH >

Transfers a discrete FE function (like a solution vector) by interpolation while refining and/or coarsening a grid. During interpolation the vector is reinitialized to the new size and filled with the interpolated values. This class is used in the step-15, step-31, and step-33 tutorial programs.

Usage

As the interpolation while coarsening is much more complicated to organize (see further documentation below) than interpolation while pure refinement, SolutionTransfer offers two possible usages.

For deleting all stored data in SolutionTransfer and reinitializing it use the clear() function.

The template argument number denotes the data type of the vectors you want to transfer.

Implementation

Author:
Ralf Hartmann, 1999

Member Enumeration Documentation

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
enum SolutionTransfer::PreparationState [private]

Declaration of PreparationState that denotes the three possible states of the SolutionTransfer: being prepared for 'pure refinement', prepared for 'coarsening and refinement' or not prepared.

Enumerator:
none 
pure_refinement 
coarsening_and_refinement 

Constructor & Destructor Documentation

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
SolutionTransfer< dim, VectorType, DH >::SolutionTransfer ( const DH &  dof  ) 

Constructor, takes the current DoFHandler as argument.

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
SolutionTransfer< dim, VectorType, DH >::~SolutionTransfer (  ) 

Destructor


Member Function Documentation

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
void SolutionTransfer< dim, VectorType, DH >::clear (  ) 

Reinit this class to the state that it has directly after calling the Constructor

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
void SolutionTransfer< dim, VectorType, DH >::prepare_for_pure_refinement (  ) 

Prepares the SolutionTransfer for pure refinement. It stores the dof indices of each cell. After calling this function only calling the refine_interpolate functions is allowed.

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
void SolutionTransfer< dim, VectorType, DH >::prepare_for_coarsening_and_refinement ( const std::vector< VectorType > &  all_in  ) 

Prepares the SolutionTransfer for coarsening and refinement. It stores the dof indices of each cell and stores the dof values of the vectors in all_in in each cell that'll be coarsened. all_in includes all vectors that are to be interpolated onto the new (refined and/or coarsenend) grid.

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
void SolutionTransfer< dim, VectorType, DH >::prepare_for_coarsening_and_refinement ( const VectorType &  in  ) 

Same as previous function but for only one discrete function to be interpolated.

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
void SolutionTransfer< dim, VectorType, DH >::refine_interpolate ( const VectorType &  in,
VectorType &  out 
) const

This function interpolates the discrete function in, which is a vector on the grid before the refinement, to the function out which then is a vector on the refined grid. It assumes the vectors having the right sizes (i.e. in.size()==n_dofs_old, out.size()==n_dofs_refined)

Calling this function is allowed only if prepare_for_pure_refinement is called and the refinement is executed before. Multiple calling of this function is allowed. e.g. for interpolating several functions.

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
void SolutionTransfer< dim, VectorType, DH >::interpolate ( const std::vector< VectorType > &  all_in,
std::vector< VectorType > &  all_out 
) const

This function interpolates the discrete functions that are stored in all_out onto the refined and/or coarsenend grid. It assumes the vectors in all_in denote the same vectors as in all_in as parameter of prepare_for_refinement_and_coarsening(all_in). However, there is no way of verifying this internally, so be careful here.

Calling this function is allowed only if first Triangulationprepare_coarsening_and_refinement, second SolutionTransfer::prepare_for_coarsening_and_refinement, an then third Triangulationexecute_coarsening_and_refinement are called before. Multiple calling of this function is NOT allowed. Interpolating several functions can be performed in one step.

The number of output vectors is assumed to be the same as the number of input vectors. Also, the sizes of the output vectors are assumed to be of the right size (n_dofs_refined). Otherwise an assertion will be thrown.

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
void SolutionTransfer< dim, VectorType, DH >::interpolate ( const VectorType &  in,
VectorType &  out 
) const

Same as the previous function. It interpolates only one function. It assumes the vectors having the right sizes (i.e. in.size()==n_dofs_old, out.size()==n_dofs_refined)

Multiple calling of this function is NOT allowed. Interpolating several functions can be performed in one step by using interpolate (all_in, all_out)

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
unsigned int SolutionTransfer< dim, VectorType, DH >::memory_consumption (  )  const

Determine an estimate for the memory consumption (in bytes) of this object.


Member Data Documentation

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
SmartPointer<const DH> SolutionTransfer< dim, VectorType, DH >::dof_handler [private]

Pointer to the degree of freedom handler to work with.

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
unsigned int SolutionTransfer< dim, VectorType, DH >::n_dofs_old [private]

Stores the number of DoFs before the refinement and/or coarsening.

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
PreparationState SolutionTransfer< dim, VectorType, DH >::prepared_for [private]

Definition of the respective variable.

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
std::vector<std::vector<unsigned int> > SolutionTransfer< dim, VectorType, DH >::indices_on_cell [private]

Is used for prepare_for_refining (of course also for repare_for_refining_and_coarsening) and stores all dof indices of the cells that'll be refined

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
std::map<std::pair<unsigned int, unsigned int>, Pointerstruct> SolutionTransfer< dim, VectorType, DH >::cell_map [private]

Map mapping from level and index of cell to the Pointerstructs (cf. there). This map makes it possible to keep all the information needed to transfer the solution inside this object rather than using user pointers of the Triangulation for this purpose.

template<int dim, typename VectorType = Vector<double>, class DH = DoFHandler<dim>>
std::vector<std::vector<Vector<typename VectorType::value_type> > > SolutionTransfer< dim, VectorType, DH >::dof_values_on_cell [private]

Is used for prepare_for_refining_and_coarsening The interpolated dof values of all cells that'll be coarsened will be stored in this vector.


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

deal.II documentation generated on Mon Nov 23 22:58:04 2009 by doxygen 1.6.1