Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
solution_transfer.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2020 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>
27 
29 
30 # include <deal.II/lac/vector.h>
31 
32 # include <vector>
33 
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
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  {
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 
581 
582 #endif // dealii_solutiontransfer_h
583 /*---------------------------- solutiontransfer.h ---------------------------*/
DeclExceptionMsg
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:496
SolutionTransfer::Pointerstruct::Pointerstruct
Pointerstruct(std::vector< types::global_dof_index > *indices_ptr_in, const unsigned int active_fe_index_in=0)
Definition: solution_transfer.h:542
SolutionTransfer::prepare_for_pure_refinement
void prepare_for_pure_refinement()
Definition: solution_transfer.cc:87
SolutionTransfer::Pointerstruct::memory_consumption
std::size_t memory_consumption() const
Definition: solution_transfer.cc:593
SolutionTransfer::Pointerstruct::Pointerstruct
Pointerstruct(std::vector< Vector< typename VectorType::value_type >> *dof_values_ptr_in, const unsigned int active_fe_index_in=0)
Definition: solution_transfer.h:548
SolutionTransfer::~SolutionTransfer
~SolutionTransfer()
Definition: solution_transfer.cc:65
SolutionTransfer::SolutionTransfer
SolutionTransfer(const DoFHandlerType &dof)
Definition: solution_transfer.cc:45
VectorType
SolutionTransfer::Pointerstruct
Definition: solution_transfer.h:535
SolutionTransfer::ExcAlreadyPrepForRef
static ::ExceptionBase & ExcAlreadyPrepForRef()
SolutionTransfer::prepare_for_coarsening_and_refinement
void prepare_for_coarsening_and_refinement(const std::vector< VectorType > &all_in)
Definition: solution_transfer.cc:265
SolutionTransfer::refine_interpolate
void refine_interpolate(const VectorType &in, VectorType &out) const
Definition: solution_transfer.cc:127
SolutionTransfer::Pointerstruct::indices_ptr
std::vector< types::global_dof_index > * indices_ptr
Definition: solution_transfer.h:558
DoFHandler< dim >
SolutionTransfer::prepared_for
PreparationState prepared_for
Definition: solution_transfer.h:514
SolutionTransfer::clear
void clear()
Definition: solution_transfer.cc:74
SolutionTransfer::PreparationState
PreparationState
Definition: solution_transfer.h:495
SolutionTransfer::dof_values_on_cell
std::vector< std::vector< Vector< typename VectorType::value_type > > > dof_values_on_cell
Definition: solution_transfer.h:576
SolutionTransfer::memory_consumption
std::size_t memory_consumption() const
Definition: solution_transfer.cc:575
SolutionTransfer::ExcAlreadyPrepForCoarseAndRef
static ::ExceptionBase & ExcAlreadyPrepForCoarseAndRef()
SolutionTransfer::interpolate
void interpolate(const std::vector< VectorType > &all_in, std::vector< VectorType > &all_out) const
Definition: solution_transfer.cc:426
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
SolutionTransfer
Definition: solution_transfer.h:340
SolutionTransfer::Pointerstruct::active_fe_index
unsigned int active_fe_index
Definition: solution_transfer.h:560
smartpointer.h
SolutionTransfer::n_dofs_old
types::global_dof_index n_dofs_old
Definition: solution_transfer.h:488
exceptions.h
SolutionTransfer::pure_refinement
@ pure_refinement
Definition: solution_transfer.h:504
SmartPointer
Definition: smartpointer.h:68
unsigned int
SolutionTransfer::dof_handler
SmartPointer< const DoFHandlerType, SolutionTransfer< dim, VectorType, DoFHandlerType > > dof_handler
Definition: solution_transfer.h:483
SolutionTransfer::Pointerstruct::dof_values_ptr
std::vector< Vector< typename VectorType::value_type > > * dof_values_ptr
Definition: solution_transfer.h:559
vector.h
dof_handler.h
SolutionTransfer::Pointerstruct::Pointerstruct
Pointerstruct()
Definition: solution_transfer.h:537
SolutionTransfer::coarsening_and_refinement
@ coarsening_and_refinement
Definition: solution_transfer.h:508
config.h
SolutionTransfer::cell_map
std::map< std::pair< unsigned int, unsigned int >, Pointerstruct > cell_map
Definition: solution_transfer.h:569
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
SolutionTransfer::indices_on_cell
std::vector< std::vector< types::global_dof_index > > indices_on_cell
Definition: solution_transfer.h:522
Vector< double >
SolutionTransfer::none
@ none
Definition: solution_transfer.h:500
SolutionTransfer::ExcNotPrepared
static ::ExceptionBase & ExcNotPrepared()