https://mooseframework.inl.gov
Classes | Public Types | Public Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
SolutionInvalidity Class Reference

The SolutionInvalidity will contain all the information about the occurrence(s) of solution invalidity. More...

#include <SolutionInvalidity.h>

Inheritance diagram for SolutionInvalidity:
[legend]

Classes

struct  InvalidCounts
 Struct used in _counts for storing invalid occurrences. More...
 
struct  TimestepCounts
 Struct used in InvalidCounts for storing the time history of invalid occurrences. More...
 

Public Types

using SolutionInvalidityRegistry = moose::internal::SolutionInvalidityRegistry
 

Public Member Functions

 SolutionInvalidity (MooseApp &app)
 Create a new SolutionInvalidity. More...
 
void flagInvalidSolutionInternal (const InvalidSolutionID _invalid_solution_id)
 Increments solution invalid occurrences for each solution id. More...
 
bool hasInvalidSolutionWarning () const
 Whether or not an invalid solution was encountered that was a warning. More...
 
bool hasInvalidSolutionError () const
 Whether or not an invalid solution was encountered that was an error. More...
 
bool hasInvalidSolution () const
 Whether or not any invalid solution was encountered (error or warning). More...
 
void resetSolutionInvalidTimeStep ()
 Reset the number of solution invalid occurrences back to zero for the current time step. More...
 
void resetSolutionInvalidCurrentIteration ()
 Reset the number of solution invalid occurrences back to zero. More...
 
void solutionInvalidAccumulation ()
 Pass the number of solution invalid occurrences from current iteration to cumulative counters. More...
 
void solutionInvalidAccumulationTimeStep (const unsigned int timestep_index)
 Pass the number of solution invalid occurrences from current iteration to cumulative time iteration counters. More...
 
void computeTotalCounts ()
 Compute the total number of solution invalid occurrences. More...
 
const std::vector< InvalidCounts > & counts () const
 Access the private solution invalidity counts. More...
 
void print (const ConsoleStream &console) const
 Print the summary table of Solution Invalid warnings. More...
 
void printHistory (const ConsoleStream &console, unsigned int &timestep_interval_size) const
 Print the time history table of Solution Invalid warnings. More...
 
void printDebug (InvalidSolutionID _invalid_solution_id) const
 Immediately print the section and message for debug purpose. More...
 
void syncIteration ()
 Sync iteration counts to main processor. More...
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Protected Attributes

const ConsoleStream _console
 An instance of helper class to write streams to the Console objects. More...
 
const Parallel::Communicator_communicator
 

Private Types

typedef VariadicTable< std::string, unsigned long int, unsigned long int, unsigned long int, std::string > FullTable
 
typedef VariadicTable< std::string, std::string, unsigned long int, unsigned long intTimeTable
 

Private Member Functions

FullTable summaryTable () const
 Build a VariadicTable for solution invalidity. More...
 
TimeTable transientTable (unsigned int &time_interval) const
 Build a VariadicTable for solution invalidity history. More...
 

Private Attributes

std::mutex _invalid_mutex
 Mutex for locking access to the invalid counts TODO: These can be changed to shared_mutexes. More...
 
SolutionInvalidityRegistry_solution_invalidity_registry
 Create a registry to keep track of the names and occurrences of the solution invalidity. More...
 
std::vector< InvalidCounts_counts
 Store the solution invalidity counts. More...
 
bool _has_synced
 Whether or not we've synced (can check counts/existance of warnings or errors) More...
 
bool _has_solution_warning
 Whether or not we have a warning (only after a sync) More...
 
bool _has_solution_error
 Whether or not we have an invalid solution (only after a sync) More...
 

Friends

void dataStore (std::ostream &, SolutionInvalidity &, void *)
 
void dataLoad (std::istream &, SolutionInvalidity &, void *)
 

Detailed Description

The SolutionInvalidity will contain all the information about the occurrence(s) of solution invalidity.

Definition at line 37 of file SolutionInvalidity.h.

Member Typedef Documentation

◆ FullTable

typedef VariadicTable<std::string, unsigned long int, unsigned long int, unsigned long int, std::string> SolutionInvalidity::FullTable
private

Definition at line 142 of file SolutionInvalidity.h.

