https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Classes | Functions
SolutionInvalidity.h File Reference

Go to the source code of this file.

Classes

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 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}
unsigned int InvalidSolutionID
Definition MooseTypes.h:241
void dataLoad(std::istream &stream, SolutionInvalidity::TimestepCounts &timestep_counts, void *context)
bool keyExists(const Key &key) const
std::size_t id(const Key &key) const
SolutionInvalidityRegistry & _solution_invalidity_registry
Create a registry to keep track of the names and occurrences of the solution invalidity.
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.
processor_id_type processor_id() const
Helper class that stores the name associated with an invalid solution.
InvalidSolutionID registerInvalidity(const std::string &object_type, const std::string &message, const bool warning)
Call to register an invalid calculation.
std::string name(const ElemQuality q)
SolutionInvalidityRegistry & getSolutionInvalidityRegistry()
Get the global SolutionInvalidityRegistry singleton.

◆ dataLoad() [2/2]

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

Definition at line 346 of file SolutionInvalidity.C.

349{
350 dataLoad(stream, timestep_counts.timestep_index, context);
351 dataLoad(stream, timestep_counts.counts, context);
352}

Referenced by dataLoad().

◆ dataStore() [1/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)
const Item & item(const std::size_t id) const
void syncIteration()
Sync iteration counts to main processor Sum across all processors.
MPI_Info info
auto index_range(const T &sizable)

◆ dataStore() [2/2]

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

Definition at line 336 of file SolutionInvalidity.C.

339{
340 dataStore(stream, timestep_counts.timestep_index, context);
341 dataStore(stream, timestep_counts.counts, context);
342}

Referenced by dataStore().