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... | |
static bool | GenerateVariableSet (const std::string &str, const std::vector< std::string > &variables, std::set< int > &out) |
Generate a set of variable locations. More... | |
static bool | GenerateVariableVector (const std::string &str, const std::vector< std::string > &variables, std::vector< int > &out) |
Definition at line 47 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 72 of file ParseUtils.h.
Referenced by Nektar::SpatialDomains::MeshGraph::GetCompositeString(), Nektar::SpatialDomains::MeshGraphIO::GetCompositeString(), Nektar::SolverUtils::DriverAdaptive::ReplaceExpansion(), Nektar::LibUtilities::FieldIOXml::v_Write(), Nektar::SpatialDomains::MeshGraphIOHDF5::WriteDomain(), Nektar::SpatialDomains::MeshGraphIOXml::WriteDomain(), Nektar::SpatialDomains::Movement::WriteMovement(), Nektar::LibUtilities::FieldIOXml::WriteMultiFldFileIDs(), and Nektar::SpatialDomains::MeshGraphIOXml::WriteXMLGeometry().
|
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 104 of file ParseUtils.cpp.
Referenced by Nektar::SpatialDomains::MeshGraphIOHDF5::CreateCompositeDescriptor(), Nektar::SolverUtils::FilterIntegral::FilterIntegral(), Nektar::SpatialDomains::MeshGraph::GetCompositeList(), Nektar::LibUtilities::FieldIOXml::ImportFieldDefs(), Nektar::LibUtilities::FieldIOXml::ImportMultiFldFileIDs(), Nektar::SpatialDomains::BoundaryConditions::ReadBoundaryConditions(), Nektar::Collections::CollectionOptimisation::ReadCollOps(), Nektar::SpatialDomains::MeshGraphIOHDF5::ReadComposites(), Nektar::SpatialDomains::MeshPartition::ReadExpansions(), Nektar::LibUtilities::SessionReader::ReadFunctions(), Nektar::SpatialDomains::MeshGraphIOXml::ResolveGeomRef1D(), Nektar::SpatialDomains::MeshGraphIOXml::ResolveGeomRef2D(), Nektar::SpatialDomains::MeshGraphIOXml::ResolveGeomRef3D(), Nektar::SolverUtils::FilterAeroForces::v_Initialise(), Nektar::SolverUtils::FilterLagrangianPoints::v_Initialise(), Nektar::FilterMovingBody::v_Initialise(), Nektar::SpatialDomains::MeshGraphIOHDF5::v_PartitionMesh(), Nektar::FieldUtils::ProcessInnerProduct::v_Process(), and Nektar::SpatialDomains::MeshGraphIOXml::WriteXMLGeometry().
|
static |
Generate a set of variable locations.
This utility routine takes entries of str
and returns a integer set that contains locations of parsed variables in variables
. For example,
str = "0,1,w,p"; variables = {"u", "v", "w", "p"};
will produce an set out = {0,1,2,3}
.
variables
. Definition at line 168 of file ParseUtils.cpp.
References GenerateVariableVector().
Referenced by Nektar::FieldUtils::ProcessGrad::ParserOptions(), Nektar::FieldUtils::ProcessHalfModeToFourier::v_Process(), Nektar::FieldUtils::ProcessInterpField::v_Process(), Nektar::FieldUtils::ProcessInterpPoints::v_Process(), and Nektar::FieldUtils::ProcessPowerSpectrum::v_Process().
|
static |
Definition at line 185 of file ParseUtils.cpp.
References ASSERTL0, Nektar::StdRegions::find(), GenerateVector(), and WARNINGL0.
Referenced by GenerateVariableSet(), and Nektar::FieldUtils::ProcessMRF::v_Process().
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 156 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 130 of file ParseUtils.cpp.
Referenced by Nektar::MovementTests::BOOST_AUTO_TEST_CASE(), Nektar::SolverUtils::ForcingAbsorption::CalcAbsorption(), Nektar::FieldUtils::ProcessInterpPoints::calcCp0(), Nektar::FieldUtils::ProcessInterpPtsToPts::calcCp0(), Nektar::FieldUtils::ProcessInterpPoints::CreateFieldPts(), Nektar::FieldUtils::ProcessInterpPtsToPts::CreateFieldPts(), Nektar::SolverUtils::FilterHistoryPoints::FilterHistoryPoints(), GenerateVariableVector(), Nektar::LibUtilities::FieldIOHdf5::ImportFieldDef(), Nektar::LibUtilities::FieldIOXml::ImportFieldDefs(), Nektar::SolverUtils::ForcingMovingReferenceFrame::InitBodySolver(), Nektar::SolverUtils::ForcingMovingReferenceFrame::LoadParameters(), Nektar::SpatialDomains::MeshGraph::ReadExpansionInfo(), Nektar::SpatialDomains::MeshPartition::ReadExpansions(), Nektar::LibUtilities::SessionReader::ReadFunctions(), Nektar::LibUtilities::SessionReader::ReadGlobalSysSolnInfo(), Nektar::SpatialDomains::MeshGraph::ReadRefinementInfo(), Nektar::SpatialDomains::Movement::ReadZones(), Nektar::IncNavierStokes::SetUpWomersley(), Nektar::LibUtilities::CsvIO::v_ImportPtsFieldData(), Nektar::LibUtilities::PtsIO::v_ImportPtsFieldData(), Nektar::SolverUtils::Coupling::v_Init(), Nektar::SolverUtils::FilterLagrangianPoints::v_Initialise(), Nektar::FieldUtils::InputDat::v_Process(), Nektar::FieldUtils::InputXml::v_Process(), Nektar::FieldUtils::ProcessAverageFld::v_Process(), Nektar::FieldUtils::ProcessBodyFittedVelocity::v_Process(), Nektar::FieldUtils::ProcessBoundaryExtract::v_Process(), Nektar::FieldUtils::ProcessC0Projection::v_Process(), Nektar::FieldUtils::ProcessInnerProduct::v_Process(), Nektar::FieldUtils::ProcessInterpField::v_Process(), Nektar::FieldUtils::ProcessInterpPoints::v_Process(), Nektar::FieldUtils::ProcessPowerSpectrum::v_Process(), Nektar::FieldUtils::ProcessRemoveField::v_Process(), and Nektar::FieldUtils::ProcessWallNormalData::v_Process().