◆ SolutionInvalidityRegistry

Definition at line 40 of file SolutionInvalidity.h.

◆ TimeTable

typedef VariadicTable<std::string, std::string, unsigned long int, unsigned long int> SolutionInvalidity::TimeTable
private

Definition at line 147 of file SolutionInvalidity.h.

Constructor & Destructor Documentation

◆ SolutionInvalidity()

SolutionInvalidity::SolutionInvalidity ( MooseApp app)

Create a new SolutionInvalidity.

Definition at line 27 of file SolutionInvalidity.C.

29  ParallelObject(app.comm()),
31  _has_synced(true),
32  _has_solution_warning(false),
33  _has_solution_error(false)
34 {
35 }
ParallelObject(const Parallel::Communicator &comm_in)
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)
SolutionInvalidityRegistry & _solution_invalidity_registry
Create a registry to keep track of the names and occurrences of the solution invalidity.
const Parallel::Communicator & comm() const
bool _has_solution_warning
Whether or not we have a warning (only after a sync)
ConsoleStreamInterface(MooseApp &app)
A class for providing a helper stream object for writting message to all the Output objects...
bool _has_solution_error
Whether or not we have an invalid solution (only after a sync)
SolutionInvalidityRegistry & getSolutionInvalidityRegistry()
Get the global SolutionInvalidityRegistry singleton.

Member Function Documentation

◆ computeTotalCounts()

void SolutionInvalidity::computeTotalCounts ( )

Compute the total number of solution invalid occurrences.

Definition at line 107 of file SolutionInvalidity.C.

108 {
109  mooseAssert(_has_synced, "Has not synced");
110 
111  for (auto & entry : _counts)
112  {
113  entry.total_counts = 0;
114  for (auto & time_counts : entry.timestep_counts)
115  entry.total_counts += time_counts.counts;
116  }
117 }
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)

◆ counts()

const std::vector<InvalidCounts>& SolutionInvalidity::counts ( ) const
inline

Access the private solution invalidity counts.

Definition at line 105 of file SolutionInvalidity.h.

Referenced by syncIteration(), and to_json().

105 { return _counts; }
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.

◆ flagInvalidSolutionInternal()

void SolutionInvalidity::flagInvalidSolutionInternal ( const InvalidSolutionID  _invalid_solution_id)

Increments solution invalid occurrences for each solution id.

Definition at line 38 of file SolutionInvalidity.C.

39 {
40  std::lock_guard<std::mutex> lock_id(_invalid_mutex);
41  if (_counts.size() <= _invalid_solution_id)
42  _counts.resize(_invalid_solution_id + 1);
43 
44  ++_counts[_invalid_solution_id].current_counts;
45 }
std::mutex _invalid_mutex
Mutex for locking access to the invalid counts TODO: These can be changed to shared_mutexes.
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.

◆ hasInvalidSolution()

bool SolutionInvalidity::hasInvalidSolution ( ) const

Whether or not any invalid solution was encountered (error or warning).

This must be called after a sync.

Definition at line 62 of file SolutionInvalidity.C.

Referenced by SolutionInvalidityOutput::shouldOutput().

63 {
65 }
bool hasInvalidSolutionError() const
Whether or not an invalid solution was encountered that was an error.
bool hasInvalidSolutionWarning() const
Whether or not an invalid solution was encountered that was a warning.

◆ hasInvalidSolutionError()

bool SolutionInvalidity::hasInvalidSolutionError ( ) const

Whether or not an invalid solution was encountered that was an error.

This must be called after a sync.

Definition at line 55 of file SolutionInvalidity.C.

Referenced by FEProblemBase::acceptInvalidSolution(), and hasInvalidSolution().

56 {
57  mooseAssert(_has_synced, "Has not synced");
58  return _has_solution_error;
59 }
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)
bool _has_solution_error
Whether or not we have an invalid solution (only after a sync)

◆ hasInvalidSolutionWarning()

bool SolutionInvalidity::hasInvalidSolutionWarning ( ) const

Whether or not an invalid solution was encountered that was a warning.

This must be called after a sync.

Definition at line 48 of file SolutionInvalidity.C.

Referenced by hasInvalidSolution().

