From 512b9800e47bb8806001de4ece9e649c17d29359 Mon Sep 17 00:00:00 2001 From: Lorenzo Milazzo Date: Thu, 20 Apr 2023 13:40:32 +0100 Subject: [PATCH 1/2] added procedure to include metadata in FieldSet --- src/atlas/field/FieldSet.cc | 10 +++++++++- src/atlas/field/FieldSet.h | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/atlas/field/FieldSet.cc b/src/atlas/field/FieldSet.cc index 49a6ba3be..d410bf6de 100644 --- a/src/atlas/field/FieldSet.cc +++ b/src/atlas/field/FieldSet.cc @@ -1,5 +1,5 @@ /* - * (C) Copyright 2013 ECMWF. + * (C) Copyright 2013-2023 ECMWF. * * This software is licensed under the terms of the Apache Licence Version 2.0 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. @@ -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); } diff --git a/src/atlas/field/FieldSet.h b/src/atlas/field/FieldSet.h index 46f804a1c..e07602153 100644 --- a/src/atlas/field/FieldSet.h +++ b/src/atlas/field/FieldSet.h @@ -1,5 +1,5 @@ /* - * (C) Copyright 2013 ECMWF. + * (C) Copyright 2013-2023 ECMWF. * * This software is licensed under the terms of the Apache Licence Version 2.0 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. @@ -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" @@ -112,6 +113,9 @@ 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; @@ -119,6 +123,7 @@ class FieldSetImpl : public util::Object { protected: // data std::vector fields_; ///< field storage std::string name_; ///< internal name + util::Metadata metadata_; ///< metadata associated with the FieldSet std::map index_; ///< name-to-index map, to refer fields by name }; @@ -209,6 +214,9 @@ class FieldSet : DOXYGEN_HIDE(public util::ObjectHandle) { 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; From 7faf49caef9694b11e23059c130a7eae9638e40f Mon Sep 17 00:00:00 2001 From: Lorenzo Milazzo Date: Fri, 21 Apr 2023 15:21:47 +0100 Subject: [PATCH 2/2] update 21.04.23-01 --- src/atlas/field/FieldSet.cc | 2 +- src/atlas/field/FieldSet.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/atlas/field/FieldSet.cc b/src/atlas/field/FieldSet.cc index d410bf6de..bf8eda526 100644 --- a/src/atlas/field/FieldSet.cc +++ b/src/atlas/field/FieldSet.cc @@ -1,5 +1,5 @@ /* - * (C) Copyright 2013-2023 ECMWF. + * (C) Copyright 2013 ECMWF. * * This software is licensed under the terms of the Apache Licence Version 2.0 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. diff --git a/src/atlas/field/FieldSet.h b/src/atlas/field/FieldSet.h index e07602153..a4c2d998c 100644 --- a/src/atlas/field/FieldSet.h +++ b/src/atlas/field/FieldSet.h @@ -1,5 +1,5 @@ /* - * (C) Copyright 2013-2023 ECMWF. + * (C) Copyright 2013 ECMWF. * * This software is licensed under the terms of the Apache Licence Version 2.0 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.