Flow123d  3.9.0-127d9ed9b
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
TimeMarks Class Reference

This class is a collection of time marks to manage various events occurring during simulation time. More...

#include <time_marks.hh>

Collaboration diagram for TimeMarks:
Collaboration graph
[legend]

Public Types

typedef TimeMarksIterator iterator
 Iterator class for iteration over time marks of particular type. This is always const_iterator. More...
 

Public Member Functions

 TimeMarks ()
 
void reinit ()
 
TimeMark::Type new_mark_type ()
 
TimeMark::Type type_fixed_time ()
 
TimeMark::Type type_output ()
 
TimeMark::Type type_input ()
 
TimeMark::Type type_balance_output ()
 
TimeMark add (const TimeMark &mark)
 
void add_time_marks (double time, double dt, double end_time, TimeMark::Type type)
 
void add_to_type_all (TimeMark::Type filter_type, TimeMark::Type add_type)
 
TimeMarks::iterator current (const TimeStep &time_step, const TimeMark::Type &mask) const
 
TimeMarks::iterator next (const TimeGovernor &tg, const TimeMark::Type &mask) const
 
TimeMarks::iterator last (const TimeStep &time_step, const TimeMark::Type &mask) const
 
TimeMarks::iterator last (const TimeGovernor &tg, const TimeMark::Type &mask) const
 
TimeMarks::iterator last (const TimeMark::Type &mask) const
 
TimeMarks::iterator begin (TimeMark::Type mask) const
 Iterator for the begin mimics container-like of TimeMarks. More...
 
TimeMarks::iterator begin (unsigned char ei) const
 Same as previous, but constructs TimeMark::Type from equation index. More...
 
TimeMarks::iterator end (TimeMark::Type mask) const
 Iterator for the end mimics container-like of TimeMarks. More...
 
TimeMarks::iterator end (unsigned char ei) const
 Same as previous, but constructs TimeMark::Type from equation index. More...
 

Private Attributes

TimeMark::Type next_mark_type_
 MarkType that will be used at next new_time_mark() call. More...
 
std::vector< std::vector< TimeMark > > marks_
 TimeMarks list sorted according to the their time. More...
 
TimeMark::Type type_fixed_time_
 Predefined type for fixed time. More...
 
TimeMark::Type type_output_
 Predefined type for output. More...
 
TimeMark::Type type_input_
 Predefined type for change of boundary condition. More...
 
TimeMark::Type type_balance_output_
 Predefined type for balance output. More...
 

Friends

std::ostream & operator<< (std::ostream &stream, const TimeMarks &marks)
 Friend output operator. More...
 

Detailed Description

This class is a collection of time marks to manage various events occurring during simulation time.

TimeMark and their types

One TimeMark consists of time and type (TimeMark::Type), see the constructor TimeMark::TimeMark. The type of mark is bitmap where individual bits corresponds to some base event types like changing a BC, output solution, coupling time with another equation and so on. Base types can be combined by bitwise or (operator|).

Special types are predefined in TimeMarks class. These are returned by their getters:

TimeMarks collection

TimeMarks collect marks of various types and provides methods for iterating over stored marks. You can selectively access only marks matching given type mask. See TimeMark::match_mask.

You can add one new mark through method add or add evenly spaced marks of same type by TimeMarks::add_time_marks.

You can allocate new TimeMark::Type in the context of one TimeMarks object by TimeMarks::new_mark_type.

For a given TimeGovernor (not necessarily connected one) you can ask about existence of mark in current time interval (TimeMarks::is_current) and see TimeMarks close to the current time (TimeMarks::next and TimeMarks::last). The current time interval is left-open and right-closed: (t,t+dt]. Repeatedly used TimeMarks::next always returns the same TimeMark if the time of the TimeGovernor is not changed.

In most cases there will be only one TimeMarks object for the whole solved problem and used by TimeGovernors of individual equations. However this is not necessary.

See also
TimeMark

Definition at line 206 of file time_marks.hh.

Member Typedef Documentation

◆ iterator

Iterator class for iteration over time marks of particular type. This is always const_iterator.

Definition at line 210 of file time_marks.hh.

Constructor & Destructor Documentation

◆ TimeMarks()

TimeMarks::TimeMarks ( )

Default constructor.

Definition at line 44 of file time_marks.cc.

Member Function Documentation

◆ add()

TimeMark TimeMarks::add ( const TimeMark mark)

Basic method for inserting TimeMarks.

Parameters
markReference to TimeMark object.

Definition at line 81 of file time_marks.cc.

Here is the caller graph for this function:

◆ add_time_marks()

void TimeMarks::add_time_marks ( double  time,
double  dt,
double  end_time,
TimeMark::Type  type 
)

Method for creating and inserting equally spaced TimeMarks.

Parameters
timeTime of the first TimeMark.
dtLenght of interval between equally spaced TimeMarks.
end_timeNo marks after the end_time.
typeType of inserted TimeMarks or their combinations.

Current lazy implementation have complexity O(m*n) where m is number of inserted time marks and n number of time marks in the array. TODO: O(n+m) implementation

Definition at line 106 of file time_marks.cc.

Here is the caller graph for this function:

◆ add_to_type_all()

void TimeMarks::add_to_type_all ( TimeMark::Type  filter_type,
TimeMark::Type  add_type 
)