49 {
50  mooseAssert(_has_synced, "Has not synced");
51  return _has_solution_warning;
52 }
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)
bool _has_solution_warning
Whether or not we have a warning (only after a sync)

◆ print()

void SolutionInvalidity::print ( const ConsoleStream console) const

Print the summary table of Solution Invalid warnings.

Parameters
consoleThe output stream to output to

Definition at line 120 of file SolutionInvalidity.C.

121 {
122  console << "\nSolution Invalid Warnings:\n";
123  summaryTable().print(console);
124 }
void print(StreamType &stream)
Pretty print the table of data.
Definition: VariadicTable.h:97
FullTable summaryTable() const
Build a VariadicTable for solution invalidity.

◆ printDebug()

void SolutionInvalidity::printDebug ( InvalidSolutionID  _invalid_solution_id) const

Immediately print the section and message for debug purpose.

Definition at line 206 of file SolutionInvalidity.C.

Referenced by SolutionInvalidInterface::flagInvalidSolutionInternal().

207 {
208  const auto & info = _solution_invalidity_registry.item(_invalid_solution_id);
209  _console << info.object_type << ": " << info.message << "\n" << std::flush;
210 }
MPI_Info info
SolutionInvalidityRegistry & _solution_invalidity_registry
Create a registry to keep track of the names and occurrences of the solution invalidity.
const Item & item(const std::size_t id) const
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.

◆ printHistory()

void SolutionInvalidity::printHistory ( const ConsoleStream console,
unsigned int timestep_interval_size 
) const

Print the time history table of Solution Invalid warnings.

Parameters
consoleThe output stream to output to

Definition at line 127 of file SolutionInvalidity.C.

Referenced by SolutionInvalidityOutput::output().

129 {
130  console << "\nSolution Invalid Warnings History:\n";
131  transientTable(timestep_interval_size).print(console);
132 }
void print(StreamType &stream)
Pretty print the table of data.
Definition: VariadicTable.h:97
TimeTable transientTable(unsigned int &time_interval) const
Build a VariadicTable for solution invalidity history.

◆ resetSolutionInvalidCurrentIteration()

void SolutionInvalidity::resetSolutionInvalidCurrentIteration ( )

Reset the number of solution invalid occurrences back to zero.

Definition at line 68 of file SolutionInvalidity.C.

Referenced by NonlinearSystemBase::jacobianSetup(), and NonlinearSystemBase::residualSetup().

69 {
70  // Zero current counts
71  for (auto & entry : _counts)
72  entry.current_counts = 0;
73 }
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.

◆ resetSolutionInvalidTimeStep()

void SolutionInvalidity::resetSolutionInvalidTimeStep ( )

Reset the number of solution invalid occurrences back to zero for the current time step.

Definition at line 76 of file SolutionInvalidity.C.

Referenced by NonlinearSystem::solve().

77 {
78  // Reset that we have synced because we're on a new iteration
79  _has_synced = false;
80 
81  for (auto & entry : _counts)
82  entry.current_timestep_counts = 0;
83 }
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)

◆ solutionInvalidAccumulation()

void SolutionInvalidity::solutionInvalidAccumulation ( )

Pass the number of solution invalid occurrences from current iteration to cumulative counters.

Definition at line 86 of file SolutionInvalidity.C.

Referenced by NonlinearSystemBase::computeJacobianInternal(), LinearSystem::computeLinearSystemInternal(), and NonlinearSystemBase::computeResidualInternal().

87 {
88  for (auto & entry : _counts)
89  entry.current_timestep_counts += entry.current_counts;
90 }
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.

◆ solutionInvalidAccumulationTimeStep()

void SolutionInvalidity::solutionInvalidAccumulationTimeStep ( const unsigned int  timestep_index)

Pass the number of solution invalid occurrences from current iteration to cumulative time iteration counters.

Definition at line 93 of file SolutionInvalidity.C.

Referenced by NonlinearSystem::solve().

94 {
95  for (auto & entry : _counts)
96  if (entry.current_timestep_counts)
97  {
98  if (entry.timestep_counts.empty() ||
99  entry.timestep_counts.back().timestep_index != timestep_index)
100  entry.timestep_counts.emplace_back(timestep_index);
101  entry.timestep_counts.back().counts = entry.current_timestep_counts;
102  entry.total_counts += entry.current_timestep_counts;
103  }
104 }
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.

