<commit_before>#pragma once


#include "dg/file/nc_utilities.h"

namespace feltor
{//We use the typedefs and MPI_OUT
//
//everyone reads their portion of the input data
//don't forget to also read source profiles
std::array<std::array<DVec,2>,2> init_from_file( std::string file_name, const Geometry& grid, const Parameters& p, double& time){
#ifdef FELTOR_MPI
    int rank;
    MPI_Comm_rank( MPI_COMM_WORLD, &rank);
#endif
    std::array<std::array<DVec,2>,2> y0;
    ///////////////////read in and show inputfile
    file::NC_Error_Handle errIN;
    int ncidIN;
    errIN = nc_open( file_name.data(), NC_NOWRITE, &ncidIN);
    size_t lengthIN;
    errIN = nc_inq_attlen( ncidIN, NC_GLOBAL, "inputfile", &lengthIN);
    std::string inputIN( lengthIN, 'x');
    errIN = nc_get_att_text( ncidIN, NC_GLOBAL, "inputfile", &inputIN[0]);

    Json::Value jsIN;
    std::stringstream is(inputIN);
    Json::CharReaderBuilder parser;
    parser["collectComments"] = false;
    std::string errs;
    parseFromStream( parser, is, &jsIN, &errs); //read input without comments
    unsigned  pINn       = jsIN["n"].asUInt();
    unsigned  pINNx      = jsIN["Nx"].asUInt();
    unsigned  pINNy      = jsIN["Ny"].asUInt();
    unsigned  pINNz      = jsIN["Nz"].asUInt();
    double    pINdt      = jsIN["dt"].asDouble();
    bool      pINsymmetric   = jsIN.get( "symmetric", false).asBool();
    MPI_OUT std::cout << "RESTART from file "<<file_name<< std::endl;
    MPI_OUT std::cout << " file parameters:" << std::endl;

    // Now read in last timestep
    Geometry grid_IN( grid.x0(), grid.x1(), grid.y0(), grid.y1(), grid.z0(), grid.z1(),
        pINn, pINNx, pINNy, pINsymmetric ? 1 : pINNz, dg::DIR, dg::DIR, dg::PER
        #ifdef FELTOR_MPI
        , grid.communicator()
        #endif //FELTOR_MPI
        );
    IHMatrix interpolateIN = dg::create::interpolation( grid, grid_IN);

    #ifdef FELTOR_MPI
    int dimsIN[3],  coordsIN[3];
    int periods[3] = {false, false, true}; //non-, non-, periodic
    MPI_Cart_get( grid.communicator(), 3, dimsIN, periods, coordsIN);
    size_t countIN[3] = {grid_IN.local().Nz(),
            grid_IN.n()*(grid_IN.local().Ny()),<commit_msg>remove unnecessary pINdt in feltordiag<commit_after>#pragma once


#include "dg/file/nc_utilities.h"

namespace feltor
{//We use the typedefs and MPI_OUT
//
//everyone reads their portion of the input data
//don't forget to also read source profiles
std::array<std::array<DVec,2>,2> init_from_file( std::string file_name, const Geometry& grid, const Parameters& p, double& time){
#ifdef FELTOR_MPI
    int rank;
    MPI_Comm_rank( MPI_COMM_WORLD, &rank);
#endif
    std::array<std::array<DVec,2>,2> y0;
    ///////////////////read in and show inputfile
    file::NC_Error_Handle errIN;
    int ncidIN;
    errIN = nc_open( file_name.data(), NC_NOWRITE, &ncidIN);
    size_t lengthIN;
    errIN = nc_inq_attlen( ncidIN, NC_GLOBAL, "inputfile", &lengthIN);
    std::string inputIN( lengthIN, 'x');
    errIN = nc_get_att_text( ncidIN, NC_GLOBAL, "inputfile", &inputIN[0]);

    Json::Value jsIN;
    std::stringstream is(inputIN);
    Json::CharReaderBuilder parser;
    parser["collectComments"] = false;
    std::string errs;
    parseFromStream( parser, is, &jsIN, &errs); //read input without comments
    unsigned  pINn       = jsIN["n"].asUInt();
    unsigned  pINNx      = jsIN["Nx"].asUInt();
    unsigned  pINNy      = jsIN["Ny"].asUInt();
    unsigned  pINNz      = jsIN["Nz"].asUInt();
    bool      pINsymmetric   = jsIN.get( "symmetric", false).asBool();
    MPI_OUT std::cout << "RESTART from file "<<file_name<< std::endl;
    MPI_OUT std::cout << " file parameters:" << std::endl;

    // Now read in last timestep
    Geometry grid_IN( grid.x0(), grid.x1(), grid.y0(), grid.y1(), grid.z0(), grid.z1(),
        pINn, pINNx, pINNy, pINsymmetric ? 1 : pINNz, dg::DIR, dg::DIR, dg::PER
        #ifdef FELTOR_MPI
        , grid.communicator()
        #endif //FELTOR_MPI
        );
    IHMatrix interpolateIN = dg::create::interpolation( grid, grid_IN);

    #ifdef FELTOR_MPI
    int dimsIN[3],  coordsIN[3];
    int periods[3] = {false, false, true}; //non-, non-, periodic
    MPI_Cart_get( grid.communicator(), 3, dimsIN, periods, coordsIN);
    size_t countIN[3] = {grid_IN.local().Nz(),
            grid_IN.n()*(grid_IN.local().Ny()),
{'fraction_non_alphanumeric': 0.15976878612716763, 'fraction_numerical': 0.008323699421965317, 'mean_word_length': 3.3696969696969696, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3367734', 'n_tokens_mistral': 1611, 'n_tokens_neox': 1574, 'n_words': 374}