33 #include <boost/any.hpp>
44 using namespace Input::Type;
47 =
Record(
"OutputStream",
"Parameters of output.")
50 "File path to the connected output file.")
53 "Format of output stream and possible parameters.")
55 "Time interval between outputs.\n"
56 "Regular grid of output time points starts at the initial time of the equation and ends at the end time which must be specified.\n"
57 "The start time and the end time are always added. ")
59 "Explicit array of output time points (can be combined with 'time_step'.")
61 "Add all input time points of the equation, mentioned in the 'input_fields' list, also as the output points.");
66 "Format of output stream and possible parameters.");
74 if(fname->compare(fname->size()-4, 4,
".pvd") != 0) {
75 xprintf(
Warn,
"Renaming name of output file from: %s to %s.pvd\n", fname->c_str(), fname->c_str());
76 *fname = *fname +
".pvd";
86 if(fname->compare(fname->size()-4, 4,
".msh") != 0) {
87 xprintf(
Warn,
"Renaming name of output file from: %s to %s.msh\n", fname->c_str(), fname->c_str());
88 *fname = *fname +
".msh";
100 data_vector = &this->node_data;
103 data_vector = &this->corner_data;
106 data_vector = &this->elem_data;
111 for(
auto &data : *data_vector)
112 if (data->field_name == field_name)
return data;
183 xprintf(
Warn,
"Unsupported file format, using default VTK\n");
237 for (
auto it = in_sel.
begin(); it != in_sel.
end(); ++it)
239 output_names.insert(std::pair<std::string, bool>(it->key_,
false));
242 for (
auto it: field_ids)
249 : input_record_(in_rec)
288 base_file =
new ofstream;
291 base_file->open(fname.c_str());
292 INPUT_CHECK( base_file->is_open() ,
"Can not open output file: %s\n", fname.c_str() );
293 xprintf(
MsgLog,
"Writing flow output file: %s ... \n", fname.c_str());
296 base_filename =
new string(fname);
352 for(
auto it = tg.
marks().
begin(input_mark_type); it != tg.
marks().
end(input_mark_type); ++it)
353 mark_times.push_back(it->time());
354 for(
double time : mark_times)
437 #define INSTANCE_register_field(spacedim, value) \
438 template void OutputTime::register_data<spacedim, value> \
439 (const DiscreteSpace ref_type, Field<spacedim, value> &field);
441 #define INSTANCE_register_multifield(spacedim, value) \
442 template void OutputTime::register_data<spacedim, value> \
443 (const DiscreteSpace ref_type, MultiField<spacedim, value> &field);
446 #define INSTANCE_OutputData(spacedim, value) \
447 template class OutputData<value>;
450 #define INSTANCE_DIM_DEP_VALUES( MACRO, dim_from, dim_to) \
451 MACRO(dim_from, FieldValue<dim_to>::VectorFixed ) \
452 MACRO(dim_from, FieldValue<dim_to>::TensorFixed )
454 #define INSTANCE_TO_ALL( MACRO, dim_from) \
455 MACRO(dim_from, FieldValue<0>::Enum ) \
456 MACRO(dim_from, FieldValue<0>::EnumVector) \
457 MACRO(dim_from, FieldValue<0>::Integer) \
458 MACRO(dim_from, FieldValue<0>::Scalar) \
459 MACRO(dim_from, FieldValue<0>::Vector) \
461 INSTANCE_DIM_DEP_VALUES(MACRO, dim_from, 2) \
462 INSTANCE_DIM_DEP_VALUES(MACRO, dim_from, 3) \
464 #define INSTANCE_ALL(MACRO) \
465 INSTANCE_TO_ALL( MACRO, 3) \
466 INSTANCE_TO_ALL( MACRO, 2)
double time
The newest time of registered data.
Common parent class for templated OutputData.
static Input::Type::AbstractRecord input_format_type
The specification of output file format.
Input::Record input_record_
ofstream * base_file
Base output stream.
Header: The functions for all outputs.
TimeMarks::iterator begin(TimeMark::Type mask=TimeMark::every_type) const
Iterator for the begin mimics container-like of TimeMarks.
static Input::Type::Record input_type
The specification of output stream.
void set_base_file(ofstream *_base_file)
static Input::Type::Record input_type
The definition of input record for gmsh file format.
TimeMark::Type type_output()
OutputTime(const Input::Record &in_rec)
Constructor of OutputTime object. It opens base file for writing.
#define INSTANCE_register_multifield(spacedim, value)
I/O functions with filename storing, able to track current line in opened file. All standard stdio fu...
Basic time management functionality for unsteady (and steady) solvers (class Equation).
static TimeMarks & marks()
vector< OutputDataBase * > node_data
static void destroy_all(void)
Try to find output stream from a key in record.
#define INSTANCE_register_field(spacedim, value)
static Input::Type::Record input_type
The definition of input record for vtk file format.
static void fix_GMSH_file_name(string *fname)
This method add right suffix to .msh GMSH file.
void add(const TimeMark &mark)
static OutputTime * create_output_stream(const Input::Record &in_rec)
This method write all registered data to output streams.
string * _base_filename
Name of base output file.
static std::vector< OutputTime * > output_streams
Vector of pointers at OutputTime.
void set_mesh(Mesh *_mesh)
int current_step
Current step.
void add_time_marks_grid(double step, TimeMark::Type mark_type=TimeMark::none_type) const
TimeMark::Type equation_fixed_mark_type() const
TimeMark::Type equation_mark_type() const
OutputDataBase * output_data_by_field_name(const string &field_name, DiscreteSpace ref_type)
This method returns pointer at existing data, when corresponding output data exists or it creates new...
vector< OutputDataBase * > elem_data
Header: The functions for MSH (GMSH) outputs.
This class is used for output data to VTK file format.
int rank
MPI rank of process (is tested in methods)
virtual ~OutputTime()
Destructor of OutputTime. It doesn't do anything, because all necessary destructors will be called in...
void clear_data(void)
Clear data for output computed by method compute_field_data.
The class for outputing data during time.
void mark_output_times(const TimeGovernor &tg)
#define INPUT_CHECK(i,...)
Debugging macros.
Dedicated class for storing path to input and output files.
Header: The functions for VTK outputs.
TimeMark::Type type_input()
virtual int write_data(void)=0
void add_admissible_field_names(const Input::Array &in_array, const Input::Type::Selection &in_sel)
Registers names of output fields that can be written using this stream.
#define INSTANCE_ALL(MACRO)
Class used for marking specified times at which some events occur.
double write_time
The last time, when data was wrote to this stream.
TimeMarks::iterator end(TimeMark::Type mask=TimeMark::every_type) const
Iterator for the end mimics container-like of TimeMarks.
static void fix_VTK_file_name(string *fname)
This method add right suffix to .pvd VTK file.
This class is used for output data to VTK file format.
vector< OutputDataBase * > corner_data