Esempio n. 1
0
void write_tasks(transport::repository<>& repo, transport::dquad_mpi<>* model)
  {
    const double Mp   = 1.0;
    const double Mphi = 9E-5 * Mp;
    const double Mchi = 1E-5 * Mp;

    transport::parameters<> params(Mp, {Mphi, Mchi}, model);

    const double phi_init = 10.0 * Mp;
    const double chi_init = 12.9 * Mp;

    const double N_init = 0.0;
    const double N_pre  = 12.0;
    const double N_end  = 60.0;

    transport::initial_conditions<> ics("dquad", params, {phi_init, chi_init}, N_init, N_pre);

    transport::basic_range<> ts(N_init, N_end, 300, transport::spacing::linear);

    const double kt_lo = std::exp(3.0);
    const double kt_hi = std::exp(8.0);

    transport::basic_range<> ks(kt_lo, kt_hi, 50, transport::spacing::log_bottom);

    transport::twopf_task<> tk2("dquad.twopf", ics, ts, ks);
    tk2.set_adaptive_ics_efolds(5.0);
    tk2.set_description("Compute time history of the 2-point function from k ~ e^3 to k ~ e^9");

    transport::threepf_cubic_task<> tk3("dquad.threepf", ics, ts, ks);
    tk3.set_adaptive_ics_efolds(5.0);
    tk3.set_description("Compute time history of the 3-point function on a cubic lattice from k ~ e^3 to k ~ e^9");

    repo.commit(tk2);
    repo.commit(tk3);
  }
Esempio n. 2
0
void write_tasks(transport::repository<>& repo, transport::step_mpi<>* model)
  {
    const double M_P       = 1.0;
    const double m         = 1E-5 * M_P;
    const double c         = 0.0018;
    const double d         = 0.022 * M_P;
    const double phi0      = 14.84 * M_P;

    const double phi_init  = 16.5 * M_P;

    const double N_init    = 0.0;
    const double N_pre     = 6.0;
    const double N_max     = 50.1;

    transport::parameters<> params(M_P, { m, c, d, phi0 }, model);
    transport::initial_conditions<> ics("step", params, { phi_init }, N_init, N_pre);

    transport::basic_range<> times(N_init, N_max, 100, transport::spacing::linear);


    transport::basic_range<> ks(exp(7.0), exp(11.5), 1000, transport::spacing::log_bottom);
    transport::basic_range<> alphas(0.0, 0.0, 0, transport::spacing::linear);
    transport::basic_range<> betas(1.0/3.0, 1.0/3.0, 0, transport::spacing::linear);

    // construct a threepf task
    transport::threepf_alphabeta_task<> tk3("step.threepf", ics, times, ks, alphas, betas);
    tk3.set_collect_initial_conditions(true).set_adaptive_ics_efolds(5.0);

    transport::zeta_threepf_task<> ztk3("step.threepf-zeta", tk3);

    repo.commit(ztk3);
  }
Esempio n. 3
0
void write_tasks(transport::repository<>& repo, transport::new_axion_mpi<>* model)
  {
    const double M_Planck = 1.0;
    const double g        = 1e-10;
    const double f        = M_Planck;
    const double Lambda   = std::pow(g, 1.0/4.0) * std::pow(25.0/(2*M_PI), 1.0/2.0) * M_Planck;

    const double phi_init = 23.5 * M_Planck;
    const double chi_init = f/2.0 - 0.001*M_Planck;

    const double N_init = 0.0;
    const double N_pre  = 10.0;
    const double N_max  = 68.0;

    transport::parameters<> params(M_Planck, { g, Lambda, f, M_PI }, model);
    transport::initial_conditions<> ics("axion_cfs", params, { phi_init, chi_init }, N_init, N_pre);

    transport::basic_range<> times(N_init, N_max, 500, transport::spacing::linear);


    transport::basic_range<> ks(exp(5.0), exp(5.0), 0, transport::spacing::linear);
    transport::basic_range<> alphas(0.0, 0.0, 0, transport::spacing::linear);

    transport::basic_range<> beta_equi(1.0/3.0, 1.0/3.0, 0, transport::spacing::linear);
    transport::basic_range<> beta_sq(0.95, 0.95, 0, transport::spacing::linear);

    // construct a threepf task for the equilateral mode
    transport::threepf_alphabeta_task<> tk3_equi("axion_cfs.equi.threepf", ics, times, ks, alphas, beta_equi);
    tk3_equi.set_adaptive_ics_efolds(4.0);
    tk3_equi.set_collect_initial_conditions(true);

    transport::zeta_threepf_task<> ztk3_equi("axion_cfs.equi.threepf-zeta", tk3_equi);
    ztk3_equi.set_paired(true);

    // construct a threepf task for the squeezed mode
    transport::threepf_alphabeta_task<> tk3_sq("axion_cfs.sq.threepf", ics, times, ks, alphas, beta_sq);
    tk3_sq.set_adaptive_ics_efolds(4.0);
    tk3_sq.set_collect_initial_conditions(true);

    transport::zeta_threepf_task<> ztk3_sq("axion_cfs.sq.threepf-zeta", tk3_sq);
    ztk3_sq.set_paired(true);

    repo.commit(ztk3_equi);
    repo.commit(ztk3_sq);
  }
