dune-pdelab  2.5-dev
istl/descriptors.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_PDELAB_BACKEND_ISTL_DESCRIPTORS_HH
4 #define DUNE_PDELAB_BACKEND_ISTL_DESCRIPTORS_HH
5 
10 #include <cstddef>
11 
12 namespace Dune {
13  namespace PDELab {
14 
15 #ifndef DOXYGEN
16  template<typename T>
17  constexpr bool deactivate_standard_blocking_for_ordering(const T&)
18  {
19  return false;
20  }
21 #endif
22 
23  namespace ISTL {
24 
26  enum class Blocking
27  {
29  none,
31  bcrs,
33 
40  fixed,
41  };
42 
44  struct vector_backend_tag {};
45 
46  template<Blocking blocking = Blocking::none, std::size_t block_size_ = 0>
48  {
49 
51 
52  using size_type = std::size_t;
53 
54  static const size_type blockSize = block_size_;
55 
56  struct Traits
57  {
58  static const Blocking block_type = blocking;
59  static const size_type block_size = block_size_;
60 
61  static const bool blocked = blocking != Blocking::none;
62 
63  static const size_type max_blocking_depth = blocked ? 1 : 0;
64  };
65 
66  template<typename GFS>
67  bool blocked(const GFS& gfs) const
68  {
69  if (deactivate_standard_blocking_for_ordering(gfs.orderingTag()))
70  return false;
71  // We have to make an exception for static blocking and block_size == 1:
72  // In that case, the ISTL backends expect the redundant index information
73  // at that level to be elided, and keeping it in here will break vector
74  // and matrix accesses.
75  // To work around that problem, we override the user and just turn off
76  // blocking internally.
77  return Traits::blocked && (blocking != Blocking::fixed || !GFS::isLeaf || block_size_ > 1);
78  }
79 
80  };
81 
82  }
83 
84  } // namespace PDELab
85 } // namespace Dune
86 
87 
88 #endif // DUNE_PDELAB_BACKEND_ISTL_DESCRIPTORS_HH
Dune::PDELab::ISTL::Blocking
Blocking
The type of blocking employed at this node in the function space tree.
Definition: istl/descriptors.hh:26
Dune
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
Dune::PDELab::ISTL::VectorBackend::Traits::block_size
static const size_type block_size
Definition: istl/descriptors.hh:59
Dune::PDELab::ISTL::VectorBackend::Traits::blocked
static const bool blocked
Definition: istl/descriptors.hh:61
Dune::PDELab::ISTL::VectorBackend::blocked
bool blocked(const GFS &gfs) const
Definition: istl/descriptors.hh:67
Dune::PDELab::ISTL::VectorBackend::size_type
std::size_t size_type
Definition: istl/descriptors.hh:52
Dune::PDELab::ISTL::Blocking::none
@ none
No blocking at this level.
Dune::PDELab::ISTL::VectorBackend::Traits::max_blocking_depth
static const size_type max_blocking_depth
Definition: istl/descriptors.hh:63
Dune::PDELab::ISTL::VectorBackend
Definition: istl/descriptors.hh:47
matrixhelpers.hh
forwarddeclarations.hh
Dune::PDELab::ISTL::vector_backend_tag
Tag describing an ISTL BlockVector backend.
Definition: istl/descriptors.hh:44
Dune::PDELab::ordering::deactivate_standard_blocking_for_ordering
constexpr bool deactivate_standard_blocking_for_ordering(const Chunked< Decorated > &)
Definition: chunkedblockordering.hh:100
utility.hh
Dune::PDELab::ISTL::VectorBackend::Traits::block_type
static const Blocking block_type
Definition: istl/descriptors.hh:58
Dune::PDELab::ISTL::Blocking::fixed
@ fixed
Create fixed size blocks that each group together a fixed number of DOFs from each child space.
Dune::PDELab::ISTL::VectorBackend::Traits
Definition: istl/descriptors.hh:56
interface.hh
Dune::PDELab::ISTL::Blocking::bcrs
@ bcrs
Creates one macro block for each child space, each block is a BlockVector / BCRS matrix.
Dune::PDELab::ISTL::VectorBackend::blockSize
static const size_type blockSize
Definition: istl/descriptors.hh:54