https://mooseframework.inl.gov
Classes | Functions
SolutionInvalidity.h File Reference

Go to the source code of this file.

Classes

class  VariadicTable< Ts >
 A class for "pretty printing" a table of data. More...
 
class  SolutionInvalidity
 The SolutionInvalidity will contain all the information about the occurrence(s) of solution invalidity. More...
 
struct  SolutionInvalidity::TimestepCounts
 Struct used in InvalidCounts for storing the time history of invalid occurrences. More...
 
struct  SolutionInvalidity::InvalidCounts
 Struct used in _counts for storing invalid occurrences. More...
 

Functions

void dataStore (std::ostream &stream, SolutionInvalidity::TimestepCounts &timestep_counts, void *context)
 
void dataLoad (std::istream &stream, SolutionInvalidity::TimestepCounts &timestep_counts, void *context)
 
void dataStore (std::ostream &stream, SolutionInvalidity &solution_invalidity, void *context)
 
void dataLoad (std::istream &stream, SolutionInvalidity &solution_invalidity, void *context)
 

Function Documentation

◆ dataLoad() [1/2]

void dataLoad ( std::istream &  stream,
SolutionInvalidity::TimestepCounts timestep_counts,
void context 
)

Definition at line 339 of file SolutionInvalidity.C.

Referenced by dataLoad().

342 {
343  dataLoad(stream, timestep_counts.timestep_index, context);
344  dataLoad(stream, timestep_counts.counts, context);
345 }
void dataLoad(std::istream &stream, SolutionInvalidity::TimestepCounts &timestep_counts, void *context)

◆ dataLoad() [2/2]

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

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.
void dataLoad(std::istream &stream, SolutionInvalidity::TimestepCounts &timestep_counts, void *context)
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() [1/2]

void dataStore ( std::ostream &  stream,
SolutionInvalidity::TimestepCounts timestep_counts,
void context 
)

Definition at line 329 of file SolutionInvalidity.C.

Referenced by dataStore().

332 {
333  dataStore(stream, timestep_counts.timestep_index, context);
334  dataStore(stream, timestep_counts.counts, context);
335 }
void dataStore(std::ostream &stream, SolutionInvalidity::TimestepCounts &timestep_counts, void *context)

◆ dataStore() [2/2]

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

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 }
void dataStore(std::ostream &stream, SolutionInvalidity::TimestepCounts &timestep_counts, void *context)
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.
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)