31 std::string result( abi::__cxa_demangle(name, NULL, NULL, &status) );
32 return (status==0) ? result.c_str() : name ;
37 std::this_thread::sleep_for(std::chrono::milliseconds(t));
43 ExcMessage(
"Use get_end_time() before reuse get_start_time().") );
45 t_start = std::chrono::high_resolution_clock::now();
53 ExcMessage(
"Use get_start_time() before get_end_time().") );
55 t_end = std::chrono::high_resolution_clock::now();
56 std::chrono::duration<double> time_span = std::chrono::duration_cast<std::chrono::duration<double>>(
t_end -
t_start);
57 times.push_back( time_span.count() );
69 std::ifstream ifile(in_file, std::ios::in);
70 std::ofstream ofile(out_file, std::ios::out | std::ios::app);
72 ofile << ifile.rdbuf();
80 return (stat (file.c_str(), &st) == 0);
86 return (stat (dir.c_str(), &st) == 0);
93 if (
dir_exists( base + dealii::Utilities::int_to_string (start, n_digits) ) )
105 return base + dealii::Utilities::int_to_string (index, n_digits);
110 Assert((std::find(name.begin(), name.end(),
' ') == name.end()),
112 std::string cmd =
"mkdir -p " + name;
114 status = std::system(cmd.c_str());
115 AssertThrow(status == 0, ExcCannottExecuteCommand(cmd));
119 bool copy_files(
const std::string &files,
const std::string &destination)
124 std::vector<std::string> strs;
125 std::string new_file;
126 strs = dealii::Utilities::split_string_list(files,
' ');
127 for (
size_t i = 0; i < strs.size(); i++)
130 new_file = destination+
"/"+strs[i];
131 std::string cmd =
"cp " + strs[i] +
" " + new_file;
132 status = std::system( cmd.c_str() );
133 AssertThrow(status == 0, ExcCannottExecuteCommand(cmd));
139 bool copy_file(
const std::string &file,
const std::string &new_file)
142 std::string cmd =
"cp " + file +
" " + new_file ;
144 status = std::system(cmd.c_str());
145 AssertThrow(status == 0, ExcCannottExecuteCommand(cmd));
149 bool rename_file(
const std::string &file,
const std::string &new_file)
152 std::string cmd =
"mv " + file +
" " + new_file;
154 status = std::system(cmd.c_str());
155 AssertThrow(status == 0, ExcCannottExecuteCommand(cmd));
160 #ifdef D2K_WITH_SUNDIALS 162 #ifdef DEAL_II_WITH_MPI 164 #ifdef DEAL_II_WITH_TRILINOS 170 for (
unsigned int i=0; i<is.
n_elements(); ++i)
181 for (
unsigned int i=0; i<is.
n_elements(); ++i)
191 for (
unsigned int i=0; i<is.
n_elements(); ++i)
202 for (
unsigned int i=0; i<is.
n_elements(); ++i)
208 #endif //DEAL_II_WITH_TRILINOS 210 #ifdef DEAL_II_WITH_PETSC 216 for (
unsigned int i=0; i<is.
n_elements(); ++i)
227 for (
unsigned int i=0; i<is.
n_elements(); ++i)
237 for (
unsigned int i=0; i<is.
n_elements(); ++i)
248 for (
unsigned int i=0; i<is.
n_elements(); ++i)
254 #endif //DEAL_II_WITH_PETSC 260 #ifdef DEAL_II_WITH_MPI 265 for (
unsigned int i=0; i<dst.
size(); ++i)
267 #ifdef DEAL_II_WITH_MPI 268 dst[i] = NV_Ith_P(src, i);
270 dst[i] = NV_Ith_S(src, i);
277 #ifdef DEAL_II_WITH_MPI 282 for (
unsigned int i=0; i<src.
size(); ++i)
284 #ifdef DEAL_II_WITH_MPI 285 NV_Ith_P(dst, i) = src[i];
287 NV_Ith_S(dst, i) = src[i];
bool dir_exists(const std::string &dir)
A function to check the existence of dir directory.
#define AssertDimension(dim1, dim2)
void compress(::VectorOperation::values operation)
IndexSet locally_owned_elements() const
void copy(BlockVector< double > &dst, const N_Vector &src)
size_type n_elements() const
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...
void get_start_time()
It sets the start time for a measure.
#define AssertThrow(cond, exc)
std::chrono::high_resolution_clock::time_point t_end
bool rename_file(const std::string &file, const std::string &new_file)
A function to rename a file with a new name new_file.
static::ExceptionBase & ExcMessage(std::string arg1)
void compress(const VectorOperation::values operation)
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 ...
#define Assert(cond, exc)
std::vector< double > times
bool file_exists(const std::string &file)
A function to check the existence of file file.
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) ...
int get_num_measures()
It returns the number of measures done.
void sleep(unsigned int t)
It freezes the thread for t milliseconds.
std::string demangle(const char *name)
Demangle c++ names.
void compress(::VectorOperation::values operation)
bool create_directory(const std::string &name)
A function to create directory.
std::chrono::high_resolution_clock::time_point t_start
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 .
bool copy_file(const std::string &file, const std::string &new_file)
A function to make a copy of file with the name destination.
IndexSet locally_owned_elements() const
void get_end_time()
It sets the end time for a measure.
size_type nth_index_in_set(const unsigned int local_index) const
IndexSet locally_owned_elements() const