https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Classes | Functions
SolutionInvalidityReporter.h File Reference

Go to the source code of this file.

Classes

class  SolutionInvalidityReporter
 Reports the summary table of solution invalid warnings. More...
 

Functions

void to_json (nlohmann::json &json, const SolutionInvalidity *const &solution_invalidity)
 
void dataStore (std::ostream &, const SolutionInvalidity *&, void *)
 Store and load methods for const SolutionInvalidity *, used in the SolutionInvalidityReporter, which does nothing.
 
void dataLoad (std::istream &, const SolutionInvalidity *&, void *)
 

Function Documentation

◆ dataLoad()

void dataLoad ( std::istream &  ,
const SolutionInvalidity *&  ,
void *   
)

Definition at line 48 of file SolutionInvalidityReporter.h.

49{
50}

◆ dataStore()

void dataStore ( std::ostream &  ,
const SolutionInvalidity *&  ,
void *   
)

Store and load methods for const SolutionInvalidity *, used in the SolutionInvalidityReporter, which does nothing.

We need not do anything here because the data store/load capability of the SolutionInvalidity (non-pointer) object is specialized. The store/load capability of that object will properly initialize what the reporter value in SolutionInvalidityReporter points to.

Definition at line 44 of file SolutionInvalidityReporter.h.

45{
46}

◆ to_json()

void to_json ( nlohmann::json &  json,
const SolutionInvalidity *const &  solution_invalidity 
)

Definition at line 34 of file SolutionInvalidityReporter.C.

35{
36 mooseAssert(solution_invalidity->processor_id() == 0, "should only be called on rank 0");
37
38 const auto & solution_registry = moose::internal::getSolutionInvalidityRegistry();
39 const auto & counts = solution_invalidity->counts();
40 if (counts.size() == 0)
41 // Create an empty array
42 json = nlohmann::json::array();
43 else
44 // Output data to json
45 for (const auto id : index_range(solution_invalidity->counts()))
46 {
47 nlohmann::json entry;
48 entry["object_type"] = solution_registry.item(id).object_type;
49 entry["message"] = solution_registry.item(id).message;
50 entry["timestep_counts"] = counts[id].current_timestep_counts;
51 entry["total_counts"] = counts[id].total_counts;
52 json.push_back(entry);
53 }
54}
const std::vector< InvalidCounts > & counts() const
Access the private solution invalidity counts.
processor_id_type processor_id() const
auto index_range(const T &sizable)
SolutionInvalidityRegistry & getSolutionInvalidityRegistry()
Get the global SolutionInvalidityRegistry singleton.