dune-pdelab 2.7-git
Loading...
Searching...
No Matches
jacobiantocurl.hh
Go to the documentation of this file.
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
8#include <dune/common/fvector.hh>
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;
64 typedef FieldVector<CurlField, dimCurl> Curl;
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;
105 typedef FieldVector<CurlField, dimCurl> Curl;
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;
140 typedef FieldVector<CurlField, dimCurl> Curl;
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
For backward compatibility – Do not use this!
Definition adaptivity.hh:28
extract the curl of a function from the jacobian of that function
Definition jacobiantocurl.hh:27
FieldVector< CurlField, dimCurl > Curl
Definition jacobiantocurl.hh:64
Jacobian::block_type CurlField
Definition jacobiantocurl.hh:62
void operator()(const Jacobian &jacobian, Curl &curl) const
Definition jacobiantocurl.hh:66
Jacobian::block_type CurlField
Definition jacobiantocurl.hh:103
void operator()(const Jacobian &jacobian, Curl &curl) const
Definition jacobiantocurl.hh:107
FieldVector< CurlField, dimCurl > Curl
Definition jacobiantocurl.hh:105
void operator()(const Jacobian &jacobian, Curl &curl) const
Definition jacobiantocurl.hh:142
Jacobian::block_type CurlField
Definition jacobiantocurl.hh:138
FieldVector< CurlField, dimCurl > Curl
Definition jacobiantocurl.hh:140