Flow123d  release_3.0.0-1106-ga3b2e4c
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<1> {
30 public:
31  /// Empty constructor
32  QMidpoint(const unsigned int n_quadrature_points){
33 
34  double qweight = 1.0/n_quadrature_points;
35  this->weights.resize(n_quadrature_points,qweight);
36  this->quadrature_points.resize(n_quadrature_points);
37  for(unsigned int q=0; q < n_quadrature_points; q++)
38  this->quadrature_points[q] = arma::vec({0.5*qweight + q*qweight});
39  }
40 };
41 
42 #endif // QMIDPOINT_HH_
QMidpoint(const unsigned int n_quadrature_points)
Empty constructor.
Definition: qmidpoint.hh:32
std::vector< double > weights
List of weights to the quadrature points.
Definition: quadrature.hh:111
std::vector< arma::vec::fixed< dim > > quadrature_points
List of quadrature points.
Definition: quadrature.hh:104
Base class for quadrature rules on simplices in arbitrary dimensions.
Definition: fe_values.hh:35
Global macros to enhance readability and debugging, general constants.
Basic definitions of numerical quadrature rules.
Class representing midpoint rule, with uniformly distributed points of the same weight.
Definition: qmidpoint.hh:29