| 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/UnstructuredGrid.h" |
| 12 |
|
| 13 |
#include <limits> |
| 14 |
#include <string> |
| 15 |
#include <vector> |
| 16 |
|
| 17 |
#include "eckit/config/Parametrisation.h" |
| 18 |
|
| 19 |
#include "atlas/domain/Domain.h" |
| 20 |
#include "atlas/grid/Spacing.h" |
| 21 |
#include "atlas/projection/Projection.h" |
| 22 |
#include "atlas/util/Config.h" |
| 23 |
|
| 24 |
namespace atlas { |
| 25 |
|
| 26 |
inline const UnstructuredGrid::grid_t* unstructured_grid(const Grid::Implementation* grid) { |
| 27 |
return dynamic_cast<const UnstructuredGrid::grid_t*>(grid); |
| 28 |
} |
| 29 |
|
| 30 |
UnstructuredGrid::UnstructuredGrid(): Grid() {} |
| 31 |
|
| 32 |
UnstructuredGrid::UnstructuredGrid(const Grid& grid): Grid(grid), grid_(unstructured_grid(get())) {} |
| 33 |
|
| 34 |
UnstructuredGrid::UnstructuredGrid(const Grid::Implementation* grid): Grid(grid), grid_(unstructured_grid(get())) {} |
| 35 |
|
| 36 |
UnstructuredGrid::UnstructuredGrid(const Config& grid): Grid(grid), grid_(unstructured_grid(get())) {} |
| 37 |
|
| 38 |
UnstructuredGrid::UnstructuredGrid(std::vector<PointXY>* xy): |
| 39 |
Grid(new UnstructuredGrid::grid_t(xy)), grid_(unstructured_grid(get())) {} |
| 40 |
|
| 41 |
UnstructuredGrid::UnstructuredGrid(std::vector<PointXY>&& xy): |
| 42 |
Grid(new UnstructuredGrid::grid_t(std::forward<std::vector<PointXY>>(xy))), grid_(unstructured_grid(get())) {} |
| 43 |
|
| 44 |
UnstructuredGrid::UnstructuredGrid(const std::vector<PointXY>& xy): |
| 45 |
Grid(new UnstructuredGrid::grid_t(std::forward<const std::vector<PointXY>>(xy))), grid_(unstructured_grid(get())) {} |
| 46 |
|
| 47 |
UnstructuredGrid::UnstructuredGrid(std::initializer_list<PointXY> xy): |
| 48 |
Grid(new UnstructuredGrid::grid_t(xy)), grid_(unstructured_grid(get())) {} |
| 49 |
|
| 50 |
UnstructuredGrid::UnstructuredGrid(const Grid& grid, const Grid::Domain& domain): |
| 51 |
Grid(new UnstructuredGrid::grid_t(*grid.get(), domain)), grid_(unstructured_grid(get())) {} |
| 52 |
|
| 53 |
|
| 54 |
} // namespace atlas |