19 this->
write(storage, stats);
27 const std::string& message,
28 const std::string& unit =
"",
29 const std::string& emptyValue =
"") {
31 logger.
write(message, stats.
get<T>(
id), unit);
32 }
else if (!emptyValue.empty()) {
33 logger.
write(message, emptyValue);
48 logger->
write(name,
" #", index,
" time = ", time,
" wallclock time: ", formattedWallclock);
52 logger->
write(
" - progress: ",
int(progress * 100),
"%");
53 if (progress > 0.05_f) {
54 const std::string formattedEta =
getFormattedTime(int64_t(wallclock * (1._f / progress - 1._f)));
70 logger->
write(
" - timestep: ", dt,
" (set by ", ss.str(),
")");
96 for (std::size_t i = 0; i < r.
size(); ++i) {
102 iterate<VisitorEnum::FIRST_ORDER>(storage, [&](
QuantityId id,
const auto& v,
const auto& dv) {
104 for (
Size i = 0; i < v.size(); ++i) {
109 logger->
write(
" * ", name,
": ", range,
" (derivative ", drange,
")");
111 iterate<VisitorEnum::SECOND_ORDER>(storage, [&](
QuantityId id,
const auto& v,
const auto&,
const auto& d2v) {
113 for (
Size i = 0; i < v.size(); ++i) {
118 logger->
write(
" * ", name,
": ", range,
" (derivative ", drange,
")");
125 for (
Size i = 0; i < divv.size(); ++i) {
126 divvRange.
extend(divv[i]);
129 logger->
write(
" * velocity divergence: ", divvRange);
130 logger->
write(
" * velocity gradient: ", gradvRange);
145 logger->
write(name,
" #", index,
", time = ", time,
", step = ", dt);
INLINE Float minElement(const AntisymmetricTensor &t)
Returns the minimal element of the tensor.
#define SPH_ASSERT(x,...)
INLINE AutoPtr< T > makeAuto(TArgs &&... args)
Object representing a three-dimensional axis-aligned box.
INLINE Float maxElement(const T &value)
Returns maximum element, simply the value iself by default.
uint32_t Size
Integral type used to index arrays (by default).
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
Functions for iterating over individual quantities in Storage.
void printStat(ILogger &logger, const Statistics &stats, const StatisticsId id, const std::string &message, const std::string &unit="", const std::string &emptyValue="")
Logging routines of the run.
#define NAMESPACE_SPH_END
QuantityMetadata getMetadata(const QuantityId key)
Returns the quantity information using quantity ID.
QuantityId
Unique IDs of basic quantities of SPH particles.
@ VELOCITY_DIVERGENCE
Velocity divergence.
@ VELOCITY_GRADIENT
Velocity gradient.
@ POSITION
Positions (velocities, accelerations) of particles, always a vector quantity,.
INLINE SharedPtr< T > makeShared(TArgs &&... args)
Statistics gathered and periodically displayed during the run.
StatisticsId
List of values that are computed and displayed every timestep.
@ NEIGHBOUR_COUNT
Number of neighbours (min, max, mean)
@ COLLISION_EVAL_TIME
Wallclock duration of collision evaluation.
@ WALLCLOCK_TIME
Current wallclock duration of the simulation.
@ SPH_EVAL_TIME
Wallclock duration of evaluation of SPH derivatives.
@ BREAKUP_COUNT
Number of fragmentation collisions.
@ LIMITING_QUANTITY
Quantity that currently limits the timestep.
@ POSTPROCESS_EVAL_TIME
Wallclock spent on data dump, particle visualization, etc.
@ RUN_TIME
Current time of the simulation in code units. Does not necessarily have to be 0 when run starts.
@ TIMESTEP_VALUE
Current value of timestep.
@ AGGREGATE_COUNT
Number of aggregates in the simulation (single particles are not counted as aggregates).
@ SOLVER_SUMMATION_ITERATIONS
Number of iterations used to compute density and smoothing length in summation solver.
@ TIMESTEP_CRITERION
Criterion that currently limits the timestep.
@ TOTAL_COLLISION_COUNT
Number of collisions in the timestep.
@ INDEX
Current number of time step, indexed from 0.
@ OVERLAP_COUNT
Number of particle overlaps detected during collision evaluation.
@ TIMESTEP_ELAPSED
Wallclock time spend on computing last timestep.
@ GRAVITY_BUILD_TIME
Wallclock duration of gravity tree building.
@ MERGER_COUNT
Number of mergers in the timestep.
@ GRAVITY_EVAL_TIME
Wallclock duration of gravity evaluation.
@ BOUNCE_COUNT
Number of bounce collisions.
Container for storing particle quantities and materials.
std::string lowercase(const std::string &s)
Converts all uppercase characters to their lowercase variants. Other characters are unchanged.
String getFormattedTime(const String &format)
Utility functions.
Criteria for computing the time step.
@ DERIVATIVE
Timestep based on value-to-derivative ratio.
Measuring time intervals and executing periodic events.
Object providing safe access to continuous memory of data.
INLINE TCounter size() const
Wrapper of pointer that deletes the resource from destructor.
Helper object defining three-dimensional interval (box).
INLINE void extend(const Vector &v)
Enlarges the box to contain the vector.
virtual void write(const Storage &storage, const Statistics &stats) override
Writes to the log using provided storage and statistics.
BriefLogWriter(const SharedPtr< ILogger > &logger, const RunSettings &settings)
Base class for objects logging run statistics.
SharedPtr< ILogger > logger
virtual AutoPtr< ITrigger > action(Storage &storage, Statistics &stats) override final
Writes to the log using provided storage and statistics.
ILogWriter(const SharedPtr< ILogger > &logger, const Float period=0._f)
Constructs the log file.
virtual void write(const Storage &storage, const Statistics &stats)=0
Writes to the log using provided storage and statistics.
Interface providing generic (text, human readable) output of the program.
void write(TArgs &&... args)
Creates and logs a message by concatenating arguments.
Writer logging selected integrals of motion.
virtual void write(const Storage &storage, const Statistics &stats) override
Writes to the log using provided storage and statistics.
IntegralsLogWriter(const Path &path, const Size interval)
Creates a writer that writes the output into given file.
Object representing a 1D interval of real numbers.
INLINE void extend(const Float &value)
Extends the interval to contain given value.
virtual void write(const Storage &storage, const Statistics &stats) override
Writes to the log using provided storage and statistics.
Helper logger that does not write anything.
Object representing a path on a filesystem.
Trigger executing given action every period.
TValue get(const TEnum idx, std::enable_if_t<!std::is_enum< std::decay_t< TValue >>::value, int >=0) const
Returns a value of given type from the settings.
virtual void write(const Storage &storage, const Statistics &stats) override
Writes to the log using provided storage and statistics.
StandardLogWriter(const SharedPtr< ILogger > &logger, const RunSettings &settings)
Object holding various statistics about current run.
TValue get(const StatisticsId idx) const
Returns value of a statistic.
bool has(const StatisticsId idx) const
Checks if the object contains a statistic with given ID.
Container storing all quantities used within the simulations.
Size getParticleCnt() const
Returns the number of particles.
Array< TValue > & getValue(const QuantityId key)
Retrieves a quantity values from the storage, given its key and value type.
Symmetric tensor of 2nd order.
virtual Vector evaluate(const Storage &storage) const override
Computes the integral quantity using particles in the storage.
virtual Float evaluate(const Storage &storage) const override
Computes the integral quantity using particles in the storage.
virtual Vector evaluate(const Storage &storage) const override
Computes the integral quantity using particles in the storage.
virtual void write(const Storage &storage, const Statistics &stats) override
Writes to the log using provided storage and statistics.
@ RUN_NAME
User-specified name of the run, used in some output files.