Functions
oomph::StringConversion Namespace Reference

Conversion functions for easily making strings (e.g. for filenames - to avoid stack smashing problems with cstrings and long filenames). More...

Functions

std::string to_lower (const std::string &input)
 Convert a string to lower case (outputs a copy). More...
 
std::string to_upper (const std::string &input)
 Convert a string to upper case (outputs a copy). More...
 
void split_string (const std::string &s, char delim, Vector< std::string > &elems)
 Split a string, s, into a vector of strings where ever there is an instance of delimiter (i.e. is delimiter is " " will give a list of words). Note that mutliple delimiters in a row will give empty strings. More...
 
Vector< std::string > split_string (const std::string &s, char delim)
 Split a string, s, into a vector of strings where ever there is an instance of delimiter (i.e. is delimiter is " " will give a list of words). Note that mutliple delimiters in a row will give empty strings. Return by value. More...
 
template<class T >
std::string to_string (T object, unsigned float_precision=8)
 Conversion function that should work for anything with operator<< defined (at least all basic types). More...
 

Detailed Description

Conversion functions for easily making strings (e.g. for filenames - to avoid stack smashing problems with cstrings and long filenames).

Function Documentation

◆ split_string() [1/2]

Vector< std::string > oomph::StringConversion::split_string ( const std::string &  s,
char  delim 
)

Split a string, s, into a vector of strings where ever there is an instance of delimiter (i.e. is delimiter is " " will give a list of words). Note that mutliple delimiters in a row will give empty strings. Return by value.

Split a string, s, into a vector of strings where ever there is an instance of delimiter (i.e. is delimiter is " " will give a list of words). Note that multiple delimiters in a row will give empty strings. Return by value.

Definition at line 390 of file oomph_utilities.cc.

References s, and split_string().

◆ split_string() [2/2]

void oomph::StringConversion::split_string ( const std::string &  s,
char  delim,
Vector< std::string > &  elems 
)

Split a string, s, into a vector of strings where ever there is an instance of delimiter (i.e. is delimiter is " " will give a list of words). Note that mutliple delimiters in a row will give empty strings.

Split a string, s, into a vector of strings where ever there is an instance of delimiter (i.e. is delimiter is " " will give a list of words). Note that multiple delimiters in a row will give empty strings.

Definition at line 373 of file oomph_utilities.cc.

References s, and oomph::Global_string_for_annotation::string().

Referenced by split_string().

◆ to_lower()

std::string oomph::StringConversion::to_lower ( const std::string &  input)

Convert a string to lower case (outputs a copy).

Definition at line 345 of file oomph_utilities.cc.

References oomph::CommandLineArgs::output(), and oomph::Global_string_for_annotation::string().

◆ to_string()

template<class T >
std::string oomph::StringConversion::to_string ( object,
unsigned  float_precision = 8 
)

Conversion function that should work for anything with operator<< defined (at least all basic types).

Definition at line 189 of file oomph_utilities.h.

Referenced by oomph::IMRByBDF::actions_after_timestep(), oomph::RefineableGmshTetMesh< ELEMENT >::adapt(), oomph::SumOfMatrices::add_matrix(), oomph::Problem::calculate_predictions(), oomph::GmshTetScaffoldMesh::create_mesh_from_msh_file(), oomph::GeneralPurposeBlockPreconditioner< MATRIX >::fill_in_subsidiary_preconditioners(), oomph::TypeNames::get_type_name(), oomph::AddedMainNumberingLookup::main_to_added(), oomph::NodeOrdering::node_global_position_comparison(), oomph::DocInfo::number_as_string(), oomph::BlockPreconditioner< MATRIX >::output_blocks_to_files(), oomph::AdvectionDiffusionEquations< DIM >::scalar_name_paraview(), oomph::AxisymAdvectionDiffusionEquations::scalar_name_paraview(), oomph::AxisymmetricNavierStokesTractionElement< ELEMENT >::scalar_name_paraview(), oomph::AxisymmetricNavierStokesEquations::scalar_name_paraview(), oomph::GeneralisedNewtonianAxisymmetricNavierStokesEquations::scalar_name_paraview(), oomph::GeneralisedNewtonianNavierStokesEquations< DIM >::scalar_name_paraview(), oomph::FiniteElement::scalar_name_paraview(), oomph::BuoyantQCrouzeixRaviartElement< DIM >::scalar_name_paraview(), oomph::RefineableBuoyantQCrouzeixRaviartElement< DIM >::scalar_name_paraview(), oomph::NavierStokesEquations< DIM >::scalar_name_paraview(), oomph::VorticitySmootherElement< ELEMENT >::scalar_name_paraview(), oomph::SpaceTimeNavierStokesEquations< DIM >::scalar_name_paraview(), oomph::SpaceTimeNavierStokesMixedOrderEquations< DIM >::scalar_name_paraview(), oomph::Time::time(), and oomph::EBDF3::timestep().

◆ to_upper()

std::string oomph::StringConversion::to_upper ( const std::string &  input)

Convert a string to upper case (outputs a copy).

Definition at line 358 of file oomph_utilities.cc.

References oomph::CommandLineArgs::output(), and oomph::Global_string_for_annotation::string().