Flow123d  3.9.0-895a22dee
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_
armor.hh
Quadrature::weights
std::vector< double > weights
List of weights to the quadrature points.
Definition: quadrature.hh:147
point.hh
Quadrature::set
Armor::Array< double >::ArrayMatSet set(uint i)
Definition: quadrature.hh:97
QMidpoint
Class representing midpoint rule, with uniformly distributed points of the same weight.
Definition: qmidpoint.hh:30
global_defs.h
Global macros to enhance readability and debugging, general constants.
QMidpoint::QMidpoint
QMidpoint(unsigned int n_quadrature_points)
Empty constructor.
Definition: qmidpoint.hh:33
quadrature.hh
Basic definitions of numerical quadrature rules.
Quadrature
Base class for quadrature rules on simplices in arbitrary dimensions.
Definition: quadrature.hh:48
Armor::ArmaVec
typename arma::Col< Type >::template fixed< nr > ArmaVec
Definition: armor.hh:505