Beispiel #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);
  }
Beispiel #2
0
bool VcImporter::OnProject(const wxString& firstLine, wxString& errMsg)
{
    // first line contains the project name, project file path, and project id
    wxStringTokenizer tkz(firstLine, wxT("="));
    if(tkz.CountTokens() != 2) {
        errMsg = wxT("Invalid 'Project' section found. expected <expr> = <expr>");
        return false;
    }

    tkz.NextToken();
    wxString token = tkz.NextToken();
    TrimString(token);
    wxStringTokenizer tk2(token, wxT(","));
    if(tk2.CountTokens() != 3) {
        errMsg = wxT("Invalid 'Project' section found. expected <project name>, <project file path>, <project id>");
        return false;
    }

    VcProjectData pd;

    pd.name = tk2.NextToken();
    RemoveGershaim(pd.name);

    pd.filepath = tk2.NextToken();
    RemoveGershaim(pd.filepath);

    // Make sure that the project path has a forward slash style
    pd.filepath.Replace(wxT("\\"), wxT("/"));

    pd.id = tk2.NextToken();
    RemoveGershaim(pd.id);

    std::pair<wxString, VcProjectData> p;
    p.first = pd.id;
    p.second = pd;
    m_projects.insert(p);
    // Skip all lines until EndProject section is found
    wxString line;
    while(true) {
        NEXT_LINE(line);
        if(line == wxT("EndProject")) {
            return true;
        }
    }
    return false;
}
Beispiel #3
0
bool PositionParser::FindSeparator(const wxString & src)
{ 

    // Used when format is similar to "12 34.56 N 12 34.56 E"
    wxString posPartOfSeparator = _T("");

    // First the XML case:
    // Generalized XML tag format, accepts anything like <XXX yyy="<lat>" zzz="<lon>" >
    // GPX format <wpt lat="<lat>" lon="<lon>" /> tag among others.

    wxRegEx regex;

    int re_compile_flags = wxRE_ICASE;
#ifdef wxHAS_REGEX_ADVANCED
    re_compile_flags |= wxRE_ADVANCED;
#endif

    regex.Compile(
            _T( "<[a-z,A-Z]*\\s*[a-z,A-Z]*=\"([0-9,.]*)\"\\s*[a-z,A-Z]*=\"([-,0-9,.]*)\"\\s*/*>" ),
                  re_compile_flags );

    if( regex.IsValid() ) {
        if( regex.Matches( src ) ) {
			int n = regex.GetMatchCount();
            latitudeString = regex.GetMatch( src, 1 );
            longitudeString = regex.GetMatch( src, 2 );
            latitudeString.Trim( true );
            latitudeString.Trim( false );
            longitudeString.Trim( true );
            longitudeString.Trim( false );
            return true;
        }
    }

    // Now try various separators.

    separator = _T(", ");
    wxStringTokenizer tk1(src, separator);
    if (tk1.CountTokens() == 2) {
        latitudeString = tk1.GetNextToken();
        latitudeString.Trim(true);
        latitudeString.Trim(false);
        longitudeString = tk1.GetNextToken();
        longitudeString.Trim(true);
        longitudeString.Trim(false);

        return true;
    }

    separator = _T(",");
    wxStringTokenizer tk2 (src, separator);
    if (tk2.CountTokens() == 2) {
        latitudeString = tk2.GetNextToken();
        latitudeString.Trim(true);
        latitudeString.Trim(false);
        longitudeString = tk2.GetNextToken();
        longitudeString.Trim(true);
        longitudeString.Trim(false);

        return true;
    }   

    separator = _T(" ");
    wxStringTokenizer tk3(src, separator);
    if (tk3.CountTokens() == 2) {
        latitudeString = tk3.GetNextToken();
        latitudeString.Trim(true);
        latitudeString.Trim(false);
        longitudeString = tk3.GetNextToken();
        longitudeString.Trim(true);
        longitudeString.Trim(false);

        return true;
    }
    
    separator = _T("\t");
    wxStringTokenizer tk4(src, separator);
    if (tk4.CountTokens() == 2) {
        latitudeString = tk4.GetNextToken();
        latitudeString.Trim(true);
        latitudeString.Trim(false);
        longitudeString = tk4.GetNextToken();
        longitudeString.Trim(true);
        longitudeString.Trim(false);

        return true;
    }
   
    separator = _T("\n");
    wxStringTokenizer tk5(src, separator);
    if (tk5.CountTokens() == 2) {
        latitudeString = tk5.GetNextToken();
        latitudeString.Trim(true);
        latitudeString.Trim(false);
        longitudeString = tk5.GetNextToken();
        longitudeString.Trim(true);
        longitudeString.Trim(false);

        return true;
    }
  
    separator = _T("N");   
    posPartOfSeparator = _T("N");
    wxStringTokenizer tk6(src, separator);
    if (tk6.CountTokens() == 2) {
        latitudeString = tk6.GetNextToken() << posPartOfSeparator;
        latitudeString.Trim(true);
        latitudeString.Trim(false);
        longitudeString = tk6.GetNextToken();
        longitudeString.Trim(true);
        longitudeString.Trim(false);

        return true;
    }
   
    separator = _T("S");   
    posPartOfSeparator = _T("S");
    wxStringTokenizer tk7(src, separator);
    if (tk7.CountTokens() == 2) {
        latitudeString = tk7.GetNextToken() << posPartOfSeparator;
        latitudeString.Trim(true);
        latitudeString.Trim(false);
        longitudeString = tk7.GetNextToken();
        longitudeString.Trim(true);
        longitudeString.Trim(false);

        return true;
    }   

    // Give up.
    return false;
}