23 mutable Size dumpNum = 0;
181 const std::string& runName,
217 std::string scriptPath;
221 const std::string& runName,
222 const std::string& scriptPath,
225 :
TextOutput(fileMask, runName, quantities, flags)
226 , scriptPath(scriptPath) {}
339 static constexpr
Size PADDING_SIZE = 164;
548 return cbrt(3._f * m / (4._f *
PI * rho));
#define NOT_IMPLEMENTED
Helper macro marking missing implementation.
@ NONE
No collision took place.
Definitions of physical constaints (in SI units).
Helper object for converting enums to string, listing all available values of enum,...
Wrapper of type containing either a value or an error message.
const EmptyFlags EMPTY_FLAGS
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.
INLINE Float cbrt(const Float f)
Returns a cubed root of a value.
constexpr Float PI
Mathematical constants.
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
Return value of function that may fail, containing either SUCCEES (true) or error message.
OutputQuantityFlag
List of quantities we can write to text output.
@ STRAIN_RATE_CORRECTION_TENSOR
Symmetric tensor correcting kernel gradient for linear consistency.
@ DEVIATORIC_STRESS
Deviatoric stress tensor, always a traceless tensor stored in components xx, yy, xy,...
@ PRESSURE
Pressure, reduced by yielding and fracture model (multiplied by 1-damage); always a scalar quantity.
@ VELOCITY
Current velocities of particles, always a vector quantity.
@ DAMAGE
Damage, reducing the pressure and deviatoric stress.
@ POSITION
Positions of particles, always a vector quantity.
@ ENERGY
Specific internal energy, always a scalar quantity.
@ SMOOTHING_LENGTH
Smoothing lenghts of particles.
@ ANGULAR_FREQUENCY
Angular frequency of particles, used in N-body simulations.
@ DENSITY
Density, always a scalar quantity.
@ INDEX
Index of particle.
@ MASS
Particle masses, always a scalar quantity.
@ MATERIAL_ID
ID of material, indexed from 0 to (#bodies - 1).
RunTypeEnum
Type of simulation, stored as metadata in the binary file.
@ SPH
Main SPH simulation.
@ RUBBLE_PILE
Pre-stabilization phase, using N-body solver to get a realistic rubble-pile body.
@ NBODY
Main N-body simulation, using initial conditions either from SPH (handoff) or manually specified.
@ STABILIZATION
Confergence phase using SPH solver, used to obtain stable initial conditions.
@ V2021_03_20
added wallclock time and build date
@ V2018_04_07
serializing (incorrectly!!) enum type
@ V2018_10_24
reverted enum (storing zero instead of hash), storing type of simulation
Object representing a path on a filesystem, similar to std::filesystem::path in c++17.
QuantityId
Unique IDs of basic quantities of SPH particles.
Container for storing particle quantities and materials.
BasicVector< Float > Vector
Generic dynamically allocated resizable storage.
Wrapper of pointer that deletes the resource from destructor.
Output saving data to binary data without loss of precision.
virtual Expected< Path > dump(const Storage &storage, const Statistics &stats) override
Saves data from particle storage into the file.
BinaryOutput(const OutputFile &fileMask, const RunTypeEnum runTypeId=RunTypeEnum::SPH)
CompressedOutput(const OutputFile &fileMask, const CompressionEnum compression, const RunTypeEnum runTypeId=RunTypeEnum::SPH)
virtual Expected< Path > dump(const Storage &storage, const Statistics &stats) override
Saves data from particle storage into the file.
Wrapper of type that either contains a value of given type, or an error message.
Extension of text output that runs given gnuplot script on dumped text data.
virtual Expected< Path > dump(const Storage &storage, const Statistics &stats) override
Saves data from particle storage into the file.
GnuplotOutput(const OutputFile &fileMask, const std::string &runName, const std::string &scriptPath, const Flags< OutputQuantityFlag > quantities, const Flags< Options > flags)
Interface for saving quantities of SPH particles to a file.
IOutput(const OutputFile &fileMask)
Constructs output given the file name of the output.
virtual Expected< Path > dump(const Storage &storage, const Statistics &stats)=0
Saves data from particle storage into the file.
Base class for conversion of quantities into the output data.
virtual Expected< Path > dump(const Storage &UNUSED(storage), const Statistics &UNUSED(stats)) override
Helper file generating file names for output files.
static Optional< Size > getDumpIdx(const Path &path)
Extracts the dump index from given path generated by OutputFile.
Path getNextPath(const Statistics &stats) const
Returns path to the next output file.
Path getMask() const
Returns the file mask as given in constructor.
static Optional< OutputFile > getMaskFromPath(const Path &path, const Size firstDumpIdx=0)
Attemps to get the OutputFile from one of the path generated from it.
bool hasWildcard() const
Returns true if the file mask contains (at least one) wildcard.
Object representing a path on a filesystem.
Dumps data into a file that can be used as an input for pkdgrav code by Richardson et al.
virtual Expected< Path > dump(const Storage &storage, const Statistics &stats) override
Saves data from particle storage into the file.
PkdgravOutput(const OutputFile &fileMask, PkdgravParams &¶ms)
Object holding various statistics about current run.
Container storing all quantities used within the simulations.
Input for the text file, generated by TextOutput or conforming to the same format.
virtual Outcome load(const Path &path, Storage &storage, Statistics &stats) override
Loads data from the file into the storage.
TextInput & addColumn(AutoPtr< ITextColumn > &&column)
TextInput(Flags< OutputQuantityFlag > quantities)
Output saving data to text (human readable) file.
TextOutput(const OutputFile &fileMask, const std::string &runName, Flags< OutputQuantityFlag > quantities, Flags< Options > options=EMPTY_FLAGS)
Creates a new text file output.
virtual Expected< Path > dump(const Storage &storage, const Statistics &stats) override
Saves data from particle storage into the file.
@ DUMP_ALL
Dumps all quantity values from the storage; this overrides the list of selected particles.
@ SCIENTIFIC
Writes all numbers in scientific format.
TextOutput & addColumn(AutoPtr< ITextColumn > &&column)
Adds a new column to be saved into the file.
XML-based output format used by Visualization ToolKit (VTK)
VtkOutput(const OutputFile &fileMask, const Flags< OutputQuantityFlag > flags)
virtual Expected< Path > dump(const Storage &storage, const Statistics &stats) override
Saves data from particle storage into the file.
constexpr Float au
Astronomical unit (exactly)
Conversion factors for pkdgrav.
struct PkdgravParams::Conversion conversion
Radius
Conversion formula from SPH particles to hard spheres in pkdgrav.
@ FROM_DENSITY
Compute sphere radius so that its mass is equivalent to the mass of SPH particle.
@ FROM_SMOOTHING_LENGTH
Compute sphere radius using R = h/3 formula.
Base class for all polymorphic objects.
Helper class for adding individual enums to the enum map.