deal2lkit: A ToolKit library for Deal.II
utilities.cc File Reference
#include <deal2lkit/utilities.h>
#include <vector>
#include <fstream>
#include <thread>
#include <stdlib.h>
#include <sys/stat.h>

Go to the source code of this file.

Functions

std::string demangle (const char *name)
 Demangle c++ names. More...
 
void append_to_file (const std::string &in_file, const std::string &out_file)
 This function copy the text contained in in_file to the file out_file . More...
 
bool file_exists (const std::string &file)
 A function to check the existence of file file. More...
 
bool dir_exists (const std::string &dir)
 A function to check the existence of dir directory. More...
 
unsigned int get_next_available_index_directory_name (const std::string &base, int n_digits, unsigned int start, unsigned int index_max)
 A function that return the index of the first non existing folder matching a pattern make by base and n_digits number. More...
 
std::string get_next_available_directory_name (const std::string &base, int n_digits, unsigned int start, unsigned int index_max)
 A function that return the name of the first non existing folder matching a pattern make by base and n_digits number. More...
 
bool create_directory (const std::string &name)
 A function to create directory. More...
 
bool copy_files (const std::string &files, const std::string &destination)
 A function to copy a list of file ( "file1 file2 file3" ) in the destination folder (destination) More...
 
bool copy_file (const std::string &file, const std::string &new_file)
 A function to make a copy of file with the name destination. More...
 
bool rename_file (const std::string &file, const std::string &new_file)
 A function to rename a file with a new name new_file. More...
 
void copy (BlockVector< double > &dst, const N_Vector &src)
 
void copy (N_Vector &dst, const BlockVector< double > &src)
 

Function Documentation

§ append_to_file()

void append_to_file ( const std::string &  in_file,
const std::string &  out_file 
)

This function copy the text contained in in_file to the file out_file .

Definition at line 67 of file utilities.cc.

§ copy() [1/2]

void copy ( BlockVector< double > &  dst,
const N_Vector &  src 
)

Definition at line 258 of file utilities.cc.

§ copy() [2/2]

void copy ( N_Vector &  dst,
const BlockVector< double > &  src 
)

Definition at line 275 of file utilities.cc.

§ copy_file()

bool copy_file ( const std::string &  file,
const std::string &  new_file 
)

A function to make a copy of file with the name destination.

Definition at line 139 of file utilities.cc.

§ copy_files()

bool copy_files ( const std::string &  files,
const std::string &  destination 
)

A function to copy a list of file ( "file1 file2 file3" ) in the destination folder (destination)

Definition at line 119 of file utilities.cc.

§ create_directory()

bool create_directory ( const std::string &  name)

A function to create directory.

It creates all directories needed.

Definition at line 108 of file utilities.cc.

§ demangle()

std::string demangle ( const char *  name)

Demangle c++ names.

Definition at line 28 of file utilities.cc.

§ dir_exists()

bool dir_exists ( const std::string &  dir)

A function to check the existence of dir directory.

Definition at line 83 of file utilities.cc.

§ file_exists()

bool file_exists ( const std::string &  file)

A function to check the existence of file file.

Definition at line 77 of file utilities.cc.

§ get_next_available_directory_name()

std::string get_next_available_directory_name ( const std::string &  base,
int  n_digits = 3,
unsigned int  start = 0,
unsigned int  index_max = 1000 
)

A function that return the name of the first non existing folder matching a pattern make by base and n_digits number.

(base000, base001, base002, ...) The research of the index starts from the value start and ends when index_max is reached.

Definition at line 102 of file utilities.cc.

§ get_next_available_index_directory_name()

unsigned int get_next_available_index_directory_name ( const std::string &  base,
int  n_digits = 3,
unsigned int  start = 0,
unsigned int  index_max = 1000 
)

A function that return the index of the first non existing folder matching a pattern make by base and n_digits number.

(base000, base001, base002, ...) The research of the index starts from the value start and ends when index_max is reached.

Definition at line 89 of file utilities.cc.

§ rename_file()

bool rename_file ( const std::string &  file,
const std::string &  new_file 
)

A function to rename a file with a new name new_file.

Definition at line 149 of file utilities.cc.