#include <deal2lkit/config.h>
#include <deal.II/base/utilities.h>
#include <deal.II/base/smartpointer.h>
#include <deal.II/base/exceptions.h>
#include <deal.II/base/timer.h>
#include <deal.II/fe/fe.h>
#include <deal.II/base/std_cxx11/shared_ptr.h>
#include <typeinfo>
#include <cxxabi.h>
#include <sstream>
#include <sys/ioctl.h>
#include <chrono>
#include <stdio.h>
#include <deal.II/lac/block_vector.h>
#include <nvector/nvector_serial.h>
#include <deal.II/base/index_set.h>
Go to the source code of this file.
Classes | |
class | TimeUtilities |
This function collects some time utilities. More... | |
class | OverWriteStream< Stream > |
This class uses n_lines lines of stream_out to show the output. More... | |
class | OverWriteStream< Stream > |
This class uses n_lines lines of stream_out to show the output. More... | |
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... | |
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. More... | |
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. More... | |
bool | dir_exists (const std::string &dir) |
A function to check the existence of dir directory. More... | |
bool | file_exists (const std::string &file) |
A function to check the existence of file file. 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 &files, const std::string &destination) |
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... | |
DeclException1 (ExcCannottExecuteCommand, std::string,<< "Cannot execute command "<< arg1<< "\Please verify you have "<< "the needed permissions.") | |
Cannot execute std::system(command) More... | |
template<typename S , typename T > | |
OverWriteStream< S > & | operator<< (OverWriteStream< S > &output_stream, const T &t) |
template<class T > | |
std::vector< T > | unique (const std::vector< T > &myvector) |
A simple function that accepts a vector as an input and returns a second vector containing only the unique value among consecutive entries of the original vector. More... | |
template<class Type > | |
std::string | print (const std::vector< Type > &list, const std::string sep=",") |
Return a string containing the content of the vector, with elements separated by the @ sep parameter. More... | |
template<int dim> | |
std::string | print (const Point< dim > &point, const std::string sep=",") |
Return a string containing the content of the Point, with elements separated by the @ sep parameter. More... | |
template<class T > | |
std::string | type (const T &t) |
Return a human readable name of the type passed as argument. More... | |
template<class T > | |
shared_ptr< T > | SP (T *t) |
Construct a shared pointer to a non const class T. More... | |
template<class T > | |
shared_ptr< const T > | SP (const T *t) |
Construct a shared pointer to a const class T. More... | |
template<typename VEC > | |
void | vector_shift (VEC &in_vec, double a_scalar) |
A simple class to shift a vector by a scalar. More... | |
void | copy (BlockVector< double > &dst, const N_Vector &src) |
void | copy (N_Vector &dst, const BlockVector< double > &src) |
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.
void copy | ( | BlockVector< double > & | dst, |
const N_Vector & | src | ||
) |
Definition at line 258 of file utilities.cc.
void copy | ( | N_Vector & | dst, |
const BlockVector< double > & | src | ||
) |
Definition at line 275 of file utilities.cc.
bool copy_file | ( | const std::string & | files, |
const std::string & | destination | ||
) |
A function to make a copy of file
with the name destination
.
Definition at line 139 of file utilities.cc.
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.
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.
DeclException1 | ( | ExcCannottExecuteCommand | , |
std::string | , | ||
<< "Cannot execute command "<< arg1<< "\ease verify you have "<< "the needed permissions." | |||
) |
Cannot execute std::system(command)
std::string demangle | ( | const char * | name | ) |
Demangle c++ names.
Definition at line 28 of file utilities.cc.
bool dir_exists | ( | const std::string & | dir | ) |
A function to check the existence of dir
directory.
Definition at line 83 of file utilities.cc.
bool file_exists | ( | const std::string & | file | ) |
A function to check the existence of file
file.
Definition at line 77 of file utilities.cc.
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.
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.
|
inline |
Definition at line 395 of file utilities.h.
std::string print | ( | const std::vector< Type > & | list, |
const std::string | sep = "," |
||
) |
Return a string containing the content of the vector, with elements separated by the @ sep parameter.
Definition at line 425 of file utilities.h.
std::string print | ( | const Point< dim > & | point, |
const std::string | sep = "," |
||
) |
Return a string containing the content of the Point, with elements separated by the @ sep parameter.
Definition at line 443 of file utilities.h.
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.
|
inline |
Construct a shared pointer to a non const class T.
This is a convenience function to simplify the construction of shared pointers:
code
std_cxx11::shared_ptr<MyClass> my_ptr;
...
my_ptr = SP(new MyClass);
Definition at line 483 of file utilities.h.
|
inline |
Construct a shared pointer to a const class T.
This is a convenience function to simplify the construction of shared pointers (which should replace dealii::SmartPointers):
code
std_cxx11::shared_ptr<const MyClass> my_ptr;
... const MyClass * p = new MyClass; my_ptr = SP(p);
Definition at line 505 of file utilities.h.
std::string type | ( | const T & | t | ) |
Return a human readable name of the type passed as argument.
Definition at line 461 of file utilities.h.
std::vector<T> unique | ( | const std::vector< T > & | myvector | ) |
A simple function that accepts a vector as an input and returns a second vector containing only the unique value among consecutive entries of the original vector.
Definition at line 412 of file utilities.h.
void vector_shift | ( | VEC & | in_vec, |
double | a_scalar | ||
) |
A simple class to shift a vector by a scalar.
This function is deprecated in deal but needed in many codes
Definition at line 516 of file utilities.h.