PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
util::io Namespace Reference

Provides geometrical methods such as point inside rectangle. More...

Data Structures

class  InputParser
 Input command line argument parser. More...
 
class  Logger
 Prints log to std::cout and also write to the file. More...
 
struct  LoggerDeck
 Deck to store log parameters. More...
 
class  Msg
 Collects a message with stream syntax for use in an exception. More...
 

Functions

std::string getTabS (int nt)
 Returns tab spaces of a given size.
 
template<class T >
std::string printStr (const T &msg, int nt=print_default_tab)
 Returns formatted string for output.
 
template<class T >
std::string printStr (const std::vector< T > &list, int nt=print_default_tab)
 Returns formatted string for output.
 
template<>
std::string printStr (const std::vector< util::Point > &list, int nt)
 Returns formatted string for output.
 
template<typename T , typename U >
std::string printStr (const std::map< T, U > &map, int nt=print_default_tab)
 Returns formatted string for output.
 
template<class T >
void print (const T &msg, int nt=print_default_tab, int printMpiRank=print_default_mpi_rank)
 Prints formatted information.
 
template<class T >
void print (const std::vector< T > &list, int nt=print_default_tab, int printMpiRank=print_default_mpi_rank)
 Prints formatted information.
 
template<class T >
std::string printStr (const std::vector< std::vector< T > > &list, int nt=print_default_tab)
 Returns formatted string for output.
 
template<class T >
void print (const std::vector< std::vector< T > > &list, int nt=print_default_tab, int printMpiRank=print_default_mpi_rank)
 Prints formatted information.
 
std::string printBoxStr (const std::pair< util::Point, util::Point > &box, int nt=print_default_tab)
 Returns formatted string for output.
 
void printBox (const std::pair< util::Point, util::Point > &box, int nt=print_default_tab, int printMpiRank=print_default_mpi_rank)
 Prints formatted string for output.
 
std::string printBoxStr (const std::pair< std::vector< double >, std::vector< double > > &box, int nt=print_default_tab)
 Returns formatted string for output.
 
void printBox (const std::pair< std::vector< double >, std::vector< double > > &box, int nt=print_default_tab, int printMpiRank=print_default_mpi_rank)
 Prints formatted string for output.
 
void initLogger (int debug_level=logger_default_debug_lvl, std::string filename="")
 Initializes the logger.
 
void log (std::ostringstream &oss, bool screen_out=false, int printMpiRank=print_default_mpi_rank)
 Global method to log the message.
 
void log (const std::string &str, bool screen_out=false, int printMpiRank=print_default_mpi_rank)
 Global method to log the message.
 
bool logEnabled (int priority, bool check_condition=true, int override_priority=-1)
 True if a message at this priority would be logged (uses LoggerDeck::d_debugLevel)
 
void log (int priority, const std::string &str, bool check_condition=true, int override_priority=-1, bool screen_out=false)
 Log if LoggerDeck debug level passes the priority gate.
 
void log (int priority, std::ostringstream &oss, bool check_condition=true, int override_priority=-1, bool screen_out=false)
 
std::string getFilenameFromPath (std::string const &path, std::string const &delims="/\\")
 Get filename removing path from the string Source - https://stackoverflow.com/a/24386991.
 
std::string removeExtensionFromFile (std::string const &filename)
 Remove extension from the filename Source - https://stackoverflow.com/a/24386991.
 
std::string getExtensionFromFile (std::string const &filename)
 Get extension from the filename.
 
std::string checkAndCreateNewFilename (std::string const &filename, std::string filename_ext)
 Check for extension and if possible create new filename from a given filename and a given extension.
 
bool isFileEmpty (std::string filename)
 Check if file is empty or null.
 
bool isFileEmpty (std::ifstream &pFile)
 Check if file is empty or null.
 

Variables

const int print_default_tab = 0
 Default value of tab used in outputting formatted information.
 
