#include #include "Util.h" int main() { using namespace da::sha::top; std::string ex_name = "Lshape"; std::filesystem::path out_dir(OUTPUT_DIR); std::filesystem::path assets_dir(ASSETS_DIR); int len_x = 2; int len_y = 30; int len_z = 20; // NOTE: USER DEFINE GRID HERE //e.g. L-shape mesh Tensor3d L_shape_grid(len_x, len_y, len_z); L_shape_grid.setConstant(1); // set the initial voxel model for (int k = 0; k < len_z; ++k) { for (int j = 0; j < len_y; ++j) { for (int i = 0; i < len_x; ++i) { if (j >= len_y * 0.5 & k >= len_z * 0.5) { L_shape_grid(i, j, k) = 0; } } } } std::filesystem::path txt_path = assets_dir / "voxel_model" / (ex_name + "_model.txt"); WriteTensor3d(txt_path, L_shape_grid); spdlog::info("Write user defined grid to file: {}", txt_path.string()); // vtk std::filesystem::path vtk_path = assets_dir / "voxel_model" / (ex_name + "_model.vtk"); WriteTensorToVtk(vtk_path, L_shape_grid); spdlog::info("Visualize user defined grid to file: {}", vtk_path.string()); }