27#include "neml2/misc/errors.h"
28#include "neml2/misc/string_utils.h"
75template <
typename... Args>
120template <
typename... Args>
130 throw NEMLException(
"Diagnostics are not currently being run. diagnostic_assert should only be "
131 "called inside a DiagnosticsInterface::diagnose method.");
133 std::ostringstream oss;
140 std::forward<Args>(args)...);
Interface for object making diagnostics about common setup errors.
Definition DiagnosticsInterface.h:80
DiagnosticsInterface(DiagnosticsInterface &&)=delete
const NEML2Object & object() const
Get the object.
Definition DiagnosticsInterface.h:107
virtual void diagnose() const =0
Check for common problems.
DiagnosticsInterface & operator=(const DiagnosticsInterface &)=delete
DiagnosticsInterface(const DiagnosticsInterface &)=delete
DiagnosticsInterface()=delete
DiagnosticsInterface & operator=(DiagnosticsInterface &&)=delete
virtual ~DiagnosticsInterface()=default
The base class of all "manufacturable" objects in the NEML2 library.
Definition NEML2Object.h:42
Base class of variable.
Definition Variable.h:52
void stream_all(std::ostringstream &ss, T &&val, Args &&... args)
Definition string_utils.h:64
Definition DiagnosticsInterface.cxx:30
std::vector< Diagnosis > diagnose(const DiagnosticsInterface &patient)
A helper function to diagnose common setup errors.
Definition DiagnosticsInterface.cxx:54
DiagnosticState & current_diagnostic_state()
Get the current diagnostic state.
Definition DiagnosticsInterface.cxx:40
void diagnostic_assert(bool, Args &&...)
Helper assertion function for diagnostics.
std::vector< Diagnosis > & current_diagnoses()
Get the current diagnoses.
Definition DiagnosticsInterface.cxx:47
Diagnosing & operator=(Diagnosing &&)=delete
Diagnosing(bool ongoing=true)
Definition DiagnosticsInterface.cxx:31
const DiagnosticState prev_state
Definition DiagnosticsInterface.h:62
Diagnosing(Diagnosing &&)=delete
Diagnosing(const Diagnosing &)=delete
~Diagnosing()
Definition DiagnosticsInterface.cxx:37
Diagnosing & operator=(const Diagnosing &)=delete
Definition DiagnosticsInterface.h:38
bool ongoing
Definition DiagnosticsInterface.h:39
std::string patient_name
Definition DiagnosticsInterface.h:40
std::string patient_type
Definition DiagnosticsInterface.h:41
void reset()
Definition DiagnosticsInterface.h:43