1.4 KiB
1.4 KiB
Lab 3: Stencil-Based Grid Subdivision
How to Build
Windows
Use Visual Studio (Developer Command Prompt) to compile the code.
.\make.bat
Note:
clis only available in the Developer Command Prompt, change the path ofVsDevCmd.batinmake.batfirst.
Linux / macOS — GCC via Makefile
make
This compiles all targets including subdivide_grid.
How to Run
Windows
subdivide_grid.exe {num_iter} {input_file}
Linux / macOS
./subdivide_grid {num_iter} {input_file}
{num_iter}: integer number of subdivision iterations (>= 0){input_file}: a.grid2Dfile
The output file is written to the same directory as the input, with the suffix
-subdiv.grid2D appended (replacing the .grid2D extension).
Optional -off flag
./subdivide_grid -off {num_iter} {input_file}
With -off, the program additionally writes a Geomview .off file named
{basename}-subdiv.off.
Examples
./subdivide_grid 1 "Lab3 simple grids/grid2D-2x3-A.grid2D"
./subdivide_grid 3 "Lab3 grids/wave-A.grid2D"
./subdivide_grid -off 3 "Lab3 grids/sphere-A.grid2D"
Visualization
Convert a .grid2D file to Geomview .off format:
./grid2off {input.grid2D}
AI Tools Used
GitHub Copilot (via VS Code) was used for:
- Auto generating
Makefileand thisREADME.md.