BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
fn_identity.hpp
Go to the documentation of this file.
1/*
2 * BELFEM -- The Berkeley Lab Finite Element Framework
3 * Copyright (c) 2026, The Regents of the University of California,
4 * through Lawrence Berkeley National Laboratory (subject to receipt of any required
5 * approvals from the U.S. Dept. of Energy). All rights reserved.
6 *
7 * Developers: Christian Messe, Gregory Giard
8 *
9 * See the top-level LICENSE file for the complete license and disclaimer.
10 */
11
12#ifndef BELFEM_FN_IDENTITY_HPP
13#define BELFEM_FN_IDENTITY_HPP
14
15#include "cl_Tensor.hpp"
16#include "assert.hpp"
17
18namespace belfem
19{
20 namespace tensor
21 {
22//---------------------------------------------------------------------------
23
30 template< typename T >
31 void
32 identity( Tensor< T > & aTensor )
33 {
34 BELFEM_ASSERT( aTensor.is_3333(),
35 "Tensor must be of size 3x3x3x3" );
36
37 // get pointer to tensor
38 T * tData = aTensor.data();
39
40 // populate
41 tData[ 0 ] = 1.0 ;
42 tData[ 1 ] = 0.0 ;
43 tData[ 2 ] = 0.0 ;
44 tData[ 3 ] = 0.0 ;
45 tData[ 4 ] = 0.0 ;
46 tData[ 5 ] = 0.0 ;
47 tData[ 6 ] = 0.0 ;
48 tData[ 7 ] = 0.0 ;
49 tData[ 8 ] = 0.0 ;
50 tData[ 9 ] = 0.0 ;
51 tData[ 10 ] = 0.5 ;
52 tData[ 11 ] = 0.0 ;
53 tData[ 12 ] = 0.5 ;
54 tData[ 13 ] = 0.0 ;
55 tData[ 14 ] = 0.0 ;
56 tData[ 15 ] = 0.0 ;
57 tData[ 16 ] = 0.0 ;
58 tData[ 17 ] = 0.0 ;
59 tData[ 18 ] = 0.0 ;
60 tData[ 19 ] = 0.0 ;
61 tData[ 20 ] = 0.5 ;
62 tData[ 21 ] = 0.0 ;
63 tData[ 22 ] = 0.0 ;
64 tData[ 23 ] = 0.0 ;
65 tData[ 24 ] = 0.5 ;
66 tData[ 25 ] = 0.0 ;
67 tData[ 26 ] = 0.0 ;
68 tData[ 27 ] = 0.0 ;
69 tData[ 28 ] = 0.5 ;
70 tData[ 29 ] = 0.0 ;
71 tData[ 30 ] = 0.5 ;
72 tData[ 31 ] = 0.0 ;
73 tData[ 32 ] = 0.0 ;
74 tData[ 33 ] = 0.0 ;
75 tData[ 34 ] = 0.0 ;
76 tData[ 35 ] = 0.0 ;
77 tData[ 36 ] = 0.0 ;
78 tData[ 37 ] = 0.0 ;
79 tData[ 38 ] = 0.0 ;
80 tData[ 39 ] = 0.0 ;
81 tData[ 40 ] = 1.0 ;
82 tData[ 41 ] = 0.0 ;
83 tData[ 42 ] = 0.0 ;
84 tData[ 43 ] = 0.0 ;
85 tData[ 44 ] = 0.0 ;
86 tData[ 45 ] = 0.0 ;
87 tData[ 46 ] = 0.0 ;
88 tData[ 47 ] = 0.0 ;
89 tData[ 48 ] = 0.0 ;
90 tData[ 49 ] = 0.0 ;
91 tData[ 50 ] = 0.5 ;
92 tData[ 51 ] = 0.0 ;
93 tData[ 52 ] = 0.5 ;
94 tData[ 53 ] = 0.0 ;
95 tData[ 54 ] = 0.0 ;
96 tData[ 55 ] = 0.0 ;
97 tData[ 56 ] = 0.5 ;
98 tData[ 57 ] = 0.0 ;
99 tData[ 58 ] = 0.0 ;
100 tData[ 59 ] = 0.0 ;
101 tData[ 60 ] = 0.5 ;
102 tData[ 61 ] = 0.0 ;
103 tData[ 62 ] = 0.0 ;
104 tData[ 63 ] = 0.0 ;
105 tData[ 64 ] = 0.0 ;
106 tData[ 65 ] = 0.0 ;
107 tData[ 66 ] = 0.0 ;
108 tData[ 67 ] = 0.0 ;
109 tData[ 68 ] = 0.5 ;
110 tData[ 69 ] = 0.0 ;
111 tData[ 70 ] = 0.5 ;
112 tData[ 71 ] = 0.0 ;
113 tData[ 72 ] = 0.0 ;
114 tData[ 73 ] = 0.0 ;
115 tData[ 74 ] = 0.0 ;
116 tData[ 75 ] = 0.0 ;
117 tData[ 76 ] = 0.0 ;
118 tData[ 77 ] = 0.0 ;
119 tData[ 78 ] = 0.0 ;
120 tData[ 79 ] = 0.0 ;
121 tData[ 80 ] = 1.0 ;
122 }
123//----------------------------------------------------------------------------
124 } /* namespace tensor */
125} /* namespace belfem */
126#endif //BELFEM_FN_IDENTITY_HPP
#define BELFEM_ASSERT(aCheck,...)
Definition assert.hpp:244
Third- or fourth-order tensor container; the constitutive helpers (contraction, rotation,...
Definition cl_Tensor.hpp:43
T * data()
expose the underlying raw pointer
Definition cl_Tensor.hpp:211
bool is_3333() const
returns true if this is a 3x3x3x3 tensor
Definition cl_Tensor.hpp:319
Definition fn_TR_contract42_arma.hpp:21
void identity(Tensor< T > &aTensor)
populate the symmetric identity tensor
Definition fn_identity.hpp:32
USER GUIDES:
Definition cl_Capacitor.cpp:16