const int print_default_mpi_rank = 0
 Default mpi rank in printing information.
 
const int logger_default_debug_lvl = 5
 Default debug level for logger.
 

Detailed Description

Provides geometrical methods such as point inside rectangle.

Provides utility function for input and output.

Function Documentation

◆ checkAndCreateNewFilename()

std::string util::io::checkAndCreateNewFilename ( std::string const &  filename,
std::string  filename_ext 
)
inline

Check for extension and if possible create new filename from a given filename and a given extension.

Parameters
filenameFilename with/without extension
filename_extExtension to check for and append if needed
Returns
string New filename if successful

Definition at line 366 of file io.h.

367{
368 auto f_ext = util::io::getExtensionFromFile(filename);
369 std::string f = filename;
370 if (f_ext.empty()) {
371 f = f + "." + filename_ext;
372 }
373 else {
374 if (f_ext != filename_ext) {
375 throw std::runtime_error(
377 << "checkAndCreateNewFilename(): Argument filename = "
378 << filename << " has extension = "
379 << f_ext << " which does not match expected extension = "
380 << filename_ext << std::endl);
381 }
382 }
383
384 return f;
385}
Collects a message with stream syntax for use in an exception.
Definition io.h:52
std::string getExtensionFromFile(std::string const &filename)
Get extension from the filename.
Definition io.h:351

References getExtensionFromFile().

Referenced by rw::writer::MshWriter::MshWriter(), rw::reader::VtkParticleReader::VtkParticleReader(), and rw::reader::VtkReader::VtkReader().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getExtensionFromFile()

std::string util::io::getExtensionFromFile ( std::string const &  filename)
inline

Get extension from the filename.

Parameters
filenameFilename with extension
Returns
string Extension

Definition at line 351 of file io.h.

352{
353 typename std::string::size_type const p(filename.find_last_of('.'));
354
355 //return filename.substr(p + 1);
356 return p > 0 && p != std::string::npos ? filename.substr(p+1) : "";
357}

Referenced by checkAndCreateNewFilename(), mesh::Mesh::createData(), and mesh::Mesh::readElementData().

Here is the caller graph for this function:

◆ getFilenameFromPath()

std::string util::io::getFilenameFromPath ( std::string const &  path,
std::string const &  delims = "/\\" 
)
inline

Get filename removing path from the string Source - https://stackoverflow.com/a/24386991.

Parameters
pathFilename with path
delimsDelimiter to separate the filename from the path
Returns
string Filename

Definition at line 327 of file io.h.

328{
329 return path.substr(path.find_last_of(delims) + 1);
330}

Referenced by test::testGraphPartitioning(), and test::testMPI().

Here is the caller graph for this function:

◆ getTabS()

std::string util::io::getTabS ( int  nt)
inline

Returns tab spaces of a given size.

Parameters
ntNumber of tabs
Returns
string Tab spaces

Definition at line 82 of file io.h.

82 {
83 std::string tabS = "";
84 for (int i = 0; i < nt; i++)
85 tabS += "\t";
86
87 return tabS;
88};

