Flow123d  JS_before_hm-2-g912b55d
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 
26 
27 /** @brief Class representing midpoint rule, with uniformly distributed points of the same weight.
28  */
29 class QMidpoint : public Quadrature {
30 public:
31  /// Empty constructor
32  QMidpoint(const unsigned int n_quadrature_points)
33  : Quadrature(1) {
34 
35  double qweight = 1.0/n_quadrature_points;
36  this->weights.resize(n_quadrature_points,qweight);
37  this->quadrature_points.resize(n_quadrature_points);
38  for(unsigned int q=0; q < n_quadrature_points; q++)
39  this->point<1>(q) = arma::vec({0.5*qweight + q*qweight});
40  }
41 };
42 
43 #endif // QMIDPOINT_HH_
QMidpoint(const unsigned int n_quadrature_points)
Empty constructor.
Definition: qmidpoint.hh:32
void resize(uint size)
Definition: armor.hh:141
Mat< double, N, 1 > vec
Definition: armor.hh:211
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:141
Basic definitions of numerical quadrature rules.
Class representing midpoint rule, with uniformly distributed points of the same weight.
Definition: qmidpoint.hh:29
Armor::array quadrature_points
List of quadrature points.
Definition: quadrature.hh:134