MAST3
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
quadrature.hpp
Go to the documentation of this file.
1 /*
2 * MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3 * Copyright (C) 2013-2020 Manav Bhatia and MAST authors
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 
20 #ifndef __mast__libmesh_quadrature_h__
21 #define __mast__libmesh_quadrature_h__
22 
23 // MAST includes
25 
26 // libMesh includes
27 #include <libmesh/quadrature.h>
28 #include <libmesh/enum_quadrature_type.h>
29 
30 namespace MAST {
31 
32 namespace Quadrature {
33 namespace libMeshWrapper {
34 
35 template <typename ScalarType, uint_t Dim>
36 class Quadrature {
37 
38 public:
39 
40  using scalar_t = ScalarType;
41  using quadrature_t = libMesh::QBase;
42  static const uint_t dim = Dim;
44  "Class only implemented for scalar type = double.");
45 
47  _q (&q),
48  _own_pointer (false) {
49 
50  }
51 
52  Quadrature(const libMesh::QuadratureType qt,
53  const libMesh::Order order):
54  _q (libMesh::QBase::build (qt, Dim, order).release()),
55  _own_pointer (true) {
56 
57  }
58 
60 
61  if (_own_pointer)
62  delete _q;
63  }
64 
65  inline uint_t order() const { return _q->get_order();}
66  inline uint_t n_points() const { return _q->n_points();}
67  inline scalar_t qp_coord(uint_t qp, uint_t xi_i) const { return _q->get_points()[qp](xi_i);}
68  inline scalar_t weight(uint_t qp) const { return _q->w(qp);}
69  inline quadrature_t& quadrature_object() { return *_q;}
70  inline const quadrature_t& quadrature_object() const { return *_q;}
71 
72 private:
73 
76 };
77 
78 } // namespace libMeshWrapper
79 } // namespace Quadrature
80 } // namespace MAST
81 
82 #endif // __mast__libmesh_quadrature_h__
std::enable_if< Dim< 3, ScalarType >::typesource_load_multiplier(const SourceLoadFieldType *f, const SectionAreaType *s, ContextType &c) { Assert0(f, "Invalid pointer");Assert0(s, "Invalid pointer");return f-> value(c) *s -> value(c)
scalar_t qp_coord(uint_t qp, uint_t xi_i) const
Definition: quadrature.hpp:67
Quadrature(const libMesh::QuadratureType qt, const libMesh::Order order)
Definition: quadrature.hpp:52
unsigned int uint_t
std::unique_ptr< ValType > build(const libMesh::System &sys)
Definition: utility.hpp:284
const quadrature_t & quadrature_object() const
Definition: quadrature.hpp:70