15 #ifndef Intrepid2_CellGeometryTestUtils_h
16 #define Intrepid2_CellGeometryTestUtils_h
19 #include "Intrepid2_ScalarView.hpp"
30 template<
typename Po
intScalar,
int spaceDim,
typename DeviceType >
32 CellGeometry<PointScalar, spaceDim, DeviceType> getNodalCellGeometry(CellGeometry<PointScalar, spaceDim, DeviceType> &anyCellGeometry,
33 const bool ©Affineness)
36 const int numCells = anyCellGeometry.extent_int(0);
37 const int numNodes = anyCellGeometry.extent_int(1);
39 using PointScalarView = ScalarView<PointScalar, DeviceType >;
40 using intView = ScalarView< int, DeviceType >;
42 auto cellToNodes = intView (
"cell to nodes", numCells, numNodes);
43 PointScalarView nodes = getView<PointScalar,DeviceType>(
"nodes", numCells * numNodes, spaceDim);
45 using ExecutionSpace =
typename DeviceType::execution_space;
46 auto policy = Kokkos::MDRangePolicy<ExecutionSpace,Kokkos::Rank<2>>({0,0},{numCells,numNodes});
48 Kokkos::parallel_for(
"copy cell nodes from CellGeometry", policy,
49 KOKKOS_LAMBDA (
const int &cellOrdinal,
const int &nodeOrdinalInCell) {
50 const int globalNodeOrdinal = cellOrdinal * numNodes + nodeOrdinalInCell;
51 for (
int d=0; d<spaceDim; d++)
53 nodes(globalNodeOrdinal,d) = anyCellGeometry(cellOrdinal,nodeOrdinalInCell,d);
55 cellToNodes(cellOrdinal,nodeOrdinalInCell) = globalNodeOrdinal;
58 ExecutionSpace().fence();
60 const bool claimAffine = copyAffineness && anyCellGeometry.affine();
61 const auto nodeOrdering = anyCellGeometry.nodeOrderingForHypercubes();
63 const auto cellTopology = anyCellGeometry.cellTopology();
64 CellGeometry<PointScalar, spaceDim, DeviceType> nodalCellGeometry(cellTopology,cellToNodes,nodes,claimAffine,nodeOrdering);
66 return nodalCellGeometry;
74 template<
class Po
intScalar,
int spaceDim,
typename DeviceType>
75 inline CellGeometry<PointScalar,spaceDim,DeviceType> uniformCartesianMesh(
const Kokkos::Array<PointScalar,spaceDim> &domainExtents,
76 const Kokkos::Array<int,spaceDim> &gridCellCounts)
78 Kokkos::Array<PointScalar,spaceDim> origin;
79 for (
int d=0; d<spaceDim; d++)
88 return CellGeometry(origin, domainExtents, gridCellCounts, NO_SUBDIVISION, HYPERCUBE_NODE_ORDER_CLASSIC_SHARDS);
96 template<
class Po
intScalar,
int spaceDim,
typename DeviceType>
97 inline CellGeometry<PointScalar,spaceDim,DeviceType> uniformCartesianMesh(
const PointScalar &domainExtent,
const int &meshWidth)
99 Kokkos::Array<PointScalar,spaceDim> origin;
100 Kokkos::Array<PointScalar,spaceDim> domainExtents;
101 Kokkos::Array<int,spaceDim> gridCellCounts;
102 for (
int d=0; d<spaceDim; d++)
105 domainExtents[d] = domainExtent;
106 gridCellCounts[d] = meshWidth;
113 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.