Loading [MathJax]/extensions/tex2jax.js
QUGaR 0.0.8
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Concepts
qugar::SubCartGridTP< dim > Class Template Reference

Subgrid of a Cartesian grid TP. It is a subset of the cells of a given grid. More...

#include <cart_grid_tp.hpp>

Public Types

using GridPtr = std::shared_ptr<const CartGridTP<dim>>
 Shared-pointer to Cartesian grid type.
 

Public Member Functions

 SubCartGridTP (const GridPtr grid, const TensorIndexTP< dim > &indices_start, const TensorIndexTP< dim > &indices_end)
 Constructor.
 
 SubCartGridTP (const GridPtr grid, const TensorIndexRangeTP< dim > &indices_range)
 Constructor.
 
 SubCartGridTP (const GridPtr grid)
 Constructor. Creates a subgrid containing the full grid.
 
TensorSizeTP< dim > get_num_cells_dir () const
 Gets the number of cells (spans) per direction of the subgrid.
 
std::int64_t to_flat (const TensorIndexTP< dim > &tid) const
 Gets the flat index of a grid cells from the tensor index.
 
std::size_t get_num_cells () const
 Gets the total number of cells of the subgrid.
 
bool is_full () const
 Checks if the subgrid corresponds to the total grid.
 
bool is_unique_cell () const
 Checks if the subgrid has only one cell.
 
const TensorIndexRangeTP< dim > & get_range () const
 Gets a range describing the range of the subrid.
 
std::array< std::shared_ptr< const SubCartGridTP< dim > >, 2 > split () const
 Splits the current subgrid along the direction with a largest number of cells.
 
BoundBox< dim > get_domain () const
 Creates the bounding box of the subgrid's domain.
 
GridPtr get_grid () const
 Gets the parent grid.
 
std::int64_t get_single_cell () const
 Gets the single cell in the subgrid.
 

Private Attributes

GridPtr grid_
 Parent grid.
 
TensorIndexRangeTP< dim > range_
 Indices range.
 

Detailed Description

template<int dim>
class qugar::SubCartGridTP< dim >

Subgrid of a Cartesian grid TP. It is a subset of the cells of a given grid.

Template Parameters
dimParametric dimension.

Member Typedef Documentation

◆ GridPtr

template<int dim>
using qugar::SubCartGridTP< dim >::GridPtr = std::shared_ptr<const CartGridTP<dim>>

Shared-pointer to Cartesian grid type.

Constructor & Destructor Documentation

◆ SubCartGridTP() [1/3]

template<int dim>
qugar::SubCartGridTP< dim >::SubCartGridTP ( const GridPtr grid,
const TensorIndexTP< dim > & indices_start,
const TensorIndexTP< dim > & indices_end )

Constructor.

Parameters
gridParent grid.
indices_startStart indices of the coordinates of the parent grid.
indices_endEnd indices of the coordinates of the parent grid.

◆ SubCartGridTP() [2/3]

template<int dim>
qugar::SubCartGridTP< dim >::SubCartGridTP ( const GridPtr grid,
const TensorIndexRangeTP< dim > & indices_range )

Constructor.

Parameters
gridParent grid.
indices_rangeIndices range.

◆ SubCartGridTP() [3/3]

template<int dim>
qugar::SubCartGridTP< dim >::SubCartGridTP ( const GridPtr grid)
explicit

Constructor. Creates a subgrid containing the full grid.

Parameters
gridParent grid.

Member Function Documentation

◆ get_domain()

template<int dim>
BoundBox< dim > qugar::SubCartGridTP< dim >::get_domain ( ) const
nodiscard

Creates the bounding box of the subgrid's domain.

Returns
Bounding box of the subgrid.

◆ get_grid()

template<int dim>
GridPtr qugar::SubCartGridTP< dim >::get_grid ( ) const
nodiscard

Gets the parent grid.

Returns
Parent Cartesian grid.

◆ get_num_cells()

template<int dim>
std::size_t qugar::SubCartGridTP< dim >::get_num_cells ( ) const
nodiscard

Gets the total number of cells of the subgrid.

Returns
Total number of cells.

◆ get_num_cells_dir()

template<int dim>
TensorSizeTP< dim > qugar::SubCartGridTP< dim >::get_num_cells_dir ( ) const
nodiscard

Gets the number of cells (spans) per direction of the subgrid.

The ordering is such that dimension 0 is inner-most, i.e., iterates the fastest, while dimension dim-1 is outer-most and iterates the slowest.

Returns
Number of cells per direction.

◆ get_range()

template<int dim>
const TensorIndexRangeTP< dim > & qugar::SubCartGridTP< dim >::get_range ( ) const
nodiscard

Gets a range describing the range of the subrid.

Returns
Tensor-product indices range.

◆ get_single_cell()

template<int dim>
std::int64_t qugar::SubCartGridTP< dim >::get_single_cell ( ) const
nodiscard

Gets the single cell in the subgrid.

Returns
Single cell in the subgrid.

◆ is_full()

template<int dim>
bool qugar::SubCartGridTP< dim >::is_full ( ) const
nodiscard

Checks if the subgrid corresponds to the total grid.

Returns
True if the subgrid corresponds to the total grid, false otherwise.

◆ is_unique_cell()

template<int dim>
bool qugar::SubCartGridTP< dim >::is_unique_cell ( ) const
nodiscard

Checks if the subgrid has only one cell.

Returns
True if it has only one cell, false otherwise.

◆ split()

template<int dim>
std::array< std::shared_ptr< const SubCartGridTP< dim > >, 2 > qugar::SubCartGridTP< dim >::split ( ) const
nodiscard

Splits the current subgrid along the direction with a largest number of cells.

Returns
Two generated subgrid wrapped in shared pointers.

◆ to_flat()

template<int dim>
std::int64_t qugar::SubCartGridTP< dim >::to_flat ( const TensorIndexTP< dim > & tid) const
nodiscard

Gets the flat index of a grid cells from the tensor index.

Parameters
tidTensor cell index to transform.
Returns
Flat cell index.

Member Data Documentation

◆ grid_

template<int dim>
GridPtr qugar::SubCartGridTP< dim >::grid_
private

Parent grid.

◆ range_

template<int dim>
TensorIndexRangeTP<dim> qugar::SubCartGridTP< dim >::range_
private

Indices range.


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