Flow123d  JS_before_hm-2198-g122e1f2e2
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
OutputMeshBase Class Referenceabstract

Base class for Output mesh. More...

#include <output_mesh.hh>

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

Public Types

typedef std::function< void(const Armor::array &, const ElementAccessor< spacedim > &, std::vector< double > &)> ErrorControlFieldFunc
 

Public Member Functions

 OutputMeshBase (Mesh &mesh)
 Constructor. Takes computational mesh as a parameter. More...
 
 OutputMeshBase (Mesh &mesh, const Input::Record &in_rec)
 Constructor. Takes computational mesh and input record as a parameters. More...
 
virtual ~OutputMeshBase ()
 
OutputElementIterator begin ()
 Gives iterator to the FIRST element of the output mesh. More...
 
OutputElementIterator end ()
 Gives iterator to the LAST element of the output mesh. More...
 
void create_sub_mesh ()
 
virtual void create_refined_sub_mesh ()=0
 
void set_error_control_field (ErrorControlFieldFunc error_control_field_func)
 Selects the error control field computing function of output field set according to input record. More...
 
unsigned int n_nodes ()
 Returns number of nodes. More...
 
unsigned int n_elements ()
 Returns number of element. More...
 
bool is_created ()
 Check if nodes_, connectivity_ and offsets_ data caches are created. More...
 
void create_id_caches ()
 Create nodes and elements data caches. More...
 
void make_serial_master_mesh ()
 Synchronize parallel data and create serial COLECTIVE output mesh on zero process. More...
 
virtual void make_parallel_master_mesh ()
 Create output mesh of parallel output (implemented only for discontinuous mesh) More...
 
std::shared_ptr< OutputMeshBaseget_master_mesh ()
 Return master output mesh if exists or shared_ptr of this object. More...
 
LongIdx get_loc_elem_idx (LongIdx global_idx)
 
std::shared_ptr< ElementDataCache< unsigned int > > offsets () const
 Getter to offsets data. More...
 

Static Public Member Functions

static const Input::Type::Recordget_input_type ()
 The specification of output mesh. More...
 

Static Public Attributes

static const unsigned int spacedim = 3
 Shortcut instead of spacedim template. We suppose only spacedim=3 at the moment. More...
 

Protected Types

enum  MeshType { orig, refined, discont }
 

Protected Member Functions

virtual std::shared_ptr< OutputMeshBaseconstruct_mesh ()=0
 
virtual std::shared_ptr< ElementDataCache< double > > make_serial_nodes_cache (std::shared_ptr< ElementDataCache< unsigned int >> global_offsets)=0
 
virtual std::shared_ptr< ElementDataCache< unsigned int > > make_serial_connectivity_cache (std::shared_ptr< ElementDataCache< unsigned int >> global_offsets)=0
 
std::shared_ptr< ElementDataCache< unsigned int > > get_elems_n_nodes ()
 Compute and return number of nodes for each elements (compute from offsets) More...
 

Protected Attributes

Input::Record input_record_
 Input record for output mesh. More...
 
Meshorig_mesh_
 Pointer to the computational mesh. More...
 
const unsigned int max_level_
 Maximal level of refinement. More...
 
ErrorControlFieldFunc error_control_field_func_
 Refinement error control field function (hold value_list function of field). More...
 
MeshType mesh_type_
 Type of OutputMesh. More...
 
bool refine_by_error_
 True, if output mesh is to be refined by error criterion. More...
 
double refinement_error_tolerance_
 Tolerance for error criterion refinement. More...
 
std::shared_ptr< std::vector< unsigned int > > orig_element_indices_
 Vector of element indices in the computational mesh. (Important when refining.) 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...
 
std::shared_ptr< ElementDataCache< unsigned int > > node_ids_
 Vector gets ids of nodes. Data is used in GMSH output. More...
 
std::shared_ptr< ElementDataCache< unsigned int > > elem_ids_
 Vector gets ids of elements. Data is used in GMSH output. More...
 
std::shared_ptr< ElementDataCache< unsigned int > > region_ids_
 Vector gets ids of regions. Data is used in GMSH output. More...
 
std::shared_ptr< ElementDataCache< int > > partitions_
 Vector gets partitions of elements. Data is used in GMSH output. More...
 
std::shared_ptr< OutputMeshBasemaster_mesh_
 
LongIdxel_4_loc_
 Index set assigning to local element index its global index. More...
 
LongIdxloc_4_el_
 Index set assigning to global index its local element index. More...
 
Distributionel_ds_
 Parallel distribution of elements. More...
 
LongIdxnode_4_loc_
 Index set assigning to local node index its global index. More...
 
Distributionnode_ds_
 Parallel distribution of nodes. Depends on elements distribution. More...
 
