https://mooseframework.inl.gov
Functions
SolutionInvalidity.C File Reference

Go to the source code of this file.

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 342 of file SolutionInvalidity.C.

Referenced by dataLoad().

345 {
346  dataLoad(stream, timestep_counts.timestep_index, context);
347  dataLoad(stream, timestep_counts.counts, context);
348 }
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 380 of file SolutionInvalidity.C.

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

Referenced by dataStore().

335 {
336  dataStore(stream, timestep_counts.timestep_index, context);
337  dataStore(stream, timestep_counts.counts, context);
338 }
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 351 of file SolutionInvalidity.C.

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