with boundary conditions
and initial conditions of a triangle form:
Compilation of the code can be done with the command
g++ -std=c++17 -O2 wave1d.cpp -o wave1d
or using the make command, which requires this Makefile. On the Teach cluster, this code requires loading the "gcc/9" module.
Running the code should be done with the command
which will run the simulation with the parameters in the file waveparams.txt.
The source code (wave1d.cpp), makefile (Makefile) and parameter file (waveparams.txt) should all be in the same folder.ASSIGNMENT:
Modify this code into a new, modularized version:
- Create as many functions (headers and implementation files, do not forget preprocessor guards) as you find reasonable/necessary (e.g., input,output,parameters,single-step solver, driver, etc. -- you should at least have three modules!)
- Update the Makefile to compile this modular project. Remember to include rules for each module, compilation and optimization flags, a clean rule, etc...
- Use your favourite plotting tool or file comparison tool to check that the results match those from before the modularization.
The original file should become just a 'driver', containing main, that solves the same problem as the original code.
- All source and header files and the makefile for the modularized program.
- The output file generated after running your implemented modular version of the code.
- A brief report, explaining what you did (i.e. what functions and modules you created and why), as well as the logic of the makefile, and how you checked that your code matches the results generated by the original code.
Deadline: January 27, 2022, at 11:59pm.
Late penalty policy: you can submit up to seven days late, but you will get a half point taken off for each day you submitted late. Also note that if you submit the different parts of your work at different times, the last submission date is taken as the submission of the whole.