8.2
general documentation
cs_quadrature.h
Go to the documentation of this file.
1 #ifndef __CS_QUADRATURE_H__
2 #define __CS_QUADRATURE_H__
3 
4 /*============================================================================
5  * Functions to handle quadrature rules
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2024 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  * Local headers
30  *----------------------------------------------------------------------------*/
31 
32 #include <bft_error.h>
33 
34 #include "cs_base.h"
35 #include "cs_defs.h"
36 #include "cs_flag.h"
37 #include "cs_math.h"
38 #include "cs_param_types.h"
39 
40 /*----------------------------------------------------------------------------*/
41 
43 
44 /*============================================================================
45  * Macro definitions
46  *============================================================================*/
47 
48 /*============================================================================
49  * Type definitions
50  *============================================================================*/
51 
84 typedef enum {
85 
87  CS_QUADRATURE_BARY, /* Value at the barycenter * meas */
88  CS_QUADRATURE_BARY_SUBDIV, /* Value at the barycenter * meas on a sub-mesh */
89  CS_QUADRATURE_HIGHER, /* Unique weight but several Gauss points */
90  CS_QUADRATURE_HIGHEST, /* Specific weight for each Gauss points */
92 
94 
95 /*----------------------------------------------------------------------------*/
106 /*----------------------------------------------------------------------------*/
107 
108 typedef void
110  const cs_real_3_t v2,
111  double len,
112  cs_real_3_t gpts[],
113  double *weights);
114 
115 /*----------------------------------------------------------------------------*/
127 /*----------------------------------------------------------------------------*/
128 
129 typedef void
131  const cs_real_3_t v2,
132  const cs_real_3_t v3,
133  double area,
134  cs_real_3_t gpts[],
135  double *weights);
136 
137 /*----------------------------------------------------------------------------*/
149 /*----------------------------------------------------------------------------*/
150 
151 typedef void
152 (cs_quadrature_tet_t) (const cs_real_3_t v1,
153  const cs_real_3_t v2,
154  const cs_real_3_t v3,
155  const cs_real_3_t v4,
156  double vol,
157  cs_real_3_t gpts[],
158  double weights[]);
159 
160 /*----------------------------------------------------------------------------*/
173 /*----------------------------------------------------------------------------*/
174 
175 typedef void
176 (cs_quadrature_edge_integral_t)(double tcur,
177  const cs_real_3_t v1,
178  const cs_real_3_t v2,
179  double len,
180  cs_analytic_func_t *ana,
181  void *input,
182  double results[]);
183 
184 /*----------------------------------------------------------------------------*/
198 /*----------------------------------------------------------------------------*/
199 
200 typedef void
201 (cs_quadrature_tria_integral_t)(double tcur,
202  const cs_real_3_t v1,
203  const cs_real_3_t v2,
204  const cs_real_3_t v3,
205  double area,
206  cs_analytic_func_t *ana,
207  void *input,
208  double results[]);
209 
210 /*----------------------------------------------------------------------------*/
225 /*----------------------------------------------------------------------------*/
226 
227 typedef void
228 (cs_quadrature_tetra_integral_t)(double tcur,
229  const cs_real_3_t v1,
230  const cs_real_3_t v2,
231  const cs_real_3_t v3,
232  const cs_real_3_t v4,
233  double vol,
234  cs_analytic_func_t *ana,
235  void *input,
236  double results[]);
237 
238 /*============================================================================
239  * Public function prototypes
240  *============================================================================*/
241 
242 /*----------------------------------------------------------------------------*/
246 /*----------------------------------------------------------------------------*/
247 
248 void
249 cs_quadrature_setup(void);
250 
251 /*----------------------------------------------------------------------------*/
259 /*----------------------------------------------------------------------------*/
260 
261 const char *
263 
264 /*----------------------------------------------------------------------------*/
275 /*----------------------------------------------------------------------------*/
276 
277 static inline void
279  const cs_real_3_t v2,
280  double len,
281  cs_real_3_t gpts[],
282  double *w)
283 {
284  gpts[0][0] = 0.5*(v1[0] + v2[0]);
285  gpts[0][1] = 0.5*(v1[1] + v2[1]);
286  gpts[0][2] = 0.5*(v1[2] + v2[2]);
287  w[0] = len;
288 }
289 
290 /*----------------------------------------------------------------------------*/
301 /*----------------------------------------------------------------------------*/
302 
303 void
305  const cs_real_3_t v2,
306  double len,
307  cs_real_3_t gpts[],
308  double *w);
309 
310 /*----------------------------------------------------------------------------*/
321 /*----------------------------------------------------------------------------*/
322 
323 void
325  const cs_real_3_t v2,
326  double len,
327  cs_real_3_t gpts[],
328  double w[]);
329 
330 /*----------------------------------------------------------------------------*/
342 /*----------------------------------------------------------------------------*/
343 
344 static inline void
346  const cs_real_3_t v2,
347  const cs_real_3_t v3,
348  double area,
349  cs_real_3_t gpts[],
350  double *w)
351 {
352 #ifdef __cplusplus
353  constexpr cs_real_t c_1ov3 = 1./3.;
354  gpts[0][0] = c_1ov3 * (v1[0] + v2[0] + v3[0]);
355  gpts[0][1] = c_1ov3 * (v1[1] + v2[1] + v3[1]);
356  gpts[0][2] = c_1ov3 * (v1[2] + v2[2] + v3[2]);
357  w[0] = area;
358 #else
359  gpts[0][0] = cs_math_1ov3 * (v1[0] + v2[0] + v3[0]);
360  gpts[0][1] = cs_math_1ov3 * (v1[1] + v2[1] + v3[1]);
361  gpts[0][2] = cs_math_1ov3 * (v1[2] + v2[2] + v3[2]);
362  w[0] = area;
363 #endif
364 }
365 
366 /*----------------------------------------------------------------------------*/
378 /*----------------------------------------------------------------------------*/
379 
380 void
382  const cs_real_3_t v2,
383  const cs_real_3_t v3,
384  double area,
385  cs_real_3_t gpts[],
386  double *w);
387 
388 /*----------------------------------------------------------------------------*/
400 /*----------------------------------------------------------------------------*/
401 
402 void
404  const cs_real_3_t v2,
405  const cs_real_3_t v3,
406  double area,
407  cs_real_3_t gpts[],
408  double w[]);
409 
410 /*----------------------------------------------------------------------------*/
422 /*----------------------------------------------------------------------------*/
423 
424 void
426  const cs_real_3_t v2,
427  const cs_real_3_t v3,
428  double area,
429  cs_real_3_t gpts[],
430  double w[]);
431 
432 /*----------------------------------------------------------------------------*/
445 /*----------------------------------------------------------------------------*/
446 
447 static inline void
449  const cs_real_3_t v2,
450  const cs_real_3_t v3,
451  const cs_real_3_t v4,
452  double vol,
453  cs_real_3_t gpts[],
454  double weight[])
455 {
456  gpts[0][0] = 0.25 * (v1[0] + v2[0] + v3[0] + v4[0]);
457  gpts[0][1] = 0.25 * (v1[1] + v2[1] + v3[1] + v4[1]);
458  gpts[0][2] = 0.25 * (v1[2] + v2[2] + v3[2] + v4[2]);
459  weight[0] = vol;
460 }
461 
462 /*----------------------------------------------------------------------------*/
475 /*----------------------------------------------------------------------------*/
476 
477 void
479  const cs_real_3_t v2,
480  const cs_real_3_t v3,
481  const cs_real_3_t v4,
482  double vol,
483  cs_real_3_t gpts[],
484  double weights[]);
485 
486 /*----------------------------------------------------------------------------*/
499 /*----------------------------------------------------------------------------*/
500 
501 void
503  const cs_real_3_t v2,
504  const cs_real_3_t v3,
505  const cs_real_3_t v4,
506  double vol,
507  cs_real_3_t gpts[],
508  double weights[]);
509 
510 /*----------------------------------------------------------------------------*/
523 /*----------------------------------------------------------------------------*/
524 
525 void
527  const cs_real_3_t v2,
528  const cs_real_3_t v3,
529  const cs_real_3_t v4,
530  double vol,
531  cs_real_3_t gpts[],
532  double weights[]);
533 
534 /*----------------------------------------------------------------------------*/
548 /*----------------------------------------------------------------------------*/
549 
550 static inline void
552  const cs_real_3_t v1,
553  const cs_real_3_t v2,
554  double len,
555  cs_analytic_func_t *ana,
556  void *input,
557  double results[])
558 {
559  cs_real_3_t xg;
560  double feval;
561 
562  /* Copied from cs_quadrature_1pt */
563  xg[0] = .5 * (v1[0] + v2[0]);
564  xg[1] = .5 * (v1[1] + v2[1]);
565  xg[2] = .5 * (v1[2] + v2[2]);
566 
567  /* Evaluate the function at the Gauss points */
568  ana(tcur, 1, NULL, xg, false, input, &feval);
569 
570  /* Update the result with the quadrature rule */
571  *results += len * feval;
572 }
573 
574 /*----------------------------------------------------------------------------*/
588 /*----------------------------------------------------------------------------*/
589 
590 static inline void
592  const cs_real_3_t v1,
593  const cs_real_3_t v2,
594  double len,
595  cs_analytic_func_t *ana,
596  void *input,
597  double results[])
598 {
599  cs_real_3_t gauss_pts[2];
600  double feval[2], weights[2];
601 
602  /* Compute Gauss points and its unique weight */
603  cs_quadrature_edge_2pts(v1, v2, len, gauss_pts, weights);
604 
605  /* Evaluate the function at the Gauss points */
606  ana(tcur, 2, NULL, (const cs_real_t *)gauss_pts, false, input, feval);
607 
608  /* Update the result with the quadrature rule */
609  *results += weights[0] * feval[0] + weights[1] * feval[1];
610 }
611 
612 /*----------------------------------------------------------------------------*/
626 /*----------------------------------------------------------------------------*/
627 
628 static inline void
630  const cs_real_3_t v1,
631  const cs_real_3_t v2,
632  double len,
633  cs_analytic_func_t *ana,
634  void *input,
635  double results[])
636 {
637  cs_real_3_t gauss_pts[3];
638  double feval[3], weights[3];
639 
640  /* Compute Gauss points and its weights */
641  cs_quadrature_edge_3pts(v1, v2, len, gauss_pts, weights);
642 
643  /* Evaluate the function at the Gauss points */
644  ana(tcur, 3, NULL, (const cs_real_t *)gauss_pts, false, input, feval);
645 
646  /* Update the result with the quadrature rule */
647  *results += weights[0]*feval[0] + weights[1]*feval[1] + weights[2]*feval[2];
648 }
649 
650 /*----------------------------------------------------------------------------*/
664 /*----------------------------------------------------------------------------*/
665 
666 static inline void
668  const cs_real_3_t v1,
669  const cs_real_3_t v2,
670  double len,
671  cs_analytic_func_t *ana,
672  void *input,
673  double results[])
674 {
675  cs_real_3_t xg;
676  double feval[3];
677 
678  /* Copied from cs_quadrature_1pt */
679  xg[0] = .5 * (v1[0] + v2[0]);
680  xg[1] = .5 * (v1[1] + v2[1]);
681  xg[2] = .5 * (v1[2] + v2[2]);
682 
683  /* Evaluate the function at the Gauss points */
684  ana(tcur, 1, NULL, xg, false, input, feval);
685 
686  /* Update the result with the quadrature rule */
687  results[0] += len * feval[0];
688  results[1] += len * feval[1];
689  results[2] += len * feval[2];
690 }
691 
692 /*----------------------------------------------------------------------------*/
706 /*----------------------------------------------------------------------------*/
707 
708 static inline void
710  const cs_real_3_t v1,
711  const cs_real_3_t v2,
712  double len,
713  cs_analytic_func_t *ana,
714  void *input,
715  double results[])
716 {
717  cs_real_3_t gauss_pts[2];
718  double feval[6], weights[2];
719 
720  /* Compute Gauss points and its unique weight */
721  cs_quadrature_edge_2pts(v1, v2, len, gauss_pts, weights);
722 
723  /* Evaluate the function at the Gauss points */
724  ana(tcur, 2, NULL, (const cs_real_t *)gauss_pts, false, input, feval);
725 
726  /* Update the result with the quadrature rule */
727  results[0] += weights[0] * feval[0] + weights[1] * feval[3];
728  results[1] += weights[0] * feval[1] + weights[1] * feval[4];
729  results[2] += weights[0] * feval[2] + weights[1] * feval[5];
730 }
731 
732 /*----------------------------------------------------------------------------*/
746 /*----------------------------------------------------------------------------*/
747 
748 static inline void
750  const cs_real_3_t v1,
751  const cs_real_3_t v2,
752  double len,
753  cs_analytic_func_t *ana,
754  void *input,
755  double results[])
756 {
757  cs_real_3_t gauss_pts[3];
758  double feval[9], weights[3];
759 
760  /* Compute Gauss points and its weights */
761  cs_quadrature_edge_3pts(v1, v2, len, gauss_pts, weights);
762 
763  /* Evaluate the function at the Gauss points */
764  ana(tcur, 3, NULL, (const cs_real_t *)gauss_pts, false, input, feval);
765 
766  /* Update the result with the quadrature rule */
767  for (int p = 0; p < 3; p++) {
768  results[0] += weights[p] * feval[3*p ];
769  results[1] += weights[p] * feval[3*p+1];
770  results[2] += weights[p] * feval[3*p+2];
771  }
772 }
773 
774 /*----------------------------------------------------------------------------*/
789 /*----------------------------------------------------------------------------*/
790 
791 static inline void
793  const cs_real_3_t v1,
794  const cs_real_3_t v2,
795  const cs_real_3_t v3,
796  double area,
797  cs_analytic_func_t *ana,
798  void *input,
799  double results[])
800 {
801  cs_real_3_t xg;
802  double evaluation;
803 
804  /* Copied from cs_quadrature_1pt */
805 #ifdef __cplusplus
806  constexpr cs_real_t c_1ov3 = 1./3.;
807  xg[0] = c_1ov3 * (v1[0] + v2[0] + v3[0]);
808  xg[1] = c_1ov3 * (v1[1] + v2[1] + v3[1]);
809  xg[2] = c_1ov3 * (v1[2] + v2[2] + v3[2]);
810 #else
811  xg[0] = cs_math_1ov3 * (v1[0] + v2[0] + v3[0]);
812  xg[1] = cs_math_1ov3 * (v1[1] + v2[1] + v3[1]);
813  xg[2] = cs_math_1ov3 * (v1[2] + v2[2] + v3[2]);
814 #endif
815 
816  ana(tcur, 1, NULL, xg, false, input, &evaluation);
817 
818  *results += area * evaluation;
819 }
820 
821 /*----------------------------------------------------------------------------*/
836 /*----------------------------------------------------------------------------*/
837 
838 static inline void
840  const cs_real_3_t v1,
841  const cs_real_3_t v2,
842  const cs_real_3_t v3,
843  double area,
844  cs_analytic_func_t *ana,
845  void *input,
846  double results[])
847 {
848  cs_real_3_t gauss_pts[3];
849  double evaluation[3], weights[3];
850 
851  /* Compute Gauss points and its unique weight */
852  cs_quadrature_tria_3pts(v1, v2, v3, area, gauss_pts, weights);
853 
854  ana(tcur, 3, NULL, (const cs_real_t *)gauss_pts, false, input, evaluation);
855 
856  /* Return results */
857  *results += weights[0] * evaluation[0] + weights[1] * evaluation[1] +
858  weights[2] * evaluation[2];
859 }
860 
861 /*----------------------------------------------------------------------------*/
876 /*----------------------------------------------------------------------------*/
877 
878 static inline void
880  const cs_real_3_t v1,
881  const cs_real_3_t v2,
882  const cs_real_3_t v3,
883  double area,
884  cs_analytic_func_t *ana,
885  void *input,
886  double results[])
887 {
888  cs_real_3_t gauss_pts[4];
889  double evaluation[4], weights[4];
890 
891  /* Compute Gauss points and its weights */
892  cs_quadrature_tria_4pts(v1, v2, v3, area, gauss_pts, weights);
893 
894  ana(tcur, 4, NULL, (const cs_real_t *)gauss_pts, false, input, evaluation);
895 
896  *results += weights[0] * evaluation[0] + weights[1] * evaluation[1] +
897  weights[2] * evaluation[2] + weights[3] * evaluation[3];
898 }
899 
900 /*----------------------------------------------------------------------------*/
915 /*----------------------------------------------------------------------------*/
916 
917 static inline void
919  const cs_real_3_t v1,
920  const cs_real_3_t v2,
921  const cs_real_3_t v3,
922  double area,
923  cs_analytic_func_t *ana,
924  void *input,
925  double results[])
926 {
927  cs_real_3_t gauss_pts[7];
928  double evaluation[7], weights[7];
929 
930  /* Compute Gauss points and its weights */
931  cs_quadrature_tria_7pts(v1, v2, v3, area, gauss_pts, weights);
932 
933  ana(tcur, 7, NULL, (const cs_real_t *)gauss_pts, false, input, evaluation);
934 
935  *results += weights[0] * evaluation[0] + weights[1] * evaluation[1] +
936  weights[2] * evaluation[2] + weights[3] * evaluation[3] +
937  weights[4] * evaluation[4] + weights[5] * evaluation[5] +
938  weights[6] * evaluation[6] ;
939 }
940 
941 /*----------------------------------------------------------------------------*/
956 /*----------------------------------------------------------------------------*/
957 
958 static inline void
960  const cs_real_3_t v1,
961  const cs_real_3_t v2,
962  const cs_real_3_t v3,
963  double area,
964  cs_analytic_func_t *ana,
965  void *input,
966  double results[])
967 {
968  cs_real_3_t xg;
969  double evaluation[3];
970 
971  /* Copied from cs_quadrature_1pt */
972 #ifdef __cplusplus
973  constexpr cs_real_t c_1ov3 = 1./3.;
974  xg[0] = c_1ov3 * (v1[0] + v2[0] + v3[0]);
975  xg[1] = c_1ov3 * (v1[1] + v2[1] + v3[1]);
976  xg[2] = c_1ov3 * (v1[2] + v2[2] + v3[2]);
977 #else
978  xg[0] = cs_math_1ov3 * (v1[0] + v2[0] + v3[0]);
979  xg[1] = cs_math_1ov3 * (v1[1] + v2[1] + v3[1]);
980  xg[2] = cs_math_1ov3 * (v1[2] + v2[2] + v3[2]);
981 #endif
982 
983  ana(tcur, 1, NULL, xg, false, input, evaluation);
984 
985  results[0] += area * evaluation[0];
986  results[1] += area * evaluation[1];
987  results[2] += area * evaluation[2];
988 }
989 
990 /*----------------------------------------------------------------------------*/
1005 /*----------------------------------------------------------------------------*/
1006 
1007 static inline void
1009  const cs_real_3_t v1,
1010  const cs_real_3_t v2,
1011  const cs_real_3_t v3,
1012  double area,
1013  cs_analytic_func_t *ana,
1014  void *input,
1015  double results[])
1016 {
1017  cs_real_3_t gauss_pts[3];
1018  double evaluation[3*3], weights[3];
1019 
1020  /* Compute Gauss points and its unique weight */
1021  cs_quadrature_tria_3pts(v1, v2, v3, area, gauss_pts, weights);
1022 
1023  ana(tcur, 3, NULL, (const cs_real_t *)gauss_pts, false, input, evaluation);
1024 
1025  for (int p = 0; p < 3; p++) {
1026  results[0] += weights[p] * evaluation[3*p ];
1027  results[1] += weights[p] * evaluation[3*p+1];
1028  results[2] += weights[p] * evaluation[3*p+2];
1029  }
1030 }
1031 
1032 /*----------------------------------------------------------------------------*/
1047 /*----------------------------------------------------------------------------*/
1048 
1049 static inline void
1051  const cs_real_3_t v1,
1052  const cs_real_3_t v2,
1053  const cs_real_3_t v3,
1054  double area,
1055  cs_analytic_func_t *ana,
1056  void *input,
1057  double results[])
1058 {
1059  cs_real_3_t gauss_pts[4];
1060  double evaluation[3*4], weights[4];
1061 
1062  /* Compute Gauss points and its weights */
1063  cs_quadrature_tria_4pts(v1, v2, v3, area, gauss_pts, weights);
1064 
1065  ana(tcur, 4, NULL, (const cs_real_t *)gauss_pts, false, input, evaluation);
1066 
1067  for (int p = 0; p < 4; p++) {
1068  results[0] += weights[p] * evaluation[3*p ];
1069  results[1] += weights[p] * evaluation[3*p+1];
1070  results[2] += weights[p] * evaluation[3*p+2];
1071  }
1072 }
1073 
1074 /*----------------------------------------------------------------------------*/
1089 /*----------------------------------------------------------------------------*/
1090 
1091 static inline void
1093  const cs_real_3_t v1,
1094  const cs_real_3_t v2,
1095  const cs_real_3_t v3,
1096  double area,
1097  cs_analytic_func_t *ana,
1098  void *input,
1099  double results[])
1100 {
1101  cs_real_3_t gauss_pts[7];
1102  double evaluation[3*7], weights[7];
1103 
1104  /* Compute Gauss points and its weights */
1105  cs_quadrature_tria_7pts(v1, v2, v3, area, gauss_pts, weights);
1106 
1107  ana(tcur, 7, NULL, (const cs_real_t *)gauss_pts, false, input, evaluation);
1108 
1109  for (int p = 0; p < 7; p++) {
1110  results[0] += weights[p] * evaluation[3*p ];
1111  results[1] += weights[p] * evaluation[3*p+1];
1112  results[2] += weights[p] * evaluation[3*p+2];
1113  }
1114 }
1115 
1116 /*----------------------------------------------------------------------------*/
1131 /*----------------------------------------------------------------------------*/
1132 
1133 static inline void
1135  const cs_real_3_t v1,
1136  const cs_real_3_t v2,
1137  const cs_real_3_t v3,
1138  double area,
1139  cs_analytic_func_t *ana,
1140  void *input,
1141  double results[])
1142 {
1143  cs_real_3_t xg;
1144  double evaluation[9];
1145 
1146  /* Copied from cs_quadrature_1pt */
1147 #ifdef __cplusplus
1148  constexpr cs_real_t c_1ov3 = 1./3.;
1149  xg[0] = c_1ov3 * (v1[0] + v2[0] + v3[0]);
1150  xg[1] = c_1ov3 * (v1[1] + v2[1] + v3[1]);
1151  xg[2] = c_1ov3 * (v1[2] + v2[2] + v3[2]);
1152 #else
1153  xg[0] = cs_math_1ov3 * (v1[0] + v2[0] + v3[0]);
1154  xg[1] = cs_math_1ov3 * (v1[1] + v2[1] + v3[1]);
1155  xg[2] = cs_math_1ov3 * (v1[2] + v2[2] + v3[2]);
1156 #endif
1157 
1158  ana(tcur, 1, NULL, xg, false, input, evaluation);
1159 
1160  for (short int ij = 0; ij < 9; ij++)
1161  results[ij] += area * evaluation[ij];
1162 }
1163 
1164 /*----------------------------------------------------------------------------*/
1179 /*----------------------------------------------------------------------------*/
1180 
1181 static inline void
1183  const cs_real_3_t v1,
1184  const cs_real_3_t v2,
1185  const cs_real_3_t v3,
1186  double area,
1187  cs_analytic_func_t *ana,
1188  void *input,
1189  double results[])
1190 {
1191  cs_real_3_t gauss_pts[3];
1192  double evaluation[9*3], weights[3];
1193 
1194  /* Compute Gauss points and its unique weight */
1195  cs_quadrature_tria_3pts(v1, v2, v3, area, gauss_pts, weights);
1196 
1197  ana(tcur, 3, NULL, (const cs_real_t *)gauss_pts, false, input, evaluation);
1198 
1199  for (int p = 0; p < 3; p++) {
1200  const double wp = weights[p];
1201  double *eval_p = evaluation + 9*p;
1202  for (short int ij = 0; ij < 9; ij++)
1203  results[ij] += wp * eval_p[ij];
1204  }
1205 }
1206 
1207 /*----------------------------------------------------------------------------*/
1222 /*----------------------------------------------------------------------------*/
1223 
1224 static inline void
1226  const cs_real_3_t v1,
1227  const cs_real_3_t v2,
1228  const cs_real_3_t v3,
1229  double area,
1230  cs_analytic_func_t *ana,
1231  void *input,
1232  double results[])
1233 {
1234  cs_real_3_t gauss_pts[4];
1235  double evaluation[9*4], weights[4];
1236 
1237  /* Compute Gauss points and its weights */
1238  cs_quadrature_tria_4pts(v1, v2, v3, area, gauss_pts, weights);
1239 
1240  ana(tcur, 4, NULL, (const cs_real_t *)gauss_pts, false, input, evaluation);
1241 
1242  for (int p = 0; p < 4; p++) {
1243  const double wp = weights[p];
1244  double *eval_p = evaluation + 9*p;
1245  for (short int ij = 0; ij < 9; ij++)
1246  results[ij] += wp * eval_p[ij];
1247  }
1248 }
1249 
1250 /*----------------------------------------------------------------------------*/
1265 /*----------------------------------------------------------------------------*/
1266 
1267 static inline void
1269  const cs_real_3_t v1,
1270  const cs_real_3_t v2,
1271  const cs_real_3_t v3,
1272  double area,
1273  cs_analytic_func_t *ana,
1274  void *input,
1275  double results[])
1276 {
1277  cs_real_3_t gauss_pts[7];
1278  double evaluation[9*7], weights[7];
1279 
1280  /* Compute Gauss points and its weights */
1281  cs_quadrature_tria_7pts(v1, v2, v3, area, gauss_pts, weights);
1282 
1283  ana(tcur, 7, NULL, (const cs_real_t *)gauss_pts, false, input, evaluation);
1284 
1285  for (int p = 0; p < 7; p++) {
1286  const double wp = weights[p];
1287  double *eval_p = evaluation + 9*p;
1288  for (short int ij = 0; ij < 9; ij++)
1289  results[ij] += wp * eval_p[ij];
1290  }
1291 }
1292 
1293 /*----------------------------------------------------------------------------*/
1309 /*----------------------------------------------------------------------------*/
1310 
1311 static inline void
1313  const cs_real_3_t v1,
1314  const cs_real_3_t v2,
1315  const cs_real_3_t v3,
1316  const cs_real_3_t v4,
1317  double vol,
1318  cs_analytic_func_t *ana,
1319  void *input,
1320  double results[])
1321 {
1322  cs_real_3_t xg;
1323  double evaluation;
1324 
1325  /* Copied from cs_quadrature_tet_1pt */
1326  xg[0] = 0.25 * (v1[0] + v2[0] + v3[0] + v4[0]);
1327  xg[1] = 0.25 * (v1[1] + v2[1] + v3[1] + v4[1]);
1328  xg[2] = 0.25 * (v1[2] + v2[2] + v3[2] + v4[2]);
1329 
1330  ana(tcur, 1, NULL, xg, false, input, &evaluation);
1331 
1332  *results += vol * evaluation;
1333 }
1334 
1335 /*----------------------------------------------------------------------------*/
1351 /*----------------------------------------------------------------------------*/
1352 
1353 static inline void
1355  const cs_real_3_t v1,
1356  const cs_real_3_t v2,
1357  const cs_real_3_t v3,
1358  const cs_real_3_t v4,
1359  double vol,
1360  cs_analytic_func_t *ana,
1361  void *input,
1362  double results[])
1363 {
1364  cs_real_3_t gauss_pts[4];
1365  double evaluation[4], weights[4];
1366 
1367  /* Compute Gauss points and its unique weight */
1368  cs_quadrature_tet_4pts(v1, v2, v3, v4, vol, gauss_pts, weights);
1369 
1370  ana(tcur, 4, NULL, (const cs_real_t *)gauss_pts, false, input, evaluation);
1371 
1372  /* Return results */
1373  *results += weights[0] * evaluation[0] + weights[1] * evaluation[1] +
1374  weights[2] * evaluation[2] + weights[3] * evaluation[3];
1375 }
1376 
1377 /*----------------------------------------------------------------------------*/
1393 /*----------------------------------------------------------------------------*/
1394 
1395 static inline void
1397  const cs_real_3_t v1,
1398  const cs_real_3_t v2,
1399  const cs_real_3_t v3,
1400  const cs_real_3_t v4,
1401  double vol,
1402  cs_analytic_func_t *ana,
1403  void *input,
1404  double results[])
1405 {
1406  cs_real_3_t gauss_pts[5];
1407  double evaluation[5], weights[5];
1408 
1409  /* Compute Gauss points and its weights */
1410  cs_quadrature_tet_5pts(v1, v2, v3, v4, vol, gauss_pts, weights);
1411 
1412  ana(tcur, 5, NULL, (const cs_real_t *)gauss_pts, false, input, evaluation);
1413 
1414  *results += weights[0] * evaluation[0] + weights[1] * evaluation[1] +
1415  weights[2] * evaluation[2] + weights[3] * evaluation[3] +
1416  weights[4] * evaluation[4];
1417 }
1418 
1419 /*----------------------------------------------------------------------------*/
1435 /*----------------------------------------------------------------------------*/
1436 
1437 static inline void
1439  const cs_real_3_t v1,
1440  const cs_real_3_t v2,
1441  const cs_real_3_t v3,
1442  const cs_real_3_t v4,
1443  double vol,
1444  cs_analytic_func_t *ana,
1445  void *input,
1446  double results[])
1447 {
1448  cs_real_3_t xg;
1449  double evaluation[3];
1450 
1451  /* Copied from cs_quadrature_tet_1pt */
1452  xg[0] = 0.25 * (v1[0] + v2[0] + v3[0] + v4[0]);
1453  xg[1] = 0.25 * (v1[1] + v2[1] + v3[1] + v4[1]);
1454  xg[2] = 0.25 * (v1[2] + v2[2] + v3[2] + v4[2]);
1455 
1456  ana(tcur, 1, NULL, xg, false, input, evaluation);
1457 
1458  results[0] += vol * evaluation[0];
1459  results[1] += vol * evaluation[1];
1460  results[2] += vol * evaluation[2];
1461 }
1462 
1463 /*----------------------------------------------------------------------------*/
1479 /*----------------------------------------------------------------------------*/
1480 
1481 static inline void
1483  const cs_real_3_t v1,
1484  const cs_real_3_t v2,
1485  const cs_real_3_t v3,
1486  const cs_real_3_t v4,
1487  double vol,
1488  cs_analytic_func_t *ana,
1489  void *input,
1490  double results[])
1491 {
1492  cs_real_3_t gauss_pts[4];
1493  double evaluation[3*4], weights[4];
1494 
1495  /* Compute Gauss points and its unique weight */
1496  cs_quadrature_tet_4pts(v1, v2, v3, v4, vol, gauss_pts, weights);
1497 
1498  ana(tcur, 4, NULL, (const cs_real_t *)gauss_pts, false, input, evaluation);
1499 
1500  for (int p = 0; p < 4; p++) {
1501  results[0] += weights[p] * evaluation[3*p ];
1502  results[1] += weights[p] * evaluation[3*p+1];
1503  results[2] += weights[p] * evaluation[3*p+2];
1504  }
1505 }
1506 
1507 /*----------------------------------------------------------------------------*/
1523 /*----------------------------------------------------------------------------*/
1524 
1525 static inline void
1527  const cs_real_3_t v1,
1528  const cs_real_3_t v2,
1529  const cs_real_3_t v3,
1530  const cs_real_3_t v4,
1531  double vol,
1532  cs_analytic_func_t *ana,
1533  void *input,
1534  double results[])
1535 {
1536  cs_real_3_t gauss_pts[5];
1537  double evaluation[3*5], weights[5];
1538 
1539  /* Compute Gauss points and its weights */
1540  cs_quadrature_tet_5pts(v1, v2, v3, v4, vol, gauss_pts, weights);
1541 
1542  ana(tcur, 5, NULL, (const cs_real_t *)gauss_pts, false, input, evaluation);
1543 
1544  for (int p = 0; p < 5; p++) {
1545  results[0] += weights[p] * evaluation[3*p ];
1546  results[1] += weights[p] * evaluation[3*p+1];
1547  results[2] += weights[p] * evaluation[3*p+2];
1548  }
1549 }
1550 
1551 /*----------------------------------------------------------------------------*/
1567 /*----------------------------------------------------------------------------*/
1568 
1569 static inline void
1571  const cs_real_3_t v1,
1572  const cs_real_3_t v2,
1573  const cs_real_3_t v3,
1574  const cs_real_3_t v4,
1575  double vol,
1576  cs_analytic_func_t *ana,
1577  void *input,
1578  double results[])
1579 {
1580  cs_real_3_t xg;
1581  double evaluation[9];
1582 
1583  /* Copied from cs_quadrature_tet_1pt */
1584  xg[0] = 0.25 * (v1[0] + v2[0] + v3[0] + v4[0]);
1585  xg[1] = 0.25 * (v1[1] + v2[1] + v3[1] + v4[1]);
1586  xg[2] = 0.25 * (v1[2] + v2[2] + v3[2] + v4[2]);
1587 
1588  ana(tcur, 1, NULL, xg, false, input, evaluation);
1589 
1590  for (short int ij = 0; ij < 9; ij++)
1591  results[ij] += vol * evaluation[ij];
1592 }
1593 
1594 /*----------------------------------------------------------------------------*/
1610 /*----------------------------------------------------------------------------*/
1611 
1612 static inline void
1614  const cs_real_3_t v1,
1615  const cs_real_3_t v2,
1616  const cs_real_3_t v3,
1617  const cs_real_3_t v4,
1618  double vol,
1619  cs_analytic_func_t *ana,
1620  void *input,
1621  double results[])
1622 {
1623  cs_real_3_t gauss_pts[4];
1624  double evaluation[9*4], weights[4];
1625 
1626  /* Compute Gauss points and its unique weight */
1627  cs_quadrature_tet_4pts(v1, v2, v3, v4, vol, gauss_pts, weights);
1628 
1629  ana(tcur, 4, NULL, (const cs_real_t *)gauss_pts, false, input, evaluation);
1630 
1631  for (int p = 0; p < 4; p++) {
1632  const double wp = weights[p];
1633  double *eval_p = evaluation + 9*p;
1634  for (short int ij = 0; ij < 9; ij++)
1635  results[ij] += wp * eval_p[ij];
1636  }
1637 }
1638 
1639 /*----------------------------------------------------------------------------*/
1655 /*----------------------------------------------------------------------------*/
1656 
1657 static inline void
1659  const cs_real_3_t v1,
1660  const cs_real_3_t v2,
1661  const cs_real_3_t v3,
1662  const cs_real_3_t v4,
1663  double vol,
1664  cs_analytic_func_t *ana,
1665  void *input,
1666  double results[])
1667 {
1668  cs_real_3_t gauss_pts[5];
1669  double evaluation[9*5], weights[5];
1670 
1671  /* Compute Gauss points and its weights */
1672  cs_quadrature_tet_5pts(v1, v2, v3, v4, vol, gauss_pts, weights);
1673 
1674  ana(tcur, 5, NULL, (const cs_real_t *)gauss_pts, false, input, evaluation);
1675 
1676  for (int p = 0; p < 5; p++) {
1677  const double wp = weights[p];
1678  double *eval_p = evaluation + 9*p;
1679  for (short int ij = 0; ij < 9; ij++)
1680  results[ij] += wp * eval_p[ij];
1681  }
1682 }
1683 
1684 /*----------------------------------------------------------------------------*/
1695 /*----------------------------------------------------------------------------*/
1696 
1697 static inline cs_quadrature_edge_integral_t *
1699  cs_quadrature_type_t qtype)
1700 {
1701  switch (dim) {
1702 
1703  case 1: /* Scalar-valued integral */
1704 
1705  switch (qtype) {
1706 
1707  case CS_QUADRATURE_BARY:
1710  case CS_QUADRATURE_HIGHER:
1712  case CS_QUADRATURE_HIGHEST:
1714 
1715  default:
1716  bft_error(__FILE__, __LINE__, 0,
1717  " %s: Invalid quadrature type\n", __func__);
1718  }
1719  break;
1720 
1721  case 3: /* Vector-valued case */
1722 
1723  switch (qtype) {
1724 
1725  case CS_QUADRATURE_BARY:
1728  case CS_QUADRATURE_HIGHER:
1730  case CS_QUADRATURE_HIGHEST:
1732 
1733  default:
1734  bft_error(__FILE__, __LINE__, 0,
1735  " %s: Invalid quadrature type\n", __func__);
1736  }
1737  break;
1738 
1739  default:
1740  bft_error(__FILE__, __LINE__, 0,
1741  " %s: Invalid dimension value %d. Only 1 and 3 are valid.\n",
1742  __func__, dim);
1743 
1744  } /* switch on dim */
1745 
1746  return NULL; /* Should not go to this stage */
1747 }
1748 
1749 /*----------------------------------------------------------------------------*/
1759 /*----------------------------------------------------------------------------*/
1760 
1761 static inline cs_quadrature_tria_integral_t *
1763  cs_quadrature_type_t qtype)
1764 {
1765  switch (dim) {
1766 
1767  case 1: /* Scalar-valued integral */
1768 
1769  switch (qtype) {
1770 
1771  case CS_QUADRATURE_BARY:
1774  case CS_QUADRATURE_HIGHER:
1776  case CS_QUADRATURE_HIGHEST:
1778 
1779  default:
1780  bft_error(__FILE__, __LINE__, 0,
1781  " %s: Invalid quadrature type\n", __func__);
1782  }
1783  break;
1784 
1785  case 3: /* Vector-valued case */
1786 
1787  switch (qtype) {
1788 
1789  case CS_QUADRATURE_BARY:
1792  case CS_QUADRATURE_HIGHER:
1794  case CS_QUADRATURE_HIGHEST:
1796 
1797  default:
1798  bft_error(__FILE__, __LINE__, 0,
1799  " %s: Invalid quadrature type\n", __func__);
1800  }
1801  break;
1802 
1803  case 9: /* Tensor-valued case */
1804 
1805  switch (qtype) {
1806 
1807  case CS_QUADRATURE_BARY:
1810  case CS_QUADRATURE_HIGHER:
1812  case CS_QUADRATURE_HIGHEST:
1814 
1815  default:
1816  bft_error(__FILE__, __LINE__, 0,
1817  " %s: Invalid quadrature type\n", __func__);
1818  }
1819  break;
1820 
1821  default:
1822  bft_error(__FILE__, __LINE__, 0,
1823  " %s: Invalid dimension value %d. Only 1, 3 and 9 are valid.\n",
1824  __func__, dim);
1825 
1826  } /* switch on dim */
1827 
1828  return NULL; /* Should not go to this stage */
1829 }
1830 
1831 /*----------------------------------------------------------------------------*/
1841 /*----------------------------------------------------------------------------*/
1842 
1843 static inline cs_quadrature_tetra_integral_t *
1845  cs_quadrature_type_t qtype)
1846 {
1847  switch (dim) {
1848 
1849  case 1: /* Scalar-valued case */
1850 
1851  switch (qtype) {
1852 
1853  case CS_QUADRATURE_BARY:
1856  case CS_QUADRATURE_HIGHER:
1858  case CS_QUADRATURE_HIGHEST:
1860 
1861  default:
1862  bft_error(__FILE__, __LINE__, 0,
1863  " %s: Invalid quadrature type\n", __func__);
1864  }
1865  break;
1866 
1867  case 3: /* Vector-valued case */
1868 
1869  switch (qtype) {
1870 
1871  case CS_QUADRATURE_BARY:
1874  case CS_QUADRATURE_HIGHER:
1876  case CS_QUADRATURE_HIGHEST:
1878 
1879  default:
1880  bft_error(__FILE__, __LINE__, 0,
1881  " %s: Invalid quadrature type\n", __func__);
1882  }
1883  break;
1884 
1885  case 9: /* Tensor-valued case */
1886 
1887  switch (qtype) {
1888 
1889  case CS_QUADRATURE_BARY:
1892  case CS_QUADRATURE_HIGHER:
1894  case CS_QUADRATURE_HIGHEST:
1896 
1897  default:
1898  bft_error(__FILE__, __LINE__, 0,
1899  " %s: Invalid quadrature type\n", __func__);
1900  }
1901  break;
1902 
1903  default:
1904  bft_error(__FILE__, __LINE__, 0,
1905  " %s: Invalid dimension value %d. Only 1, 3 and 9 are valid.\n",
1906  __func__, dim);
1907 
1908  } /* Switch on dim */
1909 
1910  /* Avoid no return warning */
1911  return NULL;
1912 }
1913 
1914 /*----------------------------------------------------------------------------*/
1926 /*----------------------------------------------------------------------------*/
1927 
1928 cs_eflag_t
1930  const cs_flag_t loc);
1931 
1932 /*----------------------------------------------------------------------------*/
1933 
1935 
1936 #endif /* __CS_QUADRATURE_H__ */
void bft_error(const char *const file_name, const int line_num, const int sys_error_code, const char *const format,...)
Calls the error handler (set by bft_error_handler_set() or default).
Definition: bft_error.c:193
#define BEGIN_C_DECLS
Definition: cs_defs.h:528
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:347
#define END_C_DECLS
Definition: cs_defs.h:529
unsigned short int cs_flag_t
Definition: cs_defs.h:334
@ p
Definition: cs_field_pointer.h:67
unsigned int cs_eflag_t
Definition: cs_flag.h:190
const cs_real_t cs_math_1ov3
void() cs_analytic_func_t(cs_real_t time, cs_lnum_t n_elts, const cs_lnum_t *elt_ids, const cs_real_t *coords, bool dense_output, void *input, cs_real_t *retval)
Generic function pointer for an evaluation relying on an analytic function.
Definition: cs_param_types.h:127
static cs_quadrature_edge_integral_t * cs_quadrature_get_edge_integral(int dim, cs_quadrature_type_t qtype)
Retrieve the integral function according to the quadrature type and the stride provided Case of integ...
Definition: cs_quadrature.h:1698
void cs_quadrature_tet_5pts(const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, const cs_real_3_t v4, double vol, cs_real_3_t gpts[], double weights[])
Compute the quadrature in a tetrehedra. Exact for 3rd order polynomials (order 4).
Definition: cs_quadrature.cxx:398
static void cs_quadrature_edge_1pt_scal(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, double len, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over an edge with the mid-point rule and add it to results Case of a scalar-valu...
Definition: cs_quadrature.h:551
static void cs_quadrature_tet_4pts_vect(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, const cs_real_3_t v4, double vol, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a tetrahedron with a quadrature rule using 4 Gauss points and a unique weig...
Definition: cs_quadrature.h:1482
static void cs_quadrature_tet_1pt(const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, const cs_real_3_t v4, double vol, cs_real_3_t gpts[], double weight[])
Compute the quadrature in a tetrehedra. Exact for 1st order polynomials (order 2).
Definition: cs_quadrature.h:448
static void cs_quadrature_tet_5pts_scal(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, const cs_real_3_t v4, double vol, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a tetrahedron with a quadrature rule using 5 Gauss points and 5 weights and...
Definition: cs_quadrature.h:1396
static void cs_quadrature_edge_3pts_scal(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, double len, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over an edge with a quadrature rule using 3 Gauss points and weights and add it ...
Definition: cs_quadrature.h:629
static void cs_quadrature_tet_5pts_tens(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, const cs_real_3_t v4, double vol, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a tetrahedron with a quadrature rule using 5 Gauss points and 5 weights and...
Definition: cs_quadrature.h:1658
static void cs_quadrature_tria_4pts_scal(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a triangle with a quadrature rule using 4 Gauss points and 4 weights and ad...
Definition: cs_quadrature.h:879
static void cs_quadrature_tria_7pts_scal(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a triangle with a quadrature rule using 7 Gauss points and 7 weights and ad...
Definition: cs_quadrature.h:918
void cs_quadrature_tria_7pts(const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_real_3_t gpts[], double w[])
Compute quadrature points for a triangle (7 points) Exact for polynomial function up to order 5.
Definition: cs_quadrature.cxx:314
cs_quadrature_type_t
Type of quadrature to use when computing an integral quantity. This rationale is used for integrals a...
Definition: cs_quadrature.h:84
@ CS_QUADRATURE_HIGHEST
Definition: cs_quadrature.h:90
@ CS_QUADRATURE_NONE
Definition: cs_quadrature.h:86
@ CS_QUADRATURE_BARY_SUBDIV
Definition: cs_quadrature.h:88
@ CS_QUADRATURE_N_TYPES
Definition: cs_quadrature.h:91
@ CS_QUADRATURE_HIGHER
Definition: cs_quadrature.h:89
@ CS_QUADRATURE_BARY
Definition: cs_quadrature.h:87
void() cs_quadrature_tria_integral_t(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a triangle based on a specified quadrature rule and add it to results.
Definition: cs_quadrature.h:201
static void cs_quadrature_tet_1pt_tens(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, const cs_real_3_t v4, double vol, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a tetrahedron using a barycentric quadrature rule and add it to results....
Definition: cs_quadrature.h:1570
static void cs_quadrature_edge_2pts_vect(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, double len, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over an edge with a quadrature rule using 2 Gauss points and a unique weight and...
Definition: cs_quadrature.h:709
static void cs_quadrature_tria_4pts_tens(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a triangle with a quadrature rule using 4 Gauss points and 4 weights and ad...
Definition: cs_quadrature.h:1225
void() cs_quadrature_tria_t(const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_real_3_t gpts[], double *weights)
Generic functoin pointer to compute the quadrature points for a triangle.
Definition: cs_quadrature.h:130
static void cs_quadrature_edge_1pt(const cs_real_3_t v1, const cs_real_3_t v2, double len, cs_real_3_t gpts[], double *w)
Compute quadrature points for an edge from v1 -> v2 (2 points) Exact for polynomial function up to or...
Definition: cs_quadrature.h:278
static void cs_quadrature_tria_4pts_vect(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a triangle with a quadrature rule using 4 Gauss points and 4 weights and ad...
Definition: cs_quadrature.h:1050
static void cs_quadrature_tet_1pt_vect(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, const cs_real_3_t v4, double vol, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a tetrahedron using a barycentric quadrature rule and add it to results....
Definition: cs_quadrature.h:1438
static void cs_quadrature_tet_5pts_vect(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, const cs_real_3_t v4, double vol, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a tetrahedron with a quadrature rule using 5 Gauss points and 5 weights and...
Definition: cs_quadrature.h:1526
void cs_quadrature_edge_3pts(const cs_real_3_t v1, const cs_real_3_t v2, double len, cs_real_3_t gpts[], double w[])
Compute quadrature points for an edge from v1 -> v2 (3 points) Exact for polynomial function up to or...
Definition: cs_quadrature.cxx:206
void cs_quadrature_setup(void)
Compute constant weights for all quadratures used.
Definition: cs_quadrature.cxx:108
static void cs_quadrature_tria_7pts_vect(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a triangle with a quadrature rule using 7 Gauss points and 7 weights and ad...
Definition: cs_quadrature.h:1092
void cs_quadrature_edge_2pts(const cs_real_3_t v1, const cs_real_3_t v2, double len, cs_real_3_t gpts[], double *w)
Compute quadrature points for an edge from v1 -> v2 (2 points) Exact for polynomial function up to or...
static void cs_quadrature_edge_2pts_scal(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, double len, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over an edge with a quadrature rule using 2 Gauss points and a unique weight and...
Definition: cs_quadrature.h:591
static void cs_quadrature_tet_1pt_scal(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, const cs_real_3_t v4, double vol, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a tetrahedron using a barycentric quadrature rule and add it to results....
Definition: cs_quadrature.h:1312
static void cs_quadrature_tria_3pts_vect(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a triangle with a quadrature rule using 3 Gauss points and a unique weight ...
Definition: cs_quadrature.h:1008
static void cs_quadrature_tria_1pt_scal(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a triangle using a barycentric quadrature rule and add it to results Case o...
Definition: cs_quadrature.h:792
const char * cs_quadrature_get_type_name(const cs_quadrature_type_t type)
Return th name associated to a type of quadrature.
Definition: cs_quadrature.cxx:155
static void cs_quadrature_tet_4pts_scal(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, const cs_real_3_t v4, double vol, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a tetrahedron with a quadrature rule using 4 Gauss points and a unique weig...
Definition: cs_quadrature.h:1354
static void cs_quadrature_tria_1pt(const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_real_3_t gpts[], double *w)
Compute quadrature points for a triangle (1 point) Exact for polynomial function up to order 1 (baryc...
Definition: cs_quadrature.h:345
void cs_quadrature_tria_4pts(const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_real_3_t gpts[], double w[])
Compute quadrature points for a triangle (4 points) Exact for polynomial function up to order 3.
Definition: cs_quadrature.cxx:277
void() cs_quadrature_tetra_integral_t(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, const cs_real_3_t v4, double vol, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a tetrahedron based on a specified quadrature rule and add it to results.
Definition: cs_quadrature.h:228
void cs_quadrature_tria_3pts(const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_real_3_t gpts[], double *w)
Compute quadrature points for a triangle (3 points) Exact for polynomial function up to order 2.
void cs_quadrature_tet_15pts(const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, const cs_real_3_t v4, double vol, cs_real_3_t gpts[], double weights[])
Compute the quadrature in a tetrehedra. Exact for 5th order polynomials (order 6).
Definition: cs_quadrature.cxx:444
static void cs_quadrature_tria_1pt_vect(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a triangle using a barycentric quadrature rule and add it to results Case o...
Definition: cs_quadrature.h:959
static void cs_quadrature_tria_3pts_scal(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a triangle with a quadrature rule using 3 Gauss points and a unique weight ...
Definition: cs_quadrature.h:839
void() cs_quadrature_edge_t(const cs_real_3_t v1, const cs_real_3_t v2, double len, cs_real_3_t gpts[], double *weights)
Generic function pointer to compute the quadrature points for an edge from v1 -> v2.
Definition: cs_quadrature.h:109
static cs_quadrature_tria_integral_t * cs_quadrature_get_tria_integral(int dim, cs_quadrature_type_t qtype)
Retrieve the integral function according to the quadrature type and the stride provided.
Definition: cs_quadrature.h:1762
static void cs_quadrature_edge_1pt_vect(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, double len, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over an edge using a barycentric quadrature rule and add it to results Case of a...
Definition: cs_quadrature.h:667
void() cs_quadrature_tet_t(const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, const cs_real_3_t v4, double vol, cs_real_3_t gpts[], double weights[])
Generic function to compute the quadrature points in a tetrehedra.
Definition: cs_quadrature.h:152
void() cs_quadrature_edge_integral_t(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, double len, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over an edge based on a specified quadrature rule and add it to results.
Definition: cs_quadrature.h:176
static cs_quadrature_tetra_integral_t * cs_quadrature_get_tetra_integral(int dim, cs_quadrature_type_t qtype)
Retrieve the integral function according to the quadrature type and the stride provided.
Definition: cs_quadrature.h:1844
static void cs_quadrature_tria_3pts_tens(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a triangle with a quadrature rule using 3 Gauss points and a unique weight ...
Definition: cs_quadrature.h:1182
static void cs_quadrature_tria_7pts_tens(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a triangle with a quadrature rule using 7 Gauss points and 7 weights and ad...
Definition: cs_quadrature.h:1268
void cs_quadrature_tet_4pts(const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, const cs_real_3_t v4, double vol, cs_real_3_t gpts[], double weights[])
Compute the quadrature in a tetrehedra. Exact for 2nd order polynomials (order 3).
Definition: cs_quadrature.cxx:356
cs_eflag_t cs_quadrature_get_flag(const cs_quadrature_type_t qtype, const cs_flag_t loc)
Get the flags adapted to the given quadrature type qtype and the location on which the quadrature sho...
Definition: cs_quadrature.cxx:507
static void cs_quadrature_edge_3pts_vect(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, double len, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over an edge with a quadrature rule using 3 Gauss points and weights and add it ...
Definition: cs_quadrature.h:749
static void cs_quadrature_tria_1pt_tens(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, double area, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a triangle using a barycentric quadrature rule and add it to results....
Definition: cs_quadrature.h:1134
static void cs_quadrature_tet_4pts_tens(double tcur, const cs_real_3_t v1, const cs_real_3_t v2, const cs_real_3_t v3, const cs_real_3_t v4, double vol, cs_analytic_func_t *ana, void *input, double results[])
Compute the integral over a tetrahedron with a quadrature rule using 4 Gauss points and a unique weig...
Definition: cs_quadrature.h:1613