PolyDiM
C++ library for POLYtopal DIscretization Methods
Loading...
Searching...
No Matches
Gedim::Output Class Reference

Class to print variables. More...

#include <IOUtilities.hpp>

Public Types

enum  FileFilter { FilesAndDirectories = 0 , Files = 1 , Directories = 2 }
 

Static Public Member Functions

static void CreateFolder (const std::string &nameFolder)
 Creating Folders if not exists.
 
static std::vector< std::string > StringSplit (const std::string &stringToSplit, const char character)
 Split a std::string in more strings dived by character.
 
static bool FileExists (const std::string &nameFile)
 Check if a file exists.
 
static void GetFilePath (const std::string &nameFilePath, std::string &filePath, std::string &fileName, std::string &fileExtension)
 Get the path from a file path.
 
static void GetFileList (const std::string &mainDirectory, std::vector< std::string > &out, const FileFilter &filter=Output::FilesAndDirectories, const bool &hiddenElements=false)
 Returns a list of files/directories in mainDirectory.
 
static void FindPaths (const std::string &mainDirectory, const std::string &objectNameToFind, std::vector< std::string > &paths, const FileFilter &filter=Output::FilesAndDirectories, const bool &hiddenElements=false)
 Returns a list of paths containing the file/directory found in mainDirectory.
 
static void GetBinaryFileSize (const std::string &nameFile, unsigned int &fileSize, const unsigned int &sizeOfSingleDataToWrite, const unsigned int &startingPosition=0)
 
static void ReadBinaryFile (const std::string &nameFile, void *dataToRead, const unsigned int &sizeOfSingleDataToWrite, const unsigned int &dataSizeToRead, const unsigned int &startingPosition=0)
 
static bool ReadBinaryFile (const std::string &nameFile, std::vector< double > &dataToRead, const unsigned int &dataSizeToRead=0, const unsigned int &startingPosition=0)
 
static void WriteBinaryFile (const std::string &nameFile, const void *dataToWrite, const unsigned int &sizeOfSingleDataToWrite, const unsigned int &dataSizeToWrite, const bool &append=false)
 
static bool WriteBinaryFile (const std::string &nameFile, const std::vector< double > &dataToWrite, const unsigned int &dataSizeToWrite=0, const unsigned int &dataStartingPositionToWrite=0, const bool &append=false)
 
static void PrintLine (char character=' ', bool onlyMaster=true)
 Print a line of symbol.
 
static std::ostream & PrintStars (std::ostream &out)
 Print a line of stars * in out.
 
static std::ostream & PrintLines (std::ostream &out)
 Print a line of lines - in out.
 
static void PrintStatusProgram (const std::string &programStep,...)
 Used to print to file, or on screen the status of the program.
 
static void PrintGenericMessageOnLine (const std::string &message,...)
 Used to print only on screen a generic message in the same line.
 
static void PrintGenericMessage (const std::string &message, const bool &onlyMaster,...)
 Used to print to file, or on screen a generic message.
 
static void PrintErrorMessage (const std::string &message, const bool &onlyMaster,...)
 Used to print to file, or on screen an error message.
 
static void PrintWarningMessage (const std::string &message, const bool &onlyMaster,...)
 Used to print to file, or on screen a warning message.
 
static void PrintDebugMessage (const std::string &message, const bool &onlyMaster,...)
 Used to print to file, or on screen a debug message.
 
static void PrintSuccessMessage (const std::string &message, const bool &onlyMaster,...)
 Used to print to file, or on screen a success message.
 
static void Assert (const bool &logicResult)
 Assert for all code, generate exception if something goes wrong.
 
static void Assert (const bool &logicResult, const std::string &message,...)
 Assert for all code, generate exception if something goes wrong with a message.
 

Static Public Attributes

static std::string BlueColor
 
static std::string RedColor
 
static std::string GreenColor
 
static std::string YellowColor
 
static std::string MagentaColor
 
static std::string EndColor
 
static int MaxElementToPrint = 0
 Max elements to print in vectors.
 
static int StartingIndexToPrint = 0
 Starting index to print in vectors.
 

Detailed Description

Class to print variables.

Member Enumeration Documentation

◆ FileFilter

Enumerator
FilesAndDirectories 
Files 
Directories 

Member Function Documentation

◆ Assert() [1/2]

static void Gedim::Output::Assert ( const bool logicResult)
inlinestatic

Assert for all code, generate exception if something goes wrong.

◆ Assert() [2/2]

static void Gedim::Output::Assert ( const bool logicResult,
const std::string &  message,
  ... 
)
static

Assert for all code, generate exception if something goes wrong with a message.

◆ CreateFolder()

void Gedim::Output::CreateFolder ( const std::string &  nameFolder)
static

Creating Folders if not exists.

◆ FileExists()

bool Gedim::Output::FileExists ( const std::string &  nameFile)
static

Check if a file exists.

◆ FindPaths()

