Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Static Public Member Functions | List of all members
Nektar::ParseUtils Class Reference

#include <ParseUtils.hpp>

Classes

struct  fctor1
 
struct  fctor2
 
struct  fctor3
 
struct  fctor4
 
struct  fctor5
 
struct  SymbolFunctor
 
struct  ValueFunctor
 

Static Public Member Functions

static bool ParseRealAssignment (const char *const str, std::string &symbol, NekDouble &value)
 
static bool GenerateSeqVector (const char *const str, std::vector< unsigned int > &vec)
 
static bool GenerateOrderedVector (const char *const str, std::vector< unsigned int > &vec)
 
static bool GenerateOrderedVector (const char *const str, std::vector< NekDouble > &vec)
 
static bool GenerateUnOrderedVector (const char *const str, std::vector< NekDouble > &vec)
 
static bool GenerateOrderedStringVector (const char *const str, std::vector< std::string > &vec)
 
static std::string GenerateSeqString (const std::vector< unsigned int > &elmtids)
 

Detailed Description

Definition at line 60 of file ParseUtils.hpp.

Member Function Documentation

static bool Nektar::ParseUtils::GenerateOrderedStringVector ( const char *const  str,
std::vector< std::string > &  vec 
)
inlinestatic

Definition at line 143 of file ParseUtils.hpp.

Referenced by Nektar::LibUtilities::PtsIO::ImportFieldData(), Nektar::LibUtilities::FieldIOHdf5::ImportFieldDef(), Nektar::LibUtilities::FieldIOXml::ImportFieldDefs(), Nektar::FieldUtils::InputDat::Process(), Nektar::FieldUtils::ProcessInterpField::Process(), Nektar::FieldUtils::ProcessInterpPoints::Process(), Nektar::LibUtilities::MeshPartition::ReadExpansions(), and Nektar::SpatialDomains::MeshGraph::ReadExpansions().

144  {
145  // Functors used to parse the sequence.
146  fctor3 functor3(&vec);
147 
148  return parse(str,
149  // Begin grammar
150  (
151  (+(print_p - ','))[functor3] >> *(',' >> (+(print_p - ','))[functor3])
152  )
153  ,
154  // End grammar
155 
156  space_p).full;
157  }
static bool Nektar::ParseUtils::GenerateOrderedVector ( const char *const  str,
std::vector< unsigned int > &  vec 
)
inlinestatic

Definition at line 97 of file ParseUtils.hpp.

Referenced by Nektar::LibUtilities::FieldIOHdf5::ImportFieldDef(), Nektar::LibUtilities::FieldIOXml::ImportFieldDefs(), Nektar::FieldUtils::ProcessBoundaryExtract::Process(), Nektar::FieldUtils::ProcessScalGrad::Process(), Nektar::FieldUtils::ProcessWSS::Process(), Nektar::FieldUtils::ProcessC0Projection::Process(), Nektar::LibUtilities::MeshPartition::ReadExpansions(), and Nektar::SpatialDomains::MeshGraph::ReadExpansions().

98  {
99  // Functors used to parse the sequence.
100  fctor1 functor1(&vec);
101 
102  return parse(str,
103  // Begin grammar
104  (
105  uint_p[functor1] >> *(',' >> uint_p[functor1])
106  )
107  ,
108  // End grammar
109 
110  space_p).full;
111  }
static bool Nektar::ParseUtils::GenerateOrderedVector ( const char *const  str,
std::vector< NekDouble > &  vec 
)
inlinestatic

Definition at line 113 of file ParseUtils.hpp.

114  {
115  // Functors used to parse the sequence.
116  fctor4 functor4(&vec);
117 
118  return parse(str,
119  // Begin grammar
120  (
121  real_p[functor4] >> *(',' >> real_p[functor4])
122  )
123  ,
124  // End grammar
125  space_p).full;
126  }
static std::string Nektar::ParseUtils::GenerateSeqString ( const std::vector< unsigned int > &  elmtids)
inlinestatic

Definition at line 159 of file ParseUtils.hpp.

Referenced by Nektar::LibUtilities::MeshPartition::OutputPartition(), Nektar::SolverUtils::DriverAdaptive::ReplaceExpansion(), Nektar::LibUtilities::FieldIOXml::v_Write(), Nektar::SpatialDomains::MeshGraph::WriteGeometry(), and Nektar::LibUtilities::FieldIOXml::WriteMultiFldFileIDs().

160  {
161  std::stringstream idStringStream;
162  bool setdash = true;
163  unsigned int endval;
164 
165  if (elmtids.size() == 0)
166  {
167  return std::string("");
168  }
169 
170  idStringStream << elmtids[0];
171  for (int i = 1; i < elmtids.size(); ++i)
172  {
173  if (elmtids[i] == elmtids[i - 1] + 1)
174  {
175  if (setdash)
176  {
177  idStringStream << "-";
178  setdash = false;
179  }
180 
181  if (i == elmtids.size() - 1) // last element
182  {
183  idStringStream << elmtids[i];
184  }
185  else
186  {
187  endval = elmtids[i];
188  }
189  }
190  else
191  {
192  if (setdash == false) // finish off previous dash sequence
193  {
194  idStringStream << endval;
195  setdash = true;
196  }
197 
198  idStringStream << "," << elmtids[i];
199  }
200  }
201 
202  return idStringStream.str();
203  }
static bool Nektar::ParseUtils::GenerateSeqVector ( const char *const  str,
std::vector< unsigned int > &  vec 
)
inlinestatic

Definition at line 79 of file ParseUtils.hpp.

Referenced by Nektar::Utilities::ProcessBL::BoundaryLayer2D(), Nektar::Utilities::ProcessBL::BoundaryLayer3D(), Nektar::SpatialDomains::MeshGraph::GetCompositeList(), Nektar::LibUtilities::FieldIOXml::ImportFieldDefs(), Nektar::LibUtilities::FieldIOXml::ImportMultiFldFileIDs(), Nektar::LibUtilities::MeshPartition::OutputPartition(), Nektar::NekMeshUtils::VolumeMesh::Process(), Nektar::Utilities::ProcessSpherigon::Process(), Nektar::FieldUtils::ProcessInnerProduct::Process(), Nektar::Utilities::ProcessExtractSurf::Process(), Nektar::Utilities::ProcessDetectSurf::Process(), Nektar::Utilities::ProcessScalar::Process(), Nektar::NekMeshUtils::Generator2D::Process(), Nektar::SpatialDomains::BoundaryConditions::ReadBoundaryConditions(), Nektar::LibUtilities::MeshPartition::ReadExpansions(), Nektar::LibUtilities::MeshPartition::ReadGeometry(), Nektar::SpatialDomains::MeshGraph1D::ResolveGeomRef(), Nektar::SpatialDomains::MeshGraph3D::ResolveGeomRef(), Nektar::SpatialDomains::MeshGraph2D::ResolveGeomRef(), Nektar::FilterMovingBody::v_Initialise(), and Nektar::SolverUtils::FilterAeroForces::v_Initialise().

80  {
81  // Functors used to parse the sequence.
82  fctor1 functor1(&vec);
83  fctor2 functor2(&vec);
84 
85  return parse(str,
86  // Begin grammar
87  (
88  uint_p[functor1] >> !('-' >> uint_p[functor2]) >>
89  *(',' >> uint_p[functor1] >> !('-' >> uint_p[functor2]))
90  )
91  ,
92  // End grammar
93 
94  space_p).full;
95  }
static bool Nektar::ParseUtils::GenerateUnOrderedVector ( const char *const  str,
std::vector< NekDouble > &  vec 
)
inlinestatic

Definition at line 128 of file ParseUtils.hpp.

Referenced by Nektar::FieldUtils::ProcessInterpPoints::calcCp0(), Nektar::LibUtilities::FieldIOXml::ImportFieldDefs(), Nektar::FieldUtils::InputXml::Process(), Nektar::Utilities::ProcessSpherigon::Process(), Nektar::FieldUtils::ProcessInterpPoints::Process(), and Nektar::IncNavierStokes::SetUpWomersley().

129  {
130  // Functors used to parse the sequence.
131  fctor5 functor5(&vec);
132 
133  return parse(str,
134  // Begin grammar
135  (
136  real_p[functor5] >> *(',' >> real_p[functor5])
137  )
138  ,
139  // End grammar
140  space_p).full;
141  }
static bool Nektar::ParseUtils::ParseRealAssignment ( const char *const  str,
std::string &  symbol,
NekDouble value 
)
inlinestatic

Definition at line 63 of file ParseUtils.hpp.

64  {
65  SymbolFunctor symbolFunctor(&symbol);
66  ValueFunctor valueFunctor(&value);
67 
68  return parse(str,
69  // Begin grammar
70  (
71  lexeme_d[alpha_p >> *alnum_p][symbolFunctor] >> "=" >> real_p[valueFunctor]
72  )
73  ,
74  // End grammar
75 
76  space_p).full;
77  }