programmer's documentation
cs_math.h
Go to the documentation of this file.
1 #ifndef __CS_MATH_H__
2 #define __CS_MATH_H__
3 
4 /*============================================================================
5  * Mathematical base functions.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2018 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 #include "cs_defs.h"
31 
32 /*----------------------------------------------------------------------------
33  * Standard C library headers
34  *----------------------------------------------------------------------------*/
35 
36 #include <assert.h>
37 #include <math.h>
38 
39 /*----------------------------------------------------------------------------
40  * Local headers
41  *----------------------------------------------------------------------------*/
42 
43 #if defined(DEBUG) && !defined(NDEBUG) /* Sanity check */
44 #include "bft_error.h"
45 #endif
46 
47 /*----------------------------------------------------------------------------*/
48 
50 
51 /*=============================================================================
52  * Local Macro definitions
53  *============================================================================*/
54 
55 /*============================================================================
56  * Type definition
57  *============================================================================*/
58 
59 /*============================================================================
60  * Global variables
61  *============================================================================*/
62 
63 /* Numerical constants */
64 
66 extern const cs_real_t cs_math_onethird;
67 extern const cs_real_t cs_math_onesix;
68 extern const cs_real_t cs_math_onetwelve;
69 extern const cs_real_t cs_math_epzero;
70 extern const cs_real_t cs_math_infinite_r;
71 extern const cs_real_t cs_math_big_r;
72 extern const cs_real_t cs_math_pi;
73 
74 /*=============================================================================
75  * Inline static function prototypes
76  *============================================================================*/
77 
78 /*----------------------------------------------------------------------------*/
86 /*----------------------------------------------------------------------------*/
87 
88 static inline cs_real_t
90 {
91  return x*x;
92 }
93 
94 /*----------------------------------------------------------------------------*/
104 /*----------------------------------------------------------------------------*/
105 
106 static inline cs_real_t
108  const cs_real_t xb[3])
109 {
110  cs_real_t v[3];
111 
112  v[0] = xb[0] - xa[0];
113  v[1] = xb[1] - xa[1];
114  v[2] = xb[2] - xa[2];
115 
116  return sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
117 }
118 
119 /*----------------------------------------------------------------------------*/
129 /*----------------------------------------------------------------------------*/
130 
131 static inline cs_real_t
133  const cs_real_t xb[3])
134 {
135  cs_real_t v[3] = {xb[0] - xa[0],
136  xb[1] - xa[1],
137  xb[2] - xa[2]};
138 
139  return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
140 }
141 
142 /*----------------------------------------------------------------------------*/
151 /*----------------------------------------------------------------------------*/
152 
153 static inline cs_real_t
155  const cs_real_t v[3])
156 {
157  cs_real_t uv = u[0]*v[0] + u[1]*v[1] + u[2]*v[2];
158 
159  return uv;
160 }
161 
162 /*----------------------------------------------------------------------------*/
170 /*----------------------------------------------------------------------------*/
171 
172 static inline cs_real_t
174 {
175  return sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
176 }
177 
178 /*----------------------------------------------------------------------------*/
186 /*----------------------------------------------------------------------------*/
187 
188 static inline cs_real_t
190 {
191  cs_real_t v2 = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
192 
193  return v2;
194 }
195 
196 /*----------------------------------------------------------------------------*/
205 /*----------------------------------------------------------------------------*/
206 
207 static inline void
209  const cs_real_t v[3],
210  cs_real_3_t mv)
211 {
212  mv[0] = m[0][0]*v[0] + m[0][1]*v[1] + m[0][2]*v[2];
213  mv[1] = m[1][0]*v[0] + m[1][1]*v[1] + m[1][2]*v[2];
214  mv[2] = m[2][0]*v[0] + m[2][1]*v[1] + m[2][2]*v[2];
215 }
216 
217 /*----------------------------------------------------------------------------*/
226 /*----------------------------------------------------------------------------*/
227 
228 static inline void
230  const cs_real_t v[3],
231  cs_real_3_t mv)
232 {
233  mv[0] = m[0][0]*v[0] + m[1][0]*v[1] + m[2][0]*v[2];
234  mv[1] = m[0][1]*v[0] + m[1][1]*v[1] + m[2][1]*v[2];
235  mv[2] = m[0][2]*v[0] + m[1][2]*v[1] + m[2][2]*v[2];
236 }
237 
238 /*----------------------------------------------------------------------------*/
248 /*----------------------------------------------------------------------------*/
249 
250 static inline void
252  const cs_real_t v[3],
253  cs_real_t mv[restrict 3])
254 {
255  mv[0] = m[0] * v[0] + m[3] * v[1] + m[5] * v[2];
256  mv[1] = m[3] * v[0] + m[1] * v[1] + m[4] * v[2];
257  mv[2] = m[5] * v[0] + m[4] * v[1] + m[2] * v[2];
258 }
259 
260 /*----------------------------------------------------------------------------*/
270 /*----------------------------------------------------------------------------*/
271 
272 static inline void
274  const cs_real_t v[3],
275  cs_real_t mv[restrict 3])
276 {
277  mv[0] += m[0] * v[0] + m[3] * v[1] + m[5] * v[2];
278  mv[1] += m[3] * v[0] + m[1] * v[1] + m[4] * v[2];
279  mv[2] += m[5] * v[0] + m[4] * v[1] + m[2] * v[2];
280 }
281 
282 /*----------------------------------------------------------------------------*/
291 /*----------------------------------------------------------------------------*/
292 
293 static inline void
295  const cs_real_t v[6],
296  cs_real_t mv[restrict 6])
297 {
298  for (int i = 0; i < 6; i++) {
299  for (int j = 0; j < 6; j++)
300  mv[i] = m[i][j] * v[j];
301  }
302 }
303 
304 /*----------------------------------------------------------------------------*/
313 /*----------------------------------------------------------------------------*/
314 
315 static inline void
317  const cs_real_t v[6],
318  cs_real_t mv[restrict 6])
319 {
320  for (int i = 0; i < 6; i++) {
321  for (int j = 0; j < 6; j++)
322  mv[i] += m[i][j] * v[j];
323  }
324 }
325 
326 /*----------------------------------------------------------------------------*/
334 /*----------------------------------------------------------------------------*/
335 
336 static inline cs_real_t
338 {
339  const cs_real_t com0 = m[1][1]*m[2][2] - m[2][1]*m[1][2];
340  const cs_real_t com1 = m[2][1]*m[0][2] - m[0][1]*m[2][2];
341  const cs_real_t com2 = m[0][1]*m[1][2] - m[1][1]*m[0][2];
342 
343  return m[0][0]*com0 + m[1][0]*com1 + m[2][0]*com2;
344 }
345 
346 /*----------------------------------------------------------------------------*/
354 /*----------------------------------------------------------------------------*/
355 
356 static inline cs_real_t
358 {
359  const cs_real_t com0 = m[1]*m[2] - m[4]*m[4];
360  const cs_real_t com1 = m[4]*m[5] - m[3]*m[2];
361  const cs_real_t com2 = m[3]*m[4] - m[1]*m[5];
362 
363  return m[0]*com0 + m[3]*com1 + m[5]*com2;
364 }
365 
366 
367 /*----------------------------------------------------------------------------*/
375 /*----------------------------------------------------------------------------*/
376 
377 #if defined(__INTEL_COMPILER)
378 #pragma optimization_level 0 /* Bug with O1 or above with icc 15.0.1 20141023 */
379 #endif
380 
381 static inline void
383  const cs_real_t v[3],
384  cs_real_t uv[restrict 3])
385 {
386  uv[0] = u[1]*v[2] - u[2]*v[1];
387  uv[1] = u[2]*v[0] - u[0]*v[2];
388  uv[2] = u[0]*v[1] - u[1]*v[0];
389 }
390 
391 /*----------------------------------------------------------------------------*/
398 /*----------------------------------------------------------------------------*/
399 
400 static inline void
401 cs_math_33_inv(const cs_real_t in[3][3],
402  cs_real_t out[3][3])
403 {
404  out[0][0] = in[1][1]*in[2][2] - in[2][1]*in[1][2];
405  out[0][1] = in[2][1]*in[0][2] - in[0][1]*in[2][2];
406  out[0][2] = in[0][1]*in[1][2] - in[1][1]*in[0][2];
407 
408  out[1][0] = in[2][0]*in[1][2] - in[1][0]*in[2][2];
409  out[1][1] = in[0][0]*in[2][2] - in[2][0]*in[0][2];
410  out[1][2] = in[1][0]*in[0][2] - in[0][0]*in[1][2];
411 
412  out[2][0] = in[1][0]*in[2][1] - in[2][0]*in[1][1];
413  out[2][1] = in[2][0]*in[0][1] - in[0][0]*in[2][1];
414  out[2][2] = in[0][0]*in[1][1] - in[1][0]*in[0][1];
415 
416  const double det = in[0][0]*out[0][0]+in[1][0]*out[0][1]+in[2][0]*out[0][2];
417  const double invdet = 1/det;
418 
419  out[0][0] *= invdet, out[0][1] *= invdet, out[0][2] *= invdet;
420  out[1][0] *= invdet, out[1][1] *= invdet, out[1][2] *= invdet;
421  out[2][0] *= invdet, out[2][1] *= invdet, out[2][2] *= invdet;
422 }
423 
424 /*----------------------------------------------------------------------------*/
434 /*----------------------------------------------------------------------------*/
435 
436 static inline void
438  cs_real_t sout[restrict 6])
439 {
440  double detinv;
441 
442  sout[0] = s[1]*s[2] - s[4]*s[4];
443  sout[1] = s[0]*s[2] - s[5]*s[5];
444  sout[2] = s[0]*s[1] - s[3]*s[3];
445  sout[3] = s[4]*s[5] - s[3]*s[2];
446  sout[4] = s[3]*s[5] - s[0]*s[4];
447  sout[5] = s[3]*s[4] - s[1]*s[5];
448 
449  detinv = 1. / (s[0]*sout[0] + s[3]*sout[3] + s[5]*sout[5]);
450 
451  sout[0] *= detinv;
452  sout[1] *= detinv;
453  sout[2] *= detinv;
454  sout[3] *= detinv;
455  sout[4] *= detinv;
456  sout[5] *= detinv;
457 }
458 
459 /*----------------------------------------------------------------------------*/
472 /*----------------------------------------------------------------------------*/
473 
474 static inline void
476  const cs_real_t s2[6],
477  cs_real_t sout[restrict 6])
478 {
479  /* S11 */
480  sout[0] = s1[0]*s2[0] + s1[3]*s2[3] + s1[5]*s2[5];
481  /* S22 */
482  sout[1] = s1[3]*s2[3] + s1[1]*s2[1] + s1[4]*s2[4];
483  /* S33 */
484  sout[2] = s1[5]*s2[5] + s1[4]*s2[4] + s1[2]*s2[2];
485  /* S12 = S21 */
486  sout[3] = s1[0]*s2[3] + s1[3]*s2[1] + s1[5]*s2[4];
487  /* S23 = S32 */
488  sout[4] = s1[3]*s2[5] + s1[1]*s2[4] + s1[4]*s2[2];
489  /* S13 = S31 */
490  sout[5] = s1[0]*s2[5] + s1[3]*s2[4] + s1[5]*s2[2];
491 }
492 
493 /*----------------------------------------------------------------------------*/
501 /*----------------------------------------------------------------------------*/
502 
503 static inline void
505  cs_real_t sout[restrict 6][6])
506 {
507  int tens2vect[3][3];
508  int iindex[6], jindex[6];
509 
510  tens2vect[0][0] = 0; tens2vect[0][1] = 3; tens2vect[0][2] = 5;
511  tens2vect[1][0] = 3; tens2vect[1][1] = 1; tens2vect[1][2] = 4;
512  tens2vect[2][0] = 5; tens2vect[2][1] = 4; tens2vect[2][2] = 2;
513 
514  iindex[0] = 0; iindex[1] = 1; iindex[2] = 2;
515  iindex[3] = 0; iindex[4] = 1; iindex[5] = 0;
516 
517  jindex[0] = 0; jindex[1] = 1; jindex[2] = 2;
518  jindex[3] = 1; jindex[4] = 2; jindex[5] = 2;
519 
520  /* Consider : W = R*s^t + s*R.
521  * W_ij = Sum_{k<3} [s_jk*r_ik + s_ik*r_jk]
522  * We look for A such as
523  */
524  for (int i = 0; i < 6; i++) {
525  int ii;
526  int jj;
527 
528  ii = iindex[i];
529  jj = jindex[i];
530  for (int k = 0; k < 3; k++) {
531  int ik = tens2vect[k][ii];
532  int jk = tens2vect[k][jj];
533 
534  sout[ik][i] += s[k][jj];
535 
536  sout[jk][i] += s[k][ii];
537  }
538  }
539 }
540 
541 /*----------------------------------------------------------------------------*/
553 /*----------------------------------------------------------------------------*/
554 
555 static inline void
557  const cs_real_t s2[6],
558  const cs_real_t s3[6],
559  cs_real_t sout[restrict 3][3])
560 {
561  cs_real_33_t _sout;
562 
563  /* S11 */
564  _sout[0][0] = s1[0]*s2[0] + s1[3]*s2[3] + s1[5]*s2[5];
565  /* S22 */
566  _sout[1][1] = s1[3]*s2[3] + s1[1]*s2[1] + s1[4]*s2[4];
567  /* S33 */
568  _sout[2][2] = s1[5]*s2[5] + s1[4]*s2[4] + s1[2]*s2[2];
569  /* S12 */
570  _sout[0][1] = s1[0]*s2[3] + s1[3]*s2[1] + s1[5]*s2[4];
571  /* S21 */
572  _sout[1][0] = s2[0]*s1[3] + s2[3]*s1[1] + s2[5]*s1[4];
573  /* S23 */
574  _sout[1][2] = s1[3]*s2[5] + s1[1]*s2[4] + s1[4]*s2[2];
575  /* S32 */
576  _sout[2][1] = s2[3]*s1[5] + s2[1]*s1[4] + s2[4]*s1[2];
577  /* S13 */
578  _sout[0][2] = s1[0]*s2[5] + s1[3]*s2[4] + s1[5]*s2[2];
579  /* S31 */
580  _sout[2][0] = s2[0]*s1[5] + s2[3]*s1[4] + s2[5]*s1[2];
581 
582  sout[0][0] = _sout[0][0]*s3[0] + _sout[0][1]*s3[3] + _sout[0][2]*s3[5];
583  /* S22 */
584  sout[1][1] = _sout[1][0]*s3[3] + _sout[1][1]*s3[1] + _sout[1][2]*s3[4];
585  /* S33 */
586  sout[2][2] = _sout[2][0]*s3[5] + _sout[2][1]*s3[4] + _sout[2][2]*s3[2];
587  /* S12 */
588  sout[0][1] = _sout[0][0]*s3[3] + _sout[0][1]*s3[1] + _sout[0][2]*s3[4];
589  /* S21 */
590  sout[1][0] = s3[0]*_sout[1][0] + s3[3]*_sout[1][1] + s3[5]*_sout[1][2];
591  /* S23 */
592  sout[1][2] = _sout[1][0]*s3[5] + _sout[1][1]*s3[4] + _sout[1][2]*s3[2];
593  /* S32 */
594  sout[2][1] = s3[3]*_sout[2][0] + s3[1]*_sout[2][1] + s3[4]*_sout[2][2];
595  /* S13 */
596  sout[0][2] = _sout[0][0]*s3[5] + _sout[0][1]*s3[4] + _sout[0][2]*s3[2];
597  /* S31 */
598  sout[2][0] = s3[0]*_sout[2][0] + s3[3]*_sout[2][1] + s3[5]*_sout[2][2];
599 }
600 
601 /*=============================================================================
602  * Public function prototypes
603  *============================================================================*/
604 
605 /*----------------------------------------------------------------------------*/
609 /*----------------------------------------------------------------------------*/
610 
611 void
613 
614 /*----------------------------------------------------------------------------*/
618 /*----------------------------------------------------------------------------*/
619 
620 double
622 
623 /*----------------------------------------------------------------------------*/
633 /*----------------------------------------------------------------------------*/
634 
635 void
637  const cs_real_t xb[3],
638  cs_real_t *len,
639  cs_real_3_t unitv);
640 
641 /*----------------------------------------------------------------------------*/
652 /*----------------------------------------------------------------------------*/
653 
654 void
655 cs_math_33_eigen_vals(const cs_real_t m[3][3],
656  cs_real_t eig_vals[3]);
657 
658 /*----------------------------------------------------------------------------*/
671 /*----------------------------------------------------------------------------*/
672 
673 void
674 cs_math_33_eigen(const cs_real_t m[3][3],
675  cs_real_t *eig_ratio,
676  cs_real_t *eig_max);
677 
678 /*----------------------------------------------------------------------------*/
689 /*----------------------------------------------------------------------------*/
690 
691 double
692 cs_math_surftri(const cs_real_t xv[3],
693  const cs_real_t xe[3],
694  const cs_real_t xf[3]);
695 
696 /*----------------------------------------------------------------------------*/
708 /*----------------------------------------------------------------------------*/
709 
710 double
711 cs_math_voltet(const cs_real_t xv[3],
712  const cs_real_t xe[3],
713  const cs_real_t xf[3],
714  const cs_real_t xc[3]);
715 
716 /*----------------------------------------------------------------------------
717  * Compute inverse of an array of dense matrices of same size.
718  *
719  * parameters:
720  * n_blocks <-- number of blocks
721  * db_size <-- matrix size
722  * ad <-- diagonal part of linear equation matrix
723  * ad_inv --> inverse of the diagonal part of linear equation matrix
724  *----------------------------------------------------------------------------*/
725 
726 void
727 cs_math_fact_lu(cs_lnum_t n_blocks,
728  const int db_size,
729  const cs_real_t *ad,
730  cs_real_t *ad_inv);
731 
732 /*----------------------------------------------------------------------------
733  * Compute forward and backward to solve an LU system of size db_size.
734  *
735  * parameters
736  * mat <-- P*P*dim matrix
737  * db_size <-- matrix size
738  * x --> solution
739  * b --> 1st part of RHS (c - b)
740  * c --> 2nd part of RHS (c - b)
741  *----------------------------------------------------------------------------*/
742 
743 void
744 cs_math_fw_and_bw_lu(const cs_real_t mat[],
745  const int db_size,
746  cs_real_t x[],
747  const cs_real_t b[],
748  const cs_real_t c[]);
749 
750 /*----------------------------------------------------------------------------*/
751 
753 
754 #endif /* __CS_MATH_H__ */
static void cs_math_sym_33_inv_cramer(const cs_real_t s[6], cs_real_t sout[restrict 6])
Compute the inverse of a symmetric matrix using Cramer&#39;s rule.
Definition: cs_math.h:437
Definition: cs_field_pointer.h:70
integer, save ik
Definition: numvar.f90:75
#define restrict
Definition: cs_defs.h:122
static cs_real_t cs_math_3_dot_product(const cs_real_t u[3], const cs_real_t v[3])
Compute the dot product of two vectors of 3 real values.
Definition: cs_math.h:154
const cs_real_t cs_math_onesix
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:311
const cs_real_t cs_math_big_r
static void cs_math_sym_33_3_product_add(const cs_real_t m[6], const cs_real_t v[3], cs_real_t mv[restrict 3])
Compute the product of a symmetric matrix of 3x3 real values by a vector of 3 real values and add it ...
Definition: cs_math.h:273
static void cs_math_66_6_product(const cs_real_t m[6][6], const cs_real_t v[6], cs_real_t mv[restrict 6])
Compute the product of a matrix of 6x6 real values by a vector of 6 real values.
Definition: cs_math.h:294
static void cs_math_33_3_product(const cs_real_t m[3][3], const cs_real_t v[3], cs_real_3_t mv)
Compute the product of a matrix of 3x3 real values by a vector of 3 real values.
Definition: cs_math.h:208
const cs_real_t cs_math_pi
static void cs_math_33_inv(const cs_real_t in[3][3], cs_real_t out[3][3])
Inverse a 3x3 matrix.
Definition: cs_math.h:401
#define BEGIN_C_DECLS
Definition: cs_defs.h:451
const cs_real_t cs_math_epzero
static cs_real_t cs_math_sym_33_determinant(const cs_real_6_t m)
Compute the determinant of a 3x3 symmetric matrix.
Definition: cs_math.h:357
void cs_math_33_eigen_vals(const cs_real_t m[3][3], cs_real_t eig_vals[3])
Compute all eigenvalues of a 3x3 symmetric matrix.
void cs_math_33_eigen(const cs_real_t m[3][3], cs_real_t *eig_ratio, cs_real_t *eig_max)
Compute max/min eigenvalues ratio and max. eigenvalue of a 3x3 symmetric matrix.
Definition: cs_math.c:298
static void cs_math_sym_33_double_product(const cs_real_t s1[6], const cs_real_t s2[6], const cs_real_t s3[6], cs_real_t sout[restrict 3][3])
Compute the product of three symmetric matrices.
Definition: cs_math.h:556
double cs_real_t
Floating-point value.
Definition: cs_defs.h:297
static cs_real_t cs_math_3_length(const cs_real_t xa[3], const cs_real_t xb[3])
Compute the (euclidean) length between two points xa and xb in a cartesian coordinate system of dimen...
Definition: cs_math.h:107
Definition: cs_field_pointer.h:68
static cs_real_t cs_math_3_square_norm(const cs_real_t v[3])
Compute the square norm of a vector of 3 real values.
Definition: cs_math.h:189
static cs_real_t cs_math_sq(cs_real_t x)
Compute the square of a real value.
Definition: cs_math.h:89
double cs_math_surftri(const cs_real_t xv[3], const cs_real_t xe[3], const cs_real_t xf[3])
Compute the area of the convex_hull generated by 3 points. This corresponds to the computation of the...
Definition: cs_math.c:418
double precision, dimension(:,:,:), allocatable v
Definition: atimbr.f90:114
static void cs_math_sym_33_product(const cs_real_t s1[6], const cs_real_t s2[6], cs_real_t sout[restrict 6])
Compute the product of two symmetric matrices. Warning: this is valid if and only if s1 and s2 commut...
Definition: cs_math.h:475
static void cs_math_66_6_product_add(const cs_real_t m[6][6], const cs_real_t v[6], cs_real_t mv[restrict 6])
Compute the product of a matrix of 6x6 real values by a vector of 6 real values and add it to the vec...
Definition: cs_math.h:316
double cs_math_get_machine_epsilon(void)
Get the value related to the machine precision.
Definition: cs_math.c:194
const cs_real_t cs_math_onetwelve
void cs_math_set_machine_epsilon(void)
Compute the value related to the machine precision.
Definition: cs_math.c:173
double cs_math_voltet(const cs_real_t xv[3], const cs_real_t xe[3], const cs_real_t xf[3], const cs_real_t xc[3])
Compute the volume of the convex_hull generated by 4 points. This is equivalent to the computation of...
Definition: cs_math.c:448
static cs_real_t cs_math_33_determinant(const cs_real_t m[3][3])
Compute the determinant of a 3x3 matrix.
Definition: cs_math.h:337
static cs_real_t cs_math_3_norm(const cs_real_t v[3])
Compute the euclidean norm of a vector of dimension 3.
Definition: cs_math.h:173
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:309
static void cs_math_3_cross_product(const cs_real_t u[3], const cs_real_t v[3], cs_real_t uv[restrict 3])
Compute the cross product of two vectors of 3 real values.
Definition: cs_math.h:382
const cs_real_t cs_math_zero_threshold
const cs_real_t cs_math_onethird
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:293
static cs_real_t cs_math_3_distance_squared(const cs_real_t xa[3], const cs_real_t xb[3])
Compute the squared distance between two points xa and xb in a cartesian coordinate system of dimensi...
Definition: cs_math.h:132
void cs_math_fw_and_bw_lu(const cs_real_t mat[], const int db_size, cs_real_t x[], const cs_real_t b[], const cs_real_t c[])
Block Jacobi utilities. Compute forward and backward to solve an LU P*P system.
Definition: cs_math.c:538
#define END_C_DECLS
Definition: cs_defs.h:452
static void cs_math_33t_3_product(const cs_real_t m[3][3], const cs_real_t v[3], cs_real_3_t mv)
Compute the product of the transpose of a matrix of 3x3 real values by a vector of 3 real values...
Definition: cs_math.h:229
void cs_math_fact_lu(cs_lnum_t n_blocks, const int db_size, const cs_real_t *ad, cs_real_t *ad_inv)
Compute inverses of dense matrices.
Definition: cs_math.c:476
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:315
static void cs_math_sym_33_3_product(const cs_real_t m[6], const cs_real_t v[3], cs_real_t mv[restrict 3])
Compute the product of a symmetric matrix of 3x3 real values by a vector of 3 real values...
Definition: cs_math.h:251
void cs_math_3_length_unitv(const cs_real_t xa[3], const cs_real_t xb[3], cs_real_t *len, cs_real_3_t unitv)
Compute the length (euclidien norm) between two points xa and xb in a cartesian coordinate system of ...
Definition: cs_math.c:385
const cs_real_t cs_math_infinite_r
static void cs_math_reduce_sym_prod_33_to_66(const cs_real_t s[3][3], cs_real_t sout[restrict 6][6])
Compute a 6x6 matrix A, equivalent to a 3x3 matrix s, such as: A*R_6 = R*s^t + s*R.
Definition: cs_math.h:504
double precision, save b
Definition: cs_fuel_incl.f90:146