Flow123d  JS_before_hm-2154-g185f171e0
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
OutputMSH Class Reference

This class is used for output data to VTK file format. More...

#include <output_msh.hh>

Inheritance diagram for OutputMSH:
Inheritance graph
[legend]
Collaboration diagram for OutputMSH:
Collaboration graph
[legend]

Public Types

typedef OutputTime FactoryBaseType
 
- Public Types inherited from OutputTime
enum  DiscreteSpace {
  NODE_DATA = 0, CORNER_DATA = 1, ELEM_DATA = 2, NATIVE_DATA = 3,
  MESH_DEFINITION = 9, UNDEFINED = 10
}
 
typedef std::array< bool, 4 > DiscreteSpaceFlags
 
typedef std::shared_ptr< ElementDataCacheBaseOutputDataPtr
 
typedef std::vector< OutputDataPtrOutputDataFieldVec
 
typedef std::pair< std::string, unsigned int > FieldInterpolationData
 pair of field name and shape (= Scalar 1, Vector 3, Tensor 9) More...
 
typedef std::map< DiscreteSpace, std::vector< FieldInterpolationData > > InterpolationMap
 

Public Member Functions

 OutputMSH ()
 The constructor of this class. We open the output file in first call of write_data. More...
 
 ~OutputMSH ()
 The destructor of this class. More...
 
int write_head (void)
 This method writes head of GMSH (.msh) file format. More...
 
int write_data (void)
 This method writes data to GMSH (.msh) file format for current time. More...
 
int write_tail (void)
 This method should write tail of GMSH (.msh) file format. More...
 
void set_output_data_caches (std::shared_ptr< OutputMeshBase > mesh_ptr) override
 
- Public Member Functions inherited from OutputTime
 OutputTime ()
 Default constructor. Only for testing. More...
 
virtual void init_from_input (const std::string &equation_name, const Input::Record &in_rec, const std::shared_ptr< TimeUnitConversion > &time_unit_conv)
 Constructor of OutputTime object. It opens base file for writing. More...
 
void set_stream_precision (std::ofstream &stream)
 
virtual ~OutputTime ()
 Destructor of OutputTime. It doesn't do anything, because all necessary destructors will be called in destructor of Output. More...
 
Input::Iterator< Input::Arrayget_time_set_array ()
 
Input::Iterator< Input::Recordget_output_mesh_record ()
 
void write_time_frame ()
 
std::shared_ptr< Observeobserve (Mesh *mesh)
 
void clear_data (void)
 Clear data for output computed by method compute_field_data. More...
 
bool is_output_data_caches_init ()
 
bool enable_refinement ()
 Return auxiliary flag enable_refinement_. More...
 
std::shared_ptr< OutputMeshBaseget_output_mesh_ptr ()
 
void update_time (double field_time)
 
template<typename T >
OutputDataPtr prepare_compute_data (std::string field_name, DiscreteSpace space_type, unsigned int n_rows, unsigned int n_cols, std::string fe_type="", unsigned int n_dofs_per_element=1)
 
bool is_parallel () const
 
int rank () const
 
int n_proc () const
 
double registered_time () const
 Getter to registered time. More...
 

Static Public Member Functions

static const Input::Type::Recordget_input_type ()
 The definition of input record for gmsh file format. More...
 
- Static Public Member Functions inherited from OutputTime
static const Input::Type::Recordget_input_type ()
 The specification of output stream. More...
 
static Input::Type::Abstractget_input_format_type ()
 The specification of output file format. More...
 
static bool discrete_flags_defined (DiscreteSpaceFlags &dsf)
 Check if at least one of discrete space flag is set to true. More...
 
static DiscreteSpaceFlags empty_discrete_flags ()
 Check if at least one of discrete space flag is set to true. More...
 
static void set_discrete_flag (DiscreteSpaceFlags &dsf, DiscreteSpace d_space)
 
static std::shared_ptr< OutputTimecreate_output_stream (const std::string &equation_name, const Input::Record &in_rec, const std::shared_ptr< TimeUnitConversion > &time_unit_conv)
 This method delete all object instances of class OutputTime stored in output_streams vector. More...
 

Private Member Functions

void write_msh_header (void)
 This function write header of GMSH (.msh) file format. More...
 
void write_msh_geometry (void)
 This function writes geometry (position of nodes) to GMSH (.msh) file format. More...
 
