DUNE PDELab (git)

jacobiantocurl.hh
1// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=8 sw=2 sts=2:
3#ifndef DUNE_PDELAB_COMMON_JACOBIANTOCURL_HH
4#define DUNE_PDELAB_COMMON_JACOBIANTOCURL_HH
5
6#include <cstddef>
7
9
10namespace Dune {
11 namespace PDELab {
12
14
25 template<typename Jacobian, std::size_t dimR = Jacobian::rows,
26 std::size_t dimD = Jacobian::cols>
28
31
55 template<typename Jacobian>
56 class JacobianToCurl<Jacobian, 1, 2> {
57 static_assert
58 ( Jacobian::rows == 1 && Jacobian::cols == 2, "This specialization "
59 "works only for dimRange == 1 and dimDomain == 2");
60
61 public:
62 typedef typename Jacobian::block_type CurlField;
63 static const std::size_t dimCurl = 2;
65
66 void operator()(const Jacobian& jacobian, Curl& curl) const {
67 curl[0] = jacobian[0][1];
68 curl[1] = -jacobian[0][0];
69 }
70 };
71
74
96 template<typename Jacobian>
97 class JacobianToCurl<Jacobian, 2, 2> {
98 static_assert
99 ( Jacobian::rows == 2 && Jacobian::cols == 2, "This specialization "
100 "works only for dimRange == 2 and dimDomain == 2");
101
102 public:
103 typedef typename Jacobian::block_type CurlField;
104 static const std::size_t dimCurl = 1;
106
107 void operator()(const Jacobian& jacobian, Curl& curl) const {
108 curl[0] = jacobian[1][0]-jacobian[0][1];
109 }
110 };
111
114
131 template<typename Jacobian>
132 class JacobianToCurl<Jacobian, 3, 3> {
133 static_assert
134 ( Jacobian::rows == 3 && Jacobian::cols == 3, "This specialization "
135 "works only for dimRange == 3 and dimDomain == 3");
136
137 public:
138 typedef typename Jacobian::block_type CurlField;
139 static const std::size_t dimCurl = 3;
141
142 void operator()(const Jacobian& jacobian, Curl& curl) const {
143 for(std::size_t alpha = 0; alpha < 3; ++alpha) {
144 std::size_t beta = (alpha+1)%3;
145 std::size_t gamma = (alpha+2)%3;
146 curl[alpha] = jacobian[gamma][beta]-jacobian[beta][gamma];
147 }
148 }
149 };
150
151 } // namespace PDELab
152} //namespace Dune
153
154#endif // DUNE_PDELAB_COMMON_JACOBIANTOCURL_HH
vector space out of a tensor product of fields.
Definition: fvector.hh:95
extract the curl of a function from the jacobian of that function
Definition: jacobiantocurl.hh:27
Implements a vector constructed from a given type representing a field and a compile-time given size.
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)