**********
Field Data
**********

Fides normally uses ``vtkm::cont::Field`` for storing variables that are read from ADIOS, however, the association of data in a ``vtkm::cont::Field`` must be set to points or cells.
Since we may have some situations where Fides needs to keep track of fields that do not have either association, we've added a ``fides::datamodel::FieldData`` class to handle this situation.
For example, XGC requires reading some fields that do not have the same dimensions as the fields that are associated with points in the planes, but these fields may be needed to compute other quantities such as turbulence.
``fides::datamodel::FieldData`` objects that are very loosely based on ``vtkm::cont::Field`` and this should only be used for data that does not have a point or cell association, because it does not become part of the ``vtkm::cont::DataSet`` that Fides creates.

When specifying fields in the data model JSON, the association should be set to ``field_data``.
When reading, Fides will save that data into a ``std::vector<vtkm::cont::VariantArrayHandle>``,
where each VariantArrayHandle is a block of the data read from ADIOS2.

For example, in the field declaration for the XGC data model, the JSON would look like the following:

.. code-block:: json

    {
        "fields": [
            {
                "name": "psi",
                "association": "field_data",
                "array": {
                    "array_type": "basic",
                    "data_source": "mesh",
                    "variable": "psi"
                }
            }
        ]
    }

Fides stores each ``FieldData`` object in the ``fides::datamodel::FieldDataManager`` with the name of the field (stored in a ``std::unordered_map``).
Applications using Fides can then either ask for an individual field by its name, or ask for a reference to the full map of fields (the latter is used by VTK Fides reader for example).

.. code-block:: c++

    auto fieldDataManager = reader.GetFieldData();
    if (fieldDataManager->HasField("psi"))
    {
      const auto& psi = fieldDataManager->GetField("psi").GetData();
      // Do something with psi field
    }
