src/wl.cpp
/**
 * Writes estimated Joint Density of States to file.
 * @param name (string): Name of the file with extension.
 * @param path (string): Path of the directory where the file should be written to. 
 * Relative path from the execution directory, of the form "folder1/folder2/.../".
 * @param debug (bool): If true outputs additional information about the simulation.
 * First column is the number of steps and second is the time taken.
 */
Writes estimated Joint Density of States to file.
@param name (string): Name of the file with extension.
@param path (string): Path of the directory where the file should be written to.
Relative path from the execution directory, of the form "folder1/folder2/.../".
@param debug (bool): If true outputs additional information about the simulation.
First column is the number of steps and second is the time taken.
Writes estimated Joint Density of States to file . @param name ( string ) : Name of the file with extension . @param path ( string ) : Path of the directory where the file should be written to . Relative path from the execution directory of the form " folder1 / folder2 / ... / " . @param debug ( bool ) : If true outputs additional information about the simulation . First column is the number of steps and second is the time taken .
void WL::write_to_file(std::string name, std::string path, bool debug) {
    std::filesystem::create_directories(path); 
    std::ofstream file1(path + name);
    if (file1.is_open()) {
        for (int i = 0; i < this->ising_lattice->NE; ++i) 
        {
            for (int j = 0; j < this->ising_lattice->NM; ++j) {
                file1 << this->ising_lattice->JDOS[i * this->ising_lattice->NM + j] << " ";
            }
            file1 << "\n";
        }
        file1.close();
    } else {
        std:printf(" -- Error: can not open save file, please check you directory -- \n");
    }
    if (debug) {
        std::filesystem::create_directories(path + "debug/"); 
        std::ofstream file2(path + "debug/" + name);
        if (file2.is_open()) {
            file2 << this->run_time << "\n";
            for (int i = 0; i < this->n_f_vals; i++) {
                file2 << this->steps_iter[i] << " " << this->time_iter[i] << "\n";
            }
            file2.close();
        } else {
            printf(" -- Error: can not open debug file, please check you directory -- \n");
        }
    }
}
void WL :: write_to_file ( std :: string name , std :: string path , bool debug ) { std :: filesystem :: create_directories ( path ) ; std :: ofstream file1 ( path + name ) ; if ( file1 . is_open ( ) ) { for ( int i = 0 ; i < this -> ising_lattice -> NE ; ++ i ) { for ( int j = 0 ; j < this -> ising_lattice -> NM ; ++ j ) { file1 << this -> ising_lattice -> JDOS [ i * this -> ising_lattice -> NM + j ] << " " ; } file1 << " \n " ; } file1 . close ( ) ; } else { std : printf ( " \n " ) ; } if ( debug ) { std :: filesystem :: create_directories ( path + " " ) ; std :: ofstream file2 ( path + " " + name ) ; if ( file2 . is_open ( ) ) { file2 << this -> run_time << " \n " ; for ( int i = 0 ; i < this -> n_f_vals ; i ++ ) { file2 << this -> steps_iter [ i ] << " " << this -> time_iter [ i ] << " \n " ; } file2 . close ( ) ; } else { printf ( " \n " ) ; } } }
Writes estimated Joint Density of States to file.
Writes estimated Joint Density of States to file .