35#ifndef NEKTAR_TESTS_METRIC_H
36#define NEKTAR_TESTS_METRIC_H
56 return std::string(s) ==
"";
67 Metric(TiXmlElement *metric,
bool generate);
71 bool Test(std::istream &pStdout, std::istream &pStderr);
72 void Generate(std::istream &pStdout, std::istream &pStderr);
111 virtual bool v_Test(std::istream &pStdout, std::istream &pStderr) = 0;
120 virtual void v_Generate(std::istream &pStdout, std::istream &pSrderr) = 0;
142 return m_map[key](elmt, generate);
146 std::map<std::string, CreatorFunction>
m_map;
Datatype of the NekFactory used to instantiate classes derived from the Advection class.
std::map< std::string, CreatorFunction > m_map
MetricSharedPtr(* CreatorFunction)(TiXmlElement *, bool)
std::string RegisterCreatorFunction(std::string key, CreatorFunction func)
MetricSharedPtr CreateInstance(std::string key, TiXmlElement *elmt, bool generate)
Base class for all metrics. Metric represents a test metric that can be used to evaluate the function...
bool Test(std::istream &pStdout, std::istream &pStderr)
Calls a metric's v_Test function (or v_Generate if m_generate).
TiXmlElement * m_metric
Pointer to XML structure containing metric definition.
Metric(TiXmlElement *metric, bool generate)
Constructor.
virtual bool v_Test(std::istream &pStdout, std::istream &pStderr)=0
Virtual function to test the metric. Should be redefined in derived classes.
virtual void v_Generate(std::istream &pStdout, std::istream &pSrderr)=0
Virtual function to generate the metric. Should be redefined in derived classes.
int GetID()
Return metric ID.
virtual ~Metric()=default
std::string GetType()
Return metric type.
bool m_average
Indicates whether a metric supports averaging results from multiple runs.
int m_id
Stores the ID of this metric.
std::string m_type
Stores the type of this metric (uppercase).
bool m_generate
Determines whether to generate this metric or not.
bool SupportsAverage() const
Return whether this metric supports averaging results from multiple runs.
void Generate(std::istream &pStdout, std::istream &pStderr)
std::shared_ptr< Metric > MetricSharedPtr
A shared pointer to an EquationSystem object.
bool EmptyString(const char *s)
Check to see whether the given string s is empty (or null).
MetricFactory & GetMetricFactory()