votca 2024.2-dev
Loading...
Searching...
No Matches
GaussianQuadratureBase.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 The VOTCA Development Team
3 * (http://www.votca.org)
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License")
6 *
7 * You may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20#pragma once
21
22#ifndef VOTCA_XTP_GAUSSIANQUADRATUREBASE_H
23#define VOTCA_XTP_GAUSSIANQUADRATUREBASE_H
24
25// Local VOTCA includes
26#include "eigen.h"
28
29namespace votca {
30namespace xtp {
31
33 public:
35
36 void configure(Index order) {
37 FillPoints();
39 CheckOrder(order, map_points_);
41 points_ = map_points_[order];
43 }
44
45 virtual ~GaussianQuadratureBase() = default;
46
47 Index Order() const { return points_.size(); }
48
49 template <typename F>
50 double Integrate(const F& f) const {
51 double result = 0.0;
52 for (Index j = 0; j < Order(); ++j) {
53 result += ScaledWeight(j) * f(j, ScaledPoint(j), UseSymmetry());
54 }
55 return result;
56 }
57 virtual double ScaledPoint(Index i) const = 0;
58
59 virtual double ScaledWeight(Index i) const = 0;
60
61 private:
62 void CheckOrder(Index order,
63 const std::map<Index, Eigen::VectorXd>& map) const;
64
65 protected:
66 Eigen::VectorXd points_;
67 Eigen::VectorXd weights_;
68
69 std::map<Index, Eigen::VectorXd> map_points_;
70 std::map<Index, Eigen::VectorXd> map_AdaptedWeights_;
71
72 virtual bool UseSymmetry() const = 0;
73
74 virtual void FillPoints() = 0;
75 virtual void FillAdaptedWeights() = 0;
76};
77
78} // namespace xtp
79} // namespace votca
80
81#endif // VOTCA_XTP_GAUSSIANQUADRATUREBASE_H
std::map< Index, Eigen::VectorXd > map_points_
std::map< Index, Eigen::VectorXd > map_AdaptedWeights_
virtual ~GaussianQuadratureBase()=default
void CheckOrder(Index order, const std::map< Index, Eigen::VectorXd > &map) const
virtual double ScaledPoint(Index i) const =0
virtual double ScaledWeight(Index i) const =0
virtual bool UseSymmetry() const =0
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26