| 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 |
#pragma once |
| 12 |
|
| 13 |
#include <string> |
| 14 |
|
| 15 |
#include "atlas/library/config.h" |
| 16 |
#include "atlas/util/ObjectHandle.h" |
| 17 |
|
| 18 |
namespace eckit { |
| 19 |
class Configuration; |
| 20 |
} |
| 21 |
|
| 22 |
namespace atlas { |
| 23 |
class Field; |
| 24 |
class FieldSet; |
| 25 |
class Grid; |
| 26 |
class Projection; |
| 27 |
namespace functionspace { |
| 28 |
class FunctionSpaceImpl; |
| 29 |
class HaloDescription; |
| 30 |
} |
| 31 |
namespace parallel { |
| 32 |
class GatherScatter; |
| 33 |
} // namespace parallel |
| 34 |
|
| 35 |
namespace util { |
| 36 |
class PartitionPolygon; |
| 37 |
class PartitionPolygons; |
| 38 |
} // namespace util |
| 39 |
} // namespace atlas |
| 40 |
|
| 41 |
namespace atlas { |
| 42 |
|
| 43 |
//------------------------------------------------------------------------------------------------------ |
| 44 |
|
| 45 |
class FunctionSpace : DOXYGEN_HIDE(public util::ObjectHandle<functionspace::FunctionSpaceImpl>) { |
| 46 |
public: |
| 47 |
using Handle::Handle; |
| 48 |
FunctionSpace(); |
| 49 |
|
| 50 |
std::string type() const; |
| 51 |
operator bool() const; |
| 52 |
size_t footprint() const; |
| 53 |
std::string distribution() const; |
| 54 |
|
| 55 |
Field createField(const eckit::Configuration&) const; |
| 56 |
|
| 57 |
Field createField(const Field&) const; |
| 58 |
Field createField(const Field&, const eckit::Configuration&) const; |
| 59 |
|
| 60 |
template <typename DATATYPE> |
| 61 |
Field createField(const eckit::Configuration&) const; |
| 62 |
|
| 63 |
template <typename DATATYPE> |
| 64 |
Field createField() const; |
| 65 |
|
| 66 |
void haloExchange(const FieldSet&, bool on_device = false) const; |
| 67 |
void haloExchange(const Field&, bool on_device = false) const; |
| 68 |
|
| 69 |
void adjointHaloExchange(const FieldSet&, bool on_device = false) const; |
| 70 |
void adjointHaloExchange(const Field&, bool on_device = false) const; |
| 71 |
|
| 72 |
void gather(const FieldSet&, FieldSet&) const; |
| 73 |
void gather(const Field&, Field&) const; |
| 74 |
|
| 75 |
void scatter(const FieldSet&, FieldSet&) const; |
| 76 |
void scatter(const Field&, Field&) const; |
| 77 |
|
| 78 |
const util::PartitionPolygon& polygon(idx_t halo = 0) const; |
| 79 |
|
| 80 |
const util::PartitionPolygons& polygons() const; |
| 81 |
|
| 82 |
const Projection& projection() const; |
| 83 |
|
| 84 |
idx_t part() const; |
| 85 |
|
| 86 |
idx_t nb_parts() const; |
| 87 |
|
| 88 |
idx_t size() const; |
| 89 |
|
| 90 |
const Grid& grid() const; |
| 91 |
|
| 92 |
Field lonlat() const; |
| 93 |
|
| 94 |
Field ghost() const; |
| 95 |
|
| 96 |
Field global_index() const; |
| 97 |
|
| 98 |
Field remote_index() const; |
| 99 |
|
| 100 |
Field partition() const; |
| 101 |
|
| 102 |
const functionspace::HaloDescription& halo_description() const; |
| 103 |
|
| 104 |
const parallel::GatherScatter& gather() const; |
| 105 |
const parallel::GatherScatter& scatter() const; |
| 106 |
|
| 107 |
std::string mpi_comm() const; |
| 108 |
}; |
| 109 |
|
| 110 |
//------------------------------------------------------------------------------------------------------ |
| 111 |
|
| 112 |
extern template Field FunctionSpace::createField<float>() const; |
| 113 |
extern template Field FunctionSpace::createField<double>() const; |
| 114 |
extern template Field FunctionSpace::createField<int>() const; |
| 115 |
extern template Field FunctionSpace::createField<long>() const; |
| 116 |
extern template Field FunctionSpace::createField<float>(const eckit::Configuration&) const; |
| 117 |
extern template Field FunctionSpace::createField<double>(const eckit::Configuration&) const; |
| 118 |
extern template Field FunctionSpace::createField<int>(const eckit::Configuration&) const; |
| 119 |
extern template Field FunctionSpace::createField<long>(const eckit::Configuration&) const; |
| 120 |
|
| 121 |
//------------------------------------------------------------------------------------------------------ |
| 122 |
|
| 123 |
} // namespace atlas |