Apply TimeMark::add_to_type (|=) to all time marks matching the filter type.

Definition at line 118 of file time_marks.cc.

◆ begin() [1/2]

TimeMarks::iterator TimeMarks::begin ( TimeMark::Type  mask) const

Iterator for the begin mimics container-like of TimeMarks.

Definition at line 192 of file time_marks.cc.

Here is the caller graph for this function:

◆ begin() [2/2]

TimeMarks::iterator TimeMarks::begin ( unsigned char  ei) const

Same as previous, but constructs TimeMark::Type from equation index.

Definition at line 199 of file time_marks.cc.

◆ current()

TimeMarks::iterator TimeMarks::current ( const TimeStep time_step,
const TimeMark::Type mask 
) const

Definition at line 141 of file time_marks.cc.

Here is the caller graph for this function:

◆ end() [1/2]

TimeMarks::iterator TimeMarks::end ( TimeMark::Type  mask) const

Iterator for the end mimics container-like of TimeMarks.

Definition at line 206 of file time_marks.cc.

Here is the caller graph for this function:

◆ end() [2/2]

TimeMarks::iterator TimeMarks::end ( unsigned char  ei) const

Same as previous, but constructs TimeMark::Type from equation index.

Definition at line 213 of file time_marks.cc.

◆ last() [1/3]

TimeMarks::iterator TimeMarks::last ( const TimeGovernor tg,
const TimeMark::Type mask 
) const

Definition at line 177 of file time_marks.cc.

◆ last() [2/3]

TimeMarks::iterator TimeMarks::last ( const TimeMark::Type mask) const

Returns iterator to the last time mark matching given mask.

Definition at line 183 of file time_marks.cc.

◆ last() [3/3]

TimeMarks::iterator TimeMarks::last ( const TimeStep time_step,
const TimeMark::Type mask 
) const

Return the last TimeMark with time less or equal to tg.time() that match the mask. The time governor tg is used also for time comparisons.

Parameters
tgthe time governor
maskmask of marks to iterate on

Definition at line 165 of file time_marks.cc.

Here is the caller graph for this function:

◆ new_mark_type()

TimeMark::Type TimeMarks::new_mark_type ( )

Add a new base mark within the context of the particular TimeMarks instance. User should keep the returned value (MarkType is basically a bitmap) for further queries and TimeMark insertions. ATTENTION: You can not use the TimeMark::Type with other TimeMarks instance! Types are added as they are prepared in next_mark_type_. Next mark type is updated by (left) bit shifting operator.

Definition at line 68 of file time_marks.cc.

Here is the caller graph for this function:

◆ next()

TimeMarks::iterator TimeMarks::next ( const TimeGovernor tg,
const TimeMark::Type mask 
) const

Return the first TimeMark with time strictly greater then tg.time() that match the mask. The time governor tg is used also for time comparisons.

Parameters
tgthe time governor
maskmask of marks to iterate on

TODO: have also method which accepts double (time) instead of the whole TimeGovernor. and compare without safety.

Definition at line 149 of file time_marks.cc.

Here is the caller graph for this function:

◆ reinit()

void TimeMarks::reinit ( )

Reset state after construction (through default constructor). Useful for unit tests.

Definition at line 51 of file time_marks.cc.

Here is the caller graph for this function:

◆ type_balance_output()

TimeMark::Type TimeMarks::type_balance_output ( )
inline

Predefined base TimeMark type for times of balnace output. Is defined by constructor as 0x08.

Definition at line 249 of file time_marks.hh.

◆ type_fixed_time()

TimeMark::Type TimeMarks::type_fixed_time ( )
inline

Predefined base TimeMark type that is taken into account by the TimeGovernor. Is defined by constructor as 0x01.

Definition at line 234 of file time_marks.hh.

Here is the caller graph for this function:

◆ type_input()

TimeMark::Type TimeMarks::type_input ( )
inline

Predefined base TimeMark type for times when the boundary condition is changed. Is defined by constructor as 0x04.

Definition at line 244 of file time_marks.hh.

◆ type_output()

TimeMark::Type TimeMarks::type_output ( )
inline

Predefined base TimeMark type for output times. Is defined by constructor as 0x02.

Definition at line 239 of file time_marks.hh.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  stream,
const TimeMarks marks 
)
friend

Friend output operator.

Member Data Documentation

◆ marks_

std::vector< std::vector<TimeMark> > TimeMarks::marks_
private

TimeMarks list sorted according to the their time.

Definition at line 331 of file time_marks.hh.

◆ next_mark_type_

TimeMark::Type TimeMarks::next_mark_type_
private

MarkType that will be used at next new_time_mark() call.

Definition at line 328 of file time_marks.hh.

◆ type_balance_output_

TimeMark::Type TimeMarks::type_balance_output_
private

Predefined type for balance output.

Definition at line 340 of file time_marks.hh.

◆ type_fixed_time_

TimeMark::Type TimeMarks::type_fixed_time_
private

Predefined type for fixed time.

Definition at line 334 of file time_marks.hh.

◆ type_input_

TimeMark::Type TimeMarks::type_input_
private

Predefined type for change of boundary condition.

Definition at line 338 of file time_marks.hh.

◆ type_output_

TimeMark::Type TimeMarks::type_output_
private

Predefined type for output.

Definition at line 336 of file time_marks.hh.


The documentation for this class was generated from the following files: