Files
cse5543_homework/lab3
2026-04-04 15:10:43 -04:00
..
2026-04-04 15:10:43 -04:00
2026-03-31 10:26:51 -04:00
2026-03-31 10:26:51 -04:00
2026-03-31 10:26:51 -04:00
2026-03-31 10:26:51 -04:00
2026-03-31 10:26:51 -04:00
2026-04-04 15:10:43 -04:00
2026-03-31 10:26:51 -04:00
2026-03-31 10:26:51 -04:00
2026-03-31 10:26:51 -04:00
2026-04-04 15:10:43 -04:00
2026-03-31 10:26:51 -04:00
2026-03-31 10:26:51 -04:00
2026-03-31 10:26:51 -04:00

Lab 3: Stencil-Based Grid Subdivision

How to Build

Windows

Use Visual Studio (Developer Command Prompt) to compile the code.

.\make.bat

Note: cl is only available in the Developer Command Prompt, change the path of VsDevCmd.bat in make.bat first.

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 .grid2D file

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 Makefile and this README.md.