@@ -6,7 +6,7 @@ Omega includes a Field class that registers available fields and associated
66metadata for use in IO (or any other part of Omega that may require the field
77metadata). The module owning the field will define the Field together
88with some required metadata for compliance with the Climate and Forecast
9- [ (CF) metadata conventios .] ( http://cfconventions.org/ ) . Groups of Fields
9+ [ (CF) metadata conventions .] ( http://cfconventions.org/ ) . Groups of Fields
1010can also be defined to provide a short cut to groups that are commonly used
1111together, like the model state and tracer groups. Two special Fields, CodeMeta
1212and SimMeta (with default names "code" and "simulation", respectively), are
@@ -20,7 +20,7 @@ To use the Field class, the Field header file must be included and as part of
2020the application initialization, there should be a call to the init method:
2121Fields initialized with the init method:
2222``` c++
23- int Err = Field::init();
23+ Field::init ();
2424```
2525which primarily defines the CodeMeta and SimMeta fields for later use.
2626For array fields, the appropriate Dimensions must be defined. The default
@@ -79,15 +79,14 @@ purpose.
7979
8080Additional metadata in the form of a name-value pair can be added using:
8181``` c++
82- int Err = MyField->addMetadata (
83- MetaName, // [in] Name of new metadata (string)
84- Value // [in] Value of new metadata
82+ MyField->addMetadata (MetaName, // [ in] Name of new metadata (string)
83+ Value // [ in] Value of new metadata
8584 );
8685```
8786where Value can be any supported data type (I4, I8, R4, R8, bool, string).
8887Multiple pairs can be added in a single call using:
8988``` c++
90- Err = SimField->addMetadata(
89+ SimField->addMetadata(
9190 {std::make_pair("Name1", Val1),
9291 std::make_pair("Name2", Val2),
9392 std::make_pair("Name3", Val3),
@@ -100,16 +99,16 @@ As mentioned above, the actual data array is attached in a separate call
10099using a templated form. If the pointer to the Field is available, use the
101100member function:
102101``` c++
103- int Err = MyField->attachData<ArrayType>(InDataArray);
102+ MyField->attachData<ArrayType>(InDataArray);
104103 // for example:
105- int Err = MyField->attachData<HostArray1DI4>(CellID);
106- int Err = MyField->attachData<Array2DR8>(NormalVelocity);
104+ MyField->attachData<HostArray1DI4>(CellID);
105+ MyField->attachData<Array2DR8>(NormalVelocity);
107106```
108107where ArrayType is one of the supported array types (Array1DI4, etc. or
109108HostArray1DI4, etc.). If the Field pointer has not been retrieved, an interface
110109is provided using the field name:
111110``` c++
112- int Err = Field::attachFieldData<ArrayType>(
111+ Field::attachFieldData<ArrayType>(
113112 FieldName, // [in] Name of Field (string)
114113 InDataArray // [in] Array with data to attach
115114 );
@@ -170,7 +169,7 @@ The dimension information can be retrieved using:
170169``` c++
171170 int NDims = MyField->getNumDims ();
172171 std::vector<std::string> MyDimNames (NDims);
173- int Err = MyField->getDimNames(MyDimNames);
172+ MyField->getDimNames(MyDimNames);
174173```
175174Once the dimension names have been retrieved, the Dimension class API can be
176175used to extract further dimension information. Two other field quantities
@@ -191,13 +190,13 @@ functions. To retrieve a pointer to the full Field, use:
191190With this pointer all the member functions above can be used.
192191The Metadata associated with a field can be retrieved individually using:
193192``` c++
194- int Err = MyField->getMetadata (MetadataName, MetaValue);
193+ Error Err = MyField->getMetadata (MetadataName, MetaValue);
195194```
196195where the MetaValue can be a scalar of any supported data type (I4, I8, R4, R8,
197196bool, std::string). If the value of a metadata entry needs to be changed,
198197an update function is provided:
199198```c++
200- int Err = MyField->updateMetadata(MetadataName, NewMetaValue);
199+ MyField->updateMetadata(MetadataName, NewMetaValue);
201200```
202201The existence of a metadata entry can be determined with:
203202``` c++
@@ -229,13 +228,13 @@ location as described previously.
229228
230229Metadata can be removed from a Field using:
231230``` c++
232- int Err = MyField->removeMetadata (MetaName);
231+ MyField->removeMetadata (MetaName);
233232 MyField->removeAllMetadata();
234233```
235234depending on whether a single metadata entry or all metadata entries need to
236235be deleted. Entire fields can be removed using:
237236```c++
238- int Err = Field::destroy(FieldName);
237+ Field::destroy(FieldName);
239238```
240239and before exiting, all fields should be removed using:
241240``` c++
@@ -253,8 +252,8 @@ is created by first creating an empty group with the desired name:
253252Fields can then be added either through a member function if the group
254253pointer is available, or by group name:
255254``` c++
256- int Err = MyGroup->addField (FieldName);
257- int Err = FieldGroup::addFieldToGroup(FieldName, GroupName);
255+ MyGroup->addField (FieldName);
256+ FieldGroup::addFieldToGroup(FieldName, GroupName);
258257```
259258The latter is useful especially if the group was created elsewhere. If the
260259field has already been added to the group, no additional entries are created.
@@ -289,15 +288,15 @@ The FieldGroup pointer can also be retrieved:
289288
290289A field can be removed from a field group using:
291290``` c++
292- int Err = FieldGroup:: removeField(FieldName);
291+ MyGroup-> removeField (FieldName);
293292 // or
294- int Err = removeFieldFromGroup(FieldName, GroupName);
293+ FieldGroup:: removeFieldFromGroup(FieldName, GroupName);
295294```
296295The removal of a field from a group does not remove the field itself, it only
297296removes the field name from the list of fields assigned to the group.
298297The entire group can be removed with:
299298```c++
300- int Err = FieldGroup::destroy(GroupName);
299+ FieldGroup::destroy(GroupName);
301300```
302301and the usual `` FieldGroup::clear(); `` should be used to remove all field
303302groups before exiting.
0 commit comments