Nektar++
Loading...
Searching...
No Matches
Classes | Functions
Nektar::SpatialDomains::GeoAst Namespace Reference

Simple AST for the Geo format which will be populated by the #GeoParser class. More...

Classes

struct  GeoFile
 Lightweight wrapper for a .geo file structure. More...
 
struct  Geom
 Wrapper for all other Geometry types, which are defined using a list of integer IDs. For example, a line is defined from the IDs of two points. More...
 
struct  Point
 Wrapper for the Gmsh Point geometry type. More...
 

Functions

double Eval (LibUtilities::Interpreter &interp, std::vector< char > &expr)
 Evaluate an expression using the LibUtilities::Interpreter class.
 
void SetParam (LibUtilities::Interpreter &interp, std::vector< char > &varname, double &val)
 Set a parameter inside the interp object. Used to store Gmsh variables defined in the .geo file.
 
void PrintWarning (Logger &log, std::vector< char > &geomname)
 Print a warning for unknown geometry types.
 

Detailed Description

Simple AST for the Geo format which will be populated by the #GeoParser class.

Function Documentation

◆ Eval()

double Nektar::SpatialDomains::GeoAst::Eval ( LibUtilities::Interpreter &  interp,
std::vector< char > &  expr 
)

Evaluate an expression using the LibUtilities::Interpreter class.

Parameters
interpHandle to the interpreter to use.
exprString expression returned from boost::qi, handled as a vector of characters.
Returns
The double-precision evaluation of the expression.

Definition at line 65 of file GeoParser.hpp.

66{
67 std::string exprStr(expr.begin(), expr.end());
68 int interpId = interp.DefineFunction("", exprStr);
69 return interp.Evaluate(interpId);
70}
int DefineFunction(const std::string &vlist, const std::string &expr)
Defines a function for the purposes of evaluation.
NekDouble Evaluate(const int id)
Evaluate a function which depends only on constants and/or parameters.

References Nektar::LibUtilities::Interpreter::DefineFunction(), and Nektar::LibUtilities::Interpreter::Evaluate().

Referenced by Nektar::SpatialDomains::GeoParser< Iterator, Skipper >::GeoParser().

◆ PrintWarning()

void Nektar::SpatialDomains::GeoAst::PrintWarning ( Logger &  log,
std::vector< char > &  geomname 
)

Print a warning for unknown geometry types.

Parameters
geomnameThe interpreted geomtery name.

Definition at line 93 of file GeoParser.hpp.

94{
95 std::string geom(geomname.begin(), geomname.end());
96 log(WARNING) << "Ignoring unknown geometry entity '" << geom << "'"
97 << std::endl;
98}
scalarT< T > log(scalarT< T > in)
Definition scalar.hpp:309

References tinysimd::log(), and Nektar::WARNING.

Referenced by Nektar::SpatialDomains::GeoParser< Iterator, Skipper >::GeoParser().

◆ SetParam()

void Nektar::SpatialDomains::GeoAst::SetParam ( LibUtilities::Interpreter &  interp,
std::vector< char > &  varname,
double &  val 
)

Set a parameter inside the interp object. Used to store Gmsh variables defined in the .geo file.

Parameters
interpHandle to the interpreter to use.
exprVariable name returned from boost::qi, handled as a vector of characters.
valValue of the parameter.

Definition at line 81 of file GeoParser.hpp.

83{
84 std::string varStr(varname.begin(), varname.end());
85 interp.SetParameter(varStr, val);
86}
void SetParameter(std::string const &name, NekDouble value)
Set parameter values.

References Nektar::LibUtilities::Interpreter::SetParameter().

Referenced by Nektar::SpatialDomains::GeoParser< Iterator, Skipper >::GeoParser().