Reference documentation for deal.II version Git f40be01994 2020-04-09 07:13:12 +0200
\(\newcommand{\vcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\vcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
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.md at
12 // the top level directory of deal.II.
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 
25 # include <deal.II/base/exceptions.h>
26 # include <deal.II/base/smartpointer.h>
27 
28 # include <deal.II/dofs/dof_handler.h>
29 
30 # include <deal.II/lac/vector.h>
31 
32 # include <vector>
33 
34 DEAL_II_NAMESPACE_OPEN
35 
337 template <int dim,
338  typename VectorType = Vector<double>,
339  typename DoFHandlerType = DoFHandler<dim>>
341 {
342 # ifndef DEAL_II_MSVC
343  static_assert(dim == DoFHandlerType::dimension,
344  "The dimension explicitly provided as a template "
345  "argument, and the dimension of the DoFHandlerType "
346  "template argument must match.");
347 # endif
348 public:
352  SolutionTransfer(const DoFHandlerType &dof);
353 
358 
363  void
364  clear();
365 
371  void
373 
381  void
382  prepare_for_coarsening_and_refinement(const std::vector<VectorType> &all_in);
383 
388  void
389  prepare_for_coarsening_and_refinement(const VectorType &in);
390 
402  void
403  refine_interpolate(const VectorType &in, VectorType &out) const;
404 
424  void
425  interpolate(const std::vector<VectorType> &all_in,
426  std::vector<VectorType> & all_out) const;
427 
437  void
438  interpolate(const VectorType &in, VectorType &out) const;
439 
444  std::size_t
445  memory_consumption() const;
446 
451  "You are attempting an operation for which this object is "
452  "not prepared. This may be because you either did not call "
453  "one of the prepare_*() functions at all, or because you "
454  "called the wrong one for the operation you are currently "
455  "attempting.");
456 
462  "You are attempting to call one of the prepare_*() functions "
463  "of this object to prepare it for an operation for which it "
464  "is already prepared. Specifically, the object was "
465  "previously prepared for pure refinement.");
466 
472  "You are attempting to call one of the prepare_*() functions "
473  "of this object to prepare it for an operation for which it "
474  "is already prepared. Specifically, the object was "
475  "previously prepared for both coarsening and refinement.");
476 
477 private:
481  SmartPointer<const DoFHandlerType,
484 
489 
496  {
509  };
510 
515 
516 
522  std::vector<std::vector<types::global_dof_index>> indices_on_cell;
523 
536  {
537  Pointerstruct()
538  : indices_ptr(nullptr)
539  , dof_values_ptr(nullptr)
540  , active_fe_index(0)
541  {}
542  Pointerstruct(std::vector<types::global_dof_index> *indices_ptr_in,
543  const unsigned int active_fe_index_in = 0)
544  : indices_ptr(indices_ptr_in)
545  , dof_values_ptr(nullptr)
546  , active_fe_index(active_fe_index_in)
547  {}
549  std::vector<Vector<typename VectorType::value_type>> *dof_values_ptr_in,
550  const unsigned int active_fe_index_in = 0)
551  : indices_ptr(nullptr)
552  , dof_values_ptr(dof_values_ptr_in)
553  , active_fe_index(active_fe_index_in)
554  {}
555  std::size_t
556  memory_consumption() const;
557 
558  std::vector<types::global_dof_index> * indices_ptr;
559  std::vector<Vector<typename VectorType::value_type>> *dof_values_ptr;
560  unsigned int active_fe_index;
561  };
562 
569  std::map<std::pair<unsigned int, unsigned int>, Pointerstruct> cell_map;
570 
575  std::vector<std::vector<Vector<typename VectorType::value_type>>>
577 };
578 
579 
580 DEAL_II_NAMESPACE_CLOSE
581 
582 #endif // dealii_solutiontransfer_h
583 /*---------------------------- solutiontransfer.h ---------------------------*/
types::global_dof_index n_dofs_old
SmartPointer< const DoFHandlerType, SolutionTransfer< dim, VectorType, DoFHandlerType > > dof_handler
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
void prepare_for_pure_refinement()
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:496
static ::ExceptionBase & ExcAlreadyPrepForCoarseAndRef()
SolutionTransfer(const DoFHandlerType &dof)
unsigned int global_dof_index
Definition: types.h:77
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