HIFLOW  2.0
Public Types | Public Member Functions | Protected Attributes | List of all members
hiflow::mesh::MeshBuilder Class Referenceabstract

Abstract interface for mesh construction. More...

#include <mesh_builder.h>

Inheritance diagram for hiflow::mesh::MeshBuilder:
[legend]

Public Types

typedef int EntityHandle
 Type for identifiers of entities that have been added to the MeshBuilder. This later becomes the Id values of the entities. More...
 
typedef int VertexHandle
 Type for identifiers of vertices that have been added to the MeshBuilder. More...
 

Public Member Functions

virtual std::vector< EntityHandleadd_entities (TDim tdim, const std::vector< VertexHandle > &vertices, const std::vector< int > &sizes)=0
 Add a list of entities to the Mesh under construction. More...
 
virtual EntityHandle add_entity (TDim tdim, const std::vector< VertexHandle > &vertices)=0
 Add an entity to the Mesh under construction. More...
 
virtual VertexHandle add_vertex (const std::vector< Coordinate > &coordinates)=0
 Add a vertex to the Mesh under construction. More...
 
virtual std::vector< VertexHandleadd_vertices (const std::vector< Coordinate > &coordinates)=0
 Add a list of vertices to the Mesh under construction. More...
 
virtual MeshPtr build ()=0
 Build the Mesh. More...
 
virtual void clear ()=0
 Clean the MeshBuilder. More...
 
GDim gdim () const
 Access the geometrical dimension of the Mesh under construction. More...
 
std::vector< MasterSlaveget_period () const
 Get periodicity. More...
 
 MeshBuilder (TDim tdim, GDim gdim, std::vector< MasterSlave > period=std::vector< MasterSlave >(0))
 Constructor for MeshBuilder object. More...
 
virtual void set_material_number (TDim tdim, EntityHandle entity, MaterialNumber material)=0
 Set the material number for an entity. More...
 
TDim tdim () const
 Access the topological dimension of the Mesh under construction. More...
 
virtual ~MeshBuilder ()
 Destructor. More...
 

Protected Attributes

GDim gdim_
 
std::vector< MasterSlaveperiod_
 
TDim tdim_
 

Detailed Description

Abstract interface for mesh construction.

Definition at line 34 of file mesh_builder.h.

Member Typedef Documentation

◆ EntityHandle

Type for identifiers of entities that have been added to the MeshBuilder. This later becomes the Id values of the entities.

Definition at line 42 of file mesh_builder.h.

◆ VertexHandle

Type for identifiers of vertices that have been added to the MeshBuilder.

Definition at line 38 of file mesh_builder.h.

Constructor & Destructor Documentation

◆ MeshBuilder()

hiflow::mesh::MeshBuilder::MeshBuilder ( TDim  tdim,
GDim  gdim,
std::vector< MasterSlave period = std::vector<MasterSlave>( 0 ) 
)
inline

Constructor for MeshBuilder object.

Parameters
tdimThe topological dimension of the Mesh to be constructed
gdimThe geometrical dimension of the Mesh to be constructed
periodDescribing periodicity. Default: No periodicity

Definition at line 118 of file mesh_builder.h.

Referenced by hiflow::mesh::MeshDbViewBuilder::MeshDbViewBuilder().

119  : tdim_ ( tdim ), gdim_ ( gdim ), period_ ( period )
120  {
121  }
TDim tdim() const
Access the topological dimension of the Mesh under construction.
Definition: mesh_builder.h:127
GDim gdim() const
Access the geometrical dimension of the Mesh under construction.
Definition: mesh_builder.h:132
std::vector< MasterSlave > period_
Definition: mesh_builder.h:112

◆ ~MeshBuilder()

hiflow::mesh::MeshBuilder::~MeshBuilder ( )
inlinevirtual

Destructor.

Definition at line 123 of file mesh_builder.h.

124  {
125  }

Member Function Documentation

◆ add_entities()

virtual std::vector<EntityHandle> hiflow::mesh::MeshBuilder::add_entities ( TDim  tdim,
const std::vector< VertexHandle > &  vertices,
const std::vector< int > &  sizes 
)
pure virtual

Add a list of entities to the Mesh under construction.

Parameters
tdimthe topological dimension of the added entities
verticesthe concatenated list of vertices of the entities, identified through their VertexHandle:s.
sizesa list of sizes (number of vertices) of the entities. This length of this list equals the number of entities to be added.
Returns
a list with the identifiers of the new entities

Implemented in hiflow::mesh::MeshDbViewBuilder, and hiflow::mesh::DistributedBuilder.

Referenced by hiflow::mesh::unpack_entities().

◆ add_entity()

virtual EntityHandle hiflow::mesh::MeshBuilder::add_entity ( TDim  tdim,
const std::vector< VertexHandle > &  vertices 
)
pure virtual

