.. _program_listing_file_src_pcms_field_data_simple.h: Program Listing for File simple.h ================================= |exhale_lsh| :ref:`Return to documentation for file ` (``src/pcms/field/data/simple.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef PCMS_SIMPLE_FIELD_DATA_H #define PCMS_SIMPLE_FIELD_DATA_H #include "../field_data.h" #include "../field_layout.h" #include "pcms/utility/arrays.h" #include "pcms/utility/assert.h" #include "pcms/utility/memory_spaces.h" #include #include #include namespace pcms { // SimpleFieldData is a generic concrete FieldData backed by shaped // [dof_holder][component] Kokkos Views. // // Ownership of the layout is shared — the layout is typically held by the // factory that created this field data object. template class SimpleFieldData : public FieldData , public DOFAccess { public: SimpleFieldData(std::shared_ptr layout, ValueBasis basis) : layout_(std::move(layout)), basis_(std::move(basis)), device_data_("simple_field_data_device", static_cast(layout_->GetNumOwnedDofHolder()), static_cast(layout_->GetNumComponents())) { } FieldValueType GetValueType() const override { return ValueTypeOfRank(basis_.Rank()); } const ValueBasis& GetValueBasis() const override { return basis_; } const DOFAccess* GetDOFAccess() const noexcept override { return this; } DOFAccess* GetDOFAccess() noexcept override { return this; } Rank2View GetOwnedValues() const override { return MakeConstRank2View(device_data_); } void SetOwnedValues(Rank2View values) override { CopyDeviceRank2ViewToDeviceView(device_data_, values); } private: std::shared_ptr layout_; ValueBasis basis_; Kokkos::View device_data_; }; } // namespace pcms #endif // PCMS_SIMPLE_FIELD_DATA_H