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 
6 // this is here for backwards compatibility and deprecation warnings, remove after 2.5.0
7 #include "ensureistlinclude.hh"
8 
13 #include <cstddef>
14 
15 namespace Dune {
16  namespace PDELab {
17 
18 #ifndef DOXYGEN
19  template<typename T>
20  constexpr bool deactivate_standard_blocking_for_ordering(const T&)
21  {
22  return false;
23  }
24 #endif
25 
26  namespace ISTL {
27 
29  enum class Blocking
30  {
32  none,
34  bcrs,
36 
43  fixed,
44  };
45 
47  struct vector_backend_tag {};
48 
49  template<Blocking blocking = Blocking::none, std::size_t block_size_ = 1>
51  {
52 
54 
55  static_assert((block_size_ > 0),"block size for FieldVector has to be positive");
56 
57  using size_type = std::size_t;
58 
59  static const size_type blockSize = block_size_;
60 
61  struct Traits
62  {
63  static const Blocking block_type = blocking;
64  static const size_type block_size = block_size_;
65 
66  static const bool blocked = blocking != Blocking::none;
67 
68  static const size_type max_blocking_depth = blocked ? 1 : 0;
69  };
70 
71  template<typename GFS>
72  bool blocked(const GFS& gfs) const
73  {
74  if (deactivate_standard_blocking_for_ordering(gfs.orderingTag()))
75  return false;
76  // We have to make an exception for static blocking and block_size == 1:
77  // In that case, the ISTL backends expect the redundant index information
78  // at that level to be elided, and keeping it in here will break vector
79  // and matrix accesses.
80  // To work around that problem, we override the user and just turn off
81  // blocking internally.
82  return Traits::blocked && (blocking != Blocking::fixed || !GFS::isLeaf || block_size_ > 1);
83  }
84 
85  };
86 
87  }
88 
89  } // namespace PDELab
90 } // namespace Dune
91 
92 
93 #endif // DUNE_PDELAB_BACKEND_ISTL_DESCRIPTORS_HH
Create fixed size blocks that each group together a fixed number of DOFs from each child space...
bool blocked(const GFS &gfs) const
Definition: istl/descriptors.hh:72
Blocking
The type of blocking employed at this node in the function space tree.
Definition: istl/descriptors.hh:29
Definition: istl/descriptors.hh:50
std::size_t size_type
Definition: istl/descriptors.hh:57
Creates one macro block for each child space, each block is a BlockVector / BCRS matrix.
No blocking at this level.
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
constexpr bool deactivate_standard_blocking_for_ordering(const Chunked< Decorated > &)
Definition: chunkedblockordering.hh:100
Tag describing an ISTL BlockVector backend.
Definition: istl/descriptors.hh:47
Definition: istl/descriptors.hh:61