◆ summaryTable()

SolutionInvalidity::FullTable SolutionInvalidity::summaryTable ( ) const
private

Build a VariadicTable for solution invalidity.

Definition at line 213 of file SolutionInvalidity.C.

Referenced by print().

214 {
215  mooseAssert(_has_synced, "Has not synced");
216 
217  FullTable vtable({"Object", "Converged", "Timestep", "Total", "Message"}, 4);
218 
219  vtable.setColumnFormat({
220  VariadicTableColumnFormat::AUTO, // Object Type
221  VariadicTableColumnFormat::AUTO, // Converged Iteration Warnings
222  VariadicTableColumnFormat::AUTO, // Latest Time Step Warnings
223  VariadicTableColumnFormat::AUTO, // Total Simulation Warnings
225  });
226 
227  vtable.setColumnPrecision({
228  1, // Object Name
229  0, // Converged Iteration Warnings
230  0, // Latest Time Step Warnings
231  0, // Total Simulation Warnings
232  1, // Message
233  });
234 
235  if (processor_id() == 0)
236  {
237  for (const auto id : index_range(_counts))
238  {
239  const auto & entry = _counts[id];
240  if (entry.current_counts)
241  {
242  const auto & info = _solution_invalidity_registry.item(id);
243  vtable.addRow(info.object_type, // Object Type
244  entry.current_counts, // Converged Iteration Warnings
245  entry.current_timestep_counts, // Latest Time Step Warnings
246  entry.total_counts, // Total Iteration Warnings
247  info.message // Message
248  );
249  }
250  }
251  }
252 
253  return vtable;
254 }
VariadicTable< std::string, unsigned long int, unsigned long int, unsigned long int, std::string > FullTable
MPI_Info info
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)
SolutionInvalidityRegistry & _solution_invalidity_registry
Create a registry to keep track of the names and occurrences of the solution invalidity.
const Item & item(const std::size_t id) const
processor_id_type processor_id() const
auto index_range(const T &sizable)

◆ syncIteration()

void SolutionInvalidity::syncIteration ( )

Sync iteration counts to main processor.

Definition at line 135 of file SolutionInvalidity.C.

Referenced by SolverSystem::checkInvalidSolution(), NonlinearSystemBase::computeJacobianInternal(), LinearSystem::computeLinearSystemInternal(), NonlinearSystemBase::computeResidualInternal(), dataStore(), and SolutionInvalidityOutput::shouldOutput().

