blond-org / BLonD-cpp

BLonD implementation in C++
GNU General Public License v3.0
2 stars 3 forks source link

std::arrays and/or std::vectors as an alternative to C arrays #5

Closed kiliakis closed 8 years ago

kiliakis commented 8 years ago

Many of the data members of the classes are C arrays. This is very good: we want to deal with SOAs right from the start. On the other hand these structures have the downside of explicit memory management. C++ offers alternatives, such as the std::vector which have all the benefits of the C arrays but add on top a thick usability layer. I wonder if this is a collection we'd like to use instead of the C arrays.

kiliakis commented 8 years ago

Most of c arrays have been replaced with std::vectors, however the overall performance of the code has been maintained as c arrays are still used inside core functions like kick, drift, histogram etc.