#include <Cabana_Grid_IndexSpace.hpp>
#include <Cabana_Grid_LocalGrid.hpp>
#include <Cabana_Grid_MpiTraits.hpp>
#include <Cabana_Grid_Types.hpp>
#include <Kokkos_Core.hpp>
#include <cmath>
#include <memory>
#include <type_traits>
#include <vector>
#include <mpi.h>
Go to the source code of this file.
Namespaces | |
namespace | Cabana |
Core: particle data structures and algorithms. | |
Functions | |
template<class EntityType, class MeshType> | |
std::shared_ptr< ArrayLayout< EntityType, MeshType > > | Cabana::Grid::createArrayLayout (const std::shared_ptr< LocalGrid< MeshType > > &local_grid, const int dofs_per_entity, EntityType) |
Create an array layout over the entities of a local grid. | |
template<class EntityType, class MeshType> | |
std::shared_ptr< ArrayLayout< EntityType, MeshType > > | Cabana::Grid::createArrayLayout (const std::shared_ptr< GlobalGrid< MeshType > > &global_grid, const int halo_cell_width, const int dofs_per_entity, EntityType) |
Create an array layout over the entities of a grid given local grid parameters. An intermediate local grid will be created and assigned to the layout. | |
template<class Scalar, class... Params, class EntityType, class MeshType> | |
std::shared_ptr< Array< Scalar, EntityType, MeshType, Params... > > | Cabana::Grid::createArray (const std::string &label, const std::shared_ptr< ArrayLayout< EntityType, MeshType > > &layout) |
Create an array with the given array layout. Views are constructed over the ghosted index space of the layout. | |
template<class Scalar, class EntityType, class MeshType, class... Params> | |
std::shared_ptr< Array< Scalar, EntityType, MeshType, typename Array< Scalar, EntityType, MeshType, Params... >::subview_layout, typename Array< Scalar, EntityType, MeshType, Params... >::memory_space, typename Array< Scalar, EntityType, MeshType, Params... >::subview_memory_traits > > | Cabana::Grid::createSubarray (const Array< Scalar, EntityType, MeshType, Params... > &array, const int dof_min, const int dof_max) |
Create a subarray of the given array over the given range of degrees of freedom. | |
template<class Scalar, class... Params, class EntityType, class MeshType> | |
std::shared_ptr< Array< Scalar, EntityType, MeshType, Params... > > | Cabana::Grid::ArrayOp::clone (const Array< Scalar, EntityType, MeshType, Params... > &array) |
Clone an array. Do not initialize the clone. | |
template<class Array_t, class DecompositionTag> | |
void | Cabana::Grid::ArrayOp::assign (Array_t &array, const typename Array_t::value_type alpha, DecompositionTag tag) |
Assign a scalar value to every element of an array. | |
template<class Array_t, class DecompositionTag> | |
std::enable_if_t< 3==Array_t::num_space_dim, void > | Cabana::Grid::ArrayOp::scale (Array_t &array, const typename Array_t::value_type alpha, DecompositionTag tag) |
Scale every element of an array by a scalar value. 3D specialization. | |
template<class Array_t, class DecompositionTag> | |
std::enable_if_t< 2==Array_t::num_space_dim, void > | Cabana::Grid::ArrayOp::scale (Array_t &array, const typename Array_t::value_type alpha, DecompositionTag tag) |
Scale every element of an array by a scalar value. 2D specialization. | |
template<class Array_t, class DecompositionTag> | |
std::enable_if_t< 3==Array_t::num_space_dim, void > | Cabana::Grid::ArrayOp::scale (Array_t &array, const std::vector< typename Array_t::value_type > &alpha, DecompositionTag tag) |
Scale every element of an array by a scalar. 3D specialization. | |
template<class Array_t, class DecompositionTag> | |
std::enable_if_t< 2==Array_t::num_space_dim, void > | Cabana::Grid::ArrayOp::scale (Array_t &array, const std::vector< typename Array_t::value_type > &alpha, DecompositionTag tag) |
Scale every element of an array by a scalar. 2D specialization. | |
template<class Array_t, class DecompositionTag> | |
void | Cabana::Grid::ArrayOp::copy (Array_t &a, const Array_t &b, DecompositionTag tag) |
Copy one array into another over the designated decomposition. A <- B. | |
template<class Array_t, class DecompositionTag> | |
std::shared_ptr< Array_t > | Cabana::Grid::ArrayOp::cloneCopy (const Array_t &array, DecompositionTag tag) |
Clone an array and copy its contents into the clone. | |
template<class Array_t, class DecompositionTag> | |
std::enable_if_t< 3==Array_t::num_space_dim, void > | Cabana::Grid::ArrayOp::update (Array_t &a, const typename Array_t::value_type alpha, const Array_t &b, const typename Array_t::value_type beta, DecompositionTag tag) |
Update two vectors such that a = alpha * a + beta * b. 3D specialization. | |
template<class Array_t, class DecompositionTag> | |
std::enable_if_t< 2==Array_t::num_space_dim, void > | Cabana::Grid::ArrayOp::update (Array_t &a, const typename Array_t::value_type alpha, const Array_t &b, const typename Array_t::value_type beta, DecompositionTag tag) |
Update two vectors such that a = alpha * a + beta * b. 2D specialization. | |
template<class Array_t, class DecompositionTag> | |
std::enable_if_t< 3==Array_t::num_space_dim, void > | Cabana::Grid::ArrayOp::update (Array_t &a, const typename Array_t::value_type alpha, const Array_t &b, const typename Array_t::value_type beta, const Array_t &c, const typename Array_t::value_type gamma, DecompositionTag tag) |
Update three vectors such that a = alpha * a + beta * b + gamma * c. 3D specialization. | |
template<class Array_t, class DecompositionTag> | |
std::enable_if_t< 2==Array_t::num_space_dim, void > | Cabana::Grid::ArrayOp::update (Array_t &a, const typename Array_t::value_type alpha, const Array_t &b, const typename Array_t::value_type beta, const Array_t &c, const typename Array_t::value_type gamma, DecompositionTag tag) |
Update three vectors such that a = alpha * a + beta * b + gamma * c. 2D specialization. | |
template<class Array_t> | |
void | Cabana::Grid::ArrayOp::dot (const Array_t &a, const Array_t &b, std::vector< typename Array_t::value_type > &products) |
Compute the dot product of owned space of two arrays. | |
template<class Array_t> | |
void | Cabana::Grid::ArrayOp::normInf (const Array_t &array, std::vector< typename Array_t::value_type > &norms) |
Calculate the infinity-norm of the owned elements of the array. | |
template<class Array_t> | |
void | Cabana::Grid::ArrayOp::norm1 (const Array_t &array, std::vector< typename Array_t::value_type > &norms) |
Calculate the one-norm of the owned elements of the array. | |
template<class Array_t> | |
void | Cabana::Grid::ArrayOp::norm2 (const Array_t &array, std::vector< typename Array_t::value_type > &norms) |
Calculate the two-norm of the owned elements of the array. | |
Grid field arrays.
void Cabana::Grid::ArrayOp::assign | ( | Array_t & | array, |
const typename Array_t::value_type | alpha, | ||
DecompositionTag | tag ) |
Assign a scalar value to every element of an array.
array | The array to assign the value to. |
alpha | The value to assign to the array. |
tag | The tag for the decomposition over which to perform the operation. |
std::shared_ptr< Array< Scalar, EntityType, MeshType, Params... > > Cabana::Grid::ArrayOp::clone | ( | const Array< Scalar, EntityType, MeshType, Params... > & | array | ) |
Clone an array. Do not initialize the clone.
array | The array to clone. |
std::shared_ptr< Array_t > Cabana::Grid::ArrayOp::cloneCopy | ( | const Array_t & | array, |
DecompositionTag | tag ) |
Clone an array and copy its contents into the clone.
array | The array to clone. |
tag | The tag for the decomposition over which to perform the copy. |
void Cabana::Grid::ArrayOp::copy | ( | Array_t & | a, |
const Array_t & | b, | ||
DecompositionTag | tag ) |
Copy one array into another over the designated decomposition. A <- B.
a | The array to which the data will be copied. |
b | The array from which the data will be copied. |
tag | The tag for the decomposition over which to perform the operation. |
std::shared_ptr< Array< Scalar, EntityType, MeshType, Params... > > Cabana::Grid::createArray | ( | const std::string & | label, |
const std::shared_ptr< ArrayLayout< EntityType, MeshType > > & | layout ) |
Create an array with the given array layout. Views are constructed over the ghosted index space of the layout.
label | A label for the view. |
layout | The array layout over which to construct the view. |
std::shared_ptr< ArrayLayout< EntityType, MeshType > > Cabana::Grid::createArrayLayout | ( | const std::shared_ptr< GlobalGrid< MeshType > > & | global_grid, |
const int | halo_cell_width, | ||
const int | dofs_per_entity, | ||
EntityType | ) |
Create an array layout over the entities of a grid given local grid parameters. An intermediate local grid will be created and assigned to the layout.
global_grid | The local grid over which to create the layout. |
halo_cell_width | The number of halo cells surrounding the locally owned cells. |
dofs_per_entity | The number of degrees-of-freedom per grid entity. |
std::shared_ptr< ArrayLayout< EntityType, MeshType > > Cabana::Grid::createArrayLayout | ( | const std::shared_ptr< LocalGrid< MeshType > > & | local_grid, |
const int | dofs_per_entity, | ||
EntityType | ) |
Create an array layout over the entities of a local grid.
local_grid | The local grid over which to create the layout. |
dofs_per_entity | The number of degrees-of-freedom per grid entity. |
std::shared_ptr< Array< Scalar, EntityType, MeshType, typename Array< Scalar, EntityType, MeshType, Params... >::subview_layout, typename Array< Scalar, EntityType, MeshType, Params... >::memory_space, typename Array< Scalar, EntityType, MeshType, Params... >::subview_memory_traits > > Cabana::Grid::createSubarray | ( | const Array< Scalar, EntityType, MeshType, Params... > & | array, |
const int | dof_min, | ||
const int | dof_max ) |
Create a subarray of the given array over the given range of degrees of freedom.
array | The array from which to create a subarray |
dof_min | The minimum degree-of-freedom index of the subarray. |
dof_max | The maximum degree-of-freedom index of the subarray. |
void Cabana::Grid::ArrayOp::dot | ( | const Array_t & | a, |
const Array_t & | b, | ||
std::vector< typename Array_t::value_type > & | products ) |
Compute the dot product of owned space of two arrays.
a | The first array in the dot product. |
b | The second array in the dot product. |
products | The dot product of each entity degree-of-freedom in the array. This vector should be pre-sized to the number of degrees-of-freedom per entity. |
void Cabana::Grid::ArrayOp::norm1 | ( | const Array_t & | array, |
std::vector< typename Array_t::value_type > & | norms ) |
Calculate the one-norm of the owned elements of the array.
array | The array to compute the norm for. |
norms | The norms for each degree-of-freedom in the array. This vector should be pre-sized to the number of degrees-of-freedom per entity. |
void Cabana::Grid::ArrayOp::norm2 | ( | const Array_t & | array, |
std::vector< typename Array_t::value_type > & | norms ) |
Calculate the two-norm of the owned elements of the array.
array | The array to compute the norm for. |
norms | The norms for each entity degree-of-freedom in the array. This vector should be pre-sized to the number of degrees-of-freedom per entity. |
void Cabana::Grid::ArrayOp::normInf | ( | const Array_t & | array, |
std::vector< typename Array_t::value_type > & | norms ) |
Calculate the infinity-norm of the owned elements of the array.
array | The array to compute the norm for. |
norms | The norms for each degree-of-freedom in the array. This vector should be pre-sized to the number of degrees-of-freedom per entity. |
std::enable_if_t< 3==Array_t::num_space_dim, void > Cabana::Grid::ArrayOp::scale | ( | Array_t & | array, |
const std::vector< typename Array_t::value_type > & | alpha, | ||
DecompositionTag | tag ) |
Scale every element of an array by a scalar. 3D specialization.
array | The array to scale. |
alpha | The values to scale the array by. A value must be provided for each entity degree-of-freedom in the array. |
tag | The tag for the decomposition over which to perform the operation. |
std::enable_if_t< 2==Array_t::num_space_dim, void > Cabana::Grid::ArrayOp::scale | ( | Array_t & | array, |
const std::vector< typename Array_t::value_type > & | alpha, | ||
DecompositionTag | tag ) |
Scale every element of an array by a scalar. 2D specialization.
array | The array to scale. |
alpha | The values to scale the array by. A value must be provided for each entity degree-of-freedom in the array. |
tag | The tag for the decomposition over which to perform the operation. |
std::enable_if_t< 3==Array_t::num_space_dim, void > Cabana::Grid::ArrayOp::scale | ( | Array_t & | array, |
const typename Array_t::value_type | alpha, | ||
DecompositionTag | tag ) |
Scale every element of an array by a scalar value. 3D specialization.
array | The array to scale. |
alpha | The value to scale the array by. |
tag | The tag for the decomposition over which to perform the operation. |
std::enable_if_t< 2==Array_t::num_space_dim, void > Cabana::Grid::ArrayOp::scale | ( | Array_t & | array, |
const typename Array_t::value_type | alpha, | ||
DecompositionTag | tag ) |
Scale every element of an array by a scalar value. 2D specialization.
array | The array to scale. |
alpha | The value to scale the array by. |
tag | The tag for the decomposition over which to perform the operation. |
std::enable_if_t< 3==Array_t::num_space_dim, void > Cabana::Grid::ArrayOp::update | ( | Array_t & | a, |
const typename Array_t::value_type | alpha, | ||
const Array_t & | b, | ||
const typename Array_t::value_type | beta, | ||
const Array_t & | c, | ||
const typename Array_t::value_type | gamma, | ||
DecompositionTag | tag ) |
Update three vectors such that a = alpha * a + beta * b + gamma * c. 3D specialization.
a | The array that will be updated. |
alpha | The value to scale a by. |
b | The first array to add to a. |
beta | The value to scale b by. |
c | The second array to add to a. |
gamma | The value to scale b by. |
tag | The tag for the decomposition over which to perform the operation. |
std::enable_if_t< 2==Array_t::num_space_dim, void > Cabana::Grid::ArrayOp::update | ( | Array_t & | a, |
const typename Array_t::value_type | alpha, | ||
const Array_t & | b, | ||
const typename Array_t::value_type | beta, | ||
const Array_t & | c, | ||
const typename Array_t::value_type | gamma, | ||
DecompositionTag | tag ) |
Update three vectors such that a = alpha * a + beta * b + gamma * c. 2D specialization.
a | The array that will be updated. |
alpha | The value to scale a by. |
b | The first array to add to a. |
beta | The value to scale b by. |
c | The second array to add to a. |
gamma | The value to scale b by. |
tag | The tag for the decomposition over which to perform the operation. |
std::enable_if_t< 3==Array_t::num_space_dim, void > Cabana::Grid::ArrayOp::update | ( | Array_t & | a, |
const typename Array_t::value_type | alpha, | ||
const Array_t & | b, | ||
const typename Array_t::value_type | beta, | ||
DecompositionTag | tag ) |
Update two vectors such that a = alpha * a + beta * b. 3D specialization.
a | The array that will be updated. |
alpha | The value to scale a by. |
b | The array to add to a. |
beta | The value to scale b by. |
tag | The tag for the decomposition over which to perform the operation. |
std::enable_if_t< 2==Array_t::num_space_dim, void > Cabana::Grid::ArrayOp::update | ( | Array_t & | a, |
const typename Array_t::value_type | alpha, | ||
const Array_t & | b, | ||
const typename Array_t::value_type | beta, | ||
DecompositionTag | tag ) |
Update two vectors such that a = alpha * a + beta * b. 2D specialization.
a | The array that will be updated. |
alpha | The value to scale a by. |
b | The array to add to a. |
beta | The value to scale b by. |
tag | The tag for the decomposition over which to perform the operation. |