Reply To: Rotating cuboid not working correctly in 1.8
Due to recent bot attacks we have chanced the sign-up process. If you want to participate in our forum, first register on this website and then send a message via our contact form.
› Forums › on OpenLB › Bug Reports › Rotating cuboid not working correctly in 1.8 › Reply To: Rotating cuboid not working correctly in 1.8
June 22, 2025 at 3:47 pm
#10393
upqdb
Participant
Hello,
When using the IndicatorRotate class, at the moment it is not possible to use the union and intersection operators. This, however can be solved by upcasting the IndicatorRotate to an IndicatorF2D when creating the pointer for the rotated geometry. I have added a comment in the following code.
// ramp
Vector<T, 2> straightCubeExtend(6.43, 1.85);
Vector<T, 2> straightCubeOrigin;
straightCubeOrigin[0] = 2;
Vector<T, 2> tiltedCubeExtend(8.43, 1.27);
Vector<T, 2> tiltedCubeOrigin;
tiltedCubeOrigin[0] = 1;
tiltedCubeOrigin[1] = 0;
Vector<T, 2> lowerCubeExtend(6.43, .71);
Vector<T, 2> lowerCubeOrigin;
lowerCubeOrigin[0] = 2;
std::shared_ptr<IndicatorCuboid2D<T>> straightCube(new IndicatorCuboid2D<T>(straightCubeExtend, straightCubeOrigin));
IndicatorCuboid2D<T> tiltedCube(tiltedCubeExtend, tiltedCubeOrigin);
auto rotX = tiltedCubeOrigin[0] + tiltedCubeExtend[0] / 2.0;
auto rotY = tiltedCubeOrigin[1] + tiltedCubeExtend[1] / 2.0;
Vector<T, 2> rotationPoint(rotX, rotY);
// Use IndicatorF2D as template argument for Pointer, thereby upcasting IndicatorRotate to IndicatorF2D
std::shared_ptr<IndicatorF2D<T>> rotatedCube(new IndicatorRotate<T, 2>(rotationPoint, 0.174533, tiltedCube));
std::shared_ptr<IndicatorCuboid2D<T>> lowerCube(new IndicatorCuboid2D<T>(lowerCubeExtend, lowerCubeOrigin));
// * is intersection + is union
std::shared_ptr<IndicatorF2D<T>> ramp((straightCube * rotatedCube) + lowerCube);
// Set Material Numbers
superGeometry.rename(0, 2, ramp);
superGeometry.getStatistics().print();
This should result in the same geometry that you created in the 1.7 version.
