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();
63 const auto cellTopology = anyCellGeometry.
cellTopology();
66 return nodalCellGeometry;
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);
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< 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...