dune-pdelab  2.7-git
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  // A bock size of 0 also needs special handling, as it is actually a marker for
78  // automatic block size deduction
79  return Traits::blocked && (blocking != Blocking::fixed || !GFS::isLeaf || block_size_ > 1 || block_size_ == 0);
80  }
81 
82  };
83 
84  }
85 
86  } // namespace PDELab
87 } // namespace Dune
88 
89 
90 #endif // DUNE_PDELAB_BACKEND_ISTL_DESCRIPTORS_HH
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
Blocking
The type of blocking employed at this node in the function space tree.
Definition: istl/descriptors.hh:27
@ none
No blocking at this level.
@ bcrs
Creates one macro block for each child space, each block is a BlockVector / BCRS matrix.
@ fixed
Create fixed size blocks that each group together a fixed number of DOFs from each child space.
constexpr bool deactivate_standard_blocking_for_ordering(const Chunked< Decorated > &)
Definition: chunkedblockordering.hh:100
Tag describing an ISTL BlockVector backend.
Definition: istl/descriptors.hh:44
Definition: istl/descriptors.hh:48
bool blocked(const GFS &gfs) const
Definition: istl/descriptors.hh:67
static const size_type blockSize
Definition: istl/descriptors.hh:54
std::size_t size_type
Definition: istl/descriptors.hh:52
Definition: istl/descriptors.hh:57
static const size_type block_size
Definition: istl/descriptors.hh:59
static const bool blocked
Definition: istl/descriptors.hh:61
static const size_type max_blocking_depth
Definition: istl/descriptors.hh:63
static const Blocking block_type
Definition: istl/descriptors.hh:58