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});
83 Kokkos::parallel_for(
"copy cell nodes from CellGeometry", policy,
84 KOKKOS_LAMBDA (
const int &cellOrdinal,
const int &nodeOrdinalInCell) {
85 const int globalNodeOrdinal = cellOrdinal * numNodes + nodeOrdinalInCell;
86 for (
int d=0; d<spaceDim; d++)
88 nodes(globalNodeOrdinal,d) = anyCellGeometry(cellOrdinal,nodeOrdinalInCell,d);
90 cellToNodes(cellOrdinal,nodeOrdinalInCell) = globalNodeOrdinal;
93 ExecutionSpace().fence();
95 const bool claimAffine = copyAffineness && anyCellGeometry.
affine();
98 const auto cellTopology = anyCellGeometry.
cellTopology();
101 return nodalCellGeometry;
109 template<
class Po
intScalar,
int spaceDim,
typename DeviceType>
111 const Kokkos::Array<int,spaceDim> &gridCellCounts)
113 Kokkos::Array<PointScalar,spaceDim> origin;
114 for (
int d=0; d<spaceDim; d++)
123 return CellGeometry(origin, domainExtents, gridCellCounts, NO_SUBDIVISION, HYPERCUBE_NODE_ORDER_CLASSIC_SHARDS);
131 template<
class Po
intScalar,
int spaceDim,
typename DeviceType>
134 Kokkos::Array<PointScalar,spaceDim> origin;
135 Kokkos::Array<PointScalar,spaceDim> domainExtents;
136 Kokkos::Array<int,spaceDim> gridCellCounts;
137 for (
int d=0; d<spaceDim; d++)
140 domainExtents[d] = domainExtent;
141 gridCellCounts[d] = meshWidth;
148 return CellGeometry(origin, domainExtents, gridCellCounts, NO_SUBDIVISION, HYPERCUBE_NODE_ORDER_CLASSIC_SHARDS);
const shards::CellTopology & cellTopology() const
The shards CellTopology for each cell within the CellGeometry object. Note that this is always a lowe...
CellGeometry provides the nodes for a set of cells; has options that support efficient definition of ...
KOKKOS_INLINE_FUNCTION bool affine() const
Returns true if Jacobian is constant within each cell.
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...
KOKKOS_INLINE_FUNCTION HypercubeNodeOrdering nodeOrderingForHypercubes() const
Returns the node ordering used for hypercubes.
Allows definition of cell geometry information, including uniform and curvilinear mesh definition...
Utility methods for Intrepid2 unit tests.
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...