https://mooseframework.inl.gov
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. More...
 
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 32 of file SolutionInvalidityReporter.C.

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