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 warning and invalid-solution 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 346 of file SolutionInvalidity.C.

Referenced by dataLoad().

349 {
350  dataLoad(stream, timestep_counts.timestep_index, context);
351  dataLoad(stream, timestep_counts.counts, context);
352 }
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 384 of file SolutionInvalidity.C.

385 {
386  if (solution_invalidity.processor_id() != 0)
387  return;
388 
389  std::size_t num_counts;
390  // load data block size
391  dataLoad(stream, num_counts, context);
392 
393  std::string object_type, message;
394  bool warning;
396 
397  // loop over and load stored data
398  for (size_t i = 0; i < num_counts; i++)
399  {
400  dataLoad(stream, object_type, context);
401  dataLoad(stream, message, context);
402  dataLoad(stream, warning, context);
403 
404  const moose::internal::SolutionInvalidityName name(object_type, message);
405  if (solution_invalidity._solution_invalidity_registry.keyExists(name))
406  id = solution_invalidity._solution_invalidity_registry.id(name);
407  else
409  object_type, message, warning);
410 
411  if (solution_invalidity._counts.size() <= id)
412  solution_invalidity._counts.resize(id + 1);
413 
414  auto & entry = solution_invalidity._counts[id];
415  dataLoad(stream, entry.current_counts, context);
416  dataLoad(stream, entry.current_timestep_counts, context);
417  dataLoad(stream, entry.timestep_counts, context);
418  dataLoad(stream, entry.total_counts, context);
419  }
420 }
std::string name(const ElemQuality q)
unsigned int InvalidSolutionID
Definition: MooseTypes.h:241
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 336 of file SolutionInvalidity.C.

Referenced by dataStore().

339 {
340  dataStore(stream, timestep_counts.timestep_index, context);
341  dataStore(stream, timestep_counts.counts, context);
342 }
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 355 of file SolutionInvalidity.C.

356 {
357  solution_invalidity.syncIteration();
358 
359  if (solution_invalidity.processor_id() != 0)
360  return;
361 
362  // Build data structure for store
363  std::size_t size = solution_invalidity._counts.size();
364  dataStore(stream, size, context);
365 
366  for (const auto id : index_range(solution_invalidity._counts))
367  {
368  auto & entry = solution_invalidity._counts[id];
369  const auto & info = solution_invalidity._solution_invalidity_registry.item(id);
370  std::string type = info.object_type;
371  std::string message = info.message;
372  bool warning = info.warning;
373  dataStore(stream, type, context);
374  dataStore(stream, message, context);
375  dataStore(stream, warning, context);
376  dataStore(stream, entry.current_counts, context);
377  dataStore(stream, entry.current_timestep_counts, context);
378  dataStore(stream, entry.timestep_counts, context);
379  dataStore(stream, entry.total_counts, context);
380  }
381 }
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 Sum across all processors.
const Item & item(const std::size_t id) const
processor_id_type processor_id() const
auto index_range(const T &sizable)