IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 1c1e193f authored by ralfulrich's avatar ralfulrich
Browse files

added a few asserts

parent af24950c
No related branches found
No related tags found
No related merge requests found
add_executable (helix_example helix_example.cc)
target_compile_options(helix_example PRIVATE -g) # do not skip asserts
target_link_libraries(helix_example CORSIKAgeometry CORSIKAunits)
install (TARGETS helix_example DESTINATION share/examples)
add_test(helix_example helix_example)
add_executable (geometry_example geometry_example.cc)
target_compile_options(geometry_example PRIVATE -g) # do not skip asserts
target_link_libraries (geometry_example CORSIKAgeometry CORSIKAunits)
install (TARGETS geometry_example DESTINATION share/examples)
#install (TARGETS geometry_example DESTINATION share/examples)
add_test(geometry_example geometry_example)
add_executable (logger_example logger_example.cc)
target_compile_options(logger_example PRIVATE -g) # do not skip asserts
target_link_libraries (logger_example CORSIKAunits CORSIKAlogging)
install (TARGETS logger_example DESTINATION share/examples)
#install (TARGETS logger_example DESTINATION share/examples)
add_test(logger_example logger_example)
add_executable (stack_example stack_example.cc)
target_compile_options(stack_example PRIVATE -g) # do not skip asserts
......@@ -16,6 +22,7 @@ target_link_libraries (stack_example SuperStupidStack CORSIKAunits CORSIKAloggin
add_test(stack_example stack_example)
add_executable (cascade_example cascade_example.cc)
target_compile_options(cascade_example PRIVATE -g) # do not skip asserts
target_link_libraries (cascade_example SuperStupidStack CORSIKAunits CORSIKAlogging
CORSIKArandom
CORSIKAsibyll
......@@ -26,12 +33,15 @@ target_link_libraries (cascade_example SuperStupidStack CORSIKAunits CORSIKAlogg
CORSIKAgeometry
CORSIKAprocesssequence
)
install (TARGETS cascade_example DESTINATION share/examples)
#install (TARGETS cascade_example DESTINATION share/examples)
add_test(cascade_example cascade_example)
add_executable (staticsequence_example staticsequence_example.cc)
target_compile_options(staticsequence_example PRIVATE -g) # do not skip asserts
target_link_libraries (staticsequence_example
CORSIKAprocesssequence
CORSIKAunits
CORSIKAgeometry
CORSIKAlogging)
install (TARGETS staticsequence_example DESTINATION share/examples)
#install (TARGETS staticsequence_example DESTINATION share/examples)
add_test(staticsequence_example staticsequence_example)
......@@ -50,12 +50,15 @@ int main() {
std::cout << "p2-p1 components in cs3: " << diff.GetComponents(cs3)
<< std::endl; // but not under rotations
std::cout << "p2-p1 norm^2: " << norm << std::endl;
assert(norm == 1 * meter*meter);
Sphere s(p1, 10_m); // define a sphere around a point with a radius
std::cout << "p1 inside s: " << s.Contains(p2) << std::endl;
assert(s.Contains(p2) == 1);
Sphere s2(p1, 3_um); // another sphere
std::cout << "p1 inside s2: " << s2.Contains(p2) << std::endl;
assert(s2.Contains(p2) == 0);
// let's try parallel projections:
auto const v1 = Vector<length_d>(root, {1_m, 1_m, 0_m});
......
......@@ -35,7 +35,7 @@ int main() {
auto constexpr t0 = 0_s;
auto constexpr t1 = 1_s;
auto constexpr dt = 1_us;
auto constexpr dt = 1_ms;
auto constexpr n = long((t1 - t0) / dt) + 1;
auto arr = std::make_unique<std::array<std::array<double, 4>, n>>();
......
......@@ -35,7 +35,7 @@ int main() {
std::any
*/
for (int i = 0; i < 100000; ++i) {
for (int i = 0; i < 10000; ++i) {
LOG(info, "irgendwas", " ", string("and more"), " ",
boost::format("error: %i message: %s. done."), i, "stupido");
LOG(err, "Fehler");
......@@ -46,7 +46,7 @@ int main() {
sink::NoSink off;
Logger<MessageOff> info("", "", off);
for (int i = 0; i < 100000; ++i) {
for (int i = 0; i < 10000; ++i) {
LOG(info, "irgendwas", string("and more"),
boost::format("error: %i message: %s. done."), i, "stupido", "a-number:", 8.99,
"ENDE");
......
......@@ -15,12 +15,9 @@
#include <iostream>
#include <cassert>
using namespace std;
// using namespace corsika::literals;
// using namespace corsika::io;
using namespace corsika::units::si;
using namespace corsika::stack;
using namespace std;
void fill(corsika::stack::super_stupid::SuperStupidStack& s) {
for (int i = 0; i < 11; ++i) {
......@@ -39,10 +36,9 @@ void read(corsika::stack::super_stupid::SuperStupidStack& s) {
total_energy += p.GetEnergy();
// particles are electrons with 1.5 GeV energy times i
assert(p.GetPID() == corsika::particles::Code::Electron);
assert(p.GetEnergy() == i++ * 1_GeV);
assert(p.GetEnergy() == 1.5_GeV * (i++));
}
assert(total_energy == 16.5_GeV);
//assert(total_energy == 82.5_GeV);
}
int main() {
......
......@@ -38,8 +38,8 @@ public:
Process2() {}
template <typename D, typename T, typename S>
inline EProcessReturn DoContinuous(D&, T&, S&) const {
// for (int i=0; i<10; ++i) d.p[i] *= 2;
inline EProcessReturn DoContinuous(D& d, T&, S&) const {
for (int i=0; i<10; ++i) d.p[i] -= 0.1*i;
return EProcessReturn::eOk;
}
};
......@@ -74,7 +74,7 @@ private:
};
struct DummyData {
double p[10];
double p[10] = {0,0,0,0,0,0,0,0,0,0};
};
struct DummyStack {};
......@@ -86,14 +86,19 @@ void modular() {
Process4 m4;
const auto sequence = m1 + m2 + m3 + m4;
DummyData p;
DummyStack s;
Trajectory t;
const int n = 100000000;
const int n = 1000;
for (int i = 0; i < n; ++i) { sequence.DoContinuous(p, t, s); }
for(int i=0; i<10; ++i) {
//cout << p.p[i] << endl;
//assert(p.p[i] == n-i*100);
}
cout << " done (nothing...) " << endl;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment