libMesh
quadrature_composite.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2024 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_QUADRATURE_COMPOSITE_H
21 #define LIBMESH_QUADRATURE_COMPOSITE_H
22 
23 #include "libmesh/libmesh_config.h"
24 
25 #if defined(LIBMESH_HAVE_TRIANGLE) && defined(LIBMESH_HAVE_TETGEN)
26 
27 // Local includes
28 #include "libmesh/quadrature.h"
29 #include "libmesh/elem_cutter.h"
30 #include "libmesh/fe_base.h"
31 
32 // C++ includes
33 #include <memory>
34 
35 namespace libMesh
36 {
37 
50 template <class QSubCell>
51 class QComposite final : public QSubCell
52 {
53 public:
54 
58  using QSubCell::_dim;
59  using QSubCell::_points;
60  using QSubCell::_weights;
61  using QSubCell::init;
62 
66  QComposite (unsigned int dim,
67  Order order=INVALID_ORDER);
68 
73  QComposite (const QComposite &) = delete;
74  QComposite & operator= (const QComposite &) = delete;
75 
80  QComposite (QComposite &&) = default;
81  QComposite & operator= (QComposite &&) = default;
82  virtual ~QComposite() = default;
83 
87  virtual QuadratureType type() const override;
88 
93  virtual void init (const Elem & elem,
94  const std::vector<Real> & vertex_distance_func,
95  unsigned int p_level=0) override;
96 
97 private:
98 
103  void add_subelem_values (const std::vector<Elem const *> & subelem);
104 
108  QSubCell _q_subcell;
109 
114 
118  std::unique_ptr<FEBase> _lagrange_fe;
119 };
120 
121 } // namespace libMesh
122 
123 #endif // LIBMESH_HAVE_TRIANGLE && LIBMESH_HAVE_TETGEN
124 #endif // LIBMESH_QUADRATURE_COMPOSITE_H
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
QSubCell _q_subcell
Subcell quadrature object.
unsigned int dim
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
QComposite(unsigned int dim, Order order=INVALID_ORDER)
Constructor.
QuadratureType
Defines an enum for currently available quadrature rules.
virtual void init(const Elem &elem, const std::vector< Real > &vertex_distance_func, unsigned int p_level=0) override
Overrides the base class init() function, and uses the ElemCutter to subdivide the element into "insi...
The libMesh namespace provides an interface to certain functionality in the library.
virtual ~QComposite()=default
This class implements cutting a single element into a collection of subelements.
Definition: elem_cutter.h:61
QComposite & operator=(const QComposite &)=delete
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
This class implements generic composite quadrature rules.
std::unique_ptr< FEBase > _lagrange_fe
Lagrange FE to use for subcell mapping.
ElemCutter _elem_cutter
ElemCutter object.
virtual QuadratureType type() const override
void add_subelem_values(const std::vector< Elem const *> &subelem)
Helper function called from init() to collect all the points and weights of the subelement quadrature...