Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/debug/debug_print.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename T>
inline void InfoVec(std::string msg, std::array<T, 3> vec) {
void InfoVec(std::string msg, std::array<T, 3> vec) {
INFO_FMT("{} -- [{},{},{}]", msg, vec[0], vec[1], vec[2]);
}

#endif // DEBUG_H
3 changes: 2 additions & 1 deletion src/defs/Generators/MembraneGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int, 3> &dimensions,
double h, double m,
Expand Down
4 changes: 2 additions & 2 deletions src/defs/Generators/SpheroidGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SpheroidGenerator final : public ParticleGenerator {
*/
const int type_;
/**
* TODO
* Mean velocity for brownian motion
*/
double mv_;
/**
Expand All @@ -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,
Expand Down
9 changes: 7 additions & 2 deletions src/defs/Particle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
67 changes: 9 additions & 58 deletions src/defs/Simulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ struct ThermostatConfig {
*/
struct StatisticsConfig {
/**
* TODO ?
* Inicates whether to write statistics to a file
*/
bool calc_stats{};
/**
Expand All @@ -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<int> ids{};
std::vector<ivec3> indeces{};
};

/**
* @brief struct to hold command line arguments
* @brief Supertype for all Singular Forces
*/
using SingularForceTypes =
std::variant<SingularGravityConfig, HarmonicForceConfig>;

/**
* @brief Supertype for all Interactive Forces
*/
using InteractiveForceTypes = std::variant<LennardJonesConfig, GravityConfig,
TruncatedLennardJonesConfig>;

Expand Down Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion src/defs/containers/DirectSumContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }

Expand Down
8 changes: 1 addition & 7 deletions src/defs/containers/LinkedCellsContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void(Particle &, Particle &)> &f) {
// - as x, y, z are all increasing offsets point to all neighbours in
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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);

Expand Down Expand Up @@ -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);
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/defs/containers/LinkedCellsContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LinkedCellsContainer final : public ParticleContainer {
std::vector<std::vector<Particle*>> cells_;

/**
* TODO
* saves the index that we have to locate in particles, so e.g. left or top
*/
std::vector<std::vector<std::size_t>> c18_colours_;

Expand Down Expand Up @@ -523,7 +523,6 @@ class LinkedCellsContainer final : public ParticleContainer {
*/
void initializeC18Schema() {
for (auto start_offset : c_18_schema_) {

std::vector<std::size_t> 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) {
Expand All @@ -541,7 +540,6 @@ class LinkedCellsContainer final : public ParticleContainer {
}
};


/**
* @brief directions for better readability; implicitly cast
*/
Expand Down
17 changes: 9 additions & 8 deletions src/io/file/in/xml/XmlReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Particle>& 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,
Expand All @@ -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) {
Expand All @@ -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());
}
Expand Down
7 changes: 6 additions & 1 deletion src/utils/ArrayUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <class Container>
auto getSigns(const Container &c) {
std::vector<int> signs;
Expand Down
12 changes: 6 additions & 6 deletions src/utils/Statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<std::vector<Particle*>> bins(x_bins_ * y_bins_);
Expand Down