Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add procedure to include metadata in FieldSet #126

Merged
merged 2 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/atlas/field/FieldSet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ FieldSet::FieldSet(const Field& field): Handle(new Implementation()) {
get()->add(field);
}

const util::Metadata& FieldSet::metadata() const {
return get()->metadata();
}

util::Metadata& FieldSet::metadata() {
return get()->metadata();
}

void FieldSet::set_dirty(bool value) const {
get()->set_dirty(value);
}
Expand Down
8 changes: 8 additions & 0 deletions src/atlas/field/FieldSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "atlas/field/Field.h"
#include "atlas/library/config.h"
#include "atlas/runtime/Exception.h"
#include "atlas/util/Metadata.h"
#include "atlas/util/Object.h"
#include "atlas/util/ObjectHandle.h"

Expand Down Expand Up @@ -112,13 +113,17 @@ class FieldSetImpl : public util::Object {
const_iterator cbegin() const { return fields_.begin(); }
const_iterator cend() const { return fields_.end(); }

const util::Metadata& metadata() const { return metadata_; }
util::Metadata& metadata() { return metadata_; }

void haloExchange(bool on_device = false) const;
void adjointHaloExchange(bool on_device = false) const;
void set_dirty(bool = true) const;

protected: // data
std::vector<Field> fields_; ///< field storage
std::string name_; ///< internal name
util::Metadata metadata_; ///< metadata associated with the FieldSet
std::map<std::string, idx_t> index_; ///< name-to-index map, to refer fields by name
};

Expand Down Expand Up @@ -209,6 +214,9 @@ class FieldSet : DOXYGEN_HIDE(public util::ObjectHandle<field::FieldSetImpl>) {
const_iterator cbegin() const { return get()->begin(); }
const_iterator cend() const { return get()->end(); }

const util::Metadata& metadata() const;
util::Metadata& metadata();

void haloExchange(bool on_device = false) const { get()->haloExchange(on_device); }
void set_dirty(bool = true) const;

Expand Down
Loading