C++xx
, where xx=11, 14, 17 or 20. .h
cannot be used. For example, <stdio.h>
is not allowed. Makefile
. Makefile
based on the examples shown in class, and execute make
(from the commandline) clean
section. In other words, the comamdn make clean
should remove all executable (.x) and object (.o) files.Your README.md file must be created in Markdown. Make sure you install a Markdown viewer on your computer.
Personally, I use Marked 2 on my Mac (cost \$13). Free versions can be found at Free Markdown Editors. Most of the time, I use hyphens for lists, hash tags (#, ##, ###) for headers, and [text](link)
for links. Basic latex equations should be surrounded by double dollar signs (for equations on its own line): $$α = \frac{\log x}{β}$$ or single dollar signs, i.e., $α=\frac{\log x}{β}$ to get an equations inline.
Code can be included via triple backquotes combined with the required language. Example:
cpp
void main(int argc, char** argv)
{
return 0
}
Repository structure
text
Week_#/Question_#/
README.md
homework.cpp
homework.h
Makefile
images/
additional_files and folders/
Week_03/Question_1/
...
Week_03/Question_2/
...
Week_04/Question_1/
...
where Week_#
is Week01
, Week02
, etc., and Question_#
is Question1
or Question2
.
Class Demonstration: (not the homework)
homework.cpp
. Visualize the temperature as a function of time. Read data from this file
and create a line plot of temperature as a function of time. Question 1:
Makefile
.README.md
file with description of work performed including Vector
class to add operator overloading for the product of a double
and a Vector
and the dot product.
Enhance the Particle class to include both velocity and position, initialize a time vector, and update the particle velocity and position
according to the Euler discretization. Visualize particle trajectory in the $x-y$ plane using a Python program. All class properties must
be private. Create accessors (get/set) as needed. pdf
file. Question 1:
Question 2:
std::shared_ptr
for managing particles' lifetimes, ensuring no memory leaks when particles are removed.Question 1:
DifferentialEquationSolver
and derived classes EulerSolver
and RungeKuttaSolver
for solving ordinary differential equations (ODEs). Use polymorphism to switch between solvers in a simulation.Question 2:
BoundaryCondition
with concrete derived classes representing Dirichlet and Neumann boundary conditions in a CFD simulation. Implement a simulation that applies these boundary conditions to a grid.Question 1:
Matrix<T>
that supports basic matrix operations (addition, subtraction, multiplication). Use the class to perform operations on matrices of double
and float
types.Question 2:
Question 1:
std::vector
to store and manage a dynamic list of particles in a molecular dynamics simulation. Implement functions to add, remove, and iterate over particles, updating their positions.std::vector
, including understanding capacity management and avoiding unnecessary reallocations.Question 2:
std::unordered_map
maps grid points to temperature values. Optimize access to temperature data using the map.std::unordered_map
.Question 1:
std::list
to manage a queue of tasks in a simulation, where each task represents a different time step or process to be executed. Implement functions to enqueue, dequeue, and execute tasks in order.std::list
and to explore the trade-offs compared to other containers like std::deque
.Question 2:
std::tuple
. Implement a function that returns this tuple, and use structured bindings to unpack the values.std::tuple
, ensuring correct usage of structured bindings.Question 1:
Question 2:
Question 1:
Question 2:
Question 1:
Question 2:
Question 1:
Question 2:
std::exception_ptr
, ensuring that the program can recover from runtime errors.A few extra days to account for Thanksgiving.
Question 1:
std::thread
and ensure thread-safe access to shared resources (e.g., random number generators) using std::mutex
.Question 2:
std::atomic
to track the number of completed tasks in a parallel processing environment, ensuring consistent results across threads.Finals begin Dec. 9
Question 1:
std::async
to launch parallel tasks for a large matrix multiplication, ensuring that shared data is protected using std::scoped_lock
.Question 2:
std::chrono
.implement the timing functions and visualize the performance comparison.
Question 1:
static_cast
, dynamic_cast
, const_cast
, and reinterpret_cast
.Question 2:
This structured set of homework problems ensures that students can apply their learning directly to scientific computing tasks while leveraging AI tools to deepen their understanding and solve complex issues effectively.
Previous Page | Course Schedule | Course Content