LifeV
ETCurrentFE.cpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory UNiversity
7 
8  This file is part of the LifeV library
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation; either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, see <http://www.gnu.org/licenses/>
22 
23 
24 *******************************************************************************
25 */
26 //@HEADER
27 
28 /*!
29  * @file
30  @brief This file contains the complete specialization of the ETCurrentFE methods updateDetJacobian and updateInverseJacobian.
31 
32  @date 12/2012
33  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
34  @author Luca Pasquale <luca.pasquale@mail.polimi.it>
35  */
36 
37 #include <lifev/eta/fem/ETCurrentFE.hpp>
38 
39 namespace LifeV
40 {
41 // ---------------------------------------------------------------
42 // 1D field
43 // ---------------------------------------------------------------
44 
45 // Full specialization for the computation of the determinant
46 template<>
47 void
48 ETCurrentFE<1, 1>::
50 {
51  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its determinant");
52 
53 #ifdef HAVE_LIFEV_DEBUG
55 #endif
56 
58 }
59 
60 // Full specialization for the computation of the determinant
61 template<>
62 void
63 ETCurrentFE<2, 1>::
65 {
66  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its determinant");
67 
68 #ifdef HAVE_LIFEV_DEBUG
70 #endif
71 
73  - M_jacobian[iQuadPt][1][0] * M_jacobian[iQuadPt][0][1];
74 }
75 
76 // Full specialization for the computation of the determinant
77 template<>
78 void
79 ETCurrentFE<3, 1>::
81 {
82  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its determinant");
83 
84 #ifdef HAVE_LIFEV_DEBUG
86 #endif
87 
89  M_jacobian[iQuadPt][0][0] * M_jacobian[iQuadPt][1][1] * M_jacobian[iQuadPt][2][2]
90  + M_jacobian[iQuadPt][0][1] * M_jacobian[iQuadPt][1][2] * M_jacobian[iQuadPt][2][0]
91  + M_jacobian[iQuadPt][0][2] * M_jacobian[iQuadPt][1][0] * M_jacobian[iQuadPt][2][1]
92  - M_jacobian[iQuadPt][0][0] * M_jacobian[iQuadPt][1][2] * M_jacobian[iQuadPt][2][1]
93  - M_jacobian[iQuadPt][0][1] * M_jacobian[iQuadPt][1][0] * M_jacobian[iQuadPt][2][2]
94  - M_jacobian[iQuadPt][0][2] * M_jacobian[iQuadPt][1][1] * M_jacobian[iQuadPt][2][0];
95 }
96 
97 template<>
98 void
99 ETCurrentFE<1, 1>::
101 {
102 
103  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its inverse");
104  ASSERT (M_isDetJacobianUpdated, "The determinant of the jacobian must be updated to compute its inverse");
105 
106 #ifdef HAVE_LIFEV_DEBUG
108 #endif
109 
110  M_tInverseJacobian[iQuadPt][0][0] = 1.0 / M_jacobian[iQuadPt][0][0];
111 }
112 
113 template<>
114 void
115 ETCurrentFE<2, 1>::
117 {
118 
119  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its inverse");
120  ASSERT (M_isDetJacobianUpdated, "The determinant of the jacobian must be updated to compute its inverse");
121 
122 #ifdef HAVE_LIFEV_DEBUG
124 #endif
125 
127 
128  M_tInverseJacobian[iQuadPt][0][0] = M_jacobian[iQuadPt][1][1] / det;
129  M_tInverseJacobian[iQuadPt][1][0] = -M_jacobian[iQuadPt][0][1] / det;
130  M_tInverseJacobian[iQuadPt][0][1] = -M_jacobian[iQuadPt][1][0] / det;
131  M_tInverseJacobian[iQuadPt][1][1] = M_jacobian[iQuadPt][0][0] / det;
132 }
133 
134 template<>
135 void
136 ETCurrentFE<3, 1>::
138 {
139  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its inverse");
140  ASSERT (M_isDetJacobianUpdated, "The determinant of the jacobian must be updated to compute its inverse");
141 
142 #ifdef HAVE_LIFEV_DEBUG
144 #endif
145 
147 
149  - M_jacobian[iQuadPt][1][2] * M_jacobian[iQuadPt][2][1]) / det;
150 
152  - M_jacobian[iQuadPt][1][0] * M_jacobian[iQuadPt][2][2]) / det;
153 
155  - M_jacobian[iQuadPt][1][1] * M_jacobian[iQuadPt][2][0]) / det;
156 
158  - M_jacobian[iQuadPt][0][1] * M_jacobian[iQuadPt][2][2]) / det;
159 
161  - M_jacobian[iQuadPt][0][2] * M_jacobian[iQuadPt][2][0]) / det;
162 
164  - M_jacobian[iQuadPt][0][0] * M_jacobian[iQuadPt][2][1]) / det;
165 
167  - M_jacobian[iQuadPt][0][2] * M_jacobian[iQuadPt][1][1]) / det;
168 
170  - M_jacobian[iQuadPt][0][0] * M_jacobian[iQuadPt][1][2]) / det;
171 
173  - M_jacobian[iQuadPt][0][1] * M_jacobian[iQuadPt][1][0]) / det;
174 }
175 
176 // ---------------------------------------------------------------
177 // 2D field
178 // ---------------------------------------------------------------
179 
180 // Full specialization for the computation of the determinant
181 template<>
182 void
183 ETCurrentFE<1, 2>::
185 {
186  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its determinant");
187 
188 #ifdef HAVE_LIFEV_DEBUG
189  M_isDetJacobianUpdated = true;
190 #endif
191 
193 }
194 
195 template<>
196 void
197 ETCurrentFE<2, 2>::
199 {
200  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its determinant");
201 
202 #ifdef HAVE_LIFEV_DEBUG
203  M_isDetJacobianUpdated = true;
204 #endif
205 
207  - M_jacobian[iQuadPt][1][0] * M_jacobian[iQuadPt][0][1];
208 }
209 
210 template<>
211 void
212 ETCurrentFE<3, 2>::
214 {
215  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its determinant");
216 
217 #ifdef HAVE_LIFEV_DEBUG
218  M_isDetJacobianUpdated = true;
219 #endif
220 
222  M_jacobian[iQuadPt][0][0] * M_jacobian[iQuadPt][1][1] * M_jacobian[iQuadPt][2][2]
223  + M_jacobian[iQuadPt][0][1] * M_jacobian[iQuadPt][1][2] * M_jacobian[iQuadPt][2][0]
224  + M_jacobian[iQuadPt][0][2] * M_jacobian[iQuadPt][1][0] * M_jacobian[iQuadPt][2][1]
225  - M_jacobian[iQuadPt][0][0] * M_jacobian[iQuadPt][1][2] * M_jacobian[iQuadPt][2][1]
226  - M_jacobian[iQuadPt][0][1] * M_jacobian[iQuadPt][1][0] * M_jacobian[iQuadPt][2][2]
227  - M_jacobian[iQuadPt][0][2] * M_jacobian[iQuadPt][1][1] * M_jacobian[iQuadPt][2][0];
228 }
229 
230 // Full specialization for the computation of the inverse jacobian
231 template<>
232 void
233 ETCurrentFE<1, 2>::
235 {
236 
237  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its inverse");
238  ASSERT (M_isDetJacobianUpdated, "The determinant of the jacobian must be updated to compute its inverse");
239 
240 #ifdef HAVE_LIFEV_DEBUG
242 #endif
243 
244  M_tInverseJacobian[iQuadPt][0][0] = 1.0 / M_jacobian[iQuadPt][0][0];
245 }
246 
247 template<>
248 void
249 ETCurrentFE<2, 2>::
251 {
252 
253  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its inverse");
254  ASSERT (M_isDetJacobianUpdated, "The determinant of the jacobian must be updated to compute its inverse");
255 
256 #ifdef HAVE_LIFEV_DEBUG
258 #endif
259 
261 
262  M_tInverseJacobian[iQuadPt][0][0] = M_jacobian[iQuadPt][1][1] / det;
263  M_tInverseJacobian[iQuadPt][1][0] = -M_jacobian[iQuadPt][0][1] / det;
264  M_tInverseJacobian[iQuadPt][0][1] = -M_jacobian[iQuadPt][1][0] / det;
265  M_tInverseJacobian[iQuadPt][1][1] = M_jacobian[iQuadPt][0][0] / det;
266 }
267 
268 template<>
269 void
270 ETCurrentFE<3, 2>::
272 {
273  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its inverse");
274  ASSERT (M_isDetJacobianUpdated, "The determinant of the jacobian must be updated to compute its inverse");
275 
276 #ifdef HAVE_LIFEV_DEBUG
278 #endif
279 
281 
283  - M_jacobian[iQuadPt][1][2] * M_jacobian[iQuadPt][2][1]) / det;
284 
286  - M_jacobian[iQuadPt][1][0] * M_jacobian[iQuadPt][2][2]) / det;
287 
289  - M_jacobian[iQuadPt][1][1] * M_jacobian[iQuadPt][2][0]) / det;
290 
292  - M_jacobian[iQuadPt][0][1] * M_jacobian[iQuadPt][2][2]) / det;
293 
295  - M_jacobian[iQuadPt][0][2] * M_jacobian[iQuadPt][2][0]) / det;
296 
298  - M_jacobian[iQuadPt][0][0] * M_jacobian[iQuadPt][2][1]) / det;
299 
301  - M_jacobian[iQuadPt][0][2] * M_jacobian[iQuadPt][1][1]) / det;
302 
304  - M_jacobian[iQuadPt][0][0] * M_jacobian[iQuadPt][1][2]) / det;
305 
307  - M_jacobian[iQuadPt][0][1] * M_jacobian[iQuadPt][1][0]) / det;
308 }
309 
310 // ---------------------------------------------------------------
311 // 3D field
312 // ---------------------------------------------------------------
313 
314 // Full specialization for the computation of the determinant
315 template<>
316 void
317 ETCurrentFE<1, 3>::
319 {
320  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its determinant");
321 
322 #ifdef HAVE_LIFEV_DEBUG
323  M_isDetJacobianUpdated = true;
324 #endif
325 
327 }
328 
329 template<>
330 void
331 ETCurrentFE<2, 3>::
333 {
334  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its determinant");
335 
336 #ifdef HAVE_LIFEV_DEBUG
337  M_isDetJacobianUpdated = true;
338 #endif
339 
341  - M_jacobian[iQuadPt][1][0] * M_jacobian[iQuadPt][0][1];
342 }
343 
344 template<>
345 void
346 ETCurrentFE<3, 3>::
348 {
349  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its determinant");
350 
351 #ifdef HAVE_LIFEV_DEBUG
352  M_isDetJacobianUpdated = true;
353 #endif
354 
356  M_jacobian[iQuadPt][0][0] * M_jacobian[iQuadPt][1][1] * M_jacobian[iQuadPt][2][2]
357  + M_jacobian[iQuadPt][0][1] * M_jacobian[iQuadPt][1][2] * M_jacobian[iQuadPt][2][0]
358  + M_jacobian[iQuadPt][0][2] * M_jacobian[iQuadPt][1][0] * M_jacobian[iQuadPt][2][1]
359  - M_jacobian[iQuadPt][0][0] * M_jacobian[iQuadPt][1][2] * M_jacobian[iQuadPt][2][1]
360  - M_jacobian[iQuadPt][0][1] * M_jacobian[iQuadPt][1][0] * M_jacobian[iQuadPt][2][2]
361  - M_jacobian[iQuadPt][0][2] * M_jacobian[iQuadPt][1][1] * M_jacobian[iQuadPt][2][0];
362 }
363 
364 // Full specialization for the computation of the inverse jacobian
365 template<>
366 void
367 ETCurrentFE<1, 3>::
369 {
370 
371  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its inverse");
372  ASSERT (M_isDetJacobianUpdated, "The determinant of the jacobian must be updated to compute its inverse");
373 
374 #ifdef HAVE_LIFEV_DEBUG
376 #endif
377 
378  M_tInverseJacobian[iQuadPt][0][0] = 1.0 / M_jacobian[iQuadPt][0][0];
379 }
380 
381 template<>
382 void
383 ETCurrentFE<2, 3>::
385 {
386 
387  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its inverse");
388  ASSERT (M_isDetJacobianUpdated, "The determinant of the jacobian must be updated to compute its inverse");
389 
390 #ifdef HAVE_LIFEV_DEBUG
392 #endif
393 
395 
396  M_tInverseJacobian[iQuadPt][0][0] = M_jacobian[iQuadPt][1][1] / det;
397  M_tInverseJacobian[iQuadPt][1][0] = -M_jacobian[iQuadPt][0][1] / det;
398  M_tInverseJacobian[iQuadPt][0][1] = -M_jacobian[iQuadPt][1][0] / det;
399  M_tInverseJacobian[iQuadPt][1][1] = M_jacobian[iQuadPt][0][0] / det;
400 }
401 
402 template<>
403 void
404 ETCurrentFE<3, 3>::
406 {
407  ASSERT (M_isJacobianUpdated, "Jacobian must be updated to compute its inverse");
408  ASSERT (M_isDetJacobianUpdated, "The determinant of the jacobian must be updated to compute its inverse");
409 
410 #ifdef HAVE_LIFEV_DEBUG
412 #endif
413 
415 
417  - M_jacobian[iQuadPt][1][2] * M_jacobian[iQuadPt][2][1]) / det;
418 
420  - M_jacobian[iQuadPt][1][0] * M_jacobian[iQuadPt][2][2]) / det;
421 
423  - M_jacobian[iQuadPt][1][1] * M_jacobian[iQuadPt][2][0]) / det;
424 
426  - M_jacobian[iQuadPt][0][1] * M_jacobian[iQuadPt][2][2]) / det;
427 
429  - M_jacobian[iQuadPt][0][2] * M_jacobian[iQuadPt][2][0]) / det;
430 
432  - M_jacobian[iQuadPt][0][0] * M_jacobian[iQuadPt][2][1]) / det;
433 
435  - M_jacobian[iQuadPt][0][2] * M_jacobian[iQuadPt][1][1]) / det;
436 
438  - M_jacobian[iQuadPt][0][0] * M_jacobian[iQuadPt][1][2]) / det;
439 
441  - M_jacobian[iQuadPt][0][1] * M_jacobian[iQuadPt][1][0]) / det;
442 }
443 
444 
445 } // Namespace LifeV
void updateInverseJacobian(const UInt &iQuadPt)
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90