Esempio n. 4
0
void CTest::TestEmptyInputData(CCompressStream::EMethod method)
{
    const size_t kLen = 1024;
    char   src_buf[kLen];
    char   dst_buf[kLen];
    char   cmp_buf[kLen];
    size_t n;

    const size_t count = ArraySize(s_EmptyInputDataTests);

    for (size_t i = 0;  i < count;  ++i)
    {
        SEmptyInputDataTest test = s_EmptyInputDataTests[i];
        if (test.method != method) {
            continue;
        }
        _TRACE("Test # " << i+1);

        CNcbiIstrstream is_str("");
        unique_ptr<CCompression>                compression;
        unique_ptr<CCompressionStreamProcessor> stream_compressor;
        unique_ptr<CCompressionStreamProcessor> stream_decompressor;

        if (method == CCompressStream::eBZip2) {
            compression.reset(new CBZip2Compression());
            compression->SetFlags(test.flags);
            stream_compressor.reset(new CBZip2StreamCompressor(test.flags));
            stream_decompressor.reset(new CBZip2StreamDecompressor(test.flags));
        } else 
#if defined(HAVE_LIBLZO)
        if (method == CCompressStream::eLZO) {
            compression.reset(new CLZOCompression());
            compression->SetFlags(test.flags);
            stream_compressor.reset(new CLZOStreamCompressor(test.flags));
            stream_decompressor.reset(new CLZOStreamDecompressor(test.flags));
        } else 
#endif
        if (method == CCompressStream::eZip) {
            compression.reset(new CZipCompression());
            compression->SetFlags(test.flags);
            stream_compressor.reset(new CZipStreamCompressor(test.flags));
            stream_decompressor.reset(new CZipStreamDecompressor(test.flags));
        } else
        {
            _TROUBLE;
        }

        // ---- Run tests ----

        // Buffer compression/decompression test
        {{
            bool res = compression->CompressBuffer(src_buf, 0, dst_buf, kLen, &n);
            assert(res == test.result);
            assert(n == test.buffer_output_size);
            res = compression->DecompressBuffer(dst_buf, n, cmp_buf, kLen, &n);
            assert(res == test.result);
            assert(n == 0);
        }}

        // Input stream tests
        {{
            CCompressionIStream ics(is_str, stream_compressor.get());
            assert(ics.good());
            ics.read(dst_buf, kLen);
            assert(ics.eof());
            n = (size_t)ics.gcount();
            assert(n == test.stream_output_size);
            assert(ics.GetProcessedSize() == 0);
            assert(ics.GetOutputSize() == n);

            CCompressionIStream ids(is_str, stream_decompressor.get());
            assert(ids.good());
            ids.read(dst_buf, kLen);
            assert(ids.eof());
            n = (size_t)ids.gcount();
            assert(n == 0);
            assert(ids.GetProcessedSize() == 0);
            assert(ids.GetOutputSize() == n);
        }}

        // Output stream tests
        {{
            {{
                CNcbiOstrstream os_str;
                CCompressionOStream ocs(os_str, stream_compressor.get());
                assert(ocs.good());
                ocs.Finalize();
                assert(ocs.good());
                n = (size_t)GetOssSize(os_str);
                assert(n == test.stream_output_size);
                assert(ocs.GetProcessedSize() == 0);
                assert(ocs.GetOutputSize() == n);
            }}
            {{
                CNcbiOstrstream os_str;
                CCompressionOStream ods(os_str, stream_decompressor.get());
                assert(ods.good());
                ods.Finalize();
                assert(test.result ? ods.good() : !ods.good());
                n = (size_t)GetOssSize(os_str);
                assert(n == 0);
                assert(ods.GetProcessedSize() == 0);
                assert(ods.GetOutputSize() == n);
            }}
        }}

        // Output stream tests -- with flush()
        {{
            {{
                CNcbiOstrstream os_str;
                CCompressionOStream ocs(os_str, stream_compressor.get());
                assert(ocs.good());
                ocs.flush();
                assert(ocs.good());
                ocs.Finalize();
                assert(ocs.good());
                n = (size_t)GetOssSize(os_str);
                assert(n == test.stream_output_size);
                assert(ocs.GetProcessedSize() == 0);
                assert(ocs.GetOutputSize() == n);
            }}
            {{
                CNcbiOstrstream os_str;
                CCompressionOStream ods(os_str, stream_decompressor.get());
                assert(ods.good());
                ods.flush();
                assert(ods.good());
                ods.Finalize();
                assert(test.result ? ods.good() : !ods.good());
                n = (size_t)GetOssSize(os_str);
                assert(n == 0);
                assert(ods.GetProcessedSize() == 0);
                assert(ods.GetOutputSize() == n);
            }}
        }}
    }
}