unsigned int n_local_nodes_
 Hold number of local nodes (own + ghost), value is equal with size of node_4_loc array. More...
 

Friends

class OutputElement
 Friend provides access to vectors for element accessor class. More...
 
class OutputTime
 
class OutputMSH
 
class OutputVTK
 
class OutputMesh
 
class OutputMeshDiscontinuous
 

Detailed Description

Base class for Output mesh.

Defines common members for Output mesh classes:

Making of output meshes and calling of their initialization methods must be execute in correct order, see example:

// Create or get Mesh object
Mesh * my_mesh = ...
// Construct mesh with continuous elements
std::make_shared<OutputMesh> output_mesh = std::make_shared<OutputMesh>(*my_mesh);
// Creates the sub meshes on all processes identical to the computational one.
output_mesh->create_sub_mesh();
// Creates mesh on zero process identical to the computational one.
std::make_shared<OutputMesh> serial_output_mesh = output_mesh->make_serial_master_mesh();
// Construct mesh with discontinuous elements
std::make_shared<OutputMeshDiscontinuous> output_mesh_discont = std::make_shared<OutputMeshDiscontinuous>(*my_mesh);
// Creates sub meshes on all processes mesh from the original my_mesh.
output_mesh_discont->create_sub_mesh();
// Creates mesh on zero process from the original my_mesh.
std::make_shared<OutputMeshDiscontinuous> serial_output_mesh = output_mesh->make_serial_master_mesh();

Definition at line 70 of file output_mesh.hh.

Member Typedef Documentation

◆ ErrorControlFieldFunc

typedef std::function<void(const Armor::array &, const ElementAccessor<spacedim> &, std::vector<double> &)> OutputMeshBase::ErrorControlFieldFunc

Definition at line 77 of file output_mesh.hh.

Member Enumeration Documentation

◆ MeshType

enum OutputMeshBase::MeshType
protected

Possible types of OutputMesh.

Enumerator
orig 

same as original (computational) mesh

refined 

refined mesh

discont 

discontinuous mesh

Definition at line 155 of file output_mesh.hh.

Constructor & Destructor Documentation

◆ OutputMeshBase() [1/2]

OutputMeshBase::OutputMeshBase ( Mesh mesh)

Constructor. Takes computational mesh as a parameter.

Definition at line 46 of file output_mesh.cc.

◆ OutputMeshBase() [2/2]

OutputMeshBase::OutputMeshBase ( Mesh mesh,
const Input::Record in_rec 
)

Constructor. Takes computational mesh and input record as a parameters.

Definition at line 58 of file output_mesh.cc.

◆ ~OutputMeshBase()

OutputMeshBase::~OutputMeshBase ( )
virtual

Definition at line 70 of file output_mesh.cc.

Member Function Documentation

◆ begin()

OutputElementIterator OutputMeshBase::begin ( )

Gives iterator to the FIRST element of the output mesh.

Definition at line 81 of file output_mesh.cc.

Here is the caller graph for this function:

◆ construct_mesh()

virtual std::shared_ptr<OutputMeshBase> OutputMeshBase::construct_mesh ( )
protectedpure virtual

Construct empty output mesh.

Use in make_serial_master_mesh method and create mesh of same type as this object (continuous / discontinuos)

Implemented in OutputMeshDiscontinuous, and OutputMesh.

Here is the caller graph for this function:

◆ create_id_caches()

void OutputMeshBase::create_id_caches ( )

Create nodes and elements data caches.

Definition at line 113 of file output_mesh.cc.

◆ create_refined_sub_mesh()

virtual void OutputMeshBase::create_refined_sub_mesh ( )
pure virtual

Creates refined sub mesh containing only local part of original (computation) mesh.

Implemented in OutputMeshDiscontinuous, and OutputMesh.

◆ create_sub_mesh()

void OutputMeshBase::create_sub_mesh ( )

Creates sub mesh containing only local part of original (computation) mesh.

TODO: should be replaced by local part of future parallel computational mesh.

Definition at line 151 of file output_mesh.cc.

◆ end()

OutputElementIterator OutputMeshBase::end ( )

Gives iterator to the LAST element of the output mesh.

Definition at line 88 of file output_mesh.cc.

◆ get_elems_n_nodes()

std::shared_ptr< ElementDataCache< unsigned int > > OutputMeshBase::get_elems_n_nodes ( )
protected

Compute and return number of nodes for each elements (compute from offsets)

Definition at line 255 of file output_mesh.cc.

Here is the caller graph for this function:

◆ get_input_type()

const IT::Record & OutputMeshBase::get_input_type ( )
static

The specification of output mesh.

Returns
record for output mesh

