diff --git a/src/debug/debug_print.h b/src/debug/debug_print.h index 74bd5561..e6cfc2c8 100644 --- a/src/debug/debug_print.h +++ b/src/debug/debug_print.h @@ -22,9 +22,15 @@ #define INFO(msg) SpdWrapper::get()->info(msg); #define INFO_FMT(msg, ...) SpdWrapper::get()->info(msg, __VA_ARGS__); -// TODO: move or rename +/** + * @brief Info prints any vector of type T and length 3 + * @tparam T any type that's in vector (double and int here) + * @param msg The message in front of the vector, or the debug information + * @param vec the vector to be printed + */ template -inline void InfoVec(std::string msg, std::array vec) { +void InfoVec(std::string msg, std::array vec) { INFO_FMT("{} -- [{},{},{}]", msg, vec[0], vec[1], vec[2]); } + #endif // DEBUG_H diff --git a/src/defs/Generators/MembraneGenerator.h b/src/defs/Generators/MembraneGenerator.h index 8287ae6f..948573ce 100644 --- a/src/defs/Generators/MembraneGenerator.h +++ b/src/defs/Generators/MembraneGenerator.h @@ -45,7 +45,8 @@ class MembraneGenerator final : public ParticleGenerator { * @param mv temperature of our system * @param type type of the particle in the system * @param two_d dimension of velocity vector of brownian motion - * @param indices Grid coordinates TODO + * @param indices Grid coordinates, so the dimension of the cuboids (not + * spatial) */ MembraneGenerator(const dvec3 &corner, const std::array &dimensions, double h, double m, diff --git a/src/defs/Generators/SpheroidGenerator.h b/src/defs/Generators/SpheroidGenerator.h index b27a5676..a8613067 100644 --- a/src/defs/Generators/SpheroidGenerator.h +++ b/src/defs/Generators/SpheroidGenerator.h @@ -42,7 +42,7 @@ class SpheroidGenerator final : public ParticleGenerator { */ const int type_; /** - * TODO + * Mean velocity for brownian motion */ double mv_; /** @@ -61,7 +61,7 @@ class SpheroidGenerator final : public ParticleGenerator { * @param epsilon epsilon of generated particles * @param sigma sigma of generated particles * @param type type of generated particles - * @param mv TODO of generated particles + * @param mv brownian mean velocity * @param two_d whether generator is 2D or 3D */ SpheroidGenerator(const dvec3 &origin, int radius, double h, double m, diff --git a/src/defs/Particle.h b/src/defs/Particle.h index 21de67a7..84f13823 100644 --- a/src/defs/Particle.h +++ b/src/defs/Particle.h @@ -176,7 +176,9 @@ class Particle final { [[nodiscard]] std::string toString() const; /** - * TODO + * @brief Copy assignment operator for the Particle class. + * @param other The Particle instance to copy from + * @return a reference to the current particle */ Particle &operator=(const Particle &other) { if (this != &other) { @@ -195,7 +197,10 @@ class Particle final { } /** - * TODO + * @brief Move assignment operator for Particle. Transfers the ownership of + * the neighbours vector + * + * @param other The Particle instance to move from */ Particle &operator=(Particle &&other) noexcept { if (this != &other) { diff --git a/src/defs/Simulation.h b/src/defs/Simulation.h index 021e1610..29c3f1fa 100644 --- a/src/defs/Simulation.h +++ b/src/defs/Simulation.h @@ -183,7 +183,7 @@ struct ThermostatConfig { */ struct StatisticsConfig { /** - * TODO ? + * Inicates whether to write statistics to a file */ bool calc_stats{}; /** @@ -195,70 +195,28 @@ struct StatisticsConfig { */ int y_bins{}; /** - * TODO ? + * Periodicity of outputting to files */ int output_interval{}; /** - * TODO ? + * Path to the csv containing the velocity information */ std::string velocity_output_location{}; /** - * TODO ? + * Path to the csv containing the density information */ std::string density_output_location{}; }; -//TODO: delete? -struct SphereoidGeneratorConfig { - dvec3 origin{}; - const int radius{}; - double h{}; - double m{}; - const dvec3 initial_velocity{}; - double epsilon{}; - double sigma{}; - const int type{}; - double mv{}; - const bool two_d{}; - SphereoidGeneratorConfig() = default; -}; - -//TODO: delete? -struct CuboidGeneratorConfig { - dvec3 corner{}; - ivec3 dimensions{}; - double h{}; - double m{}; - const dvec3 initial_velocity{}; - double mv{}; - double epsilon{}; - double sigma{}; - const int type{}; - const bool two_d{}; - CuboidGeneratorConfig() = default; -}; - -//TODO: delete? -struct MembraneGeneratorConfig { - dvec3 corner{}; - ivec3 dimensions{}; - double h{}; - double m{}; - const dvec3 initial_velocity{}; - double mv{}; - double epsilon{}; - double sigma{}; - const int type{}; - const bool two_d{}; - std::vector ids{}; - std::vector indeces{}; -}; - /** - * @brief struct to hold command line arguments + * @brief Supertype for all Singular Forces */ using SingularForceTypes = std::variant; + +/** + * @brief Supertype for all Interactive Forces + */ using InteractiveForceTypes = std::variant; @@ -303,13 +261,6 @@ struct Arguments { */ StatisticsConfig statistics_config; - //TODO - SphereoidGeneratorConfig spheroid_generator_config; - //TODO - CuboidGeneratorConfig cuboid_generator_config; - //TODO - MembraneGeneratorConfig membrane_generator_config; - /** * Parallelization strategy */ diff --git a/src/defs/containers/DirectSumContainer.h b/src/defs/containers/DirectSumContainer.h index d2816d9c..e938b566 100644 --- a/src/defs/containers/DirectSumContainer.h +++ b/src/defs/containers/DirectSumContainer.h @@ -119,9 +119,9 @@ class DirectSumContainer final : public ParticleContainer { double getKineticEnergy() override; /** - * TODO: this is giga redundant because size exists * @brief Get particle count * @return particle in the container + * @note this is technically unnecessary as its just size */ size_t getParticleCount() override { return particles_.size(); } diff --git a/src/defs/containers/LinkedCellsContainer.cpp b/src/defs/containers/LinkedCellsContainer.cpp index e6f5c7c3..a335ac0c 100644 --- a/src/defs/containers/LinkedCellsContainer.cpp +++ b/src/defs/containers/LinkedCellsContainer.cpp @@ -246,7 +246,6 @@ void LinkedCellsContainer::singleIterator( } } -// TODO: this is now unused => could be removed, are we allowed to? I guess void LinkedCellsContainer::pairIterator( const std::function &f) { // - as x, y, z are all increasing offsets point to all neighbours in @@ -724,7 +723,7 @@ void LinkedCellsContainer::applyPeriodicBoundary(const size_t dimension) { // the right place const std::size_t problematic_dimension = dimension / 2; const std::size_t problematic_dimension_direction = dimension % 2; - // TODO #pragma omp parallel for schedule(static) + for (const std::size_t cell_index : halo_direction_cells_[dimension]) { int counter = 0; for (auto it = cells_[cell_index].begin(); it < cells_[cell_index].end(); @@ -737,10 +736,8 @@ void LinkedCellsContainer::applyPeriodicBoundary(const size_t dimension) { const std::size_t should_be_index = dvec3ToCellIndex(new_pos); (*it)->setX(new_pos); - // TODO #pragma omp critical cells_[should_be_index].push_back(*it); } - // TODO #pragma omp critical { cells_[cell_index].clear(); cells_[cell_index].shrink_to_fit(); @@ -753,7 +750,6 @@ void LinkedCellsContainer::applyPeriodicBoundary(const size_t dimension) { } // iterate over all 9 / 3 cells on the other end - // TODO #pragma omp parallel for schedule(static) for (const std::size_t cell_index : boundary_direction_cells_[dimension]) { ivec3 cell_coordinates = cellIndexToCoord(cell_index); @@ -795,10 +791,8 @@ void LinkedCellsContainer::applyPeriodicBoundary(const size_t dimension) { const dvec3 applied_force = LennardJones::directionalForceWithOffset( *p, *q, accounted_particle_distance); - // TODO #pragma omp critical p->addF(applied_force); - // TODO #pragma omp critical q->subF(applied_force); } } diff --git a/src/defs/containers/LinkedCellsContainer.h b/src/defs/containers/LinkedCellsContainer.h index b3677fcd..ed111cda 100644 --- a/src/defs/containers/LinkedCellsContainer.h +++ b/src/defs/containers/LinkedCellsContainer.h @@ -35,7 +35,7 @@ class LinkedCellsContainer final : public ParticleContainer { std::vector> cells_; /** - * TODO + * saves the index that we have to locate in particles, so e.g. left or top */ std::vector> c18_colours_; @@ -523,7 +523,6 @@ class LinkedCellsContainer final : public ParticleContainer { */ void initializeC18Schema() { for (auto start_offset : c_18_schema_) { - std::vector iterators; for (int cx = start_offset[0]; cx <= cell_count_[0]; cx += 2) { for (int cy = start_offset[1]; cy <= cell_count_[1]; cy += 3) { @@ -541,7 +540,6 @@ class LinkedCellsContainer final : public ParticleContainer { } }; - /** * @brief directions for better readability; implicitly cast */ diff --git a/src/io/file/in/xml/XmlReader.h b/src/io/file/in/xml/XmlReader.h index 41c97bd8..d61cf8be 100644 --- a/src/io/file/in/xml/XmlReader.h +++ b/src/io/file/in/xml/XmlReader.h @@ -38,17 +38,18 @@ class XmlReader { /** * @brief Reads a xml checkpoint file as specified in * MolSim/src/io/file/out/checkpoint-schema.xsd - * @param filepath path pointing to checkpoint // TODO default location + * @param filepath path pointing to checkpoint * @param particles particles to which the checkpoint is read */ static void loadCheckpoint(const std::string& filepath, std::vector& particles); /** - * @brief TODO - * @param filepath TODO - * @param dimensions TODO - * @param particles TODO + * @brief Reads a checkpoint file + * @param filepath path pointing to checkpoint containing membrane + * @param dimensions the dimensions of the original membrane cuboid / membrane + * generator + * @param particles particles to which the checkpoint is read */ static void loadCheckpointMembrane(const std::string& filepath, const ivec3& dimensions, @@ -58,7 +59,7 @@ class XmlReader { /** * @brief validates that the number of bins are correct and not smaller than 1 * and the output time is larger than 0 - * @param stats TODO + * @param stats Statistics config to validate */ inline void validateStatisticsInput(const StatisticsConfig& stats) { if (stats.x_bins < 1 || stats.y_bins < 1) { @@ -83,8 +84,8 @@ inline void validateStatisticsInput(const StatisticsConfig& stats) { * @param type the type of file you are checking (Input, checkpoint, etc) */ inline void validatePath(const std::filesystem::path& path, - const std::string& extension, - const std::string& type) { + const std::string& extension, + const std::string& type) { if (!exists(path)) { throw std::runtime_error(type + " file not found: " + path.string()); } diff --git a/src/utils/ArrayUtils.h b/src/utils/ArrayUtils.h index c3e32d9b..af7532bd 100644 --- a/src/utils/ArrayUtils.h +++ b/src/utils/ArrayUtils.h @@ -185,7 +185,12 @@ auto L2InnerProduct(const Container &c) { [](auto a, auto b) { return a + b * b; }); } -// TODO +/** + * @brief returns the signs of the vectors + * @tparam Container + * @param c + * @return vector of length of c containing the sings of the elements + */ template auto getSigns(const Container &c) { std::vector signs; diff --git a/src/utils/Statistics.h b/src/utils/Statistics.h index 0b0ca128..03192af7 100644 --- a/src/utils/Statistics.h +++ b/src/utils/Statistics.h @@ -25,11 +25,11 @@ class Statistics { public: /** * @brief Initialize Statistics object - * @param x_bins TODO - * @param y_bins TODO - * @param container TODO - * @param density_profile_output_location TODO - * @param velocity_profile_output_location TODO + * @param x_bins amount of x_bins + * @param y_bins amount of y_bins + * @param container holds the particles + * @param density_profile_output_location path to density csv + * @param velocity_profile_output_location path to velocity csv */ Statistics(const int x_bins, const int y_bins, ParticleContainer& container, const std::string& density_profile_output_location, @@ -50,7 +50,7 @@ class Statistics { * The bins can also be along the y axis at the same time for a checkerboard * pattern. The bins are from left to right (x-axis), and for the lines from * down to up (y-axis) - * @param time TODO + * @param time current time for indexing */ void writeStatistics(const double time) { std::vector> bins(x_bins_ * y_bins_);