File indexing completed on 2026-06-02 08:17:12
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "apfel/grid.h"
0010 #include "apfel/matrix.h"
0011 #include "apfel/operator.h"
0012 #include "apfel/distribution.h"
0013 #include "apfel/doubleobject.h"
0014 #include "apfel/doubledistribution.h"
0015 #include "apfel/lagrangeinterpolator.h"
0016
0017 namespace apfel
0018 {
0019
0020
0021
0022
0023
0024 class DistributionOperator
0025 {
0026 public:
0027 DistributionOperator() = delete;
0028 DistributionOperator(DistributionOperator const&) = default;
0029
0030
0031
0032
0033
0034
0035 DistributionOperator(Grid const& gr1, Grid const& gr2);
0036
0037
0038
0039
0040
0041
0042
0043 DistributionOperator(Grid const& gr1, Grid const& gr2, std::vector<std::vector<std::vector<matrix<double>>>> const& DO);
0044
0045
0046
0047
0048
0049
0050 DistributionOperator(Distribution const& d1, Operator const& O2);
0051
0052
0053
0054
0055
0056 DistributionOperator(DoubleObject<Distribution, Operator> const& DObj);
0057
0058
0059
0060
0061 virtual ~DistributionOperator() {}
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075 Operator Evaluate(double const& x) const;
0076
0077
0078
0079
0080
0081
0082
0083 Operator Derive(double const& x) const;
0084
0085
0086
0087
0088
0089
0090
0091
0092 Operator Integrate(double const& a, double const& b) const;
0093
0094
0095
0096
0097
0098
0099 DoubleDistribution operator *= (Distribution const& d) const;
0100 DistributionOperator& operator *= (Operator const& o);
0101 DistributionOperator& operator *= (double const& s);
0102 DistributionOperator& operator /= (double const& s);
0103 DistributionOperator& operator += (DistributionOperator const& o);
0104 DistributionOperator& operator -= (DistributionOperator const& o);
0105 DistributionOperator& operator = (DistributionOperator const& o);
0106 DistributionOperator& operator *= (std::function<double(double const&, double const&)> const& f);
0107 DistributionOperator& operator *= (std::function<double(double const&)> const& f);
0108
0109
0110
0111
0112
0113 Grid const& GetFirstGrid() const { return _grid1; }
0114
0115
0116
0117
0118 Grid const& GetSecondGrid() const { return _grid2; }
0119
0120
0121
0122
0123 std::vector<std::vector<std::vector<matrix<double>>>> GetDistributionOperator() const { return _dOperator; }
0124
0125
0126
0127
0128 void Print() const { std::cout << *this << std::endl; }
0129
0130 private:
0131 Grid const& _grid1;
0132 Grid const& _grid2;
0133 LagrangeInterpolator const _li1;
0134 std::vector<std::vector<std::vector<matrix<double>>>> _dOperator;
0135
0136 friend std::ostream& operator << (std::ostream& os, DistributionOperator const& dop);
0137 };
0138
0139
0140
0141
0142
0143 DoubleDistribution operator * (DistributionOperator const& lhs, Distribution const& rhs);
0144 DistributionOperator operator * (DistributionOperator lhs, Operator const& rhs);
0145 DistributionOperator operator * (double const& s, DistributionOperator rhs);
0146 DistributionOperator operator * (DistributionOperator lhs, double const& s);
0147 DistributionOperator operator / (DistributionOperator lhs, double const& s);
0148 DistributionOperator operator + (DistributionOperator lhs, DistributionOperator const& rhs);
0149 DistributionOperator operator - (DistributionOperator lhs, DistributionOperator const& rhs);
0150 DistributionOperator operator * (std::function<double(double const&, double const&)> const& f, DistributionOperator rhs);
0151 DistributionOperator operator * (DistributionOperator lhs, std::function<double(double const&, double const&)> const& f);
0152 DistributionOperator operator * (std::function<double(double const&)> const& f, DistributionOperator rhs);
0153 DistributionOperator operator * (DistributionOperator lhs, std::function<double(double const&)> const& f);
0154
0155
0156
0157
0158
0159 std::ostream& operator << (std::ostream& os, DistributionOperator const& in);
0160 }
0161