136 {
137  std::map<processor_id_type, std::vector<std::tuple<std::string, std::string, int, unsigned int>>>
138  data_to_send;
139 
140  // Reset this as we need to see if we have new counts
141  _has_solution_warning = false;
142  _has_solution_error = false;
143 
144  for (const auto id : index_range(_counts))
145  {
146  auto & entry = _counts[id];
147  if (entry.current_counts)
148  {
149  const auto & info = _solution_invalidity_registry.item(id);
150  data_to_send[0].emplace_back(
151  info.object_type, info.message, info.warning, entry.current_counts);
152  entry.current_counts = 0;
153  }
154  }
155 
156  const auto receive_data = [this](const processor_id_type libmesh_dbg_var(pid), const auto & data)
157  {
158  mooseAssert(processor_id() == 0, "Should only receive on processor 0");
159 
160  for (const auto & [object_type, message, warning_int, counts] : data)
161  {
162  mooseAssert(counts, "Should not send data without counts");
163 
164  // We transfer this as an integer (which is guaranteed by the standard to cast to a bool)
165  // because TIMPI doesn't currently support transferring bools
166  const bool warning = warning_int;
167 
168  InvalidSolutionID main_id = 0;
169  const moose::internal::SolutionInvalidityName name(object_type, message);
171  {
172  main_id = _solution_invalidity_registry.id(name);
173  mooseAssert(_solution_invalidity_registry.item(main_id).warning == warning,
174  "Inconsistent registration of invalidity warning and error");
175  }
176  else
177  {
178  mooseAssert(pid != 0, "Should only hit on other processors");
180  object_type, message, warning);
181  }
182  if (_counts.size() <= main_id)
183  _counts.resize(main_id + 1);
184 
185  _counts[main_id].current_counts += counts;
186 
187  if (warning)
188  _has_solution_warning = true;
189  else
190  _has_solution_error = true;
191  }
192  };
193 
194  // Communicate the counts
195  TIMPI::push_parallel_vector_data(comm(), data_to_send, receive_data);
196 
197  // Set the state across all processors
200 
201  // We've now synced
202  _has_synced = true;
203 }
std::string name(const ElemQuality q)
const std::vector< InvalidCounts > & counts() const
Access the private solution invalidity counts.
MPI_Info info
unsigned int InvalidSolutionID
Definition: MooseTypes.h:213
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)
SolutionInvalidityRegistry & _solution_invalidity_registry
Create a registry to keep track of the names and occurrences of the solution invalidity.
const Parallel::Communicator & comm() const
InvalidSolutionID registerInvalidity(const std::string &object_type, const std::string &message, const bool warning)
Call to register an invalid calculation.
void push_parallel_vector_data(const Communicator &comm, MapToVectors &&data, const ActionFunctor &act_on_data)
uint8_t processor_id_type
std::size_t id(const Key &key) const
bool _has_solution_warning
Whether or not we have a warning (only after a sync)
const Item & item(const std::size_t id) const
Helper class that stores the name associated with an invalid solution.
bool _has_solution_error
Whether or not we have an invalid solution (only after a sync)
SolutionInvalidityRegistry & getSolutionInvalidityRegistry()
Get the global SolutionInvalidityRegistry singleton.
void max(const T &r, T &o, Request &req) const
bool keyExists(const Key &key) const
processor_id_type processor_id() const
auto index_range(const T &sizable)

◆ transientTable()

SolutionInvalidity::TimeTable SolutionInvalidity::transientTable ( unsigned int time_interval) const
private

Build a VariadicTable for solution invalidity history.

Definition at line 257 of file SolutionInvalidity.C.

Referenced by printHistory().

258 {
259  mooseAssert(_has_synced, "Has not synced");
260 
261  TimeTable vtable({"Object", "Time", "Stepinterval Count", "Total Count"}, 4);
262 
263  vtable.setColumnFormat({
264  VariadicTableColumnFormat::AUTO, // Object information
265  VariadicTableColumnFormat::AUTO, // Simulation Time Step
266  VariadicTableColumnFormat::AUTO, // Latest Time Step Warnings
267  VariadicTableColumnFormat::AUTO, // Total Iteration Warnings
268  });
269 
270  vtable.setColumnPrecision({
271  1, // Object information
272  1, // Simulation Time Step
273  0, // Latest Time Step Warnings
274  0, // Total Iteration Warnings
275  });
276 
277  if (processor_id() == 0)
278  {
279  for (const auto id : index_range(_counts))
280  {
281  const auto & entry = _counts[id];
282  const auto & info = _solution_invalidity_registry.item(id);
283  std::vector<unsigned int> interval_counts;
284  std::vector<unsigned int> total_counts;
285 
286  if (!entry.timestep_counts.empty())
287  {
288  for (unsigned int timestep = 0; timestep < entry.timestep_counts.back().timestep_index;
289  timestep += step_interval)
290  {
291 
292  auto start_it = timestep;
293  auto end_it = (timestep + step_interval < entry.timestep_counts.back().timestep_index)
294  ? start_it + step_interval
295  : entry.timestep_counts.back().timestep_index;
296 
297  int interval_sum = 0;
298  for (auto ts_count : entry.timestep_counts)
299  {
300  if (ts_count.timestep_index >= start_it && ts_count.timestep_index < end_it)
301  interval_sum += ts_count.counts;
302  }
303 
304  interval_counts.push_back(interval_sum);
305  }
306  }
307 
308  unsigned int interval_sum = 0;
309  for (unsigned int interval_index : index_range(interval_counts))
310  {
311  std::string interval_index_str =
312  std::to_string(interval_index) + "-" + std::to_string(interval_index + step_interval);
313 
314  interval_sum += interval_counts[interval_index];
315  vtable.addRow(info.object_type + " : " + info.message, // Object information
316  interval_index_str, // Interval Index
317  interval_counts[interval_index], // Interval Counts
318  interval_sum // Total Iteration Warnings
319 
320  );
321  }
322  }
323  }
324  return vtable;
325 }
MPI_Info info
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)
SolutionInvalidityRegistry & _solution_invalidity_registry
Create a registry to keep track of the names and occurrences of the solution invalidity.
const Item & item(const std::size_t id) const
VariadicTable< std::string, std::string, unsigned long int, unsigned long int > TimeTable
processor_id_type processor_id() const
auto index_range(const T &sizable)

