Peano 4
Loading...
Searching...
No Matches
DastgenTest.cpph
Go to the documentation of this file.
1#pragma once
2#include <cstring>
3#include <iostream>
4#include <type_traits>
5
6
7template <typename ParticleContainer>
8void swift2::dastgenTest::checkDastgen(ParticleContainer& assignedParticles) {
9
10 for (auto& particle : assignedParticles) {
11 checkBooleans(*particle);
12 checkDoubles(*particle);
13 checkEnums(*particle);
14 checkIntegers(*particle);
15 checkStrings(*particle);
16
17 checkBooleanArrays(*particle);
18 checkDoubleArrays(*particle);
19 checkIntegerArrays(*particle);
20
21 checkPeanoDoubleArrays(*particle);
22 checkPeanoIntegerArrays(*particle);
23 }
24
26}
27
28
29template <typename Particle>
31
32 // Deliberately hardcoded for sim to run 2 steps.
33 Particle::getSpecies().setTimeStepSize(0.5);
34}
35
36
37template <typename Particle>
38void swift2::dastgenTest::reportStep(const std::string& particleName) {
39 if (tarch::mpi::Rank::getInstance().isGlobalMaster()) {
40 static tarch::logging::Log _log("dastgenTest");
41
42 logInfo("reportStep()", "===============");
43 logInfo("reportStep()", particleName);
44 logInfo("reportStep()", "t=" << Particle::getSpecies().getMinTimeStamp());
45 logInfo(
46 "reportStep()", "dt=" << Particle::getSpecies().getMinTimeStepSize()
47 );
48 logInfo("reportStep()", "===============");
49 }
50}
#define logInfo(methodName, logMacroMessageStream)
Wrapper macro around tarch::tarch::logging::Log to improve logging.
Definition Log.h:411
Log Device.
Definition Log.h:516
static Rank & getInstance()
This operation returns the singleton instance.
Definition Rank.cpp:538
void checkConstructors()
Check the constructor methods.
void checkPeanoIntegerArrays(tests::swift2::dastgenTest::globaldata::dummyPart &particle)
Perform all the checks on a particle's integer array members.
void dummyMoveForwardInTime()
A dummy function to move the simulation forward in time.
void checkDoubles(tests::swift2::dastgenTest::globaldata::dummyPart &particle)
Perform all the checks on a particle's double members.
void reportStep(const std::string &particleName)
Report time-step size and current time at the end of a step.
void checkIntegerArrays(tests::swift2::dastgenTest::globaldata::dummyPart &particle)
Perform all the checks on a particle's integer array members.
void checkBooleanArrays(tests::swift2::dastgenTest::globaldata::dummyPart &particle)
Perform all the checks on a particle's boolean array members.
void checkDoubleArrays(tests::swift2::dastgenTest::globaldata::dummyPart &particle)
Perform all the checks on a particle's double array members.
void checkIntegers(tests::swift2::dastgenTest::globaldata::dummyPart &particle)
Perform all the checks on a particle's integer members.
void checkBooleans(tests::swift2::dastgenTest::globaldata::dummyPart &particle)
Perform all the checks on a particle's boolean members.
void checkStrings(tests::swift2::dastgenTest::globaldata::dummyPart &particle)
Perform all the checks on a particle's string members.
void checkDastgen(ParticleContainer &assignedParticles)
Main testing function.
void checkEnums(tests::swift2::dastgenTest::globaldata::dummyPart &particle)
Perform all the checks on a particle's enum members.
void checkPeanoDoubleArrays(tests::swift2::dastgenTest::globaldata::dummyPart &particle)
Perform all the checks on a particle's double array members.
tarch::logging::Log _log("examples::unittests")