BELFEM
0.9.0
Berkeley Lab Finite Element Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
fn_TR_ten_to_mat.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 FN_BELFEM_TR_TO_MAT_HPP
13
#define FN_BELFEM_TR_TO_MAT_HPP
14
15
#include "
cl_Matrix.hpp
"
16
17
namespace
belfem
18
{
19
namespace
tensor
20
{
21
//----------------------------------------------------------------------------
22
27
template
<
typename
T >
void
28
ten_to_mat
(
const
T * A, T * C )
29
{
30
C[ 0 ] = A[ 0 ];
31
C[ 1 ] = A[ 4 ];
32
C[ 2 ] = A[ 8 ];
33
C[ 3 ] = A[ 7 ];
34
C[ 4 ] = A[ 2 ];
35
C[ 5 ] = A[ 3 ];
36
C[ 6 ] = A[ 36 ];
37
C[ 7 ] = A[ 40 ];
38
C[ 8 ] = A[ 44 ];
39
C[ 9 ] = A[ 43 ];
40
C[ 10 ] = A[ 38 ];
41
C[ 11 ] = A[ 39 ];
42
C[ 12 ] = A[ 72 ];
43
C[ 13 ] = A[ 76 ];
44
C[ 14 ] = A[ 80 ];
45
C[ 15 ] = A[ 79 ];
46
C[ 16 ] = A[ 74 ];
47
C[ 17 ] = A[ 75 ];
48
C[ 18 ] = A[ 63 ];
49
C[ 19 ] = A[ 67 ];
50
C[ 20 ] = A[ 71 ];
51
C[ 21 ] = A[ 70 ];
52
C[ 22 ] = A[ 65 ];
53
C[ 23 ] = A[ 66 ];
54
C[ 24 ] = A[ 18 ];
55
C[ 25 ] = A[ 22 ];
56
C[ 26 ] = A[ 26 ];
57
C[ 27 ] = A[ 25 ];
58
C[ 28 ] = A[ 20 ];
59
C[ 29 ] = A[ 21 ];
60
C[ 30 ] = A[ 27 ];
61
C[ 31 ] = A[ 31 ];
62
C[ 32 ] = A[ 35 ];
63
C[ 33 ] = A[ 34 ];
64
C[ 34 ] = A[ 29 ];
65
C[ 35 ] = A[ 30 ];
66
}
67
68
template
<
typename
T >
void
69
ten_to_mat
(
const
T * A,
Matrix< T >
& C )
70
{
71
#ifdef BELFEM_ARMADILLO
72
ten_to_mat
( A, C.data() );
73
#else
74
C( 0, 0 ) = A[ 0 ];
75
C( 1, 0 ) = A[ 4 ];
76
C( 2, 0 ) = A[ 8 ];
77
C( 3, 0 ) = A[ 7 ];
78
C( 4, 0 ) = A[ 2 ];
79
C( 5, 0 ) = A[ 3 ];
80
C( 0, 1 ) = A[ 36 ];
81
C( 1, 1 ) = A[ 40 ];
82
C( 2, 1 ) = A[ 44 ];
83
C( 3, 1 ) = A[ 43 ];
84
C( 4, 1 ) = A[ 38 ];
85
C( 5, 1 ) = A[ 39 ];
86
C( 0, 2 ) = A[ 72 ];
87
C( 1, 2 ) = A[ 76 ];
88
C( 2, 2 ) = A[ 80 ];
89
C( 3, 2 ) = A[ 79 ];
90
C( 4, 2 ) = A[ 74 ];
91
C( 5, 2 ) = A[ 75 ];
92
C( 0, 3 ) = A[ 63 ];
93
C( 1, 3 ) = A[ 67 ];
94
C( 2, 3 ) = A[ 71 ];
95
C( 3, 3 ) = A[ 70 ];
96
C( 4, 3 ) = A[ 65 ];
97
C( 5, 3 ) = A[ 66 ];
98
C( 0, 4 ) = A[ 18 ];
99
C( 1, 4 ) = A[ 22 ];
100
C( 2, 4 ) = A[ 26 ];
101
C( 3, 4 ) = A[ 25 ];
102
C( 4, 4 ) = A[ 20 ];
103
C( 5, 4 ) = A[ 21 ];
104
C( 0, 5 ) = A[ 27 ];
105
C( 1, 5 ) = A[ 31 ];
106
C( 2, 5 ) = A[ 35 ];
107
C( 3, 5 ) = A[ 34 ];
108
C( 4, 5 ) = A[ 29 ];
109
C( 5, 5 ) = A[ 30 ];
110
#endif
111
}
112
//----------------------------------------------------------------------------
113
}
/* namespace tensor */
114
}
/* namespace belfem */
115
116
#endif
//FN_BELFEM_TR_TO_MAT_HPP
cl_Matrix.hpp
belfem::Matrix
Dense column-major matrix.
Definition
cl_BZ_Matrix.hpp:28
belfem::tensor
Definition
fn_TR_contract42_arma.hpp:21
belfem::tensor::ten_to_mat
void ten_to_mat(const T *A, T *C)
elasticity matrix conversion Elasticity tensor A => elasticity matrix C
Definition
fn_TR_ten_to_mat.hpp:28
belfem
USER GUIDES:
Definition
cl_Capacitor.cpp:16
src
math
tensor
fn_TR_ten_to_mat.hpp
Generated by
1.18.0