Referenced by printBoxStr(), printBoxStr(), printStr(), printStr(), printStr(), printStr(), printStr(), geom::GeomObject::printStr(), material::BaseInfluenceFn::printStr(), material::Material::printStr(), geom::AnnulusGeomObject::printStr(), geom::ComplexGeomObject::printStr(), geom::NullGeomObject::printStr(), geom::Plane::printStr(), geom::Line::printStr(), geom::Triangle::printStr(), geom::Square::printStr(), geom::Rectangle::printStr(), geom::Hexagon::printStr(), geom::Drum2D::printStr(), geom::Cube::printStr(), geom::Cuboid::printStr(), geom::Circle::printStr(), geom::Ellipse::printStr(), geom::Sphere::printStr(), geom::Ellipsoid::printStr(), geom::Cylinder::printStr(), material::ConstInfluenceFn::printStr(), material::LinearInfluenceFn::printStr(), material::GaussianInfluenceFn::printStr(), material::RnpMaterial::printStr(), material::PmbMaterial::printStr(), material::PdElastic::printStr(), material::PdState::printStr(), fe::QuadData::printStr(), geometry::Fracture::printStr(), geom::GeomData::printStr(), geom::ParticleTransform::printStr(), inp::BCBaseDeck::printStr(), inp::BCDeck::printStr(), inp::ContactDeck::printStr(), inp::ContactPairDeck::printStr(), inp::Input::printStr(), inp::MatData::printStr(), inp::MaterialDeck::printStr(), inp::MeshDeck::printStr(), inp::ModelDeck::printStr(), inp::OutputDeck::printStr(), inp::ParticleDeck::printStr(), inp::PGenDeck::printStr(), inp::PNeighborDeck::printStr(), inp::RestartDeck::printStr(), inp::TestDeck::printStr(), mesh::Mesh::printStr(), particle::BaseParticle::printStr(), particle::RefParticle::printStr(), geom::OpenCuboidChannel3D::printStr(), geom::OpenRectChannel2D::printStr(), and rw::writeOutput().

◆ initLogger()

void util::io::initLogger ( int  debug_level = logger_default_debug_lvl,
std::string  filename = "" 
)

Initializes the logger.

Parameters
debug_levelSpecify debug level/verbosity
filenameSpecify filename for logs

Definition at line 18 of file io.cpp.

18 {
19
20 if (logger_p != nullptr)
21 return;
22
23 auto deck = new LoggerDeck(debug_level, filename);
24 logger_p = new Logger(deck);
25}
Prints log to std::cout and also write to the file.
Definition logger.h:23
util::io::Logger * logger_p
Definition io.cpp:15
Deck to store log parameters.
Definition loggerDeck.h:22

References anonymous_namespace{io.cpp}::logger_p.

Referenced by main(), and PeriDEMModel::PeriDEMModel().

Here is the caller graph for this function:

◆ isFileEmpty() [1/2]

bool util::io::isFileEmpty ( std::ifstream &  pFile)
inline

Check if file is empty or null.

Parameters
pFileFile stream
Returns
bool True if file is empty

Definition at line 404 of file io.h.

404 {
405 return pFile.peek() == std::ifstream::traits_type::eof();
406}

◆ isFileEmpty() [2/2]

bool util::io::isFileEmpty ( std::string  filename)
inline

Check if file is empty or null.

Parameters
filenameFilename with/without extension
Returns
bool True if file is empty

Definition at line 393 of file io.h.

393 {
394 std::ifstream pFile(filename);
395 return pFile.peek() == std::ifstream::traits_type::eof();
396}

Referenced by rw::reader::MshReader::readCells(), rw::reader::MshReader::readMesh(), and rw::reader::MshReader::readNodes().

Here is the caller graph for this function:

◆ log() [1/4]

void util::io::log ( const std::string &  str,
bool  screen_out = false,
int  printMpiRank = print_default_mpi_rank 
)

Global method to log the message.

Parameters
strMessage
screen_outSpecify if it goes to std::cout as well
printMpiRankMPI rank to do log/print. Negative value means all ranks log.

Definition at line 27 of file io.cpp.

27 {
28
29 // The logger is created if it does not exist rather than asserting.
30 /*
31 //assert((logger_p != nullptr) && "logger_p "
32 // "(pointer of type util::io::Logger) is not initialized. "
33 // "Call util::io::initLogger(debug_level, log_filename) once at the beginning.");
34 */
35 if (logger_p == nullptr)
36 logger_p = new Logger();
37
38 logger_p->log(str, screen_out, printMpiRank);
39}
void log(std::ostringstream &oss, bool screen_out=false, int printMpiRank=print_default_mpi_rank)
Log the message.
Definition logger.h:50

