Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
solution_transfer.h
1 // ---------------------------------------------------------------------
2 // @f$Id: solution_transfer.h 30036 2013-07-18 16:55:32Z maier @f$
3 //
4 // Copyright (C) 1999 - 2013 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // The deal.II library is free software; you can use it, redistribute
9 // it, and/or modify it under the terms of the GNU Lesser General
10 // Public License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 // The full text of the license can be found in the file LICENSE at
13 // the top level of the deal.II distribution.
14 //
15 // ---------------------------------------------------------------------
16 
17 #ifndef __deal2__solution_transfer_h
18 #define __deal2__solution_transfer_h
19 
20 
21 /*---------------------------- solutiontransfer.h ----------------------*/
22 
23 
24 #include <deal.II/base/config.h>
25 #include <deal.II/base/smartpointer.h>
26 #include <deal.II/lac/vector.h>
28 #include <deal.II/dofs/dof_handler.h>
29 
30 #include <vector>
31 
33 
204 template<int dim, typename VECTOR=Vector<double>, class DH=DoFHandler<dim> >
206 {
207 public:
208 
213  SolutionTransfer(const DH &dof);
214 
219 
225  void clear();
226 
236 
248  void prepare_for_coarsening_and_refinement (const std::vector<VECTOR> &all_in);
249 
255  void prepare_for_coarsening_and_refinement (const VECTOR &in);
256 
275  void refine_interpolate (const VECTOR &in,
276  VECTOR &out) const;
277 
312  void interpolate (const std::vector<VECTOR> &all_in,
313  std::vector<VECTOR> &all_out) const;
314 
328  void interpolate (const VECTOR &in,
329  VECTOR &out) const;
330 
336  std::size_t memory_consumption () const;
337 
341  DeclException0(ExcNotPrepared);
342 
346  DeclException0(ExcAlreadyPrepForRef);
347 
351  DeclException0(ExcAlreadyPrepForCoarseAndRef);
352 
356  DeclException0(ExcTriaPrepCoarseningNotCalledBefore);
357 
361  DeclException0(ExcNoInVectorsGiven);
362 
366  DeclException0(ExcVectorsDifferFromInVectors);
367 
371  DeclException0(ExcNumberOfDoFsPerCellHasChanged);
372 
373 private:
374 
380 
386 
399  {
400  none, pure_refinement, coarsening_and_refinement
401  };
402 
407 
408 
416  std::vector<std::vector<types::global_dof_index> > indices_on_cell;
417 
438  {
439  Pointerstruct() : indices_ptr(0), dof_values_ptr(0), active_fe_index(0) {};
440  Pointerstruct(std::vector<types::global_dof_index> *indices_ptr_in,
441  const unsigned int active_fe_index_in = 0)
442  :
443  indices_ptr(indices_ptr_in),
444  dof_values_ptr (0),
445  active_fe_index(active_fe_index_in) {};
446  Pointerstruct(std::vector<Vector<typename VECTOR::value_type> > *dof_values_ptr_in,
447  const unsigned int active_fe_index_in = 0) :
448  indices_ptr (0),
449  dof_values_ptr(dof_values_ptr_in),
450  active_fe_index(active_fe_index_in) {};
451  std::size_t memory_consumption () const;
452 
453  std::vector<types::global_dof_index> *indices_ptr;
454  std::vector<Vector<typename VECTOR::value_type> > *dof_values_ptr;
455  unsigned int active_fe_index;
456  };
457 
467  std::map<std::pair<unsigned int, unsigned int>, Pointerstruct> cell_map;
468 
476  std::vector<std::vector<Vector<typename VECTOR::value_type> > > dof_values_on_cell;
477 };
478 
479 
480 DEAL_II_NAMESPACE_CLOSE
481 
482 
483 /*---------------------------- solutiontransfer.h ---------------------------*/
484 #endif
485 /*---------------------------- solutiontransfer.h ---------------------------*/
DeclException0(ExcNotPrepared)
std::vector< std::vector< Vector< typename VECTOR::value_type > > > dof_values_on_cell
std::size_t memory_consumption() const
void prepare_for_coarsening_and_refinement(const std::vector< VECTOR > &all_in)
unsigned int global_dof_index
Definition: types.h:100
void refine_interpolate(const VECTOR &in, VECTOR &out) const
SmartPointer< const DH, SolutionTransfer< dim, VECTOR, DH > > dof_handler
std::map< std::pair< unsigned int, unsigned int >, Pointerstruct > cell_map
void interpolate(const std::vector< VECTOR > &all_in, std::vector< VECTOR > &all_out) const
void prepare_for_pure_refinement()
PreparationState prepared_for
types::global_dof_index n_dofs_old
SolutionTransfer(const DH &dof)
std::vector< std::vector< types::global_dof_index > > indices_on_cell