void write_msh_topology (void)
 This function writes topology (connection of nodes) to the GMSH (.msh) file format. More...
 
void write_msh_ascii_data (std::shared_ptr< ElementDataCache< unsigned int >> id_cache, OutputDataPtr output_data, const std::vector< unsigned int > &permutations)
 This function writes nodes / elements ascii data to GMSH (.msh) output file. More...
 
void write_node_data (OutputDataPtr output_data)
 This function write all data on nodes to output file. This function is used for static and dynamic data. More...
 
void write_corner_data (OutputDataPtr output_data)
 writes ElementNode data ascii GMSH (.msh) output file. More...
 
void write_elem_data (OutputDataPtr output_data)
 This function write all data on elements to output file. This function is used for static and dynamic data. More...
 
void fix_base_file_name (void)
 This method add right suffix to .msh GMSH file. More...
 

Private Attributes

bool header_written
 
std::vector< std::vector< OutputDataPtr > > dummy_data_list_
 
std::shared_ptr< ElementDataCache< unsigned int > > node_ids_
 Vector gets ids of nodes. More...
 
std::shared_ptr< ElementDataCache< unsigned int > > elem_ids_
 Vector gets ids of elements. More...
 
std::shared_ptr< ElementDataCache< unsigned int > > region_ids_
 Vector gets ids of regions. More...
 
std::shared_ptr< ElementDataCache< int > > partitions_
 Vector gets partitions of elements. More...
 

Static Private Attributes

static const int registrar
 Registrar of class to factory. More...
 

Additional Inherited Members

- Static Public Attributes inherited from OutputTime
static const unsigned int N_DISCRETE_SPACES = 4
 
- Protected Member Functions inherited from OutputTime
void fix_main_file_extension (std::string extension)
 
int get_parallel_current_step ()
 Return unique value current step for parallel or serial output. More...
 
void gather_output_data (void)
 Collect data of individual processes to serial data on master (0th) process. More...
 
- Protected Attributes inherited from OutputTime
int rank_
 
int n_proc_
 
OutputDataFieldVec output_data_vec_ [N_DISCRETE_SPACES]
 
int current_step
 
double registered_time_
 
double write_time
 
Input::Record input_record_
 
ofstream _base_file
 
FilePath _base_filename
 
std::string equation_name_
 
int precision_
 
std::shared_ptr< OutputMeshBaseoutput_mesh_
 Output mesh. More...
 
std::shared_ptr< Observeobserve_
 
bool enable_refinement_
 Auxiliary flag for refinement enabling, due to gmsh format. More...
 
bool parallel_
 Parallel or serial version of file format (parallel has effect only for VTK) More...
 
std::shared_ptr< TimeUnitConversiontime_unit_converter
 Time unit conversion object from the equation time governor. More...
 
std::shared_ptr< ElementDataCache< double > > nodes_
 Vector of node coordinates. [spacedim x n_nodes]. More...
 
std::shared_ptr< ElementDataCache< unsigned int > > connectivity_
 Vector maps the nodes to their coordinates in vector nodes_. More...
 
std::shared_ptr< ElementDataCache< unsigned int > > offsets_
 Vector of offsets of node indices of elements. Maps elements to their nodes in connectivity_. More...
 

Detailed Description

This class is used for output data to VTK file format.

Definition at line 30 of file output_msh.hh.

Member Typedef Documentation

◆ FactoryBaseType

Definition at line 32 of file output_msh.hh.

Constructor & Destructor Documentation

◆ OutputMSH()

OutputMSH::OutputMSH ( )

The constructor of this class. We open the output file in first call of write_data.

Definition at line 44 of file output_msh.cc.

◆ ~OutputMSH()

OutputMSH::~OutputMSH ( )

The destructor of this class.

Definition at line 54 of file output_msh.cc.

Member Function Documentation

◆ fix_base_file_name()

void OutputMSH::fix_base_file_name ( void  )
private

This method add right suffix to .msh GMSH file.

◆ get_input_type()

const Record & OutputMSH::get_input_type ( )
static

The definition of input record for gmsh file format.

Definition at line 33 of file output_msh.cc.

◆ set_output_data_caches()

void OutputMSH::set_output_data_caches ( std::shared_ptr< OutputMeshBase mesh_ptr)
overridevirtual

Set shared pointers of output data caches.

Reimplemented from OutputTime.

Definition at line 332 of file output_msh.cc.

◆ write_corner_data()

void OutputMSH::write_corner_data ( OutputDataPtr  output_data)
private

writes ElementNode data ascii GMSH (.msh) output file.

Definition at line 198 of file output_msh.cc.

◆ write_data()

int OutputMSH::write_data ( void  )
virtual

This method writes data to GMSH (.msh) file format for current time.

Returns
This function returns 1

Implements OutputTime.

Definition at line 281 of file output_msh.cc.

◆ write_elem_data()

void OutputMSH::write_elem_data ( OutputDataPtr  output_data)
private

This function write all data on elements to output file. This function is used for static and dynamic data.

Parameters
[in]timeThe time from start
[in]stepThe number of steps from start

Definition at line 234 of file output_msh.cc.

◆ write_head()

int OutputMSH::write_head ( void  )

This method writes head of GMSH (.msh) file format.

Returns
This function returns 1

Definition at line 266 of file output_msh.cc.

◆ write_msh_ascii_data()

void OutputMSH::write_msh_ascii_data ( std::shared_ptr< ElementDataCache< unsigned int >>  id_cache,
OutputDataPtr  output_data,
const std::vector< unsigned int > &  permutations 
)
private

This function writes nodes / elements ascii data to GMSH (.msh) output file.

Parameters
[in]id_cacheData cache of node or element ids.
[in]output_dataThe pointer at structure storing pointer at own data.
[in]permutationsPermutation vector of optimized order of nodes / elements.

Definition at line 148 of file output_msh.cc.

◆ write_msh_geometry()

void OutputMSH::write_msh_geometry ( void  )
private

This function writes geometry (position of nodes) to GMSH (.msh) file format.

Definition at line 75 of file output_msh.cc.

◆ write_msh_header()

void OutputMSH::write_msh_header ( void  )
private

This function write header of GMSH (.msh) file format.

Definition at line 65 of file output_msh.cc.

◆ write_msh_topology()

void OutputMSH::write_msh_topology ( void  )
private

This function writes topology (connection of nodes) to the GMSH (.msh) file format.

Definition at line 96 of file output_msh.cc.

◆ write_node_data()

void OutputMSH::write_node_data ( OutputDataPtr  output_data)
private

This function write all data on nodes to output file. This function is used for static and dynamic data.

Parameters
[in]timeThe time from start
[in]stepThe number of steps from start

Definition at line 164 of file output_msh.cc.

◆ write_tail()

int OutputMSH::write_tail ( void  )

This method should write tail of GMSH (.msh) file format.

It is stupid file format. It doesn't write anything special at the end of the file

Returns
This function returns 1

Definition at line 326 of file output_msh.cc.

Member Data Documentation

◆ dummy_data_list_

std::vector< std::vector< OutputDataPtr > > OutputMSH::dummy_data_list_
private

EquationOutput force output of all output fields at the time zero. We keep this list to perform single elemnent/node output in order to have correct behavior in GMSH.

Definition at line 90 of file output_msh.hh.

◆ elem_ids_

std::shared_ptr<ElementDataCache<unsigned int> > OutputMSH::elem_ids_
private

Vector gets ids of elements.

Definition at line 150 of file output_msh.hh.

◆ header_written

bool OutputMSH::header_written
private

Definition at line 84 of file output_msh.hh.

◆ node_ids_

std::shared_ptr<ElementDataCache<unsigned int> > OutputMSH::node_ids_
private

Vector gets ids of nodes.

Definition at line 148 of file output_msh.hh.

◆ partitions_

std::shared_ptr<ElementDataCache<int> > OutputMSH::partitions_
private

Vector gets partitions of elements.

Definition at line 154 of file output_msh.hh.

◆ region_ids_

std::shared_ptr<ElementDataCache<unsigned int> > OutputMSH::region_ids_
private

Vector gets ids of regions.

Definition at line 152 of file output_msh.hh.

◆ registrar

const int OutputMSH::registrar
staticprivate
Initial value:
= Input::register_class< OutputMSH >("gmsh") +

Registrar of class to factory.

Definition at line 82 of file output_msh.hh.


The documentation for this class was generated from the following files:
Input::Type::Record::size
unsigned int size() const
Returns number of keys in the Record.
Definition: type_record.hh:602
OutputMSH::get_input_type
static const Input::Type::Record & get_input_type()
The definition of input record for gmsh file format.
Definition: output_msh.cc:33