References util::io::Logger::log(), and anonymous_namespace{io.cpp}::logger_p.

Here is the call graph for this function:

◆ log() [2/4]

void util::io::log ( int  priority,
const std::string &  str,
bool  check_condition = true,
int  override_priority = -1,
bool  screen_out = false 
)

Log if LoggerDeck debug level passes the priority gate.

Definition at line 64 of file io.cpp.

65 {
66 if (logEnabled(priority, check_condition, override_priority))
67 log(str, screen_out);
68}
bool logEnabled(int priority, bool check_condition=true, int override_priority=-1)
True if a message at this priority would be logged (uses LoggerDeck::d_debugLevel)
Definition io.cpp:55
void log(std::ostringstream &oss, bool screen_out=false, int printMpiRank=print_default_mpi_rank)
Global method to log the message.
Definition io.cpp:41

References log(), and logEnabled().

Here is the call graph for this function:

◆ log() [3/4]

void util::io::log ( int  priority,
std::ostringstream &  oss,
bool  check_condition = true,
int  override_priority = -1,
bool  screen_out = false 
)

Definition at line 70 of file io.cpp.

71 {
72 if (logEnabled(priority, check_condition, override_priority))
73 log(oss, screen_out);
74 else {
75 oss.str("");
76 oss.clear();
77 }
78}

References log(), and logEnabled().

Here is the call graph for this function:

◆ log() [4/4]

void util::io::log ( std::ostringstream &  oss,
bool  screen_out = false,
int  printMpiRank = print_default_mpi_rank 
)

Global method to log the message.

Parameters
ossMessage
screen_outSpecify if it goes to std::cout as well
printMpiRankMPI rank to do log/print. Negative value means all ranks log.

Definition at line 41 of file io.cpp.

41 {
42
43 // The logger is created if it does not exist rather than asserting.
44 /*
45 //assert((logger_p != nullptr) && "logger_p "
46 // "(pointer of type util::io::Logger) is not initialized. "
47 // "Call util::io::initLogger(debug_level, log_filename) once at the beginning.");
48 */
49 if (logger_p == nullptr)
50 logger_p = new Logger();
51
52 logger_p->log(oss, screen_out, printMpiRank);
53}

References util::io::Logger::log(), and anonymous_namespace{io.cpp}::logger_p.

Referenced by contact::Damping::apply(), anonymous_namespace{testMeshGen.cpp}::builtinMeshCheckForGeometry(), postprocess::Postprocess::checkStop(), contact::Contact::computeForces(), pd::computeForces(), mesh::Mesh::createData(), particle::createParticlesFromFile(), particle::createParticleUsingParticleZoneGeomObject(), particle::createReferenceParticles(), mesh::Mesh::finalizeMeshDerivedFieldsFromCurrentNodes(), PeriDEMModel::log(), log(), log(), PeriDEMModel::log(), main(), mesh::Mesh::readElementData(), contact::Contact::setup(), anonymous_namespace{testMeshGen.cpp}::testCircleMeshWritesFiles(), contact::Contact::updateSearchParameters(), and rw::writeOutput().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ logEnabled()

bool util::io::logEnabled ( int  priority,
bool  check_condition = true,
int  override_priority = -1 
)

True if a message at this priority would be logged (uses LoggerDeck::d_debugLevel)

Definition at line 55 of file io.cpp.

56 {
57 int dbg = 0;
58 if (logger_p != nullptr && logger_p->d_deck_p != nullptr)
60 int op = override_priority == -1 ? priority : override_priority;
61 return (check_condition && dbg > priority) || dbg > op;
62}
LoggerDeck * d_deck_p
Pointer to logger deck.
Definition logger.h:82
int d_debugLevel
Debug level.
Definition loggerDeck.h:24

References util::io::LoggerDeck::d_debugLevel, util::io::Logger::d_deck_p, and anonymous_namespace{io.cpp}::logger_p.