void Gedim::Output::FindPaths ( const std::string &  mainDirectory,
const std::string &  objectNameToFind,
std::vector< std::string > &  paths,
const FileFilter filter = Output::FilesAndDirectories,
const bool hiddenElements = false 
)
static

Returns a list of paths containing the file/directory found in mainDirectory.

◆ GetBinaryFileSize()

void Gedim::Output::GetBinaryFileSize ( const std::string &  nameFile,
unsigned int fileSize,
const unsigned int sizeOfSingleDataToWrite,
const unsigned int startingPosition = 0 
)
static

286 Open file

Get file size

◆ GetFileList()

void Gedim::Output::GetFileList ( const std::string &  mainDirectory,
std::vector< std::string > &  out,
const FileFilter filter = Output::FilesAndDirectories,
const bool hiddenElements = false 
)
static

Returns a list of files/directories in mainDirectory.

◆ GetFilePath()

void Gedim::Output::GetFilePath ( const std::string &  nameFilePath,
std::string &  filePath,
std::string &  fileName,
std::string &  fileExtension 
)
static

Get the path from a file path.

◆ PrintDebugMessage()

void Gedim::Output::PrintDebugMessage ( const std::string &  message,
const bool onlyMaster,
  ... 
)
static

Used to print to file, or on screen a debug message.

◆ PrintErrorMessage()

void Gedim::Output::PrintErrorMessage ( const std::string &  message,
const bool onlyMaster,
  ... 
)
static

Used to print to file, or on screen an error message.

◆ PrintGenericMessage()

void Gedim::Output::PrintGenericMessage ( const std::string &  message,
const bool onlyMaster,
  ... 
)
static

Used to print to file, or on screen a generic message.

◆ PrintGenericMessageOnLine()

void Gedim::Output::PrintGenericMessageOnLine ( const std::string &  message,
  ... 
)
static

Used to print only on screen a generic message in the same line.

◆ PrintLine()

void Gedim::Output::PrintLine ( char  character = ' ',
bool  onlyMaster = true 
)
static

Print a line of symbol.

◆ PrintLines()

ostream & Gedim::Output::PrintLines ( std::ostream &  out)
static

Print a line of lines - in out.

◆ PrintStars()

ostream & Gedim::Output::PrintStars ( std::ostream &  out)
static

Print a line of stars * in out.

◆ PrintStatusProgram()

void Gedim::Output::PrintStatusProgram ( const std::string &  programStep,
  ... 
)
static

Used to print to file, or on screen the status of the program.

◆ PrintSuccessMessage()

void Gedim::Output::PrintSuccessMessage ( const std::string &  message,
const bool onlyMaster,
  ... 
)
static

Used to print to file, or on screen a success message.

◆ PrintWarningMessage()

void Gedim::Output::PrintWarningMessage ( const std::string &  message,
const bool onlyMaster,
  ... 
)
static

Used to print to file, or on screen a warning message.

◆ ReadBinaryFile() [1/2]

static bool Gedim::Output::ReadBinaryFile ( const std::string &  nameFile,
std::vector< double > &  dataToRead,
const unsigned int dataSizeToRead = 0,
const unsigned int startingPosition = 0 
)
static

◆ ReadBinaryFile() [2/2]

static void Gedim::Output::ReadBinaryFile ( const std::string &  nameFile,
void dataToRead,
const unsigned int sizeOfSingleDataToWrite,
const unsigned int dataSizeToRead,
const unsigned int startingPosition = 0 
)
static

◆ StringSplit()

vector< string > Gedim::Output::StringSplit ( const std::string &  stringToSplit,
const char  character 
)
static

Split a std::string in more strings dived by character.

◆ WriteBinaryFile() [1/2]

static bool Gedim::Output::WriteBinaryFile ( const std::string &  nameFile,
const std::vector< double > &  dataToWrite,
const unsigned int dataSizeToWrite = 0,
const unsigned int dataStartingPositionToWrite = 0,
const bool append = false 
)
static

◆ WriteBinaryFile() [2/2]

static void Gedim::Output::WriteBinaryFile ( const std::string &  nameFile,
const void dataToWrite,
const unsigned int sizeOfSingleDataToWrite,
const unsigned int dataSizeToWrite,
const bool append = false 
)
static

Member Data Documentation

◆ BlueColor

std::string Gedim::Output::BlueColor
static

◆ EndColor

std::string Gedim::Output::EndColor
static

◆ GreenColor

std::string Gedim::Output::GreenColor
static

◆ MagentaColor

std::string Gedim::Output::MagentaColor
static

◆ MaxElementToPrint

int Gedim::Output::MaxElementToPrint = 0
static

Max elements to print in vectors.

◆ RedColor

std::string Gedim::Output::RedColor
static

◆ StartingIndexToPrint

int Gedim::Output::StartingIndexToPrint = 0
static

Starting index to print in vectors.

◆ YellowColor

std::string Gedim::Output::YellowColor
static

The documentation for this class was generated from the following files: