diff --git a/work/week12/starting_point/README.md b/work/week12/starting_point/README.md index 3c3b16f..33eacfa 100644 --- a/work/week12/starting_point/README.md +++ b/work/week12/starting_point/README.md @@ -1,50 +1,53 @@ # MaterialPoint class -This class is meant to be used as the fundamental entity (i.e. a grid point) to compute the spatio-temporal evolution of heat on a 2D grid. To this effect, the class inherits from the Particle class and defines two additional real number attributes: temperature and heat rate, to be used to solve the heat equation. +This class is meant to be used as the fundamental entity (i.e. a grid point) to compute the spatio-temporal evolution of heat on a 2D grid. To this effect, the class inherits from the Particle class and defines three additional real number attributes: temperature, heat rate, and heat distribution at the space position where the particles is placed, to be used to solve the heat equation. # matrix.hh file -The *matrix.hh* file defines several template classes to work with matrices of any data type. +The *matrix.hh* file defines several 2D template grid classes to work with particles of any type. A particle is supposed to be a point in the grid. ### MatrixIterator This template is an abstract object allowing iteration over Matrix objects. It contains a pointer to a Matrix object as well as a size and an index field referring to the size of the matrix and the current index. It also contains several operators: - the ++ operator handles iteration by just incrementing the index field - the * operator (i.e. accessor) returns the content of the i-th element of the matrix (i.e. at the current index) - the != operator checks for inequality of index fields between the current operator and another operator ### Matrix This template is an abstract data type representing a 2D square (NxN) matrix. Its underlying data container is a 1D std::vector. It also contains several methods and operators: - the size(), rows() and cols() methods all return the size (N) of the matrix, which is the square root of the number of elements in the 1D vector (NxN) - the resize() method resizes the matrix by resizing the underlying data vector - the accessor operator returns, for a pair of indexes (i, j), the element of the 1D vector at the corresponding serialized index (j * N + i) - the /= operator handles element-wise division of the matrix by a scalar - the data() method returns the underlying data vector - the begin() and end() methods return iterator objects that can point to the first and last elements of the matrix, which can then be used in range for loop to iterate over the matrix elements. ### MatrixIndexIterator This template defines a more complex type of abstract operator that inherits from MatrixIterator, but with overwritten accessor element that now returns a 3 elements (i, j, x) tuple, where x is the pointed element, i and j represent the indexes of the element along both matrix dimensions. ### IndexedMatrix This template defines a wrapper around the Matrix template in which the begin and end operators are of type *MatrixIndexIterator*, and can then be used in different types of range for loops. The index() method can be used to convert a "simple" Matrix object into an IndexedMatrix object. Finally, the std::iterator_traits template is used to define the data type used by the MatrixIterator objects when they are then used in other parts of the code. # MaterialPointsFactory This class is meant to be used as the interface through which the user can initialize a collection of MaterialPoint objects and then run a simulation to compute the spatio-temporal evolution of temperature across these points. To this effect, it inherits from the generic ParticlesFactoryInterface and redefines the createParticle and createSimulation methods in the specific context of material points (e.g. making sure that number of points is square at initialization). # fft.hh This file defines an FFT structure that is a wrapper around the FFTW library. In particular, it defines 3 functions to work with signals of complex numbers: - the transform() function to compute the forward FFT of a complex signal - the itransform() function to compute the inverse FFT of a complex signal -- the computeFrequencies() function to compute the sample frequencies of the forward FFT of a complex signal (i.e. the coordinates of the signal in the Fourier space). The Laplacian of these frequencies is then used to sovle the heat equation in the Fourier space. \ No newline at end of file +- the computeFrequencies() function to compute the sample frequencies of the forward FFT of a complex signal (i.e. the coordinates of the signal in the Fourier space). The Laplacian of these frequencies is then used to sovle the heat equation in the Fourier space. + +# Boundary condition to the temperature field +The boudary condition on temperature is implemented in the code by setting the temperature of the material points at the borders equal to the pre-defined value (e.g. zero in this case). In the compute_temeprature Class, after processing the temperature evolution of the particles, we set the temperature of the particles at the borders equal to 0.