FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
details.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
9#include <kernel/util/tiny_algebra.hpp>
10
11namespace FEAT
12{
13 namespace Space
14 {
16 {
17 template<typename SpaceData_>
18 CUDA_HOST_DEVICE static void trans_values(SpaceData_& space_data)
19 {
20 // loop over all basis functions
21 for(int i(0); i < SpaceData_::max_local_dofs; ++i)
22 {
23 // and copy the basis function value
24 space_data.phi[i].value = space_data.phi[i].ref_value;
25 }
26 }
27
28 template<typename SpaceData_, typename JacInvType_>
29 CUDA_HOST_DEVICE static void trans_gradients(SpaceData_& space_data, const JacInvType_& jac_inv)
30 {
31 // loop over all basis functions
32 for(int i(0); i < SpaceData_::max_local_dofs; ++i)
33 {
34 // and apply the first-order chain rule
35 space_data.phi[i].grad.set_vec_mat_mult(space_data.phi[i].ref_grad, jac_inv);
36 }
37 }
38
39 template<typename SpaceData_, typename JacInvType_>
40 CUDA_HOST_DEVICE static void inplace_trans_gradients(SpaceData_& space_data, const JacInvType_& jac_inv)
41 {
42 typename SpaceData_::EvalTraits::BasisReferenceGradientType tmp;
43 // loop over all basis functions
44 for(int i(0); i < SpaceData_::max_local_dofs; ++i)
45 {
46 tmp = space_data.phi[i].grad;
47 // and apply the first-order chain rule
48 space_data.phi[i].grad.set_vec_mat_mult(tmp, jac_inv);
49 }
50 }
51
52 template<typename SpaceData_, typename JacInvType_, typename HessInvType_>
53 CUDA_HOST_DEVICE static void trans_hessians(SpaceData_& space_data, const JacInvType_& jac_inv, const HessInvType_& hess_inv)
54 {
55 // loop over all basis functions
56 for(int i(0); i < SpaceData_::max_local_dofs; ++i)
57 {
58 // and apply the second-order chain rule
59 space_data.phi[i].hess.set_double_mat_mult(space_data.phi[i].ref_hess, jac_inv, jac_inv);
60 space_data.phi[i].hess.add_vec_tensor_mult(space_data.phi[i].ref_grad, hess_inv);
61 }
62 }
63 };
64 }
65}
FEAT Kernel base header.
FEAT namespace.
Definition: adjactor.hpp:12
@ hess_inv
specifies whether the trafo should supply inverse hessian tensors
@ jac_inv
specifies whether the trafo should supply inverse jacobian matrices