SPHinXsys  alpha version
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType > Class Template Reference

Abstract class for mesh with data packages. More...

#include <mesh_with_data_packages.h>

Inherits MeshFieldType, and SPH::Mesh.

Public Member Functions

template<typename... Args>
 MeshWithGridDataPackages (BoundingBox tentative_bounds, Real data_spacing, size_t buffer_size, Args &&...args)
 
void allocateMeshDataMatrix ()
 
void deleteMeshDataMatrix ()
 
template<class DataType , typename PackageDataAddressType , PackageDataAddressType GridDataPackageType::* MemPtr>
DataType probeMesh (const Vecd &position)
 
virtual Real DataSpacing () override
 
- Public Member Functions inherited from SPH::Mesh
 Mesh (BoundingBox tentative_bounds, Real grid_spacing, size_t buffer_width)
 
 Mesh (Vecd mesh_lower_bound, Vecu number_of_cells, Real grid_spacing)
 
Vecu NumberOfCells ()
 
size_t MeshBufferSize ()
 
- Public Member Functions inherited from SPH::BaseMesh
 BaseMesh (Vecu number_of_grid_points)
 
 BaseMesh (Vecd mesh_lower_bound, Real grid_spacing, Vecu number_of_grid_points)
 
 BaseMesh (BoundingBox tentative_bounds, Real grid_spacing, size_t buffer_width)
 
Vecd MeshLowerBound ()
 
Real GridSpacing ()
 
Vecu NumberOfGridPoints ()
 
Vecu NumberOfGridPointsFromNumberOfCells (const Vecu &number_of_cells)
 
Vecu NumberOfCellsFromNumberOfGridPoints (const Vecu &number_of_grid_points)
 
Vecd GridPositionFromCellPosition (const Vecd &cell_position)
 
Vecu CellIndexFromPosition (const Vecd &position)
 
Vecd CellPositionFromIndex (const Vecu &cell_index)
 
Vecd GridPositionFromIndex (const Vecu &grid_index)
 
Vecu transfer1DtoMeshIndex (const Vecu &number_of_mesh_indexes, size_t i)
 
size_t transferMeshIndexTo1D (const Vecu &number_of_mesh_indexes, const Vecu &mesh_index)
 
size_t MortonCode (const size_t &i)
 
size_t transferMeshIndexToMortonOrder (const Vecu &mesh_index)
 

Public Attributes

MyMemoryPool< GridDataPackageType > data_pkg_pool_
 
MeshDataMatrix< GridDataPackageType * > data_pkg_addrs_
 
ConcurrentVector< GridDataPackageType * > inner_data_pkgs_
 

Protected Member Functions

template<typename... ConstructorArgs>
void initializeASingularDataPackage (ConstructorArgs &&...args)
 
void assignDataPackageAddress (const Vecu &cell_index, GridDataPackageType *data_pkg)
 
GridDataPackageType * DataPackageFromCellIndex (const Vecu &cell_index)
 
template<typename DataType , typename PackageDataType , PackageDataType GridDataPackageType::* MemPtr>
DataType DataValueFromGlobalIndex (const Vecu &global_grid_index)
 
void initializePackageAddressesInACell (const Vecu &cell_index)
 
std::pair< int, int > CellShiftAndDataIndex (int data_addrs_index_component)
 
- Protected Member Functions inherited from SPH::Mesh
void copyMeshProperties (Mesh *another_mesh)
 

Protected Attributes

Real data_spacing_
 
const int pkg_size_ = GridDataPackageType().PackageSize()
 
const int pkg_addrs_buffer_ = GridDataPackageType().AddressBufferWidth()
 
const int pkg_operations_ = pkg_size_ + pkg_addrs_buffer_
 
const int pkg_addrs_size_ = pkg_size_ + 2 * pkg_addrs_buffer_
 
std::mutex mutex_my_pool
 
BaseMesh global_mesh_
 
StdVec< GridDataPackageType * > singular_data_pkgs_addrs_
 
- Protected Attributes inherited from SPH::Mesh
size_t buffer_width_
 
Vecu number_of_cells_
 
- Protected Attributes inherited from SPH::BaseMesh
Vecd mesh_lower_bound_
 
Real grid_spacing_
 
Vecu number_of_grid_points_
 

Detailed Description

template<class MeshFieldType, class GridDataPackageType>
class SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >

Abstract class for mesh with data packages.

The idea is to save sparse data on a cell-based mesh. We say sparse data, it means that only in some inner mesh cells there are no trivial data. A typical example is a level set field which only has meaningful values near the interface, while the latter is in the inner region of a mesh. In this class, only some inner mesh cells are filled with data packages. Each data package is again a mesh, but grid based, where two sets of data are saved on its grid points. One is the field data of matrices with PKG_SIZE, the other is corresponding address data of matrices with ADDRS_SIZE. For two neighboring data packages, they share the data in the buffer which is in the overlap region. The filling of field data is achieved first by the data matrices by the function initializeDataInACell and then the address matrix by the function initializeAddressesInACell. All these data packages are indexed by a concurrent vector inner_data_pkgs_. Note that a data package should be not near the mesh bound, otherwise one will encounter the error "out of range".

Member Function Documentation

◆ allocateMeshDataMatrix()

template<class MeshFieldType , class GridDataPackageType >
void SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >::allocateMeshDataMatrix ( )

allocate memories for addresses of data packages.

◆ CellShiftAndDataIndex()

template<class MeshFieldType, class GridDataPackageType>
std::pair<int, int> SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >::CellShiftAndDataIndex ( int  data_addrs_index_component)
inlineprotected

find related cell index and data index for a data package address matrix

◆ DataValueFromGlobalIndex()

template<class MeshFieldType , class GridDataPackageType >
template<typename DataType , typename PackageDataType , PackageDataType GridDataPackageType::* MemPtr>
DataType SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >::DataValueFromGlobalIndex ( const Vecu global_grid_index)
protected

This function find the value of data from its index from global mesh.

◆ deleteMeshDataMatrix()

template<class MeshFieldType , class GridDataPackageType >
void SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >::deleteMeshDataMatrix ( )

delete memories for addresses of data packages.

◆ probeMesh()

template<class MeshFieldType , class GridDataPackageType >
template<class DataType , typename PackageDataAddressType , PackageDataAddressType GridDataPackageType::* MemPtr>
DataType SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >::probeMesh ( const Vecd &  position)

This function probe a mesh value

Member Data Documentation

◆ data_pkg_addrs_

template<class MeshFieldType, class GridDataPackageType>
MeshDataMatrix<GridDataPackageType *> SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >::data_pkg_addrs_

Address of data packages.

◆ data_pkg_pool_

template<class MeshFieldType, class GridDataPackageType>
MyMemoryPool<GridDataPackageType> SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >::data_pkg_pool_

memory pool for all packages in the mesh.

◆ data_spacing_

template<class MeshFieldType, class GridDataPackageType>
Real SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >::data_spacing_
protected

spacing of data in the data packages

◆ global_mesh_

template<class MeshFieldType, class GridDataPackageType>
BaseMesh SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >::global_mesh_
protected

the mesh for the locations of all possible data points.

◆ inner_data_pkgs_

template<class MeshFieldType, class GridDataPackageType>
ConcurrentVector<GridDataPackageType *> SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >::inner_data_pkgs_

Inner data packages which is able to carry out spatial operations.

◆ mutex_my_pool

template<class MeshFieldType, class GridDataPackageType>
std::mutex SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >::mutex_my_pool
protected

mutex exclusion for memory pool

◆ pkg_addrs_buffer_

template<class MeshFieldType, class GridDataPackageType>
const int SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >::pkg_addrs_buffer_ = GridDataPackageType().AddressBufferWidth()
protected

the size of address buffer, a value less than the package size.

◆ pkg_addrs_size_

template<class MeshFieldType, class GridDataPackageType>
const int SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >::pkg_addrs_size_ = pkg_size_ + 2 * pkg_addrs_buffer_
protected

the size of address matrix in the data packages.

◆ pkg_operations_

template<class MeshFieldType, class GridDataPackageType>
const int SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >::pkg_operations_ = pkg_size_ + pkg_addrs_buffer_
protected

the size of operation loops.

◆ pkg_size_

template<class MeshFieldType, class GridDataPackageType>
const int SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >::pkg_size_ = GridDataPackageType().PackageSize()
protected

the size of the data package matrix

◆ singular_data_pkgs_addrs_

template<class MeshFieldType, class GridDataPackageType>
StdVec<GridDataPackageType *> SPH::MeshWithGridDataPackages< MeshFieldType, GridDataPackageType >::singular_data_pkgs_addrs_
protected

Singular data packages. provided for far field condition with usually only two values. For example, when level set is considered. The first value for inner far-field and second for outer far-field


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