Referenced by log(), and log().

Here is the caller graph for this function:

◆ print() [1/3]

template<class T >
void util::io::print ( const std::vector< std::vector< T > > &  list,
int  nt = print_default_tab,
int  printMpiRank = print_default_mpi_rank 
)
inline

Prints formatted information.

Parameters
listList of objects
ntNumber of tabs
printMpiRankMPI rank to do log/print. Negative value means all ranks log.

Definition at line 217 of file io.h.

219 {
220
221 if (printMpiRank < 0 or util::parallel::mpiRank() == printMpiRank)
222 std::cout << printStr(list, nt);
223};
std::string printStr(const T &msg, int nt=print_default_tab)
Returns formatted string for output.
Definition io.h:96
int mpiRank()
get rank (id) of this processor

References util::parallel::mpiRank(), and printStr().

Here is the call graph for this function:

◆ print() [2/3]

template<class T >
void util::io::print ( const std::vector< T > &  list,
int  nt = print_default_tab,
int  printMpiRank = print_default_mpi_rank 
)
inline

Prints formatted information.

Parameters
listList of objects
ntNumber of tabs
printMpiRankMPI rank to do log/print. Negative value means all ranks log.

Definition at line 183 of file io.h.

184 {
185 if (printMpiRank < 0 or util::parallel::mpiRank() == printMpiRank)
186 std::cout << printStr(list, nt);
187};

References util::parallel::mpiRank(), and printStr().

Here is the call graph for this function:

◆ print() [3/3]

template<class T >
void util::io::print ( const T &  msg,
int  nt = print_default_tab,
int  printMpiRank = print_default_mpi_rank 
)
inline

Prints formatted information.

Parameters
msgMessage
ntNumber of tabs
printMpiRankMPI rank to do log/print. Negative value means all ranks log.

Definition at line 171 of file io.h.

172 {
173 if (printMpiRank < 0 or util::parallel::mpiRank() == printMpiRank)
174 std::cout << printStr(msg, nt);
175};

References util::parallel::mpiRank(), and printStr().

Referenced by anonymous_namespace{main.cpp}::ContactWitness::assertOk(), particle::assignMpiOwners(), anonymous_namespace{main.cpp}::buildInputJson(), anonymous_namespace{main.cpp}::buildInputJson(), anonymous_namespace{main.cpp}::buildInputJson(), anonymous_namespace{main.cpp}::GrainContactProbe::checkStop(), anonymous_namespace{testParallelCompLib.cpp}::exchangeDispData(), main(), anonymous_namespace{main.cpp}::runLaw(), pd::setupDofPartition(), test::testMPI(), and test::testTaskflow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printBox() [1/2]

void util::io::printBox ( const std::pair< std::vector< double >, std::vector< double > > &  box,
int  nt = print_default_tab,
int  printMpiRank = print_default_mpi_rank 
)
inline

Prints formatted string for output.

Parameters
boxPair of corner points of box
ntNumber of tabs to prefix
printMpiRankMPI rank to do log/print. Negative value means all ranks log.

Definition at line 271 of file io.h.

272 {
273 if (printMpiRank < 0 or util::parallel::mpiRank() == printMpiRank)
274 std::cout << printBoxStr(box, nt);
275};
std::string printBoxStr(const std::pair< util::Point, util::Point > &box, int nt=print_default_tab)
Returns formatted string for output.
Definition io.h:231

References util::parallel::mpiRank(), and printBoxStr().

Here is the call graph for this function:

◆ printBox() [2/2]

void util::io::printBox ( const std::pair< util::Point, util::Point > &  box,
int  nt = print_default_tab,
int  printMpiRank = print_default_mpi_rank 
)
inline

Prints formatted string for output.

Parameters
boxPair of corner points of box
ntNumber of tabs to prefix
printMpiRankMPI rank to do log/print. Negative value means all ranks log.

Definition at line 247 of file io.h.

