| 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 |
|
| 12 |
#include "atlas/functionspace/FunctionSpace.h" |
| 13 |
#include "atlas/field/Field.h" |
| 14 |
#include "atlas/grid.h" |
| 15 |
#include "atlas/functionspace/detail/FunctionSpaceImpl.h" |
| 16 |
|
| 17 |
namespace atlas { |
| 18 |
|
| 19 |
FunctionSpace::FunctionSpace(): Handle(new functionspace::NoFunctionSpace()) {} |
| 20 |
|
| 21 |
|
| 22 |
std::string FunctionSpace::type() const { |
| 23 |
return get()->type(); |
| 24 |
} |
| 25 |
|
| 26 |
FunctionSpace::operator bool() const { |
| 27 |
return get()->operator bool(); |
| 28 |
} |
| 29 |
|
| 30 |
size_t FunctionSpace::footprint() const { |
| 31 |
return get()->footprint(); |
| 32 |
} |
| 33 |
|
| 34 |
const Grid& FunctionSpace::grid() const { |
| 35 |
return get()->grid(); |
| 36 |
} |
| 37 |
|
| 38 |
Field FunctionSpace::createField(const eckit::Configuration& config) const { |
| 39 |
return get()->createField(config); |
| 40 |
} |
| 41 |
|
| 42 |
Field FunctionSpace::createField(const Field& other) const { |
| 43 |
return get()->createField(other); |
| 44 |
} |
| 45 |
|
| 46 |
Field FunctionSpace::createField(const Field& other, const eckit::Configuration& config) const { |
| 47 |
return get()->createField(other, config); |
| 48 |
} |
| 49 |
|
| 50 |
std::string FunctionSpace::distribution() const { |
| 51 |
return get()->distribution(); |
| 52 |
} |
| 53 |
|
| 54 |
void FunctionSpace::haloExchange(const Field& field, bool on_device) const { |
| 55 |
get()->haloExchange(field, on_device); |
| 56 |
} |
| 57 |
|
| 58 |
void FunctionSpace::adjointHaloExchange(const Field& field, bool on_device) const { |
| 59 |
get()->adjointHaloExchange(field, on_device); |
| 60 |
} |
| 61 |
|
| 62 |
idx_t FunctionSpace::size() const { |
| 63 |
return get()->size(); |
| 64 |
} |
| 65 |
|
| 66 |
idx_t FunctionSpace::part() const { |
| 67 |
return get()->part(); |
| 68 |
} |
| 69 |
|
| 70 |
idx_t FunctionSpace::nb_parts() const { |
| 71 |
return get()->nb_parts(); |
| 72 |
} |
| 73 |
|
| 74 |
Field FunctionSpace::lonlat() const { |
| 75 |
return get()->lonlat(); |
| 76 |
} |
| 77 |
|
| 78 |
Field FunctionSpace::ghost() const { |
| 79 |
return get()->ghost(); |
| 80 |
} |
| 81 |
|
| 82 |
Field FunctionSpace::global_index() const { |
| 83 |
return get()->global_index(); |
| 84 |
} |
| 85 |
|
| 86 |
Field FunctionSpace::remote_index() const { |
| 87 |
return get()->remote_index(); |
| 88 |
} |
| 89 |
|
| 90 |
Field FunctionSpace::partition() const { |
| 91 |
return get()->partition(); |
| 92 |
} |
| 93 |
|
| 94 |
void FunctionSpace::haloExchange(const FieldSet& fields, bool on_device) const { |
| 95 |
get()->haloExchange(fields, on_device); |
| 96 |
} |
| 97 |
|
| 98 |
void FunctionSpace::adjointHaloExchange(const FieldSet& fields, bool on_device) const { |
| 99 |
get()->adjointHaloExchange(fields, on_device); |
| 100 |
} |
| 101 |
|
| 102 |
void FunctionSpace::gather(const FieldSet& local, FieldSet& global) const { |
| 103 |
get()->gather(local, global); |
| 104 |
} |
| 105 |
|
| 106 |
void FunctionSpace::gather(const Field& local, Field& global) const { |
| 107 |
get()->gather(local, global); |
| 108 |
} |
| 109 |
|
| 110 |
void FunctionSpace::scatter(const FieldSet& global, FieldSet& local) const { |
| 111 |
get()->scatter(global, local); |
| 112 |
} |
| 113 |
|
| 114 |
void FunctionSpace::scatter(const Field& global, Field& local) const { |
| 115 |
get()->scatter(global, local); |
| 116 |
} |
| 117 |
|
| 118 |
const parallel::GatherScatter& FunctionSpace::gather() const { |
| 119 |
return get()->gather(); |
| 120 |
} |
| 121 |
|
| 122 |
const parallel::GatherScatter& FunctionSpace::scatter() const { |
| 123 |
return get()->scatter(); |
| 124 |
} |
| 125 |
|
| 126 |
std::string FunctionSpace::mpi_comm() const { |
| 127 |
return get()->mpi_comm(); |
| 128 |
} |
| 129 |
|
| 130 |
const util::PartitionPolygon& FunctionSpace::polygon(idx_t halo) const { |
| 131 |
return get()->polygon(halo); |
| 132 |
} |
| 133 |
|
| 134 |
const util::PartitionPolygons& FunctionSpace::polygons() const { |
| 135 |
return get()->polygons(); |
| 136 |
} |
| 137 |
|
| 138 |
const Projection& FunctionSpace::projection() const { |
| 139 |
return get()->projection(); |
| 140 |
} |
| 141 |
|
| 142 |
const functionspace::HaloDescription& FunctionSpace::halo_description() const { |
| 143 |
return get()->halo_description(); |
| 144 |
} |
| 145 |
|
| 146 |
|
| 147 |
template <typename DATATYPE> |
| 148 |
Field FunctionSpace::createField() const { |
| 149 |
return get()->createField<DATATYPE>(); |
| 150 |
} |
| 151 |
|
| 152 |
template <typename DATATYPE> |
| 153 |
Field FunctionSpace::createField(const eckit::Configuration& options) const { |
| 154 |
return get()->createField<DATATYPE>(options); |
| 155 |
} |
| 156 |
|
| 157 |
template Field FunctionSpace::createField<double>() const; |
| 158 |
template Field FunctionSpace::createField<float>() const; |
| 159 |
template Field FunctionSpace::createField<int>() const; |
| 160 |
template Field FunctionSpace::createField<long>() const; |
| 161 |
|
| 162 |
template Field FunctionSpace::createField<double>(const eckit::Configuration&) const; |
| 163 |
template Field FunctionSpace::createField<float>(const eckit::Configuration&) const; |
| 164 |
template Field FunctionSpace::createField<int>(const eckit::Configuration&) const; |
| 165 |
template Field FunctionSpace::createField<long>(const eckit::Configuration&) const; |
| 166 |
|
| 167 |
|
| 168 |
// ------------------------------------------------------------------ |
| 169 |
|
| 170 |
} // namespace atlas |