lsst.astshim  14.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
ChebyMap.h
1 /*
2  * LSST Data Management System
3  * Copyright 2017 AURA/LSST.
4  *
5  * This product includes software developed by the
6  * LSST Project (http://www.lsst.org/).
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the LSST License Statement and
19  * the GNU General Public License along with this program. If not,
20  * see <https://www.lsstcorp.org/LegalNotices/>.
21  */
22 #ifndef ASTSHIM_CHEBYMAP_H
23 #define ASTSHIM_CHEBYMAP_H
24 
25 #include <algorithm>
26 #include <memory>
27 #include <vector>
28 
29 #include "astshim/base.h"
30 #include "astshim/Mapping.h"
31 
32 namespace ast {
33 
37 class ChebyDomain {
38 public:
45  ChebyDomain(std::vector<double> const &lbnd, std::vector<double> const &ubnd) : lbnd(lbnd), ubnd(ubnd) {}
46  std::vector<double> const lbnd;
47  std::vector<double> const ubnd;
48 };
49 
97 class ChebyMap : public Mapping {
98  friend class Object;
99 
100 public:
164  explicit ChebyMap(ndarray::Array<double, 2, 2> const &coeff_f,
165  ndarray::Array<double, 2, 2> const &coeff_i, std::vector<double> const &lbnd_f,
166  std::vector<double> const &ubnd_f, std::vector<double> const &lbnd_i,
167  std::vector<double> const &ubnd_i, std::string const &options = "")
168  : Mapping(reinterpret_cast<AstMapping *>(
169  _makeRawChebyMap(coeff_f, coeff_i, lbnd_f, ubnd_f, lbnd_i, ubnd_i, options))) {}
170 
187  explicit ChebyMap(ndarray::Array<double, 2, 2> const &coeff_f, int nout,
188  std::vector<double> const &lbnd_f, std::vector<double> const &ubnd_f,
189  std::string const &options = "IterInverse=0")
190  : Mapping(reinterpret_cast<AstMapping *>(
191  _makeRawChebyMap(coeff_f, nout, lbnd_f, ubnd_f, options))) {}
192 
193  virtual ~ChebyMap() {}
194 
195  ChebyMap(ChebyMap const &) = delete;
196  ChebyMap(ChebyMap &&) = default;
197  ChebyMap &operator=(ChebyMap const &) = delete;
198  ChebyMap &operator=(ChebyMap &&) = default;
199 
201  std::shared_ptr<ChebyMap> copy() const { return std::static_pointer_cast<ChebyMap>(copyPolymorphic()); }
202 
217  ChebyDomain getDomain(bool forward) const;
218 
300  ChebyMap polyTran(bool forward, double acc, double maxacc, int maxorder, std::vector<double> const &lbnd,
301  std::vector<double> const &ubnd) const;
302 
307  ChebyMap polyTran(bool forward, double acc, double maxacc, int maxorder) const;
308 
309 protected:
310  virtual std::shared_ptr<Object> copyPolymorphic() const override {
311  return copyImpl<ChebyMap, AstChebyMap>();
312  }
313 
315  ChebyMap(AstChebyMap *map);
316 
317 private:
319  AstChebyMap *_makeRawChebyMap(ndarray::Array<double, 2, 2> const &coeff_f,
320  ndarray::Array<double, 2, 2> const &coeff_i,
321  std::vector<double> const &lbnd_f, std::vector<double> const &ubnd_f,
322  std::vector<double> const &lbnd_i, std::vector<double> const &ubnd_i,
323  std::string const &options = "") const;
324 
326  AstChebyMap *_makeRawChebyMap(ndarray::Array<double, 2, 2> const &coeff_f, int nout,
327  std::vector<double> const &lbnd_f, std::vector<double> const &ubnd_f,
328  std::string const &options = "") const;
329 };
330 
331 } // namespace ast
332 
333 #endif
ChebyMap(ndarray::Array< double, 2, 2 > const &coeff_f, ndarray::Array< double, 2, 2 > const &coeff_i, std::vector< double > const &lbnd_f, std::vector< double > const &ubnd_f, std::vector< double > const &lbnd_i, std::vector< double > const &ubnd_i, std::string const &options="")
Definition: ChebyMap.h:164
std::vector< double > const ubnd
upper bound of domain (one element per axis)
Definition: ChebyMap.h:47
Definition: ChebyMap.h:37
Definition: Mapping.h:59
ChebyDomain(std::vector< double > const &lbnd, std::vector< double > const &ubnd)
Definition: ChebyMap.h:45
ChebyMap polyTran(bool forward, double acc, double maxacc, int maxorder, std::vector< double > const &lbnd, std::vector< double > const &ubnd) const
Definition: ChebyMap.cc:30
virtual std::shared_ptr< Object > copyPolymorphic() const override
Definition: ChebyMap.h:310
std::shared_ptr< ChebyMap > copy() const
Return a deep copy of this object.
Definition: ChebyMap.h:201
ChebyMap(ndarray::Array< double, 2, 2 > const &coeff_f, int nout, std::vector< double > const &lbnd_f, std::vector< double > const &ubnd_f, std::string const &options="IterInverse=0")
Definition: ChebyMap.h:187
Definition: ChebyMap.h:97
ChebyDomain getDomain(bool forward) const
Definition: ChebyMap.cc:57
std::vector< double > const lbnd
lower bound of domain (one element per axis)
Definition: ChebyMap.h:46
Definition: Object.h:49