Friends And Related Function Documentation

◆ dataLoad

void dataLoad ( std::istream &  stream,
SolutionInvalidity solution_invalidity,
void context 
)
friend

Definition at line 377 of file SolutionInvalidity.C.

378 {
379  if (solution_invalidity.processor_id() != 0)
380  return;
381 
382  std::size_t num_counts;
383  // load data block size
384  dataLoad(stream, num_counts, context);
385 
386  std::string object_type, message;
387  bool warning;
389 
390  // loop over and load stored data
391  for (size_t i = 0; i < num_counts; i++)
392  {
393  dataLoad(stream, object_type, context);
394  dataLoad(stream, message, context);
395  dataLoad(stream, warning, context);
396 
397  const moose::internal::SolutionInvalidityName name(object_type, message);
398  if (solution_invalidity._solution_invalidity_registry.keyExists(name))
399  id = solution_invalidity._solution_invalidity_registry.id(name);
400  else
402  object_type, message, warning);
403 
404  if (solution_invalidity._counts.size() <= id)
405  solution_invalidity._counts.resize(id + 1);
406 
407  auto & entry = solution_invalidity._counts[id];
408  dataLoad(stream, entry.current_counts, context);
409  dataLoad(stream, entry.current_timestep_counts, context);
410  dataLoad(stream, entry.timestep_counts, context);
411  dataLoad(stream, entry.total_counts, context);
412  }
413 }
std::string name(const ElemQuality q)
unsigned int InvalidSolutionID
Definition: MooseTypes.h:213
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.
friend void dataLoad(std::istream &, SolutionInvalidity &, void *)
SolutionInvalidityRegistry & _solution_invalidity_registry
Create a registry to keep track of the names and occurrences of the solution invalidity.
InvalidSolutionID registerInvalidity(const std::string &object_type, const std::string &message, const bool warning)
Call to register an invalid calculation.
std::size_t id(const Key &key) const
Helper class that stores the name associated with an invalid solution.
SolutionInvalidityRegistry & getSolutionInvalidityRegistry()
Get the global SolutionInvalidityRegistry singleton.
bool keyExists(const Key &key) const
processor_id_type processor_id() const

◆ dataStore

void dataStore ( std::ostream &  stream,
SolutionInvalidity solution_invalidity,
void context 
)
friend

Definition at line 348 of file SolutionInvalidity.C.

349 {
350  solution_invalidity.syncIteration();
351 
352  if (solution_invalidity.processor_id() != 0)
353  return;
354 
355  // Build data structure for store
356  std::size_t size = solution_invalidity._counts.size();
357  dataStore(stream, size, context);
358 
359  for (const auto id : index_range(solution_invalidity._counts))
360  {
361  auto & entry = solution_invalidity._counts[id];
362  const auto & info = solution_invalidity._solution_invalidity_registry.item(id);
363  std::string type = info.object_type;
364  std::string message = info.message;
365  bool warning = info.warning;
366  dataStore(stream, type, context);
367  dataStore(stream, message, context);
368  dataStore(stream, warning, context);
369  dataStore(stream, entry.current_counts, context);
370  dataStore(stream, entry.current_timestep_counts, context);
371  dataStore(stream, entry.timestep_counts, context);
372  dataStore(stream, entry.total_counts, context);
373  }
374 }
MPI_Info info
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.
SolutionInvalidityRegistry & _solution_invalidity_registry
Create a registry to keep track of the names and occurrences of the solution invalidity.
friend void dataStore(std::ostream &, SolutionInvalidity &, void *)
void syncIteration()
Sync iteration counts to main processor.
const Item & item(const std::size_t id) const
processor_id_type processor_id() const
auto index_range(const T &sizable)

