| 1 |
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
| 2 |
// vi: set et ts=4 sw=2 sts=2: |
| 3 |
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root |
| 4 |
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception |
| 5 |
#ifndef DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS3_CUBE2D_LOCALBASIS_HH |
| 6 |
#define DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS3_CUBE2D_LOCALBASIS_HH |
| 7 |
|
| 8 |
#include <bitset> |
| 9 |
#include <numeric> |
| 10 |
#include <vector> |
| 11 |
|
| 12 |
#include <dune/common/fmatrix.hh> |
| 13 |
|
| 14 |
#include "../../common/localbasis.hh" |
| 15 |
|
| 16 |
namespace Dune |
| 17 |
{ |
| 18 |
/** |
| 19 |
* \brief Second order Raviart-Thomas shape functions on the reference quadrilateral. |
| 20 |
* |
| 21 |
* \tparam D Type to represent the field in the domain. |
| 22 |
* \tparam R Type to represent the field in the range. |
| 23 |
* |
| 24 |
* \ingroup RaviartThomasImpl |
| 25 |
* \nosubgrouping |
| 26 |
*/ |
| 27 |
template<class D, class R> |
| 28 |
class RT3Cube2DLocalBasis |
| 29 |
{ |
| 30 |
|
| 31 |
public: |
| 32 |
typedef LocalBasisTraits<D,2,Dune::FieldVector<D,2>,R,2,Dune::FieldVector<R,2>, |
| 33 |
Dune::FieldMatrix<R,2,2> > Traits; |
| 34 |
|
| 35 |
/** |
| 36 |
* \brief Make set number s, where 0 <= s < 16 |
| 37 |
* |
| 38 |
* \param s Edge orientation indicator |
| 39 |
*/ |
| 40 |
RT3Cube2DLocalBasis (std::bitset<4> s = 0) |
| 41 |
{ |
| 42 |
sign0 = (s[0]) ? -1.0 : 1.0; |
| 43 |
sign1 = (s[1]) ? -1.0 : 1.0; |
| 44 |
sign2 = (s[2]) ? -1.0 : 1.0; |
| 45 |
sign3 = (s[3]) ? -1.0 : 1.0; |
| 46 |
} |
| 47 |
|
| 48 |
//! \brief number of shape functions |
| 49 |
unsigned int size () const |
| 50 |
{ |
| 51 |
return 40; |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* \brief Evaluate all shape functions |
| 56 |
* |
| 57 |
* \param in Position |
| 58 |
* \param out return value |
| 59 |
*/ |
| 60 |
inline void evaluateFunction (const typename Traits::DomainType& in, |
| 61 |
std::vector<typename Traits::RangeType>& out) const |
| 62 |
{ |
| 63 |
out.resize(40); |
| 64 |
auto const& x = in[0], y = in[1]; |
| 65 |
|
| 66 |
const auto tmp1 = - x*(x*(x*(35*x - 80) + 60) - 16) - 1; |
| 67 |
const auto tmp2 = x*(x*(x*(35*x - 80) + 60) - 16) + 1; |
| 68 |
const auto tmp3 = 2*y - 1; |
| 69 |
const auto tmp4 = y*(6*y - 6) + 1; |
| 70 |
const auto tmp5 = y*(y*(20*y - 30) + 12) - 1; |
| 71 |
const auto tmp6 = x*(x*(x*(35*x - 60) + 30) - 4); |
| 72 |
const auto tmp7 = - y*(y*(y*(35*y - 80) + 60) - 16) - 1; |
| 73 |
const auto tmp8 = y*(y*(y*(35*y - 80) + 60) - 16) + 1; |
| 74 |
const auto tmp9 = 2*x - 1; |
| 75 |
const auto tmp10 = x*(6*x - 6) + 1; |
| 76 |
const auto tmp11 = x*(x*(20*x - 30) + 12) - 1; |
| 77 |
const auto tmp12 = y*(y*(y*(35*y - 60) + 30) - 4); |
| 78 |
const auto tmp13 = -x*(x*(x*(7*x - 14) + 9) - 2); |
| 79 |
const auto tmp14 = x*(x*(x*(7*x - 14) + 9) - 2); |
| 80 |
const auto tmp15 = x*(x*(2*x - 3) + 1); |
| 81 |
const auto tmp16 = x*(x*(x*(5*x - 10) + 6) - 1); |
| 82 |
const auto tmp17 = -y*(y*(y*(7*y - 14) + 9) - 2); |
| 83 |
const auto tmp18 = y*(y*(2*y - 3) + 1); |
| 84 |
const auto tmp19 = y*(y*(y*(5*y - 10) + 6) - 1); |
| 85 |
const auto tmp20 = y*(y*(y*(7*y - 14) + 9) - 2); |
| 86 |
|
| 87 |
out[0][0]=sign0*tmp1; |
| 88 |
out[0][1]=0; |
| 89 |
out[1][0]=(-3.0*tmp2*tmp3); |
| 90 |
out[1][1]=0; |
| 91 |
out[2][0]=sign0*(-5.0*tmp2*tmp4); |
| 92 |
out[2][1]=0; |
| 93 |
out[3][0]=(-7.0*tmp2*tmp5); |
| 94 |
out[3][1]=0; |
| 95 |
|
| 96 |
out[4][0]=sign1*tmp6; |
| 97 |
out[4][1]=0; |
| 98 |
out[5][0]=(-3.0*tmp6*tmp3); |
| 99 |
out[5][1]=0; |
| 100 |
out[6][0]=sign1*(5.0*tmp6*tmp4); |
| 101 |
out[6][1]=0; |
| 102 |
out[7][0]=(-7.0*tmp6*tmp5); |
| 103 |
out[7][1]=0; |
| 104 |
|
| 105 |
out[8][0]=0; |
| 106 |
out[8][1]=sign2*tmp7; |
| 107 |
out[9][0]=0; |
| 108 |
out[9][1]=3.0*tmp9*tmp8; |
| 109 |
out[10][0]=0; |
| 110 |
out[10][1]=sign2*(-5.0*tmp10*tmp8); |
| 111 |
out[11][0]=0; |
| 112 |
out[11][1]=7.0*tmp11*tmp8; |
| 113 |
|
| 114 |
out[12][0]=0; |
| 115 |
out[12][1]=sign3*tmp12; |
| 116 |
out[13][0]=0; |
| 117 |
out[13][1]=3.0*tmp9*tmp12; |
| 118 |
out[14][0]=0; |
| 119 |
out[14][1]=sign3*5.0*tmp10*tmp12; |
| 120 |
out[15][0]=0; |
| 121 |
out[15][1]=7.0*tmp11*tmp12; |
| 122 |
|
| 123 |
out[16][0]=10.0*tmp13; |
| 124 |
out[16][1]=0; |
| 125 |
out[17][0]=-30.0*tmp14*tmp3; |
| 126 |
out[17][1]=0; |
| 127 |
out[18][0]=-50.0*tmp14*tmp4; |
| 128 |
out[18][1]=0; |
| 129 |
out[19][0]=-70.0*tmp14*tmp5; |
| 130 |
out[19][1]=0; |
| 131 |
out[20][0]=-30.0*tmp15; |
| 132 |
out[20][1]=0; |
| 133 |
out[21][0]=-90.0*tmp15*tmp3; |
| 134 |
out[21][1]=0; |
| 135 |
out[22][0]=-150.0*tmp15*tmp4; |
| 136 |
out[22][1]=0; |
| 137 |
out[23][0]=-210.0*tmp15*tmp5; |
| 138 |
out[23][1]=0; |
| 139 |
out[24][0]=-70.0*tmp16; |
| 140 |
out[24][1]=0; |
| 141 |
out[25][0]=-210.0*tmp16*tmp3; |
| 142 |
out[25][1]=0; |
| 143 |
out[26][0]=-350.0*tmp16*tmp4; |
| 144 |
out[26][1]=0; |
| 145 |
out[27][0]=-490.0*tmp16*tmp5; |
| 146 |
out[27][1]=0; |
| 147 |
out[28][0]=0; |
| 148 |
out[28][1]=10.0*tmp17; |
| 149 |
out[29][0]=0; |
| 150 |
out[29][1]=-30.0*tmp18; |
| 151 |
out[30][0]=0; |
| 152 |
out[30][1]=-70.0*tmp19; |
| 153 |
out[31][0]=0; |
| 154 |
out[31][1]=-30.0*tmp9*tmp20; |
| 155 |
out[32][0]=0; |
| 156 |
out[32][1]=-90.0*tmp9*tmp18; |
| 157 |
out[33][0]=0; |
| 158 |
out[33][1]=-210.0*tmp9*tmp19; |
| 159 |
out[34][0]=0; |
| 160 |
out[34][1]=-50.0*tmp10*tmp20; |
| 161 |
out[35][0]=0; |
| 162 |
out[35][1]=-150.0*tmp10*tmp18; |
| 163 |
out[36][0]=0; |
| 164 |
out[36][1]=-350.0*tmp10*tmp19; |
| 165 |
out[37][0]=0; |
| 166 |
out[37][1]=-70.0*tmp11*tmp20; |
| 167 |
out[38][0]=0; |
| 168 |
out[38][1]=-210.0*tmp11*tmp18; |
| 169 |
out[39][0]=0; |
| 170 |
out[39][1]=-490.0*tmp11*tmp19; |
| 171 |
} |
| 172 |
|
| 173 |
/** |
| 174 |
* \brief Evaluate Jacobian of all shape functions |
| 175 |
* |
| 176 |
* \param in Position |
| 177 |
* \param out return value |
| 178 |
*/ |
| 179 |
inline void evaluateJacobian (const typename Traits::DomainType& in, |
| 180 |
std::vector<typename Traits::JacobianType>& out) const |
| 181 |
{ |
| 182 |
out.resize(40); |
| 183 |
auto const& x = in[0], y = in[1]; |
| 184 |
|
| 185 |
const auto tmp2 = x*(x*(x*(35*x - 80) + 60) - 16) + 1; |
| 186 |
const auto tmp3 = 2*y - 1; |
| 187 |
const auto tmp4 = y*(6*y - 6) + 1; |
| 188 |
const auto tmp5 = y*(y*(20*y - 30) + 12) - 1; |
| 189 |
const auto tmp6 = x*(x*(x*(35*x - 60) + 30) - 4); |
| 190 |
const auto tmp8 = y*(y*(y*(35*y - 80) + 60) - 16) + 1; |
| 191 |
const auto tmp9 = 2*x - 1; |
| 192 |
const auto tmp10 = x*(6*x - 6) + 1; |
| 193 |
const auto tmp11 = x*(x*(20*x - 30) + 12) - 1; |
| 194 |
const auto tmp12 = y*(y*(y*(35*y - 60) + 30) - 4); |
| 195 |
const auto tmp14 = x*(x*(x*(7*x - 14) + 9) - 2); |
| 196 |
const auto tmp15 = x*(x*(2*x - 3) + 1); |
| 197 |
const auto tmp16 = x*(x*(x*(5*x - 10) + 6) - 1); |
| 198 |
const auto tmp18 = y*(y*(2*y - 3) + 1); |
| 199 |
const auto tmp19 = y*(y*(y*(5*y - 10) + 6) - 1); |
| 200 |
const auto tmp20 = y*(y*(y*(7*y - 14) + 9) - 2); |
| 201 |
// temporaries tmp1, tmp7, tmp13, tmp17 are not used in jacobian |
| 202 |
|
| 203 |
const auto dxtmp1 = 16 - x*(x*(140*x - 240) + 120); |
| 204 |
const auto dxtmp2 = x*(x*(140*x - 240) + 120) - 16; |
| 205 |
const auto dytmp3 = 2; |
| 206 |
const auto dytmp4 = 12*y - 6; |
| 207 |
const auto dytmp5 = y*(60*y - 60) + 12; |
| 208 |
const auto dxtmp6 = x*(x*(140*x - 180) + 60) - 4; |
| 209 |
const auto dytmp7 = 16 - y*(y*(140*y - 240) + 120); |
| 210 |
const auto dytmp8 = y*(y*(140*y - 240) + 120) - 16; |
| 211 |
const auto dxtmp9 = 2; |
| 212 |
const auto dxtmp10 = 12*x - 6; |
| 213 |
const auto dxtmp11 = x*(60*x - 60) + 12; |
| 214 |
const auto dytmp12 = y*(y*(140*y - 180) + 60) - 4; |
| 215 |
const auto dxtmp13 = 2 - x*(x*(28*x - 42) + 18); |
| 216 |
const auto dxtmp14 = x*(x*(28*x - 42) + 18) - 2; |
| 217 |
const auto dxtmp15 = x*(6*x - 6) + 1; |
| 218 |
const auto dxtmp16 = x*(x*(20*x - 30) + 12) - 1; |
| 219 |
const auto dytmp17 = 2 - y*(y*(28*y - 42) + 18); |
| 220 |
const auto dytmp18 = y*(6*y - 6) + 1; |
| 221 |
const auto dytmp19 = y*(y*(20*y - 30) + 12) - 1; |
| 222 |
const auto dytmp20 = y*(y*(28*y - 42) + 18) - 2; |
| 223 |
|
| 224 |
|
| 225 |
// x-component |
| 226 |
out[0][0][0]=sign0*dxtmp1; |
| 227 |
out[0][1][0]=0; |
| 228 |
out[1][0][0]=(-3.0*dxtmp2*tmp3); |
| 229 |
out[1][1][0]=0; |
| 230 |
out[2][0][0]=sign0*(-5.0*dxtmp2*tmp4); |
| 231 |
out[2][1][0]=0; |
| 232 |
out[3][0][0]=(-7.0*dxtmp2*tmp5); |
| 233 |
out[3][1][0]=0; |
| 234 |
|
| 235 |
out[4][0][0]=sign1*dxtmp6; |
| 236 |
out[4][1][0]=0; |
| 237 |
out[5][0][0]=(-3.0*dxtmp6*tmp3); |
| 238 |
out[5][1][0]=0; |
| 239 |
out[6][0][0]=sign1*(5.0*dxtmp6*tmp4); |
| 240 |
out[6][1][0]=0; |
| 241 |
out[7][0][0]=(-7.0*dxtmp6*tmp5); |
| 242 |
out[7][1][0]=0; |
| 243 |
|
| 244 |
out[8][0][0]=0; |
| 245 |
out[8][1][0]=0; |
| 246 |
out[9][0][0]=0; |
| 247 |
out[9][1][0]=3.0*dxtmp9*tmp8; |
| 248 |
out[10][0][0]=0; |
| 249 |
out[10][1][0]=sign2*(-5.0*dxtmp10*tmp8); |
| 250 |
out[11][0][0]=0; |
| 251 |
out[11][1][0]=7.0*dxtmp11*tmp8; |
| 252 |
|
| 253 |
out[12][0][0]=0; |
| 254 |
out[12][1][0]=0; |
| 255 |
out[13][0][0]=0; |
| 256 |
out[13][1][0]=3.0*dxtmp9*tmp12; |
| 257 |
out[14][0][0]=0; |
| 258 |
out[14][1][0]=sign3*5.0*dxtmp10*tmp12; |
| 259 |
out[15][0][0]=0; |
| 260 |
out[15][1][0]=7.0*dxtmp11*tmp12; |
| 261 |
|
| 262 |
out[16][0][0]=10.0*dxtmp13; |
| 263 |
out[16][1][0]=0; |
| 264 |
out[17][0][0]=-30.0*dxtmp14*tmp3; |
| 265 |
out[17][1][0]=0; |
| 266 |
out[18][0][0]=-50.0*dxtmp14*tmp4; |
| 267 |
out[18][1][0]=0; |
| 268 |
out[19][0][0]=-70.0*dxtmp14*tmp5; |
| 269 |
out[19][1][0]=0; |
| 270 |
out[20][0][0]=-30.0*dxtmp15; |
| 271 |
out[20][1][0]=0; |
| 272 |
out[21][0][0]=-90.0*dxtmp15*tmp3; |
| 273 |
out[21][1][0]=0; |
| 274 |
out[22][0][0]=-150.0*dxtmp15*tmp4; |
| 275 |
out[22][1][0]=0; |
| 276 |
out[23][0][0]=-210.0*dxtmp15*tmp5; |
| 277 |
out[23][1][0]=0; |
| 278 |
out[24][0][0]=-70.0*dxtmp16; |
| 279 |
out[24][1][0]=0; |
| 280 |
out[25][0][0]=-210.0*dxtmp16*tmp3; |
| 281 |
out[25][1][0]=0; |
| 282 |
out[26][0][0]=-350.0*dxtmp16*tmp4; |
| 283 |
out[26][1][0]=0; |
| 284 |
out[27][0][0]=-490.0*dxtmp16*tmp5; |
| 285 |
out[27][1][0]=0; |
| 286 |
out[28][0][0]=0; |
| 287 |
out[28][1][0]=0; |
| 288 |
out[29][0][0]=0; |
| 289 |
out[29][1][0]=0; |
| 290 |
out[30][0][0]=0; |
| 291 |
out[30][1][0]=0; |
| 292 |
out[31][0][0]=0; |
| 293 |
out[31][1][0]=-30.0*dxtmp9*tmp20; |
| 294 |
out[32][0][0]=0; |
| 295 |
out[32][1][0]=-90.0*dxtmp9*tmp18; |
| 296 |
out[33][0][0]=0; |
| 297 |
out[33][1][0]=-210.0*dxtmp9*tmp19; |
| 298 |
out[34][0][0]=0; |
| 299 |
out[34][1][0]=-50.0*dxtmp10*tmp20; |
| 300 |
out[35][0][0]=0; |
| 301 |
out[35][1][0]=-150.0*dxtmp10*tmp18; |
| 302 |
out[36][0][0]=0; |
| 303 |
out[36][1][0]=-350.0*dxtmp10*tmp19; |
| 304 |
out[37][0][0]=0; |
| 305 |
out[37][1][0]=-70.0*dxtmp11*tmp20; |
| 306 |
out[38][0][0]=0; |
| 307 |
out[38][1][0]=-210.0*dxtmp11*tmp18; |
| 308 |
out[39][0][0]=0; |
| 309 |
out[39][1][0]=-490.0*dxtmp11*tmp19; |
| 310 |
|
| 311 |
|
| 312 |
// y-component |
| 313 |
out[0][0][1]=0; |
| 314 |
out[0][1][1]=0; |
| 315 |
out[1][0][1]=(-3.0*tmp2*dytmp3); |
| 316 |
out[1][1][1]=0; |
| 317 |
out[2][0][1]=sign0*(-5.0*tmp2*dytmp4); |
| 318 |
out[2][1][1]=0; |
| 319 |
out[3][0][1]=(-7.0*tmp2*dytmp5); |
| 320 |
out[3][1][1]=0; |
| 321 |
|
| 322 |
out[4][0][1]=0; |
| 323 |
out[4][1][1]=0; |
| 324 |
out[5][0][1]=(-3.0*tmp6*dytmp3); |
| 325 |
out[5][1][1]=0; |
| 326 |
out[6][0][1]=sign1*(5.0*tmp6*dytmp4); |
| 327 |
out[6][1][1]=0; |
| 328 |
out[7][0][1]=(-7.0*tmp6*dytmp5); |
| 329 |
out[7][1][1]=0; |
| 330 |
|
| 331 |
out[8][0][1]=0; |
| 332 |
out[8][1][1]=sign2*dytmp7; |
| 333 |
out[9][0][1]=0; |
| 334 |
out[9][1][1]=3.0*tmp9*dytmp8; |
| 335 |
out[10][0][1]=0; |
| 336 |
out[10][1][1]=sign2*(-5.0*tmp10*dytmp8); |
| 337 |
out[11][0][1]=0; |
| 338 |
out[11][1][1]=7.0*tmp11*dytmp8; |
| 339 |
|
| 340 |
out[12][0][1]=0; |
| 341 |
out[12][1][1]=sign3*dytmp12; |
| 342 |
out[13][0][1]=0; |
| 343 |
out[13][1][1]=3.0*tmp9*dytmp12; |
| 344 |
out[14][0][1]=0; |
| 345 |
out[14][1][1]=sign3*5.0*tmp10*dytmp12; |
| 346 |
out[15][0][1]=0; |
| 347 |
out[15][1][1]=7.0*tmp11*dytmp12; |
| 348 |
|
| 349 |
out[16][0][1]=0; |
| 350 |
out[16][1][1]=0; |
| 351 |
out[17][0][1]=-30.0*tmp14*dytmp3; |
| 352 |
out[17][1][1]=0; |
| 353 |
out[18][0][1]=-50.0*tmp14*dytmp4; |
| 354 |
out[18][1][1]=0; |
| 355 |
out[19][0][1]=-70.0*tmp14*dytmp5; |
| 356 |
out[19][1][1]=0; |
| 357 |
out[20][0][1]=0; |
| 358 |
out[20][1][1]=0; |
| 359 |
out[21][0][1]=-90.0*tmp15*dytmp3; |
| 360 |
out[21][1][1]=0; |
| 361 |
out[22][0][1]=-150.0*tmp15*dytmp4; |
| 362 |
out[22][1][1]=0; |
| 363 |
out[23][0][1]=-210.0*tmp15*dytmp5; |
| 364 |
out[23][1][1]=0; |
| 365 |
out[24][0][1]=0; |
| 366 |
out[24][1][1]=0; |
| 367 |
out[25][0][1]=-210.0*tmp16*dytmp3; |
| 368 |
out[25][1][1]=0; |
| 369 |
out[26][0][1]=-350.0*tmp16*dytmp4; |
| 370 |
out[26][1][1]=0; |
| 371 |
out[27][0][1]=-490.0*tmp16*dytmp5; |
| 372 |
out[27][1][1]=0; |
| 373 |
out[28][0][1]=0; |
| 374 |
out[28][1][1]=10.0*dytmp17; |
| 375 |
out[29][0][1]=0; |
| 376 |
out[29][1][1]=-30.0*dytmp18; |
| 377 |
out[30][0][1]=0; |
| 378 |
out[30][1][1]=-70.0*dytmp19; |
| 379 |
out[31][0][1]=0; |
| 380 |
out[31][1][1]=-30.0*tmp9*dytmp20; |
| 381 |
out[32][0][1]=0; |
| 382 |
out[32][1][1]=-90.0*tmp9*dytmp18; |
| 383 |
out[33][0][1]=0; |
| 384 |
out[33][1][1]=-210.0*tmp9*dytmp19; |
| 385 |
out[34][0][1]=0; |
| 386 |
out[34][1][1]=-50.0*tmp10*dytmp20; |
| 387 |
out[35][0][1]=0; |
| 388 |
out[35][1][1]=-150.0*tmp10*dytmp18; |
| 389 |
out[36][0][1]=0; |
| 390 |
out[36][1][1]=-350.0*tmp10*dytmp19; |
| 391 |
out[37][0][1]=0; |
| 392 |
out[37][1][1]=-70.0*tmp11*dytmp20; |
| 393 |
out[38][0][1]=0; |
| 394 |
out[38][1][1]=-210.0*tmp11*dytmp18; |
| 395 |
out[39][0][1]=0; |
| 396 |
out[39][1][1]=-490.0*tmp11*dytmp19; |
| 397 |
|
| 398 |
} |
| 399 |
|
| 400 |
//! \brief Evaluate partial derivatives of all shape functions |
| 401 |
void partial (const std::array<unsigned int, 2>& order, |
| 402 |
const typename Traits::DomainType& in, // position |
| 403 |
std::vector<typename Traits::RangeType>& out) const // return value |
| 404 |
{ |
| 405 |
auto totalOrder = std::accumulate(order.begin(), order.end(), 0); |
| 406 |
if (totalOrder == 0) { |
| 407 |
evaluateFunction(in, out); |
| 408 |
} else if (totalOrder == 1) { |
| 409 |
out.resize(size()); |
| 410 |
auto const direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 1)); |
| 411 |
auto const& x = in[0], y = in[1]; |
| 412 |
|
| 413 |
if (direction == 0) { |
| 414 |
auto tmp3 = 2*y - 1; |
| 415 |
auto tmp4 = y*(6*y - 6) + 1; |
| 416 |
auto tmp5 = y*(y*(20*y - 30) + 12) - 1; |
| 417 |
auto tmp8 = y*(y*(y*(35*y - 80) + 60) - 16) + 1; |
| 418 |
auto tmp12 = y*(y*(y*(35*y - 60) + 30) - 4); |
| 419 |
auto tmp18 = y*(y*(2*y - 3) + 1); |
| 420 |
auto tmp19 = y*(y*(y*(5*y - 10) + 6) - 1); |
| 421 |
auto tmp20 = y*(y*(y*(7*y - 14) + 9) - 2); |
| 422 |
|
| 423 |
auto dxtmp1 = 16 - x*(x*(140*x - 240) + 120); |
| 424 |
auto dxtmp2 = x*(x*(140*x - 240) + 120) - 16; |
| 425 |
auto dxtmp6 = x*(x*(140*x - 180) + 60) - 4; |
| 426 |
auto dxtmp9 = 2; |
| 427 |
auto dxtmp10 = 12*x - 6; |
| 428 |
auto dxtmp11 = x*(60*x - 60) + 12; |
| 429 |
auto dxtmp13 = 2 - x*(x*(28*x - 42) + 18); |
| 430 |
auto dxtmp14 = x*(x*(28*x - 42) + 18) - 2; |
| 431 |
auto dxtmp15 = x*(6*x - 6) + 1; |
| 432 |
auto dxtmp16 = x*(x*(20*x - 30) + 12) - 1; |
| 433 |
|
| 434 |
out[0][0]=sign0*dxtmp1; |
| 435 |
out[0][1]=0; |
| 436 |
out[1][0]=(-3.0*dxtmp2*tmp3); |
| 437 |
out[1][1]=0; |
| 438 |
out[2][0]=sign0*(-5.0*dxtmp2*tmp4); |
| 439 |
out[2][1]=0; |
| 440 |
out[3][0]=(-7.0*dxtmp2*tmp5); |
| 441 |
out[3][1]=0; |
| 442 |
|
| 443 |
out[4][0]=sign1*dxtmp6; |
| 444 |
out[4][1]=0; |
| 445 |
out[5][0]=(-3.0*dxtmp6*tmp3); |
| 446 |
out[5][1]=0; |
| 447 |
out[6][0]=sign1*(5.0*dxtmp6*tmp4); |
| 448 |
out[6][1]=0; |
| 449 |
out[7][0]=(-7.0*dxtmp6*tmp5); |
| 450 |
out[7][1]=0; |
| 451 |
|
| 452 |
out[8][0]=0; |
| 453 |
out[8][1]=0; |
| 454 |
out[9][0]=0; |
| 455 |
out[9][1]=3.0*dxtmp9*tmp8; |
| 456 |
out[10][0]=0; |
| 457 |
out[10][1]=sign2*(-5.0*dxtmp10*tmp8); |
| 458 |
out[11][0]=0; |
| 459 |
out[11][1]=7.0*dxtmp11*tmp8; |
| 460 |
|
| 461 |
out[12][0]=0; |
| 462 |
out[12][1]=0; |
| 463 |
out[13][0]=0; |
| 464 |
out[13][1]=3.0*dxtmp9*tmp12; |
| 465 |
out[14][0]=0; |
| 466 |
out[14][1]=sign3*5.0*dxtmp10*tmp12; |
| 467 |
out[15][0]=0; |
| 468 |
out[15][1]=7.0*dxtmp11*tmp12; |
| 469 |
|
| 470 |
out[16][0]=10.0*dxtmp13; |
| 471 |
out[16][1]=0; |
| 472 |
out[17][0]=-30.0*dxtmp14*tmp3; |
| 473 |
out[17][1]=0; |
| 474 |
out[18][0]=-50.0*dxtmp14*tmp4; |
| 475 |
out[18][1]=0; |
| 476 |
out[19][0]=-70.0*dxtmp14*tmp5; |
| 477 |
out[19][1]=0; |
| 478 |
out[20][0]=-30.0*dxtmp15; |
| 479 |
out[20][1]=0; |
| 480 |
out[21][0]=-90.0*dxtmp15*tmp3; |
| 481 |
out[21][1]=0; |
| 482 |
out[22][0]=-150.0*dxtmp15*tmp4; |
| 483 |
out[22][1]=0; |
| 484 |
out[23][0]=-210.0*dxtmp15*tmp5; |
| 485 |
out[23][1]=0; |
| 486 |
out[24][0]=-70.0*dxtmp16; |
| 487 |
out[24][1]=0; |
| 488 |
out[25][0]=-210.0*dxtmp16*tmp3; |
| 489 |
out[25][1]=0; |
| 490 |
out[26][0]=-350.0*dxtmp16*tmp4; |
| 491 |
out[26][1]=0; |
| 492 |
out[27][0]=-490.0*dxtmp16*tmp5; |
| 493 |
out[27][1]=0; |
| 494 |
out[28][0]=0; |
| 495 |
out[28][1]=0; |
| 496 |
out[29][0]=0; |
| 497 |
out[29][1]=0; |
| 498 |
out[30][0]=0; |
| 499 |
out[30][1]=0; |
| 500 |
out[31][0]=0; |
| 501 |
out[31][1]=-30.0*dxtmp9*tmp20; |
| 502 |
out[32][0]=0; |
| 503 |
out[32][1]=-90.0*dxtmp9*tmp18; |
| 504 |
out[33][0]=0; |
| 505 |
out[33][1]=-210.0*dxtmp9*tmp19; |
| 506 |
out[34][0]=0; |
| 507 |
out[34][1]=-50.0*dxtmp10*tmp20; |
| 508 |
out[35][0]=0; |
| 509 |
out[35][1]=-150.0*dxtmp10*tmp18; |
| 510 |
out[36][0]=0; |
| 511 |
out[36][1]=-350.0*dxtmp10*tmp19; |
| 512 |
out[37][0]=0; |
| 513 |
out[37][1]=-70.0*dxtmp11*tmp20; |
| 514 |
out[38][0]=0; |
| 515 |
out[38][1]=-210.0*dxtmp11*tmp18; |
| 516 |
out[39][0]=0; |
| 517 |
out[39][1]=-490.0*dxtmp11*tmp19; |
| 518 |
} else if (direction == 1) { |
| 519 |
const auto tmp2 = x*(x*(x*(35*x - 80) + 60) - 16) + 1; |
| 520 |
const auto tmp6 = x*(x*(x*(35*x - 60) + 30) - 4); |
| 521 |
const auto tmp9 = 2*x - 1; |
| 522 |
const auto tmp10 = x*(6*x - 6) + 1; |
| 523 |
const auto tmp11 = x*(x*(20*x - 30) + 12) - 1; |
| 524 |
const auto tmp14 = x*(x*(x*(7*x - 14) + 9) - 2); |
| 525 |
const auto tmp15 = x*(x*(2*x - 3) + 1); |
| 526 |
const auto tmp16 = x*(x*(x*(5*x - 10) + 6) - 1); |
| 527 |
|
| 528 |
const auto dytmp3 = 2; |
| 529 |
const auto dytmp4 = 12*y - 6; |
| 530 |
const auto dytmp5 = y*(60*y - 60) + 12; |
| 531 |
const auto dytmp7 = 16 - y*(y*(140*y - 240) + 120); |
| 532 |
const auto dytmp8 = y*(y*(140*y - 240) + 120) - 16; |
| 533 |
const auto dytmp12 = y*(y*(140*y - 180) + 60) - 4; |
| 534 |
const auto dytmp17 = 2 - y*(y*(28*y - 42) + 18); |
| 535 |
const auto dytmp18 = y*(6*y - 6) + 1; |
| 536 |
const auto dytmp19 = y*(y*(20*y - 30) + 12) - 1; |
| 537 |
const auto dytmp20 = y*(y*(28*y - 42) + 18) - 2; |
| 538 |
|
| 539 |
out[0][0]=0; |
| 540 |
out[0][1]=0; |
| 541 |
out[1][0]=(-3.0*tmp2*dytmp3); |
| 542 |
out[1][1]=0; |
| 543 |
out[2][0]=sign0*(-5.0*tmp2*dytmp4); |
| 544 |
out[2][1]=0; |
| 545 |
out[3][0]=(-7.0*tmp2*dytmp5); |
| 546 |
out[3][1]=0; |
| 547 |
|
| 548 |
out[4][0]=0; |
| 549 |
out[4][1]=0; |
| 550 |
out[5][0]=(-3.0*tmp6*dytmp3); |
| 551 |
out[5][1]=0; |
| 552 |
out[6][0]=sign1*(5.0*tmp6*dytmp4); |
| 553 |
out[6][1]=0; |
| 554 |
out[7][0]=(-7.0*tmp6*dytmp5); |
| 555 |
out[7][1]=0; |
| 556 |
|
| 557 |
out[8][0]=0; |
| 558 |
out[8][1]=sign2*dytmp7; |
| 559 |
out[9][0]=0; |
| 560 |
out[9][1]=3.0*tmp9*dytmp8; |
| 561 |
out[10][0]=0; |
| 562 |
out[10][1]=sign2*(-5.0*tmp10*dytmp8); |
| 563 |
out[11][0]=0; |
| 564 |
out[11][1]=7.0*tmp11*dytmp8; |
| 565 |
|
| 566 |
out[12][0]=0; |
| 567 |
out[12][1]=sign3*dytmp12; |
| 568 |
out[13][0]=0; |
| 569 |
out[13][1]=3.0*tmp9*dytmp12; |
| 570 |
out[14][0]=0; |
| 571 |
out[14][1]=sign3*5.0*tmp10*dytmp12; |
| 572 |
out[15][0]=0; |
| 573 |
out[15][1]=7.0*tmp11*dytmp12; |
| 574 |
|
| 575 |
out[16][0]=0; |
| 576 |
out[16][1]=0; |
| 577 |
out[17][0]=-30.0*tmp14*dytmp3; |
| 578 |
out[17][1]=0; |
| 579 |
out[18][0]=-50.0*tmp14*dytmp4; |
| 580 |
out[18][1]=0; |
| 581 |
out[19][0]=-70.0*tmp14*dytmp5; |
| 582 |
out[19][1]=0; |
| 583 |
out[20][0]=0; |
| 584 |
out[20][1]=0; |
| 585 |
out[21][0]=-90.0*tmp15*dytmp3; |
| 586 |
out[21][1]=0; |
| 587 |
out[22][0]=-150.0*tmp15*dytmp4; |
| 588 |
out[22][1]=0; |
| 589 |
out[23][0]=-210.0*tmp15*dytmp5; |
| 590 |
out[23][1]=0; |
| 591 |
out[24][0]=0; |
| 592 |
out[24][1]=0; |
| 593 |
out[25][0]=-210.0*tmp16*dytmp3; |
| 594 |
out[25][1]=0; |
| 595 |
out[26][0]=-350.0*tmp16*dytmp4; |
| 596 |
out[26][1]=0; |
| 597 |
out[27][0]=-490.0*tmp16*dytmp5; |
| 598 |
out[27][1]=0; |
| 599 |
out[28][0]=0; |
| 600 |
out[28][1]=10.0*dytmp17; |
| 601 |
out[29][0]=0; |
| 602 |
out[29][1]=-30.0*dytmp18; |
| 603 |
out[30][0]=0; |
| 604 |
out[30][1]=-70.0*dytmp19; |
| 605 |
out[31][0]=0; |
| 606 |
out[31][1]=-30.0*tmp9*dytmp20; |
| 607 |
out[32][0]=0; |
| 608 |
out[32][1]=-90.0*tmp9*dytmp18; |
| 609 |
out[33][0]=0; |
| 610 |
out[33][1]=-210.0*tmp9*dytmp19; |
| 611 |
out[34][0]=0; |
| 612 |
out[34][1]=-50.0*tmp10*dytmp20; |
| 613 |
out[35][0]=0; |
| 614 |
out[35][1]=-150.0*tmp10*dytmp18; |
| 615 |
out[36][0]=0; |
| 616 |
out[36][1]=-350.0*tmp10*dytmp19; |
| 617 |
out[37][0]=0; |
| 618 |
out[37][1]=-70.0*tmp11*dytmp20; |
| 619 |
out[38][0]=0; |
| 620 |
out[38][1]=-210.0*tmp11*dytmp18; |
| 621 |
out[39][0]=0; |
| 622 |
out[39][1]=-490.0*tmp11*dytmp19; |
| 623 |
} else { |
| 624 |
DUNE_THROW(RangeError, "Component out of range."); |
| 625 |
} |
| 626 |
} else { |
| 627 |
DUNE_THROW(NotImplemented, "Desired derivative order is not implemented"); |
| 628 |
} |
| 629 |
} |
| 630 |
|
| 631 |
//! \brief Polynomial order of the shape functions |
| 632 |
unsigned int order () const |
| 633 |
{ |
| 634 |
return 7; |
| 635 |
} |
| 636 |
|
| 637 |
private: |
| 638 |
R sign0, sign1, sign2, sign3; |
| 639 |
}; |
| 640 |
} |
| 641 |
|
| 642 |
#endif // DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS3_CUBE2D_LOCALBASIS_HH |