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