Definition at line 31 of file output_mesh.cc.

Here is the caller graph for this function:

◆ get_loc_elem_idx()

LongIdx OutputMeshBase::get_loc_elem_idx ( LongIdx  global_idx)
inline

Return local element index to its global index.

Temporary method. Used only in output assembly classes. DO NOT USE in other code!

Definition at line 140 of file output_mesh.hh.

◆ get_master_mesh()

std::shared_ptr<OutputMeshBase> OutputMeshBase::get_master_mesh ( )
inline

Return master output mesh if exists or shared_ptr of this object.

Definition at line 130 of file output_mesh.hh.

◆ is_created()

bool OutputMeshBase::is_created ( )

Check if nodes_, connectivity_ and offsets_ data caches are created.

Definition at line 145 of file output_mesh.cc.

Here is the caller graph for this function:

◆ make_parallel_master_mesh()

virtual void OutputMeshBase::make_parallel_master_mesh ( )
inlinevirtual

Create output mesh of parallel output (implemented only for discontinuous mesh)

Reimplemented in OutputMeshDiscontinuous.

Definition at line 126 of file output_mesh.hh.

◆ make_serial_connectivity_cache()

virtual std::shared_ptr<ElementDataCache<unsigned int> > OutputMeshBase::make_serial_connectivity_cache ( std::shared_ptr< ElementDataCache< unsigned int >>  global_offsets)
protectedpure virtual

Create serial (collective) connectivity cache on zero process.

Implements part of make_serial_master_mesh that are specific for continuous and discontinuous case.

Implemented in OutputMeshDiscontinuous, and OutputMesh.

Here is the caller graph for this function:

◆ make_serial_master_mesh()

void OutputMeshBase::make_serial_master_mesh ( )

Synchronize parallel data and create serial COLECTIVE output mesh on zero process.

Definition at line 217 of file output_mesh.cc.

◆ make_serial_nodes_cache()

virtual std::shared_ptr<ElementDataCache<double> > OutputMeshBase::make_serial_nodes_cache ( std::shared_ptr< ElementDataCache< unsigned int >>  global_offsets)
protectedpure virtual

Create serial (collective) nodes cache on zero process.

Implements part of make_serial_master_mesh that are specific for continuous and discontinuous case.

Implemented in OutputMeshDiscontinuous, and OutputMesh.

Here is the caller graph for this function:

◆ n_elements()

unsigned int OutputMeshBase::n_elements ( )

Returns number of element.

Definition at line 101 of file output_mesh.cc.

Here is the caller graph for this function:

◆ n_nodes()

unsigned int OutputMeshBase::n_nodes ( )

Returns number of nodes.

Definition at line 107 of file output_mesh.cc.

Here is the caller graph for this function:

◆ offsets()

std::shared_ptr<ElementDataCache<unsigned int> > OutputMeshBase::offsets ( ) const
inline

Getter to offsets data.

Definition at line 147 of file output_mesh.hh.

◆ set_error_control_field()

void OutputMeshBase::set_error_control_field ( ErrorControlFieldFunc  error_control_field_func)

Selects the error control field computing function of output field set according to input record.

Definition at line 96 of file output_mesh.cc.

Friends And Related Function Documentation

◆ OutputElement

friend class OutputElement
friend

Friend provides access to vectors for element accessor class.

Definition at line 242 of file output_mesh.hh.

◆ OutputMesh

friend class OutputMesh
friend

Definition at line 246 of file output_mesh.hh.

◆ OutputMeshDiscontinuous

friend class OutputMeshDiscontinuous
friend

Definition at line 247 of file output_mesh.hh.

◆ OutputMSH

friend class OutputMSH
friend

Definition at line 244 of file output_mesh.hh.

◆ OutputTime

friend class OutputTime
friend

Definition at line 243 of file output_mesh.hh.

◆ OutputVTK

friend class OutputVTK
friend

Definition at line 245 of file output_mesh.hh.

Member Data Documentation

◆ connectivity_

std::shared_ptr<ElementDataCache<unsigned int> > OutputMeshBase::connectivity_
protected

Vector maps the nodes to their coordinates in vector nodes_.

Definition at line 208 of file output_mesh.hh.

◆ el_4_loc_

LongIdx* OutputMeshBase::el_4_loc_
protected

Index set assigning to local element index its global index.

Next variables hold distributions of elements and nodes. They differ for mesh types

  • continuous and discontinuous mesh shared objects with computational (orig) mesh
  • refined mesh creates own objects

Definition at line 234 of file output_mesh.hh.

◆ el_ds_

Distribution* OutputMeshBase::el_ds_
protected

Parallel distribution of elements.

Definition at line 236 of file output_mesh.hh.

