Nektar++
|
#include <ParseUtils.h>
Public Member Functions | |
template<> | |
bool | GenerateVector (const std::string &str, std::vector< std::string > &out) |
Specialised version of ParseUtils::GenerateVector for std::string. More... | |
Static Public Member Functions | |
static bool | GenerateSeqVector (const std::string &str, std::vector< unsigned int > &out) |
Takes a comma-separated compressed string and converts it to entries in a vector. More... | |
template<typename T > | |
static bool | GenerateVector (const std::string &str, std::vector< T > &out) |
Takes a comma-separated string and converts it to entries in a vector. More... | |
template<typename T > | |
static std::string | GenerateSeqString (const std::vector< T > &v) |
Generate a compressed comma-separated string representation of a vector of unsigned integers. More... | |
Definition at line 46 of file ParseUtils.h.
|
inlinestatic |
Generate a compressed comma-separated string representation of a vector of unsigned integers.
This utility routine takes entries of v
and returns a string sequence. For example,
std::vector<unsigned int> vec = {1,2,3,4,6,7,8,5,2,3}; std::string output = ParseUtils::GenerateVector(vec);
will produce an output
string containing 1-4,6-8,5,2,3
.
v | Vector of unsigned integers. |
Definition at line 71 of file ParseUtils.h.
Referenced by Nektar::SolverUtils::DriverAdaptive::ReplaceExpansion(), Nektar::LibUtilities::FieldIOXml::v_Write(), and Nektar::LibUtilities::FieldIOXml::WriteMultiFldFileIDs().
|
static |
Takes a comma-separated compressed string and converts it to entries in a vector.
This routine is the inverse of ParseUtils::GenerateSeqString. For example,
std::string input = "1-4,6-8,5,2,3"; std::vector<unsigned int> output; ParseUtils::GenerateSeqString(input, output);
produces an output
vector with the entries {1,2,3,4,6,7,8,5,2,3}
.
str | Input CSV string of unsigned integers. |
out | Output vector. |
Definition at line 108 of file ParseUtils.cpp.
Referenced by Nektar::LibUtilities::FieldIOXml::ImportFieldDefs(), Nektar::LibUtilities::FieldIOXml::ImportMultiFldFileIDs(), Nektar::FieldUtils::ProcessInnerProduct::Process(), Nektar::SpatialDomains::BoundaryConditions::ReadBoundaryConditions(), Nektar::SpatialDomains::MeshPartition::ReadExpansions(), Nektar::SolverUtils::FilterAeroForces::v_Initialise(), and Nektar::FilterMovingBody::v_Initialise().
bool Nektar::ParseUtils::GenerateVector | ( | const std::string & | str, |
std::vector< std::string > & | out | ||
) |
Specialised version of ParseUtils::GenerateVector for std::string.
This routine specialises for the std::string data type as this type is not supported by boost::spirit::qi::auto_.
Definition at line 161 of file ParseUtils.cpp.
|
static |
Takes a comma-separated string and converts it to entries in a vector.
This routine splits up a comma-separated string and returns a vector with the entries. Template specialisations should be defined in this file (and not in the header file) as the use of boost::spirit::qi makes compilation times quite slow.
str | Input CSV string. |
out | Output vector. |
Definition at line 135 of file ParseUtils.cpp.
Referenced by Nektar::SolverUtils::ForcingAbsorption::CalcAbsorption(), Nektar::FieldUtils::ProcessInterpPoints::calcCp0(), Nektar::FieldUtils::ProcessInterpPtsToPts::calcCp0(), Nektar::FieldUtils::ProcessInterpPoints::CreateFieldPts(), Nektar::FieldUtils::ProcessInterpPtsToPts::CreateFieldPts(), Nektar::SolverUtils::FilterHistoryPoints::FilterHistoryPoints(), Nektar::LibUtilities::FieldIOHdf5::ImportFieldDef(), Nektar::LibUtilities::FieldIOXml::ImportFieldDefs(), Nektar::FieldUtils::InputDat::Process(), Nektar::FieldUtils::InputXml::Process(), Nektar::FieldUtils::ProcessBoundaryExtract::Process(), Nektar::FieldUtils::ProcessC0Projection::Process(), Nektar::FieldUtils::ProcessInnerProduct::Process(), Nektar::FieldUtils::ProcessInterpField::Process(), Nektar::FieldUtils::ProcessInterpPoints::Process(), Nektar::FieldUtils::ProcessRemoveField::Process(), Nektar::FieldUtils::ProcessWallNormalData::Process(), Nektar::SpatialDomains::MeshPartition::ReadExpansions(), Nektar::IncNavierStokes::SetUpWomersley(), Nektar::LibUtilities::CsvIO::v_ImportFieldData(), Nektar::LibUtilities::PtsIO::v_ImportFieldData(), and Nektar::SolverUtils::Coupling::v_Init().