Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
quadrature_selector.cc
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2003 - 2018 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #include <deal.II/base/quadrature_lib.h>
17 #include <deal.II/base/quadrature_selector.h>
18 
19 DEAL_II_NAMESPACE_OPEN
20 
21 
22 template <int dim>
25  const unsigned int order)
26 {
27  if (s == "gauss")
28  {
29  AssertThrow(order >= 1, ExcInvalidQGaussOrder(order));
30  return QGauss<dim>(order);
31  }
32  else
33  {
34  AssertThrow(order == 0, ExcInvalidOrder(s, order));
35 
36  if (s == "midpoint")
37  return QMidpoint<dim>();
38  else if (s == "milne")
39  return QMilne<dim>();
40  else if (s == "simpson")
41  return QSimpson<dim>();
42  else if (s == "trapez")
43  return QTrapez<dim>();
44  else if (s == "weddle")
45  return QWeddle<dim>();
46  }
47 
48  // we didn't find this name
49  AssertThrow(false, ExcInvalidQuadrature(s));
50  // return something to suppress
51  // stupid warnings by some
52  // compilers
53  return Quadrature<dim>();
54 }
55 
56 
57 
58 template <int dim>
60  const unsigned int order)
61  : Quadrature<dim>(create_quadrature(s, order).get_points(),
62  create_quadrature(s, order).get_weights())
63 {}
64 
65 
66 
67 template <int dim>
68 std::string
70 {
71  return std::string("gauss|midpoint|milne|simpson|trapez|weddle");
72 }
73 
74 
75 
76 // explicit instantiations
77 template class QuadratureSelector<1>;
78 template class QuadratureSelector<2>;
79 template class QuadratureSelector<3>;
80 
81 DEAL_II_NAMESPACE_CLOSE
static Quadrature< dim > create_quadrature(const std::string &s, const unsigned int order)
static std::string get_quadrature_names()
#define AssertThrow(cond, exc)
Definition: exceptions.h:1519
QuadratureSelector(const std::string &s, const unsigned int order=0)