30 #if !defined WASH_WSER && !defined WASH_WISB && !defined WASH_WEST && !defined WASH_CSTONE && !defined WASH_WONE 31 #error "Please specify an implementation when compiling WASH" 37 #error "Please define -DDIM=d when compiling WASH" 47 #include <unordered_map> 51 #include "particle.hpp" 52 #include "particle_data.hpp" 55 #include "kernels.hpp" 64 #define defineWashForceKernel(kernel_name, particle_name) \ 65 void kernel_name (wash::Particle& particle_name, \ 66 const std::vector<wash::Particle>::const_iterator& begin, \ 67 const std::vector<wash::Particle>::const_iterator& end) 74 #define defineWashVoidKernel(kernel_name) \ 75 void kernel_name (void) 84 #define defineWashUpdateKernel(kernel_name, particle_name) \ 85 void kernel_name (wash::Particle& particle_name) 94 #define defineWashReductionKernel(kernel_name, particle_name) \ 95 double kernel_name (const wash::Particle& particle_name) 104 #define washForEachNeighbour(var_name, body) \ 106 for (auto it = begin; it != end; it++) {\ 107 const auto& var_name = *it;\ 130 void set_bounding_box(
const double min,
const double max,
const bool periodic);
135 void set_bounding_box(
const double xmin,
const double xmax,
const double ymin,
const double ymax,
const double zmin,
136 const double zmax,
const bool x_periodic,
const bool y_periodic,
const bool z_periodic);
158 void add_variable(
const std::string variable,
double init_value = 0.0);
247 void set_variable(
const std::string& variable,
const double value);
283 double eucdist(
const Particle& p,
const Particle& q);
309 void set_io(
const std::string format,
size_t output_nth,
bool timings =
true);
uint64_t get_max_iterations()
Get the max iterations of the simulation.
Definition: wash.cpp:42
void add_reduction_kernel(const MapFuncT map_func, const ReduceOp reduce_op, double *variable)
Add a reduction kernel to the simulation which will loop over the particles.
Definition: wash.cpp:116
void add_void_kernel(const VoidFuncT func)
Add a void kernel to the simulation.
Definition: wash.cpp:121
void start()
Get the vector of all particles in the simulation.
Definition: wash.cpp:255
void set_particle_count(const size_t count)
Set the number of particles to be used in the simulation.
Definition: wash.cpp:51
void add_force_vector(const std::string force)
Add a n-dim vector force to the simulation.
Definition: wash.cpp:83
ReduceOp
Type of reduction operation to perform in a reduce kernel.
Definition: kernels.hpp:18
void add_variable(const std::string variable, double init_value=0.0)
Add a scalar variable to the simulation.
Definition: wash.cpp:90
void set_default_neighbor_search(const unsigned max_count)
Set the neighborhood search to use the provided default which uses the smoothing length of the partic...
Definition: wash.cpp:126
double get_variable(const std::string &variable)
Get the value of a variable.
Definition: wash.cpp:184
void set_max_iterations(const uint64_t iterations)
Set the max number of iterations.
Definition: wash.cpp:44
double * use_variable(const std::string &variable)
Returns a reference to a variable useful for e.g. reduction kernels.
Definition: wash.cpp:186
void set_output_file_name(const std::string name)
Set the output file name of the simulation.
Definition: wash.cpp:147
void set_simulation_name(const std::string name)
Set the name of the simulation, used in IO.
Definition: wash.cpp:140
void add_update_kernel(const UpdateFuncT func)
Add an update kernel to the simulation which will loop over the particles.
Definition: wash.cpp:111
void add_force_kernel(const ForceFuncT func)
Add a force kernel to the simulation which will loop over the particles and their neighbourhood...
Definition: wash.cpp:106
size_t get_particle_count()
Get the number of particles used in the simulation.
Definition: wash.cpp:49
TODO: Consider having this as a private header in WISB/WS2ST/etc implementations. ...
Definition: ascii.hpp:5
void set_neighbor_search_kernel(const NeighborsFuncT func, const unsigned max_count)
Sets the neighbourhood search to use a custom function.
Definition: wash.cpp:132
void set_variable(const std::string &variable, const double value)
Set the value of a variable.
Definition: wash.cpp:188
double eucdist(const Particle &p, const Particle &q)
TODO: Move eucdist calculation to the paticle header?
Definition: wash.cpp:394
void add_init_update_kernel(const UpdateFuncT func)
Add an initialisation update kernel (will be executed for each particle)
Definition: wash.cpp:96
void add_force_scalar(const std::string force)
Add a scalar force to the simulation.
Definition: wash.cpp:75
void add_init_void_kernel(const VoidFuncT func)
Add an initialization void kernel to the simulation - run once.
Definition: wash.cpp:101
void set_dimension(int dim)
Set the dimensionality of the simulation.
Definition: wash.cpp:423
void set_io(const std::string format, size_t output_nth, bool timings=true)
Set the IO parameters used for the simulation.
Definition: wash.cpp:429
void set_bounding_box(const double min, const double max, const bool periodic)
Set the bounding box dimensions and periodicity type.
Definition: wash.cpp:56