249 {
250 if (printMpiRank < 0 or util::parallel::mpiRank() == printMpiRank)
251 std::cout << printBoxStr(box, nt);
252};

References util::parallel::mpiRank(), and printBoxStr().

Here is the call graph for this function:

◆ printBoxStr() [1/2]

std::string util::io::printBoxStr ( const std::pair< std::vector< double >, std::vector< double > > &  box,
int  nt = print_default_tab 
)
inline

Returns formatted string for output.

Parameters
boxPair of corner points of box
ntNumber of tabs to prefix
Returns
string Formatted string

Definition at line 256 of file io.h.

257 {
258 auto tabS = getTabS(nt);
259 std::ostringstream oss;
260 oss << tabS << "Corner point 1 = (" << printStr<double>(box.first, 0)
261 << ")" << std::endl;
262 oss << tabS << "Corner point 2 = (" << printStr<double>(box.second, 0)
263 << ")" << std::endl;
264
265 return oss.str();
266};
std::string getTabS(int nt)
Returns tab spaces of a given size.
Definition io.h:82

References getTabS().

Here is the call graph for this function:

◆ printBoxStr() [2/2]

std::string util::io::printBoxStr ( const std::pair< util::Point, util::Point > &  box,
int  nt = print_default_tab 
)
inline

Returns formatted string for output.

Parameters
boxPair of corner points of box
ntNumber of tabs to prefix
Returns
string Formatted string

Definition at line 231 of file io.h.

232 {
233 auto tabS = getTabS(nt);
234 std::ostringstream oss;
235 oss << tabS << "Corner point 1 = " << box.first.printStr(nt, 0) << std::endl;
236 oss << tabS << "Corner point 2 = " << box.second.printStr(nt, 0) << std::endl;
237
238 return oss.str();
239};

References getTabS().

Referenced by printBox(), printBox(), geom::AnnulusGeomObject::printStr(), geom::ComplexGeomObject::printStr(), geom::Line::printStr(), geom::Square::printStr(), geom::Rectangle::printStr(), geom::Cube::printStr(), geom::Cuboid::printStr(), geom::Circle::printStr(), geom::Ellipse::printStr(), geom::Sphere::printStr(), geom::Ellipsoid::printStr(), geom::Cylinder::printStr(), and mesh::Mesh::printStr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printStr() [1/5]

template<typename T , typename U >
std::string util::io::printStr ( const std::map< T, U > &  map,
int  nt = print_default_tab 
)
inline

Returns formatted string for output.

Parameters
mapList of objects
ntNumber of tabs to prefix
Returns
string Formatted string

Definition at line 150 of file io.h.

151 {
152
153 auto tabS = getTabS(nt);
154 std::ostringstream oss;
155 oss << tabS;
156 for (const auto &l : map) {
157 oss << "{" << l.first << " : " << l.second << "}";
158 if (std::next(&l) != map.cend())
159 oss << ", ";
160 }
161
162 return oss.str();
163 };

References getTabS().

Here is the call graph for this function:

◆ printStr() [2/5]

template<class T >
std::string util::io::printStr ( const std::vector< std::vector< T > > &  list,
int  nt = print_default_tab 
)
inline

Returns formatted string for output.

Parameters
listList of objects
ntNumber of tabs to prefix
Returns
string Formatted string

Definition at line 191 of file io.h.

192 {
193
194 auto tabS = getTabS(nt);
195 std::ostringstream oss;
196 oss << tabS;
197 size_t i = 0;
198 for (auto l : list) {
199 oss << "(";
200 for (size_t k = 0; k < l.size(); k++) {
201 oss << l[k];
202 if (k < l.size() - 1)
203 oss << ", ";
204 }
205 oss << ")";
206
207 i++;
208 if (i != list.size())
209 oss << ", ";
210 }
211
212 return oss.str();
213}

References getTabS().

Here is the call graph for this function:

◆ printStr() [3/5]

template<class T >
std::string util::io::printStr ( const std::vector< T > &  list,
int  nt = print_default_tab 
)
inline

Returns formatted string for output.

Parameters
listList of objects
ntNumber of tabs to prefix
Returns
string Formatted string

Definition at line 109 of file io.h.

110 {
111
112 auto tabS = getTabS(nt);
113 std::ostringstream oss;
114 oss << tabS;
115 size_t i = 0;
116 for (auto l : list) {
117 oss << l;
118 i++;
119 if (i != list.size())
120 oss << ", ";
121 }
122
123 return oss.str();
124};

References getTabS().

Here is the call graph for this function:

◆ printStr() [4/5]

template<>
std::string util::io::printStr ( const std::vector< util::Point > &  list,
int  nt 
)
inline

Returns formatted string for output.

Parameters
listList of objects
ntNumber of tabs to prefix
Returns
string Formatted string

Definition at line 127 of file io.h.

128 {
129
130 auto tabS = getTabS(nt);
131 std::ostringstream oss;
132 oss << tabS;
133 size_t i = 0;
134 for (auto l : list) {
135 oss << "(" << l[0] << ", " << l[1] << ", " << l[2] << ")";
136 i++;
137 if (i != list.size())
138 oss << ", ";
139 }
140
141 return oss.str();
142};

References getTabS().

Here is the call graph for this function:

◆ printStr() [5/5]

template<class T >
std::string util::io::printStr ( const T &  msg,
int  nt = print_default_tab 
)
inline

Returns formatted string for output.

Parameters
msgMessage
ntNumber of tabs to prefix
Returns
string Formatted string

Definition at line 96 of file io.h.

96 {
97
98 std::ostringstream oss;
99 oss << getTabS(nt) << msg;
100 return oss.str();
101};

References getTabS().

Referenced by util::checkMatrix(), mesh::Mesh::computeVol(), geom::createGeomObjectOld(), print(), print(), print(), anonymous_namespace{complexGeomObjects.cpp}::printErrMsg(), anonymous_namespace{geomObjects.cpp}::printErrMsg(), anonymous_namespace{geomObjectsUtil.cpp}::printErrMsg(), geom::Triangle::printStr(), geom::Square::printStr(), geom::Rectangle::printStr(), geom::Hexagon::printStr(), geom::Drum2D::printStr(), geom::Cube::printStr(), geom::Cuboid::printStr(), fe::QuadData::printStr(), geom::GeomData::printStr(), geom::OpenRectChannel2D::printStr(), test::testTetElem(), and rw::writeOutput().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeExtensionFromFile()

std::string util::io::removeExtensionFromFile ( std::string const &  filename)
inline

Remove extension from the filename Source - https://stackoverflow.com/a/24386991.

Parameters
filenameFilename with extension
Returns
string Filename without extension

Definition at line 339 of file io.h.

340{
341 typename std::string::size_type const p(filename.find_last_of('.'));
342 return p > 0 && p != std::string::npos ? filename.substr(0, p) : filename;
343}

Referenced by mesh_gen::createParticleMesh(), anonymous_namespace{particleMesh.cpp}::maybeWriteMeshFile(), test::testGraphPartitioning(), and test::testMPI().

Here is the caller graph for this function:

Variable Documentation

◆ logger_default_debug_lvl

const int util::io::logger_default_debug_lvl = 5

Default debug level for logger.

Definition at line 24 of file constants.h.

◆ print_default_mpi_rank

const int util::io::print_default_mpi_rank = 0

Default mpi rank in printing information.

Definition at line 21 of file constants.h.

◆ print_default_tab

const int util::io::print_default_tab = 0

Default value of tab used in outputting formatted information.

Definition at line 18 of file constants.h.

Referenced by anonymous_namespace{testParallelCompLib.cpp}::exchangeDispData(), and test::testMPI().