DUNE PDELab (2.8)

descriptors.hh
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#include <dune/pdelab/backend/interface.hh>
7#include <dune/pdelab/backend/istl/forwarddeclarations.hh>
8#include <dune/pdelab/backend/istl/matrixhelpers.hh>
9#include <dune/pdelab/backend/istl/utility.hh>
10#include <cstddef>
11
12namespace 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
45
46 template<Blocking blocking = Blocking::none, std::size_t block_size_ = 0>
47 struct VectorBackend
48 {
49
50 using tag = vector_backend_tag;
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
constexpr GeometryType none(unsigned int dim)
Returns a GeometryType representing a singular of dimension dim.
Definition: type.hh:479
Dune namespace.
Definition: alignedallocator.hh:11
Tag describing an ISTL BlockVector backend.
Definition: descriptors.hh:44
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 22, 23:30, 2024)