atlas
Public Member Functions | Friends | List of all members
atlas::Field Class Reference

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

#include <Field.h>

Inheritance diagram for atlas::Field:
Inheritance graph
[legend]
Collaboration diagram for atlas::Field:
Collaboration graph
[legend]

Public Member Functions

 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 & ()
 
const array::Arrayarray () const
 Access contained Array.
 
array::Arrayarray ()
 
bool valid () const
 
void * storage ()
 Access to raw data.
 
array::DataType datatype () const
 Internal data type of field.
 
const std::string & name () const
 Name associated to this field.
 
void rename (const std::string &name)
 Rename this field.
 
const util::Metadatametadata () const
 Access to metadata associated to this field.
 
util::Metadatametadata ()
 
void resize (const array::ArrayShape &shape)
 Resize field to given shape.
 
void insert (idx_t idx1, idx_t size1)
 
const std::vector< int > & shapef () const
 Shape of this field in Fortran style (reverse order of C style)
 
const std::vector< int > & stridesf () const
 Strides of this field in Fortran style (reverse order of C style)
 
const array::ArrayShapeshape () const
 Shape of this field (reverse order of Fortran style)
 
const array::ArrayStridesstrides () const
 Strides of this field.
 
idx_t shape (idx_t i) const
 Shape of this field associated to index 'i'.
 
idx_t stride (idx_t i) const
 Stride of this field associated to index 'i'.
 
size_t size () const
 Number of values stored in this field.
 
idx_t rank () const
 Rank of field.
 
size_t bytes () const
 Number of bytes occupied by the values of this field.
 
bool contiguous () const
 
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.
 
idx_t levels () const
 
void set_variables (idx_t n)
 Metadata that is more intrinsic to the Field, and queried often.
 
idx_t variables () const
 
void set_functionspace (const FunctionSpace &functionspace)
 
const FunctionSpacefunctionspace () const
 
size_t footprint () const
 Return the memory footprint of the Field.
 
bool dirty () const
 
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
 
bool hostNeedsUpdate () const
 
bool deviceNeedsUpdate () const
 
void reactivateDeviceWriteViews () const
 
void reactivateHostWriteViews () const
 

Friends

std::ostream & operator<< (std::ostream &os, const Field &v)
 Output information of field.
 

Detailed Description

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 );

The documentation for this class was generated from the following files: