You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
990 B

#include <spdlog/spdlog.h>
#include "Util.h"
int main() {
using namespace da::sha::top;
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::string txt_path = ASSETS_DIR "/voxel_model/Lshape_model.txt";
WriteTensor3d(txt_path, L_shape_grid);
spdlog::info("Write user defined grid to file: {}", txt_path);
// vtk
std::string vtk_path = ASSETS_DIR "/voxel_model/Lshape_model.vtk";
WriteTensorToVtk(vtk_path, L_shape_grid);
spdlog::info("Visualize user defined grid to file: {}", vtk_path);
}