Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes

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

List of all members.

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

Static Public Member Functions

::ExceptionBaseExcNotPrepared ()
::ExceptionBaseExcAlreadyPrepForRef ()
::ExceptionBaseExcAlreadyPrepForCoarseAndRef ()
::ExceptionBaseExcTriaPrepCoarseningNotCalledBefore ()
::ExceptionBaseExcNoInVectorsGiven ()
::ExceptionBaseExcVectorsDifferFromInVectors ()
::ExceptionBaseExcNumberOfDoFsPerCellHasChanged ()

Private Types

enum  PreparationState { none, pure_refinement, coarsening_and_refinement }

Private Attributes

SmartPointer< const DH,
SolutionTransfer< dim, VECTOR,
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
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 200 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.

Enumerator:
none 
pure_refinement 
coarsening_and_refinement 

Definition at line 393 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_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 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>>
::ExceptionBase& SolutionTransfer< dim, VECTOR, DH >::ExcNotPrepared (  ) [static]

Exception

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
::ExceptionBase& SolutionTransfer< dim, VECTOR, DH >::ExcAlreadyPrepForRef (  ) [static]

Exception

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
::ExceptionBase& SolutionTransfer< dim, VECTOR, DH >::ExcAlreadyPrepForCoarseAndRef (  ) [static]

Exception

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
::ExceptionBase& SolutionTransfer< dim, VECTOR, DH >::ExcTriaPrepCoarseningNotCalledBefore (  ) [static]

Exception

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
::ExceptionBase& SolutionTransfer< dim, VECTOR, DH >::ExcNoInVectorsGiven (  ) [static]

Exception

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
::ExceptionBase& SolutionTransfer< dim, VECTOR, DH >::ExcVectorsDifferFromInVectors (  ) [static]

Exception

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
::ExceptionBase& SolutionTransfer< dim, VECTOR, DH >::ExcNumberOfDoFsPerCellHasChanged (  ) [static]

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 374 of file solution_transfer.h.

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

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

Definition at line 380 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 400 of file solution_transfer.h.

template<int dim, typename VECTOR = Vector<double>, class DH = DoFHandler<dim>>
std::vector<std::vector<unsigned int> > 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 410 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 448 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 457 of file solution_transfer.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

deal.II documentation generated on Fri Feb 3 2012 06:04:11 by doxygen 1.7.2