Member Data Documentation

◆ _console

const ConsoleStream ConsoleStreamInterface::_console
inherited

An instance of helper class to write streams to the Console objects.

Definition at line 31 of file ConsoleStreamInterface.h.

Referenced by IterationAdaptiveDT::acceptStep(), MeshOnlyAction::act(), SetupDebugAction::act(), MaterialOutputAction::act(), Adaptivity::adaptMesh(), FEProblemBase::adaptMesh(), PerfGraph::addToExecutionList(), SimplePredictor::apply(), SystemBase::applyScalingFactors(), MultiApp::backup(), FEProblemBase::backupMultiApps(), CoarsenedPiecewiseLinear::buildCoarsenedGrid(), MeshDiagnosticsGenerator::checkElementOverlap(), MeshDiagnosticsGenerator::checkElementTypes(), MeshDiagnosticsGenerator::checkElementVolumes(), FEProblemBase::checkExceptionAndStopSolve(), SolverSystem::checkInvalidSolution(), MeshDiagnosticsGenerator::checkLocalJacobians(), MeshDiagnosticsGenerator::checkNonConformalMesh(), MeshDiagnosticsGenerator::checkNonConformalMeshFromAdaptivity(), MeshDiagnosticsGenerator::checkNonMatchingEdges(), MeshDiagnosticsGenerator::checkNonPlanarSides(), FEProblemBase::checkProblemIntegrity(), ReferenceResidualConvergence::checkRelativeConvergence(), MeshDiagnosticsGenerator::checkSidesetsOrientation(), MeshDiagnosticsGenerator::checkWatertightNodesets(), MeshDiagnosticsGenerator::checkWatertightSidesets(), IterationAdaptiveDT::computeAdaptiveDT(), TransientBase::computeConstrainedDT(), DefaultMultiAppFixedPointConvergence::computeCustomConvergencePostprocessor(), NonlinearSystemBase::computeDamping(), FixedPointIterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeFailedDT(), IterationAdaptiveDT::computeInitialDT(), IterationAdaptiveDT::computeInterpolationDT(), LinearSystem::computeLinearSystemTags(), FEProblemBase::computeLinearSystemTags(), NonlinearSystemBase::computeScaling(), Problem::console(), IterationAdaptiveDT::constrainStep(), TimeStepper::constrainStep(), MultiApp::createApp(), FEProblemBase::execMultiApps(), FEProblemBase::execMultiAppTransfers(), MFEMSteady::execute(), MessageFromInput::execute(), SteadyBase::execute(), Eigenvalue::execute(), ActionWarehouse::executeActionsWithAction(), ActionWarehouse::executeAllActions(), MeshGeneratorSystem::executeMeshGenerators(), ElementQualityChecker::finalize(), FEProblemBase::finishMultiAppStep(), MeshRepairGenerator::fixOverlappingNodes(), CoarsenBlockGenerator::generate(), MeshGenerator::generateInternal(), VariableCondensationPreconditioner::getDofToCondense(), InversePowerMethod::init(), NonlinearEigen::init(), FEProblemBase::initialAdaptMesh(), DefaultMultiAppFixedPointConvergence::initialize(), EigenExecutionerBase::inversePowerIteration(), FEProblemBase::joinAndFinalize(), TransientBase::keepGoing(), IterationAdaptiveDT::limitDTByFunction(), IterationAdaptiveDT::limitDTToPostprocessorValue(), FEProblemBase::logAdd(), EigenExecutionerBase::makeBXConsistent(), Console::meshChanged(), MooseBaseErrorInterface::mooseDeprecated(), MooseBaseErrorInterface::mooseInfo(), MooseBaseErrorInterface::mooseWarning(), MooseBaseErrorInterface::mooseWarningNonPrefixed(), ReferenceResidualConvergence::nonlinearConvergenceSetup(), ReporterDebugOutput::output(), PerfGraphOutput::output(), SolutionInvalidityOutput::output(), MaterialPropertyDebugOutput::output(), DOFMapOutput::output(), VariableResidualNormsDebugOutput::output(), Console::output(), ControlOutput::outputActiveObjects(), ControlOutput::outputChangedControls(), ControlOutput::outputControls(), Console::outputInput(), Console::outputPostprocessors(), PseudoTimestep::outputPseudoTimestep(), Console::outputReporters(), DefaultMultiAppFixedPointConvergence::outputResidualNorm(), Console::outputScalarVariables(), Console::outputSystemInformation(), FEProblemBase::possiblyRebuildGeomSearchPatches(), EigenExecutionerBase::postExecute(), AB2PredictorCorrector::postSolve(), ActionWarehouse::printActionDependencySets(), BlockRestrictionDebugOutput::printBlockRestrictionMap(), printDebug(), EigenExecutionerBase::printEigenvalue(), SecantSolve::printFixedPointConvergenceHistory(), SteffensenSolve::printFixedPointConvergenceHistory(), PicardSolve::printFixedPointConvergenceHistory(), FixedPointSolve::printFixedPointConvergenceReason(), PerfGraphLivePrint::printLiveMessage(), MaterialPropertyDebugOutput::printMaterialMap(), PerfGraphLivePrint::printStats(), NEML2Action::printSummary(), AutomaticMortarGeneration::projectPrimaryNodesSinglePair(), AutomaticMortarGeneration::projectSecondaryNodesSinglePair(), CoarsenBlockGenerator::recursiveCoarsen(), SolutionTimeAdaptiveDT::rejectStep(), MultiApp::restore(), FEProblemBase::restoreMultiApps(), FEProblemBase::restoreSolutions(), NonlinearSystemBase::setInitialSolution(), MooseApp::setupOptions(), Checkpoint::shouldOutput(), SubProblem::showFunctorRequestors(), SubProblem::showFunctors(), FullSolveMultiApp::showStatusMessage(), FEProblemSolve::solve(), FixedPointSolve::solve(), EigenProblem::solve(), NonlinearSystem::solve(), LinearSystem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), LStableDirk4::solve(), AStableDirk4::solve(), ExplicitRK2::solve(), TransientMultiApp::solveStep(), FixedPointSolve::solveStep(), PerfGraphLivePrint::start(), AB2PredictorCorrector::step(), NonlinearEigen::takeStep(), TransientBase::takeStep(), TerminateChainControl::terminate(), Convergence::verboseOutput(), Console::writeTimestepInformation(), Console::writeVariableNorms(), and FEProblemBase::~FEProblemBase().

