8 return makeFailed(
"One or both files do not exist");
11 return makeFailed(
"Files have different sizes");
13 std::ifstream ifs1(path1.
native());
14 std::ifstream ifs2(path2.
native());
17 while (ifs1 && ifs2) {
18 ifs1.read(&buffer1[0], buffer1.
size());
19 ifs2.read(&buffer2[0], buffer2.
size());
21 if (buffer1 != buffer2) {
22 return makeFailed(
"Difference found at position ", ifs1.tellg());
39 return makeFailed(
"Different particle counts");
42 return makeFailed(
"Different material counts");
45 return makeFailed(
"Different quantity counts");
48 bool buffersEqual =
true;
49 iteratePair<VisitorEnum::ALL_BUFFERS>(storage1, storage2, [&buffersEqual](
auto& b1,
auto& b2) {
50 if (b1.size() != b2.size()) {
53 for (Size i = 0; i < b1.size(); ++i) {
54 buffersEqual &= almostEqual(b1[i], b2[i], EPS);
61 return makeFailed(
"Different quantity values");
72 logger.
write(
"\"", __DATE__,
"\" ", duration);
NAMESPACE_SPH_BEGIN Outcome areFilesIdentical(const Path &path1, const Path &path2)
Checks whether the two files are identical (to the bit).
void measureRun(const Path &file, Function< void()> run)
Outcome areFilesApproxEqual(const Path &path1, const Path &path2)
Checks if two .ssf files are almost equal (may have eps-differences in quantities).
Functions for iterating over individual quantities in Storage.
#define NAMESPACE_SPH_END
const SuccessTag SUCCESS
Global constant for successful outcome.
INLINE Outcome makeFailed(TArgs &&... args)
Constructs failed object with error message.
void write(TArgs &&... args)
Creates and logs a message by concatenating arguments.
Object representing a path on a filesystem.
std::string native() const
Returns the native version of the path.
Array with fixed number of allocated elements.
INLINE TCounter size() const
Returns the current size of the array (number of constructed elements).
Object holding various statistics about current run.
Container storing all quantities used within the simulations.
Size getMaterialCnt() const
Return the number of materials in the storage.
Size getParticleCnt() const
Returns the number of particles.
Size getQuantityCnt() const
Returns the number of stored quantities.
Basic time-measuring tool. Starts automatically when constructed.
int64_t elapsed(const TimerUnit unit) const
Returns elapsed time in timer units. Does not reset the timer.
bool pathExists(const Path &path)
Checks if a file or directory exists (or more precisely, if a file or directory is accessible).
Size fileSize(const Path &path)
Returns the size of a file.