atlas::Field class

A Field contains an Array, Metadata, and a reference to a FunctionSpace.

The Field is a key component of Atlas. It contains an array::Array object and a util::Metadata object. Furthermore it contains a link to a FunctionSpace object.

A Field should typically be created via the FunctionSpace::createField() method, which ensures that the Field is completely setup.

A field can be implicitly converted to an Array reference, so that it can be passed to routines that expect an Array. This is especially useful to create an ArrayView:

Field field = functionspace.createField<double>( ... );
auto view = array::make_view<double,2>( field );

Constructors, destructors, conversion operators

Field() defaulted
Field(const eckit::Parametrisation&)
Create field from parametrisation.
Field(const std::string& name, array::DataType, const array::ArrayShape& = array::ArrayShape())
Create field with given name, Datatype and ArrayShape.
Field(const std::string& name, array::DataType, array::ArraySpec&&)
Create field with given name, Datatype and ArraySpec.
Field(const std::string& name, array::Array*)
Create field with given name, and take ownership of given Array.
template<typename DATATYPE>
Field(const std::string& name, DATATYPE* data, const array::ArraySpec&)
Create field by wrapping existing data, Datatype of template and ArraySpec.
template<typename DATATYPE>
Field(const std::string& name, DATATYPE* data, const array::ArrayShape&)
Create field by wrapping existing data, Datatype of template and ArrayShape.
operator const array::Array&() const
Implicit conversion to Array.
operator array::Array&()

Public functions

auto clone(const eckit::Parametrisation& = util::Config()) const -> Field
Deep copy.
auto array() const -> const array::Array&
Access contained Array.
auto array() -> array::Array&
auto valid() const -> bool
auto storage() -> void*
Access to raw data.
auto datatype() const -> array::DataType
Internal data type of field.
auto name() const -> const std::string&
Name associated to this field.
void rename(const std::string& name)
Rename this field.
auto metadata() const -> const util::Metadata&
Access to metadata associated to this field.
auto metadata() -> util::Metadata&
void resize(const array::ArrayShape& shape)
Resize field to given shape.
void insert(idx_t idx1, idx_t size1)
auto shapef() const -> const std::vector<int>&
Shape of this field in Fortran style (reverse order of C style)
auto stridesf() const -> const std::vector<int>&
Strides of this field in Fortran style (reverse order of C style)
auto shape() const -> const array::ArrayShape&
Shape of this field (reverse order of Fortran style)
auto strides() const -> const array::ArrayStrides&
Strides of this field.
auto shape(idx_t i) const -> idx_t
Shape of this field associated to index 'i'.
auto stride(idx_t i) const -> idx_t
Stride of this field associated to index 'i'.
auto size() const -> size_t
Number of values stored in this field.
auto rank() const -> idx_t
Rank of field.
auto bytes() const -> size_t
Number of bytes occupied by the values of this field.
auto contiguous() const -> bool
void dump(std::ostream& os) const
Output information of field plus raw data.
void set_levels(idx_t n)
Metadata that is more intrinsic to the Field, and queried often.
auto levels() const -> idx_t
void set_variables(idx_t n)
Metadata that is more intrinsic to the Field, and queried often.
auto variables() const -> idx_t
void set_horizontal_dimension(const std::vector<idx_t>&)
auto horizontal_dimension() const -> std::vector<idx_t>
void set_functionspace(const FunctionSpace& functionspace)
auto functionspace() const -> const FunctionSpace&
auto footprint() const -> size_t
Return the memory footprint of the Field.
auto dirty() const -> bool
void set_dirty(bool = true) const
void haloExchange(bool on_device = false) const
void adjointHaloExchange(bool on_device = false) const
void updateHost() const
void updateDevice() const
void syncHostDevice() const
auto hostNeedsUpdate() const -> bool
auto deviceNeedsUpdate() const -> bool
void setHostNeedsUpdate(bool) const
void setDeviceNeedsUpdate(bool) const
auto deviceAllocated() const -> bool
void allocateDevice()
void deallocateDevice()
void reactivateDeviceWriteViews() const
void reactivateHostWriteViews() const

Friends

auto operator<<(std::ostream& os, const Field& v) -> std::ostream&
Output information of field.
This website is beyond its original expiry date and the content may be out of date. The site owner has been notified and may choose to extend the expiry date and remove this banner. If you have any questions about this, please visit our support portal.