Skip to content

Reply To: How to add 2d vtk files as geometrical models

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics How to add 2d vtk files as geometrical models Reply To: How to add 2d vtk files as geometrical models

#8947
jan
Participant

Dear Bobbie,

if your 2D structure can be converted to a VTI, then you can use an approach such as this, which uses the IndicatorBlockData2D:


    std::shared_ptr<BlockVTIreader3D<T, T>> vtiReader(
        new BlockVTIreader3D<T, T>(vtiFile, "Elevation"));
    vtiReader->printInfo();
    auto           cuboidSample     = vtiReader->getCuboid();
    T              deltaRsample     = cuboidSample.getDeltaR() * sourceScale;
    Vector<int, 3> extentSample     = cuboidSample.getExtent();
    Vector<T, 3>   originSamplePhys = cuboidSample.getOrigin() * sourceScale;
    Vector<T, 3>   extentSamplePhys = {deltaRsample * T(extentSample[0] + 0.5),
                                       deltaRsample * T(extentSample[1] + 0.5),
                                       deltaRsample * T(extentSample[2] + 0.5)};
    std::shared_ptr<IndicatorBlockData2D<T>> ind(
        new IndicatorBlockData2D<T>(vtiReader->getBlockData(), extentSamplePhys,
                                    originSamplePhys, deltaRsample, false));

Best regards,
Jan