Reference documentation for deal.II version 8.1.0
Classes | Public Member Functions | Private Types | Private Attributes | List of all members
SolutionTransfer< dim, VECTOR, DH > Class Template Reference

#include <solution_transfer.h>

Classes

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< VECTOR > &all_in)
 
void prepare_for_coarsening_and_refinement (const VECTOR &in)
 
void refine_interpolate (const VECTOR &in, VECTOR &out) const
 
void interpolate (const std::vector< VECTOR > &all_in, std::vector< VECTOR > &all_out) const
 
void interpolate (const VECTOR &in, VECTOR &out) const
 
std::size_t memory_consumption () const
 
 DeclException0 (ExcNotPrepared)
 
 DeclException0 (ExcAlreadyPrepForRef)
 
 DeclException0 (ExcAlreadyPrepForCoarseAndRef)
 
 DeclException0 (ExcTriaPrepCoarseningNotCalledBefore)
 
 DeclException0 (ExcNoInVectorsGiven)
 
 DeclException0 (ExcVectorsDifferFromInVectors)
 
 DeclException0 (ExcNumberOfDoFsPerCellHasChanged)
 

Private Types

enum  PreparationState { none, pure_refinement, coarsening_and_refinement }
 

Private Attributes

SmartPointer< const DH, SolutionTransfer< dim, VECTOR, DH > > dof_handler
 
types::global_dof_index n_dofs_old
 
PreparationState prepared_for
 
std::vector< std::vector< types::global_dof_index > > indices_on_cell
 
std::map< std::pair< unsigned int, unsigned int >, Pointerstructcell_map
 
std::vector< std::vector< Vector< typename VECTOR::value_type > > > dof_values_on_cell
 

Detailed Description

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

This class implements the transfer of a discrete FE function (e.g. a solution vector) from one mesh to another that is obtained by the first by a single refinement and/or coarsening step. 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

This class implements the algorithms in two different ways:

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

Definition at line 205 of file solution_transfer.h.

Member Enumeration Documentation

template<int dim, typename VECTOR = 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.

Definition at line 398 of file solution_transfer.h.

Constructor & Destructor Documentation

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

Constructor, takes the current DoFHandler as argument.

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

Destructor

Member Function Documentation

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

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

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
void SolutionTransfer< dim, VECTOR, 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 VECTOR = Vector<double>, class DH = DoFHandler<dim>>
void SolutionTransfer< dim, VECTOR, DH >::prepare_for_coarsening_and_refinement ( const std::vector< VECTOR > &  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 VECTOR = Vector<double>, class DH = DoFHandler<dim>>
void SolutionTransfer< dim, VECTOR, DH >::prepare_for_coarsening_and_refinement ( const VECTOR &  in)

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

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
void SolutionTransfer< dim, VECTOR, DH >::refine_interpolate ( const VECTOR &  in,
VECTOR &  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 VECTOR = Vector<double>, class DH = DoFHandler<dim>>
void SolutionTransfer< dim, VECTOR, DH >::interpolate ( const std::vector< VECTOR > &  all_in,
std::vector< VECTOR > &  all_out 
) const

This function interpolates the discrete functions that are stored in all_in 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 Triangulation::prepare_coarsening_and_refinement, second SolutionTransfer::prepare_for_coarsening_and_refinement, an then third Triangulation::execute_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 VECTOR = Vector<double>, class DH = DoFHandler<dim>>
void SolutionTransfer< dim, VECTOR, DH >::interpolate ( const VECTOR &  in,
VECTOR &  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 VECTOR = Vector<double>, class DH = DoFHandler<dim>>
std::size_t SolutionTransfer< dim, VECTOR, DH >::memory_consumption ( ) const

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

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
SolutionTransfer< dim, VECTOR, DH >::DeclException0 ( ExcNotPrepared  )

Exception

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
SolutionTransfer< dim, VECTOR, DH >::DeclException0 ( ExcAlreadyPrepForRef  )

Exception

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
SolutionTransfer< dim, VECTOR, DH >::DeclException0 ( ExcAlreadyPrepForCoarseAndRef  )

Exception

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
SolutionTransfer< dim, VECTOR, DH >::DeclException0 ( ExcTriaPrepCoarseningNotCalledBefore  )

Exception

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
SolutionTransfer< dim, VECTOR, DH >::DeclException0 ( ExcNoInVectorsGiven  )

Exception

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
SolutionTransfer< dim, VECTOR, DH >::DeclException0 ( ExcVectorsDifferFromInVectors  )

Exception

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
SolutionTransfer< dim, VECTOR, DH >::DeclException0 ( ExcNumberOfDoFsPerCellHasChanged  )

Exception

Member Data Documentation

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

Pointer to the degree of freedom handler to work with.

Definition at line 379 of file solution_transfer.h.

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
types::global_dof_index SolutionTransfer< dim, VECTOR, DH >::n_dofs_old
private

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

Definition at line 385 of file solution_transfer.h.

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

Definition of the respective variable.

Definition at line 406 of file solution_transfer.h.

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
std::vector<std::vector<types::global_dof_index> > SolutionTransfer< dim, VECTOR, 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

Definition at line 416 of file solution_transfer.h.

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
std::map<std::pair<unsigned int, unsigned int>, Pointerstruct> SolutionTransfer< dim, VECTOR, 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.

Definition at line 467 of file solution_transfer.h.

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
std::vector<std::vector<Vector<typename VECTOR::value_type> > > SolutionTransfer< dim, VECTOR, 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.

Definition at line 476 of file solution_transfer.h.


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