Reference documentation for deal.II version 9.0.0
solution_transfer.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2018 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,
292  typename VectorType = Vector<double>,
293  typename DoFHandlerType = DoFHandler<dim> >
295 {
296 #ifndef DEAL_II_MSVC
297  static_assert (dim == DoFHandlerType::dimension,
298  "The dimension explicitly provided as a template "
299  "argument, and the dimension of the DoFHandlerType "
300  "template argument must match.");
301 #endif
302 public:
303 
307  SolutionTransfer(const DoFHandlerType &dof);
308 
313 
318  void clear();
319 
326 
334  void prepare_for_coarsening_and_refinement (const std::vector<VectorType> &all_in);
335 
340  void prepare_for_coarsening_and_refinement (const VectorType &in);
341 
353  void refine_interpolate (const VectorType &in,
354  VectorType &out) const;
355 
375  void interpolate (const std::vector<VectorType> &all_in,
376  std::vector<VectorType> &all_out) const;
377 
387  void interpolate (const VectorType &in,
388  VectorType &out) const;
389 
394  std::size_t memory_consumption () const;
395 
400  "You are attempting an operation for which this object is "
401  "not prepared. This may be because you either did not call "
402  "one of the prepare_*() functions at all, or because you "
403  "called the wrong one for the operation you are currently "
404  "attempting.");
405 
410  "You are attempting to call one of the prepare_*() functions "
411  "of this object to prepare it for an operation for which it "
412  "is already prepared. Specifically, the object was "
413  "previously prepared for pure refinement.");
414 
419  "You are attempting to call one of the prepare_*() functions "
420  "of this object to prepare it for an operation for which it "
421  "is already prepared. Specifically, the object was "
422  "previously prepared for both coarsening and refinement.");
423 
424 private:
425 
430 
435 
442  {
455  };
456 
461 
462 
468  std::vector<std::vector<types::global_dof_index> > indices_on_cell;
469 
482  {
483  Pointerstruct() : indices_ptr(nullptr), dof_values_ptr(nullptr), active_fe_index(0) {}
484  Pointerstruct(std::vector<types::global_dof_index> *indices_ptr_in,
485  const unsigned int active_fe_index_in = 0)
486  :
487  indices_ptr(indices_ptr_in),
488  dof_values_ptr (nullptr),
489  active_fe_index(active_fe_index_in) {}
490  Pointerstruct(std::vector<Vector<typename VectorType::value_type> > *dof_values_ptr_in,
491  const unsigned int active_fe_index_in = 0) :
492  indices_ptr (nullptr),
493  dof_values_ptr(dof_values_ptr_in),
494  active_fe_index(active_fe_index_in) {}
495  std::size_t memory_consumption () const;
496 
497  std::vector<types::global_dof_index> *indices_ptr;
498  std::vector<Vector<typename VectorType::value_type> > *dof_values_ptr;
499  unsigned int active_fe_index;
500  };
501 
508  std::map<std::pair<unsigned int, unsigned int>, Pointerstruct> cell_map;
509 
514  std::vector<std::vector<Vector<typename VectorType::value_type> > > dof_values_on_cell;
515 };
516 
517 
518 DEAL_II_NAMESPACE_CLOSE
519 
520 
521 /*---------------------------- solutiontransfer.h ---------------------------*/
522 #endif
523 /*---------------------------- 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:335
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