| 1 |
/* |
| 2 |
* (C) Copyright 2013 ECMWF. |
| 3 |
* |
| 4 |
* This software is licensed under the terms of the Apache Licence Version 2.0 |
| 5 |
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
| 6 |
* In applying this licence, ECMWF does not waive the privileges and immunities |
| 7 |
* granted to it by virtue of its status as an intergovernmental organisation |
| 8 |
* nor does it submit to any jurisdiction. |
| 9 |
*/ |
| 10 |
|
| 11 |
#include "atlas/grid/Spacing.h" |
| 12 |
#include "atlas/grid/detail/spacing/GaussianSpacing.h" |
| 13 |
#include "atlas/grid/detail/spacing/LinearSpacing.h" |
| 14 |
#include "atlas/grid/detail/spacing/Spacing.h" |
| 15 |
#include "atlas/util/Config.h" |
| 16 |
|
| 17 |
namespace atlas { |
| 18 |
namespace grid { |
| 19 |
|
| 20 |
Spacing::Spacing(const eckit::Parametrisation& p): Handle(atlas::grid::spacing::Spacing::create(p)) {} |
| 21 |
|
| 22 |
size_t Spacing::size() const { |
| 23 |
return get()->size(); |
| 24 |
} |
| 25 |
|
| 26 |
double Spacing::operator[](size_t i) const { |
| 27 |
return get()->operator[](i); |
| 28 |
} |
| 29 |
|
| 30 |
Spacing::const_iterator Spacing::begin() const { |
| 31 |
return get()->begin(); |
| 32 |
} |
| 33 |
|
| 34 |
Spacing::const_iterator Spacing::end() const { |
| 35 |
return get()->end(); |
| 36 |
} |
| 37 |
|
| 38 |
double Spacing::front() const { |
| 39 |
return get()->front(); |
| 40 |
} |
| 41 |
|
| 42 |
double Spacing::back() const { |
| 43 |
return get()->back(); |
| 44 |
} |
| 45 |
|
| 46 |
Spacing::Interval Spacing::interval() const { |
| 47 |
return get()->interval(); |
| 48 |
} |
| 49 |
|
| 50 |
double Spacing::min() const { |
| 51 |
return get()->min(); |
| 52 |
} |
| 53 |
|
| 54 |
double Spacing::max() const { |
| 55 |
return get()->max(); |
| 56 |
} |
| 57 |
|
| 58 |
std::string Spacing::type() const { |
| 59 |
return get()->type(); |
| 60 |
} |
| 61 |
|
| 62 |
Spacing::Spec Spacing::spec() const { |
| 63 |
return get()->spec(); |
| 64 |
} |
| 65 |
|
| 66 |
LinearSpacing::LinearSpacing(double start, double stop, long N, bool endpoint): |
| 67 |
Spacing(new atlas::grid::spacing::LinearSpacing(start, stop, N, endpoint)) {} |
| 68 |
|
| 69 |
LinearSpacing::LinearSpacing(const Interval& interval, long N, bool endpoint): |
| 70 |
Spacing(new atlas::grid::spacing::LinearSpacing(interval, N, endpoint)) {} |
| 71 |
|
| 72 |
double LinearSpacing::step() const { |
| 73 |
return dynamic_cast<const spacing::LinearSpacing*>(get())->step(); |
| 74 |
} |
| 75 |
|
| 76 |
GaussianSpacing::GaussianSpacing(long N): Spacing(new atlas::grid::spacing::GaussianSpacing(N)) {} |
| 77 |
|
| 78 |
} // namespace grid |
| 79 |
} // namespace atlas |