WRApplication
External kratos "application" for multiscale time integration.
|
A class for keeping administrational text data throughout an analysis. More...
Classes | |
class | ThreadID |
A wrapper class for identifying threads. More... | |
Public Types | |
using | iterator = FileStringIterator |
using | const_iterator = iterator |
using | value_type = iterator::value_type |
using | size_type = std::size_t |
using | Extractor = std::function< value_type(const Model &)> |
Public Member Functions | |
KRATOS_CLASS_POINTER_DEFINITION (JournalBase) | |
JournalBase () | |
Construct the object with an empty file name (invalid). More... | |
JournalBase (const std::filesystem::path &rJournalPath) | |
Construct a registry given an associated file path and a no-op extractor. More... | |
JournalBase (const std::filesystem::path &rJournalPath, const Extractor &rExtractor) | |
Construct a registry given an associated file path and extractor. More... | |
JournalBase (JournalBase &&rOther)=delete | |
The move constructor is deleted because it's ambiguous what should happen to the associated file. More... | |
JournalBase (const JournalBase &rOther) | |
Copy constructor. More... | |
JournalBase & | operator= (JournalBase &&rOther)=delete |
The move assignment operator is deleted because it's ambiguous what should happen to the associated file. More... | |
JournalBase & | operator= (const JournalBase &rOther) |
Copy assignment operator. More... | |
const std::filesystem::path & | GetFilePath () const noexcept |
Get the path to the associated file. More... | |
void | SetExtractor (Extractor &&rExtractor) |
Set the extractor handling the conversion from Model to a string. More... | |
void | SetExtractor (const Extractor &rExtractor) |
void | Push (const Model &rModel) |
Call the extractor and append the results to the associated file. More... | |
void | Push (const value_type &rEntry) |
Call the extractor and append the results to the associated file. More... | |
void | Erase (const_iterator itEntry) |
Erase an entry from the associated file. More... | |
void | Erase (const_iterator Begin, const_iterator End) |
Erase a range of entries from the associated file. More... | |
void | EraseIf (const std::function< bool(const value_type &)> &rPredicate) |
Erase all lines from the associated file matching the input predicate. More... | |
void | Clear () |
Delete the associated file. More... | |
bool | IsOpen () const noexcept |
Check whether the associated file is opened by this object. More... | |
const_iterator | begin () const |
Create an iterator to the first line of the associated file. More... | |
const_iterator | end () const |
Create an iterator to the last (empty) line of the associated file. More... | |
size_type | size () const |
Count the number of lines in the file (including the last empty one). More... | |
A class for keeping administrational text data throughout an analysis.
This class is primarily meant to keep track of output files generated during a simulation, though extra flexibility is provided to extend its purpose as necessary. An associated text file can be written to via JournalBase::Push. On each push, a Model is taken as input, parsed, and a string consisting of a single line is appended to the file. Generating the output string from the input Model is the job of a functor that can be set in the constructor, or in JournalBase::SetExtractor.
using const_iterator = iterator |
using Extractor = std::function<value_type(const Model&)> |
using iterator = FileStringIterator |
using size_type = std::size_t |
using value_type = iterator::value_type |
JournalBase | ( | ) |
Construct the object with an empty file name (invalid).
JournalBase | ( | const std::filesystem::path & | rJournalPath | ) |
Construct a registry given an associated file path and a no-op extractor.
JournalBase | ( | const std::filesystem::path & | rJournalPath, |
const Extractor & | rExtractor | ||
) |
Construct a registry given an associated file path and extractor.
|
delete |
The move constructor is deleted because it's ambiguous what should happen to the associated file.
|
explicit |
Copy constructor.
const_iterator begin | ( | ) | const |
Create an iterator to the first line of the associated file.
void Clear | ( | ) |
Delete the associated file.
const_iterator end | ( | ) | const |
Create an iterator to the last (empty) line of the associated file.
void Erase | ( | const_iterator | Begin, |
const_iterator | End | ||
) |
Erase a range of entries from the associated file.
This operation is extremely inefficient, as a new new file has to be written that contains every line of the currently associated file except those to be erased.
void Erase | ( | const_iterator | itEntry | ) |
Erase an entry from the associated file.
This operation is extremely inefficient, as a new new file has to be written that contains every line of the currently associated file except the erased one.
void EraseIf | ( | const std::function< bool(const value_type &)> & | rPredicate | ) |
Erase all lines from the associated file matching the input predicate.
|
noexcept |
Get the path to the associated file.
|
noexcept |
Check whether the associated file is opened by this object.
KRATOS_CLASS_POINTER_DEFINITION | ( | JournalBase | ) |
JournalBase& operator= | ( | const JournalBase & | rOther | ) |
Copy assignment operator.
|
delete |
The move assignment operator is deleted because it's ambiguous what should happen to the associated file.
void Push | ( | const Model & | rModel | ) |
Call the extractor and append the results to the associated file.
void Push | ( | const value_type & | rEntry | ) |
Call the extractor and append the results to the associated file.
void SetExtractor | ( | const Extractor & | rExtractor | ) |
void SetExtractor | ( | Extractor && | rExtractor | ) |
Set the extractor handling the conversion from Model to a string.
The extractor must generate a string without any line breaks.
size_type size | ( | ) | const |
Count the number of lines in the file (including the last empty one).