OOFEM 3.0
Loading...
Searching...
No Matches
tensor4.h
Go to the documentation of this file.
1/*
2 *
3 * ##### ##### ###### ###### ### ###
4 * ## ## ## ## ## ## ## ### ##
5 * ## ## ## ## #### #### ## # ##
6 * ## ## ## ## ## ## ## ##
7 * ## ## ## ## ## ## ## ##
8 * ##### ##### ## ###### ## ##
9 *
10 *
11 * OOFEM : Object Oriented Finite Element Code
12 *
13 * Copyright (C) 1993 - 2025 Borek Patzak
14 *
15 *
16 *
17 * Czech Technical University, Faculty of Civil Engineering,
18 * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19 *
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 */
34
35#include "floatmatrix.h"
36#include "floatarray.h"
37#include "mathfem.h"
38#include "index.h"
39#pragma once
40
41using namespace FTensor;
42
43
52
53namespace oofem {
54class Tensor4_3d : public Tensor4< double, 3, 3, 3, 3 >
55{
56public:
57 using Tensor4< double, 3, 3, 3, 3 >::Tensor4;
58
64 // the first column
65 this->data [ 0 ] [ 0 ] [ 0 ] [ 0 ] = 0;
66 this->data [ 0 ] [ 1 ] [ 0 ] [ 0 ] = 0.;
67 this->data [ 0 ] [ 2 ] [ 0 ] [ 0 ] = 0.;
68 this->data [ 1 ] [ 0 ] [ 0 ] [ 0 ] = 0.;
69 this->data [ 1 ] [ 1 ] [ 0 ] [ 0 ] = 0.;
70 this->data [ 1 ] [ 2 ] [ 0 ] [ 0 ] = 0.;
71 this->data [ 2 ] [ 0 ] [ 0 ] [ 0 ] = 0.;
72 this->data [ 2 ] [ 1 ] [ 0 ] [ 0 ] = 0.;
73 this->data [ 2 ] [ 2 ] [ 0 ] [ 0 ] = 0.;
74 // the second column
75 this->data [ 0 ] [ 0 ] [ 1 ] [ 1 ] = 0.;
76 this->data [ 0 ] [ 1 ] [ 1 ] [ 1 ] = 0.;
77 this->data [ 0 ] [ 2 ] [ 1 ] [ 1 ] = 0.;
78 this->data [ 1 ] [ 0 ] [ 1 ] [ 1 ] = 0.;
79 this->data [ 1 ] [ 1 ] [ 1 ] [ 1 ] = 0.;
80 this->data [ 1 ] [ 2 ] [ 1 ] [ 1 ] = 0.;
81 this->data [ 2 ] [ 0 ] [ 1 ] [ 1 ] = 0.;
82 this->data [ 2 ] [ 1 ] [ 1 ] [ 1 ] = 0.;
83 this->data [ 2 ] [ 2 ] [ 1 ] [ 1 ] = 0.;
84 // the third column
85 this->data [ 0 ] [ 0 ] [ 2 ] [ 2 ] = 0.;
86 this->data [ 0 ] [ 1 ] [ 2 ] [ 2 ] = 0.;
87 this->data [ 0 ] [ 2 ] [ 2 ] [ 2 ] = 0.;
88 this->data [ 1 ] [ 0 ] [ 2 ] [ 2 ] = 0.;
89 this->data [ 1 ] [ 1 ] [ 2 ] [ 2 ] = 0.;
90 this->data [ 1 ] [ 2 ] [ 2 ] [ 2 ] = 0.;
91 this->data [ 2 ] [ 0 ] [ 2 ] [ 2 ] = 0.;
92 this->data [ 2 ] [ 1 ] [ 2 ] [ 2 ] = 0.;
93 this->data [ 2 ] [ 2 ] [ 2 ] [ 2 ] = 0.;
94 // the fourth column
95 this->data [ 0 ] [ 0 ] [ 1 ] [ 2 ] = 0.;
96 this->data [ 0 ] [ 1 ] [ 1 ] [ 2 ] = 0.;
97 this->data [ 0 ] [ 2 ] [ 1 ] [ 2 ] = 0.;
98 this->data [ 1 ] [ 0 ] [ 1 ] [ 2 ] = 0.;
99 this->data [ 1 ] [ 1 ] [ 1 ] [ 2 ] = 0.;
100 this->data [ 1 ] [ 2 ] [ 1 ] [ 2 ] = 0.;
101 this->data [ 2 ] [ 0 ] [ 1 ] [ 2 ] = 0.;
102 this->data [ 2 ] [ 1 ] [ 1 ] [ 2 ] = 0.;
103 this->data [ 2 ] [ 2 ] [ 1 ] [ 2 ] = 0.;
104 //the fifth column
105 this->data [ 0 ] [ 0 ] [ 0 ] [ 2 ] = 0.;
106 this->data [ 0 ] [ 1 ] [ 0 ] [ 2 ] = 0.;
107 this->data [ 0 ] [ 2 ] [ 0 ] [ 2 ] = 0.;
108 this->data [ 1 ] [ 0 ] [ 0 ] [ 2 ] = 0.;
109 this->data [ 1 ] [ 1 ] [ 0 ] [ 2 ] = 0.;
110 this->data [ 1 ] [ 2 ] [ 0 ] [ 2 ] = 0.;
111 this->data [ 2 ] [ 0 ] [ 0 ] [ 2 ] = 0.;
112 this->data [ 2 ] [ 1 ] [ 0 ] [ 2 ] = 0.;
113 this->data [ 2 ] [ 2 ] [ 0 ] [ 2 ] = 0.;
114 //the sixth column
115 this->data [ 0 ] [ 0 ] [ 0 ] [ 1 ] = 0.;
116 this->data [ 0 ] [ 1 ] [ 0 ] [ 1 ] = 0.;
117 this->data [ 0 ] [ 2 ] [ 0 ] [ 1 ] = 0.;
118 this->data [ 1 ] [ 0 ] [ 0 ] [ 1 ] = 0.;
119 this->data [ 1 ] [ 1 ] [ 0 ] [ 1 ] = 0.;
120 this->data [ 1 ] [ 2 ] [ 0 ] [ 1 ] = 0.;
121 this->data [ 2 ] [ 0 ] [ 0 ] [ 1 ] = 0.;
122 this->data [ 2 ] [ 1 ] [ 0 ] [ 1 ] = 0.;
123 this->data [ 2 ] [ 2 ] [ 0 ] [ 1 ] = 0.;
124 //the seventh column
125 this->data [ 0 ] [ 0 ] [ 2 ] [ 1 ] = 0.;
126 this->data [ 0 ] [ 1 ] [ 2 ] [ 1 ] = 0.;
127 this->data [ 0 ] [ 2 ] [ 2 ] [ 1 ] = 0.;
128 this->data [ 1 ] [ 0 ] [ 2 ] [ 1 ] = 0.;
129 this->data [ 1 ] [ 1 ] [ 2 ] [ 1 ] = 0.;
130 this->data [ 1 ] [ 2 ] [ 2 ] [ 1 ] = 0.;
131 this->data [ 2 ] [ 0 ] [ 2 ] [ 1 ] = 0.;
132 this->data [ 2 ] [ 1 ] [ 2 ] [ 1 ] = 0.;
133 this->data [ 2 ] [ 2 ] [ 2 ] [ 1 ] = 0.;
134 //the eight column
135 this->data [ 0 ] [ 0 ] [ 2 ] [ 0 ] = 0.;
136 this->data [ 0 ] [ 1 ] [ 2 ] [ 0 ] = 0.;
137 this->data [ 0 ] [ 2 ] [ 2 ] [ 0 ] = 0.;
138 this->data [ 1 ] [ 0 ] [ 2 ] [ 0 ] = 0.;
139 this->data [ 1 ] [ 1 ] [ 2 ] [ 0 ] = 0.;
140 this->data [ 1 ] [ 2 ] [ 2 ] [ 0 ] = 0.;
141 this->data [ 2 ] [ 0 ] [ 2 ] [ 0 ] = 0.;
142 this->data [ 2 ] [ 1 ] [ 2 ] [ 0 ] = 0.;
143 this->data [ 2 ] [ 2 ] [ 2 ] [ 0 ] = 0.;
144 //the nineght column
145 this->data [ 0 ] [ 0 ] [ 1 ] [ 0 ] = 0.;
146 this->data [ 0 ] [ 1 ] [ 1 ] [ 0 ] = 0.;
147 this->data [ 0 ] [ 2 ] [ 1 ] [ 0 ] = 0.;
148 this->data [ 1 ] [ 0 ] [ 1 ] [ 0 ] = 0.;
149 this->data [ 1 ] [ 1 ] [ 1 ] [ 0 ] = 0.;
150 this->data [ 1 ] [ 2 ] [ 1 ] [ 0 ] = 0.;
151 this->data [ 2 ] [ 0 ] [ 1 ] [ 0 ] = 0.;
152 this->data [ 2 ] [ 1 ] [ 1 ] [ 0 ] = 0.;
153 this->data [ 2 ] [ 2 ] [ 1 ] [ 0 ] = 0.;
154 }
155
160 // the first column
161 this->data [ 0 ] [ 0 ] [ 0 ] [ 0 ] = mat.at(1, 1);
162 this->data [ 0 ] [ 1 ] [ 0 ] [ 0 ] = mat.at(6, 1);
163 this->data [ 0 ] [ 2 ] [ 0 ] [ 0 ] = mat.at(5, 1);
164 this->data [ 1 ] [ 0 ] [ 0 ] [ 0 ] = mat.at(9, 1);
165 this->data [ 1 ] [ 1 ] [ 0 ] [ 0 ] = mat.at(2, 1);
166 this->data [ 1 ] [ 2 ] [ 0 ] [ 0 ] = mat.at(4, 1);
167 this->data [ 2 ] [ 0 ] [ 0 ] [ 0 ] = mat.at(8, 1);
168 this->data [ 2 ] [ 1 ] [ 0 ] [ 0 ] = mat.at(7, 1);
169 this->data [ 2 ] [ 2 ] [ 0 ] [ 0 ] = mat.at(3, 1);
170 // the second column
171 this->data [ 0 ] [ 0 ] [ 1 ] [ 1 ] = mat.at(1, 2);
172 this->data [ 0 ] [ 1 ] [ 1 ] [ 1 ] = mat.at(6, 2);
173 this->data [ 0 ] [ 2 ] [ 1 ] [ 1 ] = mat.at(5, 2);
174 this->data [ 1 ] [ 0 ] [ 1 ] [ 1 ] = mat.at(9, 2);
175 this->data [ 1 ] [ 1 ] [ 1 ] [ 1 ] = mat.at(2, 2);
176 this->data [ 1 ] [ 2 ] [ 1 ] [ 1 ] = mat.at(4, 2);
177 this->data [ 2 ] [ 0 ] [ 1 ] [ 1 ] = mat.at(8, 2);
178 this->data [ 2 ] [ 1 ] [ 1 ] [ 1 ] = mat.at(7, 2);
179 this->data [ 2 ] [ 2 ] [ 1 ] [ 1 ] = mat.at(3, 2);
180 // the third column
181 this->data [ 0 ] [ 0 ] [ 2 ] [ 2 ] = mat.at(1, 3);
182 this->data [ 0 ] [ 1 ] [ 2 ] [ 2 ] = mat.at(6, 3);
183 this->data [ 0 ] [ 2 ] [ 2 ] [ 2 ] = mat.at(5, 3);
184 this->data [ 1 ] [ 0 ] [ 2 ] [ 2 ] = mat.at(9, 3);
185 this->data [ 1 ] [ 1 ] [ 2 ] [ 2 ] = mat.at(2, 3);
186 this->data [ 1 ] [ 2 ] [ 2 ] [ 2 ] = mat.at(4, 3);
187 this->data [ 2 ] [ 0 ] [ 2 ] [ 2 ] = mat.at(8, 3);
188 this->data [ 2 ] [ 1 ] [ 2 ] [ 2 ] = mat.at(7, 3);
189 this->data [ 2 ] [ 2 ] [ 2 ] [ 2 ] = mat.at(3, 3);
190 // the fourth column
191 this->data [ 0 ] [ 0 ] [ 1 ] [ 2 ] = mat.at(1, 4);
192 this->data [ 0 ] [ 1 ] [ 1 ] [ 2 ] = mat.at(6, 4);
193 this->data [ 0 ] [ 2 ] [ 1 ] [ 2 ] = mat.at(5, 4);
194 this->data [ 1 ] [ 0 ] [ 1 ] [ 2 ] = mat.at(9, 4);
195 this->data [ 1 ] [ 1 ] [ 1 ] [ 2 ] = mat.at(2, 4);
196 this->data [ 1 ] [ 2 ] [ 1 ] [ 2 ] = mat.at(4, 4);
197 this->data [ 2 ] [ 0 ] [ 1 ] [ 2 ] = mat.at(8, 4);
198 this->data [ 2 ] [ 1 ] [ 1 ] [ 2 ] = mat.at(7, 4);
199 this->data [ 2 ] [ 2 ] [ 1 ] [ 2 ] = mat.at(3, 4);
200 //the fifth column
201 this->data [ 0 ] [ 0 ] [ 0 ] [ 2 ] = mat.at(1, 5);
202 this->data [ 0 ] [ 1 ] [ 0 ] [ 2 ] = mat.at(6, 5);
203 this->data [ 0 ] [ 2 ] [ 0 ] [ 2 ] = mat.at(5, 5);
204 this->data [ 1 ] [ 0 ] [ 0 ] [ 2 ] = mat.at(9, 5);
205 this->data [ 1 ] [ 1 ] [ 0 ] [ 2 ] = mat.at(2, 5);
206 this->data [ 1 ] [ 2 ] [ 0 ] [ 2 ] = mat.at(4, 5);
207 this->data [ 2 ] [ 0 ] [ 0 ] [ 2 ] = mat.at(8, 5);
208 this->data [ 2 ] [ 1 ] [ 0 ] [ 2 ] = mat.at(7, 5);
209 this->data [ 2 ] [ 2 ] [ 0 ] [ 2 ] = mat.at(3, 5);
210 //the sixth column
211 this->data [ 0 ] [ 0 ] [ 0 ] [ 1 ] = mat.at(1, 6);
212 this->data [ 0 ] [ 1 ] [ 0 ] [ 1 ] = mat.at(6, 6);
213 this->data [ 0 ] [ 2 ] [ 0 ] [ 1 ] = mat.at(5, 6);
214 this->data [ 1 ] [ 0 ] [ 0 ] [ 1 ] = mat.at(9, 6);
215 this->data [ 1 ] [ 1 ] [ 0 ] [ 1 ] = mat.at(2, 6);
216 this->data [ 1 ] [ 2 ] [ 0 ] [ 1 ] = mat.at(4, 6);
217 this->data [ 2 ] [ 0 ] [ 0 ] [ 1 ] = mat.at(8, 6);
218 this->data [ 2 ] [ 1 ] [ 0 ] [ 1 ] = mat.at(7, 6);
219 this->data [ 2 ] [ 2 ] [ 0 ] [ 1 ] = mat.at(3, 6);
220 //the seventh column
221 this->data [ 0 ] [ 0 ] [ 2 ] [ 1 ] = mat.at(1, 7);
222 this->data [ 0 ] [ 1 ] [ 2 ] [ 1 ] = mat.at(6, 7);
223 this->data [ 0 ] [ 2 ] [ 2 ] [ 1 ] = mat.at(5, 7);
224 this->data [ 1 ] [ 0 ] [ 2 ] [ 1 ] = mat.at(9, 7);
225 this->data [ 1 ] [ 1 ] [ 2 ] [ 1 ] = mat.at(2, 7);
226 this->data [ 1 ] [ 2 ] [ 2 ] [ 1 ] = mat.at(4, 7);
227 this->data [ 2 ] [ 0 ] [ 2 ] [ 1 ] = mat.at(8, 7);
228 this->data [ 2 ] [ 1 ] [ 2 ] [ 1 ] = mat.at(7, 7);
229 this->data [ 2 ] [ 2 ] [ 2 ] [ 1 ] = mat.at(3, 7);
230 //the eight column
231 this->data [ 0 ] [ 0 ] [ 2 ] [ 0 ] = mat.at(1, 8);
232 this->data [ 0 ] [ 1 ] [ 2 ] [ 0 ] = mat.at(6, 8);
233 this->data [ 0 ] [ 2 ] [ 2 ] [ 0 ] = mat.at(5, 8);
234 this->data [ 1 ] [ 0 ] [ 2 ] [ 0 ] = mat.at(9, 8);
235 this->data [ 1 ] [ 1 ] [ 2 ] [ 0 ] = mat.at(2, 8);
236 this->data [ 1 ] [ 2 ] [ 2 ] [ 0 ] = mat.at(4, 8);
237 this->data [ 2 ] [ 0 ] [ 2 ] [ 0 ] = mat.at(8, 8);
238 this->data [ 2 ] [ 1 ] [ 2 ] [ 0 ] = mat.at(7, 8);
239 this->data [ 2 ] [ 2 ] [ 2 ] [ 0 ] = mat.at(3, 8);
240 //the nineght column
241 this->data [ 0 ] [ 0 ] [ 1 ] [ 0 ] = mat.at(1, 9);
242 this->data [ 0 ] [ 1 ] [ 1 ] [ 0 ] = mat.at(6, 9);
243 this->data [ 0 ] [ 2 ] [ 1 ] [ 0 ] = mat.at(5, 9);
244 this->data [ 1 ] [ 0 ] [ 1 ] [ 0 ] = mat.at(9, 9);
245 this->data [ 1 ] [ 1 ] [ 1 ] [ 0 ] = mat.at(2, 9);
246 this->data [ 1 ] [ 2 ] [ 1 ] [ 0 ] = mat.at(4, 9);
247 this->data [ 2 ] [ 0 ] [ 1 ] [ 0 ] = mat.at(8, 9);
248 this->data [ 2 ] [ 1 ] [ 1 ] [ 0 ] = mat.at(7, 9);
249 this->data [ 2 ] [ 2 ] [ 1 ] [ 0 ] = mat.at(3, 9);
250 }
251
255
257 {
258 return { this->operator()(0, 0, 0, 0), this->operator()(1, 1, 0, 0), this->operator()(2, 2, 0, 0), this->operator()(1, 2, 0, 0), this->operator()(0, 2, 0, 0), this->operator()(0, 1, 0, 0), this->operator()(2, 1, 0, 0), this->operator()(2, 0, 0, 0), this->operator()(1, 0, 0, 0), this->operator()(0, 0, 1, 1), this->operator()(1, 1, 1, 1), this->operator()(2, 2, 1, 1), this->operator()(1, 2, 1, 1), this->operator()(0, 2, 1, 1), this->operator()(0, 1, 1, 1), this->operator()(2, 1, 1, 1), this->operator()(2, 0, 1, 1), this->operator()(1, 0, 1, 1), this->operator()(0, 0, 2, 2), this->operator()(1, 1, 2, 2), this->operator()(2, 2, 2, 2), this->operator()(1, 2, 2, 2), this->operator()(0, 2, 2, 2), this->operator()(0, 1, 2, 2), this->operator()(2, 1, 2, 2), this->operator()(2, 0, 2, 2), this->operator()(1, 0, 2, 2), this->operator()(0, 0, 1, 2), this->operator()(1, 1, 1, 2), this->operator()(2, 2, 1, 2), this->operator()(1, 2, 1, 2), this->operator()(0, 2, 1, 2), this->operator()(0, 1, 1, 2), this->operator()(2, 1, 1, 2), this->operator()(2, 0, 1, 2), this->operator()(1, 0, 1, 2), this->operator()(0, 0, 0, 2), this->operator()(1, 1, 0, 2), this->operator()(2, 2, 0, 2), this->operator()(1, 2, 0, 2), this->operator()(0, 2, 0, 2), this->operator()(0, 1, 0, 2), this->operator()(2, 1, 0, 2), this->operator()(2, 0, 0, 2), this->operator()(1, 0, 0, 2), this->operator()(0, 0, 0, 1), this->operator()(1, 1, 0, 1), this->operator()(2, 2, 0, 1), this->operator()(1, 2, 0, 1), this->operator()(0, 2, 0, 1), this->operator()(0, 1, 0, 1), this->operator()(2, 1, 0, 1), this->operator()(2, 0, 0, 1), this->operator()(1, 0, 0, 1), this->operator()(0, 0, 2, 1), this->operator()(1, 1, 2, 1), this->operator()(2, 2, 2, 1), this->operator()(1, 2, 2, 1), this->operator()(0, 2, 2, 1), this->operator()(0, 1, 2, 1), this->operator()(2, 1, 2, 1), this->operator()(2, 0, 2, 1), this->operator()(1, 0, 2, 1), this->operator()(0, 0, 2, 0), this->operator()(1, 1, 2, 0), this->operator()(2, 2, 2, 0), this->operator()(1, 2, 2, 0), this->operator()(0, 2, 2, 0), this->operator()(0, 1, 2, 0), this->operator()(2, 1, 2, 0), this->operator()(2, 0, 2, 0), this->operator()(1, 0, 2, 0), this->operator()(0, 0, 1, 0), this->operator()(1, 1, 1, 0), this->operator()(2, 2, 1, 0), this->operator()(1, 2, 1, 0), this->operator()(0, 2, 1, 0), this->operator()(0, 1, 1, 0), this->operator()(2, 1, 1, 0), this->operator()(2, 0, 1, 0), this->operator()(1, 0, 1, 0) };
259 }
260
261 //@todo, make this working
262 /* attempt to implement noinline print, but it doesn't work, why?
263 * void __attribute__((noinline)) printYourself() const
264 * // Prints the receiver on screen.
265 * {
266 * printf("4th order tensor");
267 * for ( int i = 1; i <= 3; i++ ) {
268 * for ( int j = 1; j <= 3; j++ ) {
269 * for ( int k = 1; k <= 3; k++ ) {
270 * for ( int l = 1; l <= 3; l++ ) {
271 * printf( "Component %d %d %d %d is: %10.3e \n", i,j,k,l,this->data[i][j][k][l] );
272 * }
273 * }
274 * }
275 * }
276 * }
277 *
278 * void __attribute__((noinline)) printComponent(int i, int j, int k, int l) const
279 * // Prints the receiver on screen.
280 * {
281 * printf( "Component %d %d %d %d is: %10.3e\n ", i,j,k,l,this->data[i][j][k][l] );
282 * }
283 */
284};
285} // end namespace oofem
double at(std::size_t i, std::size_t j) const
Tensor4_3d(const oofem::FloatMatrixF< 9, 9 > &mat)
Definition tensor4.h:159
FloatMatrixF< 9, 9 > to_voigt_form()
Definition tensor4.h:256

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011