materials: Review memory management
Currently, we have
QCMesh load_mesh(const char *filename) {
const auto input = default_userinput(filename);
load_input(input);
legacy::load_mpi_globals();
auto mesh = QCMesh{};
const auto materials =
std::vector<Material<DIM> *>{new ExtendedFinnisSinclairCopper<DIM>};
in src/test/testutils/mesh_impl.h
This is for almost sure a memory leak.
Idea:
Change std::vector<Material*>
to std::vector<Material>
and move the remaining virtual function(s) together with all material specific variables to virtual subclasses of ClusterModel
.
Material
will get a std::unique_ptr<ClusterModel>
as a member.
This way each material will manage its memory by itself.
Edited by brgerhar