IAP GITLAB

Skip to content
Snippets Groups Projects
testRadio.cpp 47 KiB
Newer Older
Nikos Karastathis's avatar
Nikos Karastathis committed
//    for (auto const& path : paths_) {
//      CHECK((path.total_time_ / 1_s) - ((34_m / (3 * constants::c)) / 1_s) ==
//            Approx(0).margin(absMargin));
//      CHECK(path.average_refractive_index_ == Approx(1));
//      CHECK(path.emit_.getComponents() == v1.getComponents());
//      CHECK(path.receive_.getComponents() == v1.getComponents());
//      CHECK(path.R_distance_ == 10_m);
//      //      CHECK(std::equal(P1.begin(), P1.end(), path.points_.begin(),[]
//      //      (Point a, Point b) { return (a - b).norm() / 1_m < 1e-5;}));
//      //TODO:THINK ABOUT THE POINTS IN THE SIGNALPATH.H
//
////      std::cout << "path.total_time_: " << path.total_time_ << std::endl;
////      std::cout << "path.average_refractive_index_: " << path.average_refractive_index_ << std::endl;
////      std::cout << "path.emit_: " << path.emit_.getComponents() << std::endl;
////      std::cout << "path.R_distance_: " << path.R_distance_ << std::endl;
//
Nikos Karastathis's avatar
Nikos Karastathis committed
//    CHECK(paths_.size() == 1);
//  }
//
//    SECTION("Straight Propagator w/ Exponential Refractive Index") {
//
////    logging::set_level(logging::level::info);
////    corsika_logger->set_pattern("[%n:%^%-8l%$] custom pattern: %v");
//
//     // create an environment with exponential refractive index (n_0 = 1 & lambda = 0)
//    using ExpoRIndex = ExponentialRefractiveIndex<HomogeneousMedium
//        <IRefractiveIndexModel<IMediumModel>>>;
//
//    using EnvType = Environment<IRefractiveIndexModel<IMediumModel>>;
//    EnvType env1;
//
//    //get another coordinate system
//    const CoordinateSystemPtr rootCS1 = env1.getCoordinateSystem();
//
//    auto Medium1 = EnvType::createNode<Sphere>(
//        Point{rootCS1, 0_m, 0_m, 0_m}, 1_km * std::numeric_limits<double>::infinity());
//
//    auto const props1 =
//        Medium1
//            ->setModelProperties<ExpoRIndex>( 1, 0 / 1_m,
//               1_kg / (1_m * 1_m * 1_m),
//               NuclearComposition(
//               std::vector<Code>{Code::Nitrogen},
//               std::vector<float>{1.f}));
//
//    env1.getUniverse()->addChild(std::move(Medium1));
//
//    // get some points
//    Point pp0(rootCS1, {0_m, 0_m, 0_m});
////    Point pp1(rootCS1, {0_m, 0_m, 1_m});
////    Point pp2(rootCS1, {0_m, 0_m, 2_m});
////    Point pp3(rootCS1, {0_m, 0_m, 3_m});
////    Point pp4(rootCS1, {0_m, 0_m, 4_m});
////    Point pp5(rootCS1, {0_m, 0_m, 5_m});
////    Point pp6(rootCS1, {0_m, 0_m, 6_m});
////    Point pp7(rootCS1, {0_m, 0_m, 7_m});
////    Point pp8(rootCS1, {0_m, 0_m, 8_m});
////    Point pp9(rootCS1, {0_m, 0_m, 9_m});
//    Point pp10(rootCS1, {0_m, 0_m, 10_m});
//
//    // get a unit vector
//    Vector<dimensionless_d> vv1(rootCS1, {0, 0, 1});
//
//    // construct a Straight Propagator given the exponential refractive index environment
//    StraightPropagator SP1(env1);
//
//    // store the outcome of Propagate method to paths1_
//    auto const paths1_ = SP1.propagate(pp0, pp10, 1_m);
//
//    // perform checks to paths1_ components (this is just a sketch for now)
//    for (auto const& path :paths1_) {
//      CHECK( (path.total_time_ / 1_s)  - ((34_m / (3 * constants::c)) / 1_s)
//             == Approx(0).margin(absMargin) );
//      CHECK( path.average_refractive_index_ == Approx(1) );
//      CHECK( path.emit_.getComponents() == vv1.getComponents() );
//      CHECK( path.receive_.getComponents() == vv1.getComponents() );
//      CHECK( path.R_distance_ == 10_m );
//    }
//
//    CHECK( paths1_.size() == 1 );
//
//    /*
//    * A second environment with another exponential refractive index
//    */
//
//    // create an environment with exponential refractive index (n_0 = 2 & lambda = 2)
//    using ExpoRIndex = ExponentialRefractiveIndex<HomogeneousMedium
//        <IRefractiveIndexModel<IMediumModel>>>;
//
//    using EnvType = Environment<IRefractiveIndexModel<IMediumModel>>;
//    EnvType env2;
//
//    //get another coordinate system
//    const CoordinateSystemPtr rootCS2 = env2.getCoordinateSystem();
//
//    auto Medium2 = EnvType::createNode<Sphere>(
//        Point{rootCS2, 0_m, 0_m, 0_m}, 1_km * std::numeric_limits<double>::infinity());
//
//    auto const props2 =
//        Medium2
//            ->setModelProperties<ExpoRIndex>( 2, 2 / 1_m,
//                                              1_kg / (1_m * 1_m * 1_m),
//                                              NuclearComposition(
//                                                  std::vector<Code>{Code::Nitrogen},
//                                                  std::vector<float>{1.f}));
//
//    env2.getUniverse()->addChild(std::move(Medium2));
//
//    // get some points
//    Point ppp0(rootCS2, {0_m, 0_m, 0_m});
//    Point ppp10(rootCS2, {0_m, 0_m, 10_m});
//
//    // get a unit vector
//    Vector<dimensionless_d> vvv1(rootCS2, {0, 0, 1});
//
//    // construct a Straight Propagator given the exponential refractive index environment
//    StraightPropagator SP2(env2);
//
//    // store the outcome of Propagate method to paths1_
//    auto const paths2_ = SP2.propagate(ppp0, ppp10, 1_m);
//
//    // perform checks to paths1_ components (this is just a sketch for now)
//    for (auto const& path :paths2_) {
//      CHECK( (path.total_time_ / 1_s)  - ((3.177511688_m / (3 * constants::c)) / 1_s)
//             == Approx(0).margin(absMargin) );
//      CHECK( path.average_refractive_index_ == Approx(0.210275935) );
//      CHECK( path.emit_.getComponents() == vvv1.getComponents() );
//      CHECK( path.receive_.getComponents() == vvv1.getComponents() );
//      CHECK( path.R_distance_ == 10_m );
//    }
//
//    CHECK( paths2_.size() == 1 );

} // END: TEST_CASE("Radio", "[processes]")