◆ _counts

std::vector<InvalidCounts> SolutionInvalidity::_counts
private

◆ _has_solution_error

bool SolutionInvalidity::_has_solution_error
private

Whether or not we have an invalid solution (only after a sync)

Definition at line 163 of file SolutionInvalidity.h.

Referenced by hasInvalidSolutionError(), and syncIteration().

◆ _has_solution_warning

bool SolutionInvalidity::_has_solution_warning
private

Whether or not we have a warning (only after a sync)

Definition at line 161 of file SolutionInvalidity.h.

Referenced by hasInvalidSolutionWarning(), and syncIteration().

◆ _has_synced

bool SolutionInvalidity::_has_synced
private

Whether or not we've synced (can check counts/existance of warnings or errors)

Definition at line 159 of file SolutionInvalidity.h.

Referenced by computeTotalCounts(), hasInvalidSolutionError(), hasInvalidSolutionWarning(), resetSolutionInvalidTimeStep(), summaryTable(), syncIteration(), and transientTable().

◆ _invalid_mutex

std::mutex SolutionInvalidity::_invalid_mutex
mutableprivate

Mutex for locking access to the invalid counts TODO: These can be changed to shared_mutexes.

Definition at line 135 of file SolutionInvalidity.h.

Referenced by flagInvalidSolutionInternal().

◆ _solution_invalidity_registry

SolutionInvalidityRegistry& SolutionInvalidity::_solution_invalidity_registry
private

Create a registry to keep track of the names and occurrences of the solution invalidity.

Definition at line 153 of file SolutionInvalidity.h.

Referenced by dataLoad(), dataStore(), printDebug(), summaryTable(), syncIteration(), and transientTable().


The documentation for this class was generated from the following files: