OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
SplineTimeDependence.h
Go to the documentation of this file.
1//
2// Copyright (c) 2026, Paul Scherrer Institute, Villigen PSI, Switzerland
3// All rights reserved
4//
5// This file is part of OPAL.
6//
7// OPAL is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// You should have received a copy of the GNU General License
13// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
14//
15
16#ifndef ALGORITHMS_SPLINETIMEDEPENDENCE_H_
17#define ALGORITHMS_SPLINETIMEDEPENDENCE_H_
18
19#include <vector>
20
24
25class Inform;
26
38public:
52 size_t splineOrder, const std::vector<double>& times,
53 const std::vector<double>& values);
54
57
59 ~SplineTimeDependence() override = default;
60
68 double getValue(double time) override;
69
75 double getIntegral(double time) override;
76
81 SplineTimeDependence* clone() override;
82
87 Inform& print(Inform& os) const;
88
95 void setSpline(
96 size_t splineOrder, const std::vector<double>& times,
97 const std::vector<double>& values);
98
99 /* Getters for the test case use */
100 [[nodiscard]] const std::vector<double>& getTimes() const { return times_m; }
101 [[nodiscard]] const std::vector<double>& getValues() const { return values_m; }
102 [[nodiscard]] size_t getSplineOrder() const { return splineOrder_m; }
103
104 // Spline order constants
105 static constexpr size_t LinearInterpolation = 1;
106 static constexpr size_t CubicInterpolation = 3;
107
108private:
109 std::unique_ptr<AbstractSpline> spline_m;
110 std::unique_ptr<AbstractSpline::Accelerator> splineAcc_m;
112 std::vector<double> times_m;
113 std::vector<double> values_m;
114};
115
116inline Inform& operator<<(Inform& os, const SplineTimeDependence& p) { return p.print(os); }
117
118#endif
Inform & operator<<(Inform &os, const SplineTimeDependence &p)
void setSpline(size_t splineOrder, const std::vector< double > &times, const std::vector< double > &values)
const std::vector< double > & getTimes() const
Inform & print(Inform &os) const
static constexpr size_t CubicInterpolation
SplineTimeDependence * clone() override
std::vector< double > values_m
std::unique_ptr< AbstractSpline > spline_m
const std::vector< double > & getValues() const
~SplineTimeDependence() override=default
double getValue(double time) override
std::unique_ptr< AbstractSpline::Accelerator > splineAcc_m
double getIntegral(double time) override
std::vector< double > times_m
SplineTimeDependence()=default
static constexpr size_t LinearInterpolation