Flow123d  JS_before_hm-1016-g09ec2cb
qmidpoint.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file qmidpoint.hh
15  * @brief Midpoint rule qudrature.
16  * @author Pavel Exner
17  */
18 
19 #ifndef QMIDPOINT_HH_
20 #define QMIDPOINT_HH_
21 
22 #include "system/global_defs.h"
23 #include "quadrature/quadrature.hh"
24 #include "mesh/point.hh"
25 #include "system/armor.hh"
26 
27 
28 /** @brief Class representing midpoint rule, with uniformly distributed points of the same weight.
29  */
30 class QMidpoint : public Quadrature {
31 public:
32  /// Empty constructor
33  QMidpoint(unsigned int n_quadrature_points)
34  : Quadrature(1, n_quadrature_points) {
35 
36  double qweight = 1.0/n_quadrature_points;
37  for(unsigned int q=0; q < n_quadrature_points; q++) {
38  this->weights[q] = qweight;
39  this->set(q) = Armor::ArmaVec<double, 1>({(0.5+ q)*qweight});
40  }
41  }
42 };
43 
44 #endif // QMIDPOINT_HH_
QMidpoint(unsigned int n_quadrature_points)
Empty constructor.
Definition: qmidpoint.hh:33
Base class for quadrature rules on simplices in arbitrary dimensions.
Definition: quadrature.hh:48
Global macros to enhance readability and debugging, general constants.
std::vector< double > weights
List of weights to the quadrature points.
Definition: quadrature.hh:148
Basic definitions of numerical quadrature rules.
typename arma::Col< Type >::template fixed< nr > ArmaVec
Definition: armor.hh:505
Class representing midpoint rule, with uniformly distributed points of the same weight.
Definition: qmidpoint.hh:30