quadrature.cpp 624 Bytes
Newer Older
1
2
3
4
5
#include "quadrature.h"
#include "qmontecarlo.h"

Quadrature::Quadrature( int order ) : _order( order ) {}

6
7
Quadrature* Quadrature::CreateQuadrature( std::string name, int order ) {

8
9
10
    if( name == "montecarlo" ) {
        return new QMonteCarlo( order );
    }
11
12

    // If nothing has been picked, take this as dummy:
13
14
    return new QMonteCarlo( order );
}
15
16
17
18
19
20
21
22
23
24
25
26
27

double Quadrature::SumUpWeights() {
    double w = 0;
    for( int i = 0; i < _nq; i++ ) {
        w += _weights[i];
    }
    return w;
}
void Quadrature::PrintWeights() {
    for( int i = 0; i < _nq; i++ ) {
        std::cout << _weights[i] << std::endl;
    }
}