Skip to content

Reply To: Modifying field values for neighboring cells inside a postprocessor

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics Modifying field values for neighboring cells inside a postprocessor Reply To: Modifying field values for neighboring cells inside a postprocessor

#9051
Danial.Khazaeipoul
Participant

Dear Adrian,

Would you please explain why the two following implementations behave differently? In the first implementation, although seed is only a copy of cell, the “TEST_ID” field is modified correctly.

template <typename CELL, typename T>
void test(CELL& cell)
{
auto seed = cell;
seed.template setField<FreeSurface::TEST_ID>(1);
}

On the other hand, the below implementation, although compiles and runs with no issue, but the “TEST_ID” field remains unchanged. I have also tried different methods to be able to store these cell objects in a standard container, e.g., copying, raw pointers, smart pointers, etc, with no luck.

template <typename CELL, typename T>
void test(CELL& cell)
{
std::queue<CELL> queued_;
queued_.push(cell);
auto iCell = queued_.front();
iCell.template setField<FreeSurface::TEST_ID>(1);
}

Best,
Danial