Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • feature/add-fft-interface
  • feature/expose-rnumber-from-simulations
  • feature/particle_state_generation_with_variable_box_size
  • feature/forcing-unit-test
  • feature/dealias-check2
  • bugfix/check_field_exists
  • feature/dealias-check
  • v3.x
  • feature/particles-vectorization
  • 6.2.4
  • 6.2.3
  • 6.2.2
  • 6.2.1
  • 6.2.0
  • 6.1.0
  • 6.0.0
  • 5.8.1
  • 5.8.0
  • 5.7.2
  • 5.7.1
  • 5.7.0
  • 5.6.0
  • 5.5.1
  • 5.5.0
  • 5.4.7
  • 5.4.6
  • 5.4.5
  • 5.4.4
  • 5.4.3
30 results

code_base.cpp

Blame
  • user avatar
    Chichi Lalescu authored and Cristian C Lalescu committed
    I want to properly accomodate postprocessing codes, so I need something
    more general than `direct_numerical_simulation`.
    a5b484da
    History
    code_base.cpp 849 B
    #include "code_base.hpp"
    #include "scope_timer.hpp"
    
    code_base::code_base(
            const MPI_Comm COMMUNICATOR,
            const std::string &simulation_name):
        comm(COMMUNICATOR),
        simname(simulation_name)
    {
        MPI_Comm_rank(this->comm, &this->myrank);
        MPI_Comm_size(this->comm, &this->nprocs);
        this->stop_code_now = false;
    }
    
    int code_base::check_stopping_condition(void)
    {
        if (myrank == 0)
        {
            std::string fname = (
                    std::string("stop_") +
                    std::string(this->simname));
            {
                struct stat file_buffer;
                this->stop_code_now = (
                        stat(fname.c_str(), &file_buffer) == 0);
            }
        }
        MPI_Bcast(
                &this->stop_code_now,
                1,
                MPI_C_BOOL,
                0,
                MPI_COMM_WORLD);
        return EXIT_SUCCESS;
    }