TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Quadrature_base.h
1/****************************************************************************
2 * Copyright (c) 2024, CEA
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8 * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9 *
10 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13 *
14 *****************************************************************************/
15#ifndef Quadrature_base_included
16#define Quadrature_base_included
17
18#include <TRUSTTabs_forward.h>
19#include <Parser_U.h>
20#include <Domaine_DG.h>
21#include <Matrice_Morse_Sym.h>
22
24{
25public:
28
29 virtual ~Quadrature_base() {}
30
31 inline const DoubleTab& get_integ_points() const { return integ_points_; }
32 inline const DoubleTab& get_integ_points_facets() const { return integ_points_facets_; }
33
34 inline const DoubleTab& get_weights() const { return weights_; }
35 inline const DoubleTab& get_weights_facets() const { return weights_facets_; }
36
37 inline const IntTab& get_tab_nb_pts_integ() const { return tab_nb_pts_integ_; }
38 inline const IntTab& get_ind_pts_integ() const { return ind_pts_integ_; }
39
40 /*! @brief Compute for the whole domain the exact location of integration points per element
41 */
42 virtual void compute_integ_points() = 0;
43
44 /*! @brief Compute for the whole domain the exact location of integration points per facet
45 */
47
48
49 inline int nb_pts_integ_max() const { return nb_pts_integ_max_; } // TODO: maximum number of quadrature points
50 inline int nb_pts_integ(int e ) const { return tab_nb_pts_integ_(e); }
51 inline int nb_pts_integ_facets() const { return nb_pts_integ_facets_; }
52 inline int ind_pts_integ(int e ) const { return ind_pts_integ_(e); }
53
54 /*! @brief Compute the integral of a function on the whole domain
55 */
56 double compute_integral(Parser_U& parser) const;
57 /*! @brief Compute the integral of a function on the whole domain with its values on integration points
58 */
59 double compute_integral(DoubleTab& vals_pts_integ) const;
60 /*! @brief Compute the integral of a function on one triangle
61 * @param num_elem index of the element
62 * @param parser parser providing the function values
63 * @return the integral value on the element
64 */
65 double compute_integral_on_elem(int num_elem, Parser_U& parser) const ;
66 /*! @brief Compute the integral of a function on each triangle
67 * @param parser parser providing the function values
68 * @return the total integral value over all elements
69 */
70 double compute_integral_on_elem(Parser_U& parser) const ;
71
72 /*! @brief Compute the integral of a function on one triangle with its value on integration points
73 * @param num_elem index of the element
74 * @param val_pts_integ values of the function at integration points
75 * @return the integral value on the element
76 */
77 double compute_integral_on_elem(int num_elem, DoubleTab& val_pts_integ) const ;
78 /*! @brief Compute the integral of a function on each triangle with its value on integration points
79 */
80 // DoubleTab compute_integral_on_elem(DoubleTab& val_pts_integ) const ; // unsure this is used: commented out until removed
81
82 /*! @brief Compute the integral of a function on one facet
83 * @param num_facet index of the facet
84 * @param parser parser providing the function values
85 * @return the integral value on the facet
86 */
87 double compute_integral_on_facet(int num_facet, Parser_U& parser) const ;
88 /*! @brief Compute the integral of a function on one facet with its value on integration points
89 * @param num_facet index of the facet
90 * @param val_pts_integ values of the function at integration points
91 * @return the integral value on the facet
92 */
93 double compute_integral_on_facet(int num_facet, DoubleTab& val_pts_integ) const ;
94
95
96protected:
98
99 int nb_pts_integ_quad_; // local numbers of integ points for quadrangles
100 int nb_pts_integ_tri_; // // local numbers of integ points for triangles
101 int nb_pts_integ_facets_; // local numbers of integ points for facets
102 int nb_pts_integ_max_; // maximal number of integ points for all geometrical types
103
104 IntTab tab_nb_pts_integ_; // numbers of integ points cumulated
105
106 IntTab ind_pts_integ_; // index of the first integration point for each element
107
108 DoubleTab integ_points_; // Integ points for quadrature formula
109 DoubleTab integ_points_facets_; // Integ points for quadrature formula for facets
110 DoubleTab weights_; //global weights
111 DoubleTab weights_quad_; // local numbers
112 DoubleTab weights_tri_; // local numbers
113 DoubleTab weights_facets_; // local numbers
114
115 // Computes the area of a triangle from vertex coordinates
116 double triangleArea(double x1, double y1, double x2, double y2, double x3, double y3);
117
118 // Computes a weight scale based on tessellation triangle and element volume
119 double calculateWeightScale(const IntTab& vert_elems, const DoubleTab& xs, DoubleVect& volumes, int e, int s1, int s2, int s3);
120 double calculateWeightScale(double ve, double s1x, double s1y, double s2x, double s2y, double s3x, double s3y);
121
122};
123
124#endif
class Parser_U Version of the Parser class, deriving from Objet_U.
Definition Parser_U.h:32
double triangleArea(double x1, double y1, double x2, double y2, double x3, double y3)
DoubleTab weights_facets_
int ind_pts_integ(int e) const
DoubleTab integ_points_
int nb_pts_integ(int e) const
double calculateWeightScale(const IntTab &vert_elems, const DoubleTab &xs, DoubleVect &volumes, int e, int s1, int s2, int s3)
const DoubleTab & get_weights() const
double compute_integral_on_facet(int num_facet, Parser_U &parser) const
Compute the integral of a function on each triangle with its value on integration points.
const DoubleTab & get_integ_points_facets() const
double compute_integral(Parser_U &parser) const
Compute the integral of a function on the whole domain.
const DoubleTab & get_weights_facets() const
DoubleTab integ_points_facets_
const DoubleTab & get_integ_points() const
virtual void compute_integ_points()=0
Compute for the whole domain the exact location of integration points per element.
double compute_integral_on_elem(Parser_U &parser) const
Compute the integral of a function on each triangle.
int nb_pts_integ_max() const
const IntTab & get_tab_nb_pts_integ() const
double compute_integral_on_elem(int num_elem, Parser_U &parser) const
Compute the integral of a function on one triangle.
Quadrature_base(const Domaine_DG &dom)
int nb_pts_integ_facets() const
virtual void compute_integ_points_on_facet()=0
Compute for the whole domain the exact location of integration points per facet.
const IntTab & get_ind_pts_integ() const
OBS_PTR(Domaine_DG) dom_
virtual ~Quadrature_base()
DoubleTab weights_quad_