PLaSK library
Loading...
Searching...
No Matches
axis1d.hpp
Go to the documentation of this file.
1/*
2 * This file is part of PLaSK (https://plask.app) by Photonics Group at TUL
3 * Copyright (c) 2022 Lodz University of Technology
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14#ifndef PLASK__AXIS1D_H
15#define PLASK__AXIS1D_H
16
17#include "mesh.hpp"
18#include "interpolation.hpp"
19
20#include <memory>
21
22namespace plask {
23
27class PLASK_API MeshAxis: public MeshD<1> {
28
29public:
30
37 virtual shared_ptr<MeshAxis> clone() const;
38
46 virtual std::size_t findIndex(double to_find) const;
47
54 virtual std::size_t findUpIndex(double to_find) const;
55
61 virtual std::size_t findNearestIndex(double to_find) const;
62
69 virtual shared_ptr<MeshAxis> getMidpointAxis() const;
70
74 virtual bool isIncreasing() const = 0;
75
76protected:
78 void beforeCalcMidpointMesh() const;
79};
80
89
105PLASK_API void prepareInterpolationForAxis(const MeshAxis& axis, const InterpolationFlags& flags, double wrapped_point_coord, int axis_nr, std::size_t& index_lo, std::size_t& index_hi, double& lo, double& hi, bool& invert_lo, bool& invert_hi);
106
107
108
113
114 double value;
115
120 OnePointAxis(double val): value(val) {}
121
122 std::size_t size() const override { return 1; }
123
124 double at(std::size_t) const override { return value; }
125
126 bool isIncreasing() const override { return true; }
127};
128
129
130} // namespace plask
131
132#endif // PLASK__AXIS1D_H