49 #ifndef Intrepid2_CellGeometryTestUtils_h
50 #define Intrepid2_CellGeometryTestUtils_h
53 #include "Intrepid2_ScalarView.hpp"
64 template<
typename Po
intScalar,
int spaceDim,
typename DeviceType >
66 CellGeometry<PointScalar, spaceDim, DeviceType> getNodalCellGeometry(CellGeometry<PointScalar, spaceDim, DeviceType> &anyCellGeometry,
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();
95 const auto nodeOrdering = anyCellGeometry.nodeOrderingForHypercubes();
97 const auto cellTopology = anyCellGeometry.cellTopology();
98 CellGeometry<PointScalar, spaceDim, DeviceType> nodalCellGeometry(cellTopology,cellToNodes,nodes,claimAffine,nodeOrdering);
100 return nodalCellGeometry;
108 template<
class Po
intScalar,
int spaceDim,
typename DeviceType>
109 inline CellGeometry<PointScalar,spaceDim,DeviceType> uniformCartesianMesh(
const Kokkos::Array<PointScalar,spaceDim> &domainExtents,
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>
131 inline CellGeometry<PointScalar,spaceDim,DeviceType> uniformCartesianMesh(
const PointScalar &domainExtent,
const int &meshWidth)
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 provides the nodes for a set of cells; has options that support efficient definition of ...
Allows definition of cell geometry information, including uniform and curvilinear mesh definition...
Utility methods for Intrepid2 unit tests.