49#ifndef Intrepid2_CellGeometryTestUtils_h
50#define Intrepid2_CellGeometryTestUtils_h
53#include "Intrepid2_ScalarView.hpp"
64 template<
typename Po
intScalar,
int spaceDim,
typename DeviceType >
67 const bool ©Affineness)
70 const int numCells = anyCellGeometry.
extent_int(0);
71 const int numNodes = anyCellGeometry.
extent_int(1);
73 using PointScalarView = ScalarView<PointScalar, DeviceType >;
74 using intView = ScalarView< int, DeviceType >;
76 auto cellToNodes = intView (
"cell to nodes", numCells, numNodes);
77 PointScalarView nodes = getView<PointScalar,DeviceType>(
"nodes", numCells * numNodes, spaceDim);
79 using ExecutionSpace =
typename DeviceType::execution_space;
80 auto policy = Kokkos::MDRangePolicy<ExecutionSpace,Kokkos::Rank<2>>({0,0},{numCells,numNodes});
82 Kokkos::parallel_for(
"copy cell nodes from CellGeometry", policy,
83 KOKKOS_LAMBDA (
const int &cellOrdinal,
const int &nodeOrdinalInCell) {
84 const int globalNodeOrdinal = cellOrdinal * numNodes + nodeOrdinalInCell;
85 for (
int d=0; d<spaceDim; d++)
87 nodes(globalNodeOrdinal,d) = anyCellGeometry(cellOrdinal,nodeOrdinalInCell,d);
89 cellToNodes(cellOrdinal,nodeOrdinalInCell) = globalNodeOrdinal;
92 ExecutionSpace().fence();
94 const bool claimAffine = copyAffineness && anyCellGeometry.
affine();
97 const auto cellTopology = anyCellGeometry.
cellTopology();
100 return nodalCellGeometry;
108 template<
class Po
intScalar,
int spaceDim,
typename DeviceType>
110 const Kokkos::Array<int,spaceDim> &gridCellCounts)
112 Kokkos::Array<PointScalar,spaceDim> origin;
113 for (
int d=0; d<spaceDim; d++)
122 return CellGeometry(origin, domainExtents, gridCellCounts, NO_SUBDIVISION, HYPERCUBE_NODE_ORDER_CLASSIC_SHARDS);
130 template<
class Po
intScalar,
int spaceDim,
typename DeviceType>
133 Kokkos::Array<PointScalar,spaceDim> origin;
134 Kokkos::Array<PointScalar,spaceDim> domainExtents;
135 Kokkos::Array<int,spaceDim> gridCellCounts;
136 for (
int d=0; d<spaceDim; d++)
139 domainExtents[d] = domainExtent;
140 gridCellCounts[d] = meshWidth;
147 return CellGeometry(origin, domainExtents, gridCellCounts, NO_SUBDIVISION, HYPERCUBE_NODE_ORDER_CLASSIC_SHARDS);
CellGeometry< PointScalar, spaceDim, DeviceType > uniformCartesianMesh(const Kokkos::Array< PointScalar, spaceDim > &domainExtents, const Kokkos::Array< int, spaceDim > &gridCellCounts)
Create a uniform Cartesian mesh, with origin at 0, and domain extents and mesh widths that can be dif...
CellGeometry< PointScalar, spaceDim, DeviceType > getNodalCellGeometry(CellGeometry< PointScalar, spaceDim, DeviceType > &anyCellGeometry, const bool ©Affineness)
Use the cell nodes provided by one cell geometry object to create another CellGeometry that is node-b...
Allows definition of cell geometry information, including uniform and curvilinear mesh definition,...
Utility methods for Intrepid2 unit tests.
CellGeometry provides the nodes for a set of cells; has options that support efficient definition of ...
CellGeometry(const Kokkos::Array< PointScalar, spaceDim > &origin, const Kokkos::Array< PointScalar, spaceDim > &domainExtents, const Kokkos::Array< int, spaceDim > &gridCellCounts, SubdivisionStrategy subdivisionStrategy=NO_SUBDIVISION, HypercubeNodeOrdering nodeOrdering=HYPERCUBE_NODE_ORDER_TENSOR)
Uniform grid constructor, with optional subdivision into simplices.
@ NO_SUBDIVISION
no subdivision
KOKKOS_INLINE_FUNCTION bool affine() const
Returns true if Jacobian is constant within each cell.
@ HYPERCUBE_NODE_ORDER_CLASSIC_SHARDS
classic shards ordering
KOKKOS_INLINE_FUNCTION HypercubeNodeOrdering nodeOrderingForHypercubes() const
Returns the node ordering used for hypercubes.
const shards::CellTopology & cellTopology() const
The shards CellTopology for each cell within the CellGeometry object. Note that this is always a lowe...
KOKKOS_INLINE_FUNCTION std::enable_if< std::is_integral< iType >::value, int >::type extent_int(const iType &r) const
Returns the logical extent of the container in the specified dimension as an int; the shape of CellGe...