quadrature.h 1.96 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef QUADRATURE_H
#define QUADRATURE_H

#include <blaze/Math.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Quadrature
{
  public:
    Quadrature( int order );
    virtual ~Quadrature(){};

    virtual std::string ComputeName()                                             = 0;
    virtual int ComputeNq()                                                       = 0;
    virtual blaze::DynamicVector<blaze::DynamicVector<double>> ComputePoints()    = 0;
    virtual blaze::DynamicVector<double> ComputeWeights()                         = 0;
    virtual blaze::DynamicVector<blaze::DynamicVector<int>> ComputeConnectivity() = 0;

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

    // Setter
    void SetName( std::string name ) { _name = name; };
    void SetOrder( int order ) { _order = order; };
    void SetNq( int nq ) { _nq = nq; };
    void SetPoints( blaze::DynamicVector<blaze::DynamicVector<double>> points ) { _points = points; };
    void SetWeights( blaze::DynamicVector<double> weights ) { _weights = weights; };
    void SetConnectivity( blaze::DynamicVector<blaze::DynamicVector<int>> connectivity ) { _connectivity = connectivity; };

    // Getter
    std::string GetName() { return _name; };
    int GetOrder() { return _order; };
    int GetNq() { return _nq; };
    blaze::DynamicVector<blaze::DynamicVector<double>> GetPoints() { return _points; };
    blaze::DynamicVector<double> GetWeights() { return _weights; };
    blaze::DynamicVector<blaze::DynamicVector<int>> GetConnectivity() { return _connectivity; };

  protected:
    std::string _name;
    int _order;
    int _nq;
    blaze::DynamicVector<blaze::DynamicVector<double>> _points;
    blaze::DynamicVector<double> _weights;
    blaze::DynamicVector<blaze::DynamicVector<int>> _connectivity;
};

// Quadrature Hub
Quadrature* GetQuadrature( std::string name, int order );

#endif    // QUADRATURE_H