Add an entity to the Mesh under construction.

Parameters
tdimthe topological dimension of the added entity
verticesthe list of vertices in the entity, identified through the VertexHandle:s returned from add_vertex or add_vertices.
Returns
the identifier of the new entity

Implemented in hiflow::mesh::MeshDbViewBuilder, and hiflow::mesh::DistributedBuilder.

Referenced by hiflow::mesh::DistributedBuilder::add_entities(), hiflow::mesh::DistributedBuilder::add_entity(), hiflow::mesh::UcdReader::read_file(), and hiflow::mesh::VtkReader::read_file().

◆ add_vertex()

virtual VertexHandle hiflow::mesh::MeshBuilder::add_vertex ( const std::vector< Coordinate > &  coordinates)
pure virtual

Add a vertex to the Mesh under construction.

Parameters
coordinatesthe coordinates of the vertex
Returns
the identifier of the new vertex

Implemented in hiflow::mesh::MeshDbViewBuilder, and hiflow::mesh::DistributedBuilder.

Referenced by hiflow::mesh::DistributedBuilder::add_local_vertex(), hiflow::mesh::UcdReader::read_file(), and hiflow::mesh::VtkReader::read_file().

◆ add_vertices()

virtual std::vector<VertexHandle> hiflow::mesh::MeshBuilder::add_vertices ( const std::vector< Coordinate > &  coordinates)
pure virtual

Add a list of vertices to the Mesh under construction.

Parameters
coordinatesthe coordinates of the vertices in interleaved format (x0 y0 z0 x1 y1 z1 ...)
Returns
a list with the identifiers of the new vertices

Implemented in hiflow::mesh::MeshDbViewBuilder, and hiflow::mesh::DistributedBuilder.

Referenced by hiflow::mesh::unpack_entities().

◆ build()

virtual MeshPtr hiflow::mesh::MeshBuilder::build ( )
pure virtual

Build the Mesh.

The indices of the cells in the new mesh are guaranteed to be the same as that in which they were added to the mesh. No guarantees are made about entities of lower dimension, including vertices.

Returns
a new Mesh object containing the added entities. Ownership is transferred to the caller.

Implemented in hiflow::mesh::MeshPXestBuilder, hiflow::mesh::MeshDbViewBuilder, and hiflow::mesh::DistributedBuilder.

Referenced by hiflow::mesh::DistributedBuilder::build(), hiflow::mesh::UcdReader::read_file(), and hiflow::mesh::VtkReader::read_file().

◆ clear()

virtual void hiflow::mesh::MeshBuilder::clear ( )
pure virtual

◆ gdim()

GDim hiflow::mesh::MeshBuilder::gdim ( ) const
inline

◆ get_period()

std::vector< MasterSlave > hiflow::mesh::MeshBuilder::get_period ( ) const
inline

Get periodicity.

Returns
Vector containing the information about the periodicity of the mesh

Definition at line 137 of file mesh_builder.h.

References period_.

138  {
139  return period_;
140  }
std::vector< MasterSlave > period_
Definition: mesh_builder.h:112

◆ set_material_number()

virtual void hiflow::mesh::MeshBuilder::set_material_number ( TDim  tdim,
EntityHandle  entity,
MaterialNumber  material 
)
pure virtual

Set the material number for an entity.

Parameters
tdimthe topological dimension of the entity
entityidentifier for the entity
materialnew material number for the entity

Implemented in hiflow::mesh::MeshDbViewBuilder, and hiflow::mesh::DistributedBuilder.

Referenced by hiflow::mesh::UcdReader::read_file(), hiflow::mesh::VtkReader::read_file(), and hiflow::mesh::unpack_entities().

◆ tdim()

TDim hiflow::mesh::MeshBuilder::tdim ( ) const
inline

Access the topological dimension of the Mesh under construction.

Definition at line 127 of file mesh_builder.h.

References tdim_.

Referenced by hiflow::mesh::MeshDbViewBuilder::MeshDbViewBuilder(), hiflow::mesh::UcdReader::read_file(), hiflow::mesh::VtkReader::read_file(), hiflow::mesh::UcdPXestReader::read_file(), and hiflow::mesh::unpack_entities().

128  {
129  return tdim_;
130  }

Member Data Documentation

◆ gdim_

GDim hiflow::mesh::MeshBuilder::gdim_
protected

Definition at line 111 of file mesh_builder.h.

Referenced by gdim().

◆ period_

std::vector<MasterSlave> hiflow::mesh::MeshBuilder::period_
protected

◆ tdim_

TDim hiflow::mesh::MeshBuilder::tdim_
protected

Definition at line 110 of file mesh_builder.h.

Referenced by tdim().


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