Flow123d  release_2.2.0-914-gf1a3a4f
Public Types | Public Member Functions | Protected Attributes | List of all members
Observe Class Reference

#include <observe.hh>

Collaboration diagram for Observe:
Collaboration graph
[legend]

Public Types

typedef std::shared_ptr< ElementDataCacheBaseOutputDataPtr
 
typedef std::map< string, OutputDataPtrOutputDataFieldMap
 

Public Member Functions

 Observe (string observe_name, Mesh &mesh, Input::Array in_array, unsigned int precision)
 
 ~Observe ()
 Destructor, must close the file. More...
 
const std::vector< unsigned int > & observed_elements () const
 
void output_header ()
 
void output_time_frame (double time)
 
const std::vector< ObservePoint > & points () const
 
template<typename T >
ElementDataCache< T > & prepare_compute_data (std::string field_name, double field_time, unsigned int n_rows, unsigned int n_cols)
 

Protected Attributes

int rank_
 
std::vector< ObservePointpoints_
 Full information about observe points. More...
 
std::vector< unsigned int > observed_element_indices_
 Elements of the o_points. More...
 
OutputDataFieldMap observe_field_values_
 Stored field values. More...
 
double observe_values_time_
 Common evaluation time of the fields for single time frame. More...
 
std::string observe_name_
 
std::ofstream observe_file_
 Output file stream. More...
 
std::string time_unit_str_
 String representation of the time unit. More...
 
double time_unit_seconds_
 Time unit in seconds. More...
 
unsigned int precision_
 Precision of float output. More...
 
bool no_fields_warning =false
 

Detailed Description

This class takes care about the observe points in the output stream, storing observe values of the fields and their output in the YAML format.

Definition at line 161 of file observe.hh.

Member Typedef Documentation

Definition at line 165 of file observe.hh.

typedef std::shared_ptr<ElementDataCacheBase> Observe::OutputDataPtr

Definition at line 164 of file observe.hh.

Constructor & Destructor Documentation

Observe::Observe ( string  observe_name,
Mesh mesh,
Input::Array  in_array,
unsigned int  precision 
)

Construct the observation object.

observe_name - base name of the output file, the equation name. mesh - the mesh used for search for the observe points in_array - the array of observe points

Definition at line 313 of file observe.cc.

Observe::~Observe ( )

Destructor, must close the file.

Definition at line 348 of file observe.cc.

Member Function Documentation

const std::vector<unsigned int>& Observe::observed_elements ( ) const
inline

Provides a vector of element indices on which the observation values are evaluated. This can be used to evaluate derived fields only on these elements in the times not selected to full output.

Definition at line 185 of file observe.hh.

void Observe::output_header ( )

Output file header.

Definition at line 382 of file observe.cc.

Here is the caller graph for this function:

void Observe::output_time_frame ( double  time)

Write field values to the output file. Using the YAML format.

Definition at line 394 of file observe.cc.

const std::vector<ObservePoint>& Observe::points ( ) const
inline

Return points_ vector

Definition at line 201 of file observe.hh.

template<typename T >
ElementDataCache< T > & Observe::prepare_compute_data ( std::string  field_name,
double  field_time,
unsigned int  n_rows,
unsigned int  n_cols 
)

Prepare data for computing observe values.

Method:

  • check that all fields of one time frame are evaluated at the same time
  • find and return ElementDataCache of given field_name, create its if doesn't exist.
Parameters
field_nameQuantity name of founding ElementDataCache
field_timeActual computing time
n_rowsCount of rows of data cache (used only if new cache is created)
n_colsCount of columns of data cache (used only if new cache is created)

Definition at line 354 of file observe.cc.

Member Data Documentation

bool Observe::no_fields_warning =false
protected

Definition at line 251 of file observe.hh.

OutputDataFieldMap Observe::observe_field_values_
protected

Stored field values.

Definition at line 231 of file observe.hh.

std::ofstream Observe::observe_file_
protected

Output file stream.

Definition at line 241 of file observe.hh.

std::string Observe::observe_name_
protected

Definition at line 238 of file observe.hh.

double Observe::observe_values_time_
protected

Common evaluation time of the fields for single time frame.

Definition at line 235 of file observe.hh.

std::vector<unsigned int> Observe::observed_element_indices_
protected

Elements of the o_points.

Definition at line 228 of file observe.hh.

std::vector<ObservePoint> Observe::points_
protected

Full information about observe points.

Definition at line 226 of file observe.hh.

unsigned int Observe::precision_
protected

Precision of float output.

Definition at line 248 of file observe.hh.

int Observe::rank_
protected

Definition at line 223 of file observe.hh.

double Observe::time_unit_seconds_
protected

Time unit in seconds.

Definition at line 246 of file observe.hh.

std::string Observe::time_unit_str_
protected

String representation of the time unit.

Definition at line 244 of file observe.hh.


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