.. _program_listing_file_src_pcms_field_field_data.h: Program Listing for File field_data.h ===================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/pcms/field/field_data.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef PCMS_FIELD_DATA_H #define PCMS_FIELD_DATA_H #include "pcms/field/value_view.hpp" #include "pcms/utility/arrays.h" #include "pcms/utility/memory_spaces.h" #include #include namespace pcms { // DOFAccess is the optional capability of field data whose values PCMS can // read and write directly: the values of the DOF holders this rank owns, shaped // [owned DOF holder][component] in the layout's order. Coupler exchanges and // transfer targets use it; evaluation never needs it. template class DOFAccess { public: // Valid until the field data is next written or destroyed. virtual Rank2View GetOwnedValues() const = 0; // Writes the owned values, then brings any other copies the backend keeps // (ghosts, replicas on other ranks) up to date. Collective over the ranks // that share those copies. virtual void SetOwnedValues(Rank2View values) = 0; virtual ~DOFAccess() noexcept = default; }; // FieldData holds whatever a backend needs to represent a field. It is // opaque. It should only be directly used by the type that created it. template class FieldData { public: using value_type = T; virtual FieldValueType GetValueType() const = 0; virtual const ValueBasis& GetValueBasis() const = 0; virtual const DOFAccess* GetDOFAccess() const noexcept { return nullptr; } virtual DOFAccess* GetDOFAccess() noexcept { return nullptr; } virtual ~FieldData() noexcept = default; }; using FieldDataVariant = std::variant< std::unique_ptr>, std::unique_ptr>, std::unique_ptr>, std::unique_ptr>, std::unique_ptr>>; } // namespace pcms #endif // PCMS_FIELD_DATA_H