61 unsigned int shear_direction,
unsigned int shear_plane_normal,
63 std::function<
double()>
get_shift = []() {
return 0.0; })
66 m_shear_direction(
uint_c(shear_direction)),
67 m_shear_plane_normal(
uint_c(shear_plane_normal)),
70 if (m_n_ghost_layers != 1u) {
71 throw std::domain_error(
"The Lees-Edwards sweep is implemented "
72 "for a ghost layer of thickness 1");
74 if (m_shear_plane_normal == 0
u) {
75 m_slab_min = stencil::W;
76 m_slab_max = stencil::E;
77 }
else if (m_shear_plane_normal == 1u) {
78 m_slab_min = stencil::S;
79 m_slab_max = stencil::N;
80 }
else if (m_shear_plane_normal == 2u) {
81 m_slab_min = stencil::B;
82 m_slab_max = stencil::T;
93 kernel(
block, m_slab_min);
94 kernel(
block, m_slab_max);
100 assert(m_blocks->getNumberOfCells(*
block, m_shear_plane_normal) >= 2u);
101 auto const dir = m_shear_direction;
116 auto const prefactor =
117 ((
slab_dir == m_slab_max) ? FloatType{-1} : FloatType{1});
118 auto const offset =
static_cast<FloatType
>(
get_pos_offset()) * prefactor;
123 for (
auto const &&cell :
ci) {
133 for (
uint_t q = 0
u; q < FieldType::F_SIZE; ++q) {
137 tmp_field->get(cell, m_shear_direction) -= prefactor * shift;
141 for (
auto const &&cell :
ci) {
142 for (
uint_t f = 0; f < FieldType::F_SIZE; ++f) {
143 field->get(cell, f) =
tmp_field->get(cell, f);
148 FloatType modulo(FloatType a, FloatType b)
const {
149 auto const res = std::fmod(a, b);
150 return (
res < FloatType{0}) ?
res + b :
res;
154 std::shared_ptr<StructuredBlockForest> m_blocks;
159 uint_t m_shear_plane_normal;
160 std::function<
double()> m_get_pos_offset;
161 std::function<
double()> m_get_shift;
162 stencil::Direction m_slab_min;
163 stencil::Direction m_slab_max;
InterpolateAndShiftAtBoundary(std::shared_ptr< StructuredBlockForest > blocks, BlockDataID field_id, BlockDataID tmp_field_id, unsigned int n_ghost_layers, unsigned int shear_direction, unsigned int shear_plane_normal, std::function< double()> get_pos_offset, std::function< double()> get_shift=[]() { return 0.0;})