MessageHeader(Space simSize, GridLayout<DIM2> layout, Space nodeOffset) : simSize(simSize), nodeOffset(nodeOffset) { nodeSize = layout.getDataSpace(); nodePictureSize = layout.getDataSpaceWithoutGuarding(); nodeGuardCells = layout.getGuard(); }
DataSpace<DIM> exchangeTypeToOffset(uint32_t exchange, GridLayout<DIM> &memoryLayout, DataSpace<DIM> guardingCells, uint32_t area) const { DataSpace<DIM> size = memoryLayout.getDataSpace(); DataSpace<DIM> border = memoryLayout.getGuard(); Mask mask(exchange); DataSpace<DIM> tmp_offset; if (DIM >= DIM1) { if (mask.containsExchangeType(RIGHT)) { tmp_offset[0] = size[0] - border[0] - guardingCells[0]; if (area == GUARD) { tmp_offset[0] += guardingCells[0]; } /* std::cout<<"offset="<<tmp_offset[0]<<"border"<<border[0]<<std::endl;*/ } else { tmp_offset[0] = border[0]; if (area == GUARD && mask.containsExchangeType(LEFT)) { tmp_offset[0] -= guardingCells[0]; } } } if (DIM >= DIM2) { if (mask.containsExchangeType(BOTTOM)) { tmp_offset[1] = size[1] - border[1] - guardingCells[1]; if (area == GUARD) { tmp_offset[1] += guardingCells[1]; } } else { tmp_offset[1] = border[1]; if (area == GUARD && mask.containsExchangeType(TOP)) { tmp_offset[1] -= guardingCells[1]; } } } if (DIM == DIM3) { if (mask.containsExchangeType(BACK)) { tmp_offset[2] = size[2] - border[2] - guardingCells[2]; if (area == GUARD) { tmp_offset[2] += guardingCells[2]; } } else /*all other begin from front*/ { tmp_offset[2] = border[2]; if (area == GUARD && mask.containsExchangeType(FRONT)) { tmp_offset[2] -= guardingCells[2]; } } } return tmp_offset; }