32template<
typename T,
typename DESCRIPTOR>
38template<
typename T,
typename DESCRIPTOR>
42template<
typename T,
typename DESCRIPTOR, Platform PLATFORM>
44 :
BlockD<T,DESCRIPTOR>(size, padding, PLATFORM),
45 _data(this->getNcells()),
48 DESCRIPTOR::fields_t::for_each([&](
auto id) {
49 using field =
typename decltype(id)::type;
51 _descriptorFields.template set<field>(&fieldArray);
54 DESCRIPTOR::template size<field>()>
59template<
typename T,
typename DESCRIPTOR, Platform PLATFORM>
63 _data.resize(this->getNcells());
66template<
typename T,
typename DESCRIPTOR, Platform PLATFORM>
67template<
typename FIELD_TYPE>
70 return _data.template provides<FIELD_TYPE>();
73template<
typename T,
typename DESCRIPTOR, Platform PLATFORM>
74template<
typename FIELD_TYPE>
77 OLB_ASSERT(_data.template provides<FIELD_TYPE>(),
78 "FIELD_TYPE must be allocated to be accessed");
79 return _data.template get<FIELD_TYPE>();
82template<
typename T,
typename DESCRIPTOR, Platform PLATFORM>
83template<
typename FIELD_TYPE>
86 if (_data.template provides<FIELD_TYPE>()) {
87 return _data.template get<FIELD_TYPE>();
90 auto& data = _data.template allocate<FIELD_TYPE>(this->getNcells());
92 using concrete_data_t =
typename FIELD_TYPE::template type<T,DESCRIPTOR,PLATFORM>;
93 if constexpr (std::is_base_of_v<ColumnVectorBase,concrete_data_t>) {
94 using field_t =
typename concrete_data_t::field_t;
95 if constexpr (field_t::isSerializable()) {
96 _data.template setSerialization<FIELD_TYPE>(
true);
100 DESCRIPTOR::template size<field_t>()>
105 __builtin_unreachable();
108template<
typename T,
typename DESCRIPTOR, Platform PLATFORM>
109template<
typename FIELD>
112 if constexpr (DESCRIPTOR::fields_t::template contains<FIELD>()) {
115 return getData<Array<FIELD>>();
117 __builtin_unreachable();
120template<
typename T,
typename DESCRIPTOR, Platform PLATFORM>
121template<
typename FIELD>
124 if constexpr (DESCRIPTOR::fields_t::template contains<FIELD>()) {
127 return getData<Array<FIELD>>();
129 __builtin_unreachable();
132template<
typename T,
typename DESCRIPTOR, Platform PLATFORM>
135 return _data.getNblock();
138template<
typename T,
typename DESCRIPTOR, Platform PLATFORM>
141 return _data.getSerializableSize();
144template<
typename T,
typename DESCRIPTOR, Platform PLATFORM>
147 std::size_t currentBlock = 0;
148 bool* dataPtr =
nullptr;
149 this->registerSerializableOfConstSize(iBlock, sizeBlock, currentBlock, dataPtr, _data, loadingMode);
153template<
typename T,
typename DESCRIPTOR, Platform PLATFORM>
156 if constexpr (DESCRIPTOR::template provides<descriptors::POPULATION>()) {
157 auto& population = getField<descriptors::POPULATION>();
158 for (
unsigned iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
159 population[iPop].postLoad();
BlockD(Vector< int, DESCRIPTOR::d > size, int padding, Platform platform)
BlockLatticeRowView< T, DESCRIPTOR > get(std::size_t iCell)
const auto & getData() const
void resize(Vector< int, DESCRIPTOR::d > size) override
ConcreteBlockD(Vector< int, DESCRIPTOR::d > size, int padding=0)
void postLoad() override
Reinit population structure after deserialization.
bool * getBlock(std::size_t iBlock, std::size_t &sizeBlock, bool loadingMode) override
Return a pointer to the memory of the current block and its size for the serializable interface.
std::size_t getSerializableSize() const override
Binary size for the serializer.
std::size_t getNblock() const override
Number of data blocks for the serializable interface.
const auto & getField(FIELD field=FIELD()) const
SoA storage for instances of a single FIELD.
Top level namespace for all of OpenLB.
Platform
OpenLB execution targets.
#define OLB_ASSERT(COND, MESSAGE)
Specializable declarator for concrete implementations of abstract storage types.