Reference documentation for deal.II version 8.5.1
solution_transfer.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2016 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii__solution_transfer_h
17 #define dealii__solution_transfer_h
18 
19 
20 /*---------------------------- solutiontransfer.h ----------------------*/
21 
22 
23 #include <deal.II/base/config.h>
24 #include <deal.II/base/smartpointer.h>
25 #include <deal.II/lac/vector.h>
26 #include <deal.II/base/exceptions.h>
27 #include <deal.II/dofs/dof_handler.h>
28 
29 #include <vector>
30 
31 DEAL_II_NAMESPACE_OPEN
32 
291 template<int dim, typename VectorType=Vector<double>,
292  typename DoFHandlerType=DoFHandler<dim> >
294 {
295 public:
296 
300  SolutionTransfer(const DoFHandlerType &dof);
301 
306 
311  void clear();
312 
319 
327  void prepare_for_coarsening_and_refinement (const std::vector<VectorType> &all_in);
328 
333  void prepare_for_coarsening_and_refinement (const VectorType &in);
334 
346  void refine_interpolate (const VectorType &in,
347  VectorType &out) const;
348 
368  void interpolate (const std::vector<VectorType> &all_in,
369  std::vector<VectorType> &all_out) const;
370 
380  void interpolate (const VectorType &in,
381  VectorType &out) const;
382 
387  std::size_t memory_consumption () const;
388 
393  "You are attempting an operation for which this object is "
394  "not prepared. This may be because you either did not call "
395  "one of the prepare_*() functions at all, or because you "
396  "called the wrong one for the operation you are currently "
397  "attempting.");
398 
403  "You are attempting to call one of the prepare_*() functions "
404  "of this object to prepare it for an operation for which it "
405  "is already prepared. Specifically, the object was "
406  "previously prepared for pure refinement.");
407 
412  "You are attempting to call one of the prepare_*() functions "
413  "of this object to prepare it for an operation for which it "
414  "is already prepared. Specifically, the object was "
415  "previously prepared for both coarsening and refinement.");
416 
417 private:
418 
423 
428 
435  {
448  };
449 
454 
455 
461  std::vector<std::vector<types::global_dof_index> > indices_on_cell;
462 
475  {
476  Pointerstruct() : indices_ptr(0), dof_values_ptr(0), active_fe_index(0) {};
477  Pointerstruct(std::vector<types::global_dof_index> *indices_ptr_in,
478  const unsigned int active_fe_index_in = 0)
479  :
480  indices_ptr(indices_ptr_in),
481  dof_values_ptr (0),
482  active_fe_index(active_fe_index_in) {};
483  Pointerstruct(std::vector<Vector<typename VectorType::value_type> > *dof_values_ptr_in,
484  const unsigned int active_fe_index_in = 0) :
485  indices_ptr (0),
486  dof_values_ptr(dof_values_ptr_in),
487  active_fe_index(active_fe_index_in) {};
488  std::size_t memory_consumption () const;
489 
490  std::vector<types::global_dof_index> *indices_ptr;
491  std::vector<Vector<typename VectorType::value_type> > *dof_values_ptr;
492  unsigned int active_fe_index;
493  };
494 
501  std::map<std::pair<unsigned int, unsigned int>, Pointerstruct> cell_map;
502 
507  std::vector<std::vector<Vector<typename VectorType::value_type> > > dof_values_on_cell;
508 };
509 
510 
511 DEAL_II_NAMESPACE_CLOSE
512 
513 
514 /*---------------------------- solutiontransfer.h ---------------------------*/
515 #endif
516 /*---------------------------- solutiontransfer.h ---------------------------*/
types::global_dof_index n_dofs_old
static ::ExceptionBase & ExcAlreadyPrepForRef()
static ::ExceptionBase & ExcNotPrepared()
std::map< std::pair< unsigned int, unsigned int >, Pointerstruct > cell_map
std::vector< std::vector< types::global_dof_index > > indices_on_cell
unsigned int global_dof_index
Definition: types.h:88
void prepare_for_pure_refinement()
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:553
static ::ExceptionBase & ExcAlreadyPrepForCoarseAndRef()
SolutionTransfer(const DoFHandlerType &dof)
SmartPointer< const DoFHandlerType, SolutionTransfer< dim, VectorType, DoFHandlerType > > dof_handler
void prepare_for_coarsening_and_refinement(const std::vector< VectorType > &all_in)
void refine_interpolate(const VectorType &in, VectorType &out) const
std::vector< std::vector< Vector< typename VectorType::value_type > > > dof_values_on_cell
std::size_t memory_consumption() const
PreparationState prepared_for
void interpolate(const std::vector< VectorType > &all_in, std::vector< VectorType > &all_out) const