35#ifndef NEKTAR_TESTS_METRIC_H
36#define NEKTAR_TESTS_METRIC_H
38#include <boost/filesystem.hpp>
46namespace fs = boost::filesystem;
48std::string
PortablePath(
const boost::filesystem::path &path);
61 return std::string(s) ==
"";
72 Metric(TiXmlElement *metric,
bool generate);
76 bool Test(std::istream &pStdout, std::istream &pStderr);
77 void Generate(std::istream &pStdout, std::istream &pStderr);
116 virtual bool v_Test(std::istream &pStdout, std::istream &pStderr) = 0;
125 virtual void v_Generate(std::istream &pStdout, std::istream &pSrderr) = 0;
147 return m_map[key](elmt, generate);
151 std::map<std::string, CreatorFunction>
m_map;
std::string PortablePath(const boost::filesystem::path &path)
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)
The above copyright notice and this permission notice shall be included.
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()