◆ elem_ids_

std::shared_ptr<ElementDataCache<unsigned int> > OutputMeshBase::elem_ids_
protected

Vector gets ids of elements. Data is used in GMSH output.

Definition at line 215 of file output_mesh.hh.

◆ error_control_field_func_

ErrorControlFieldFunc OutputMeshBase::error_control_field_func_
protected

Refinement error control field function (hold value_list function of field).

Definition at line 196 of file output_mesh.hh.

◆ input_record_

Input::Record OutputMeshBase::input_record_
protected

Input record for output mesh.

Definition at line 187 of file output_mesh.hh.

◆ loc_4_el_

LongIdx* OutputMeshBase::loc_4_el_
protected

Index set assigning to global index its local element index.

Definition at line 235 of file output_mesh.hh.

◆ master_mesh_

std::shared_ptr<OutputMeshBase> OutputMeshBase::master_mesh_
protected

Master OutputMesh.

  • serial output: is constructed on zero process (collective) and allow to produce serial output of parallel computation
  • parallel output: is constructed on each process only for discontinuous mesh

Definition at line 227 of file output_mesh.hh.

◆ max_level_

const unsigned int OutputMeshBase::max_level_
protected

Maximal level of refinement.

Definition at line 193 of file output_mesh.hh.

◆ mesh_type_

MeshType OutputMeshBase::mesh_type_
protected

Type of OutputMesh.

Definition at line 198 of file output_mesh.hh.

◆ n_local_nodes_

unsigned int OutputMeshBase::n_local_nodes_
protected

Hold number of local nodes (own + ghost), value is equal with size of node_4_loc array.

Definition at line 239 of file output_mesh.hh.

◆ node_4_loc_

LongIdx* OutputMeshBase::node_4_loc_
protected

Index set assigning to local node index its global index.

Definition at line 237 of file output_mesh.hh.

◆ node_ds_

Distribution* OutputMeshBase::node_ds_
protected

Parallel distribution of nodes. Depends on elements distribution.

Definition at line 238 of file output_mesh.hh.

◆ node_ids_

std::shared_ptr<ElementDataCache<unsigned int> > OutputMeshBase::node_ids_
protected

Vector gets ids of nodes. Data is used in GMSH output.

Definition at line 213 of file output_mesh.hh.

◆ nodes_

std::shared_ptr<ElementDataCache<double> > OutputMeshBase::nodes_
protected

Vector of node coordinates. [spacedim x n_nodes].

Definition at line 206 of file output_mesh.hh.

◆ offsets_

std::shared_ptr<ElementDataCache<unsigned int> > OutputMeshBase::offsets_
protected

Vector of offsets of node indices of elements. Maps elements to their nodes in connectivity_.

Definition at line 210 of file output_mesh.hh.

◆ orig_element_indices_

std::shared_ptr<std::vector<unsigned int> > OutputMeshBase::orig_element_indices_
protected

Vector of element indices in the computational mesh. (Important when refining.)

Definition at line 203 of file output_mesh.hh.

◆ orig_mesh_

Mesh* OutputMeshBase::orig_mesh_
protected

Pointer to the computational mesh.

Definition at line 190 of file output_mesh.hh.

◆ partitions_

std::shared_ptr<ElementDataCache<int> > OutputMeshBase::partitions_
protected

Vector gets partitions of elements. Data is used in GMSH output.

Definition at line 219 of file output_mesh.hh.

◆ refine_by_error_

bool OutputMeshBase::refine_by_error_
protected

True, if output mesh is to be refined by error criterion.

Definition at line 199 of file output_mesh.hh.

◆ refinement_error_tolerance_

double OutputMeshBase::refinement_error_tolerance_
protected

Tolerance for error criterion refinement.

Definition at line 200 of file output_mesh.hh.

◆ region_ids_

std::shared_ptr<ElementDataCache<unsigned int> > OutputMeshBase::region_ids_
protected

Vector gets ids of regions. Data is used in GMSH output.

Definition at line 217 of file output_mesh.hh.

◆ spacedim

const unsigned int OutputMeshBase::spacedim = 3
static

Shortcut instead of spacedim template. We suppose only spacedim=3 at the moment.

Definition at line 74 of file output_mesh.hh.


The documentation for this class was generated from the following files:
Mesh
Definition: mesh.h:355
OutputMeshBase::create_sub_mesh
void create_sub_mesh()
Definition: output_mesh.cc:151
OutputMesh
Class represents output mesh with continuous elements.
Definition: output_mesh.hh:252
OutputMeshBase::make_serial_master_mesh
void make_serial_master_mesh()
Synchronize parallel data and create serial COLECTIVE output mesh on zero process.
Definition: output_mesh.cc:217