diff --git a/components/omega/src/ocn/VertCoord.cpp b/components/omega/src/ocn/VertCoord.cpp index 027006d1164c..4de79abcc052 100644 --- a/components/omega/src/ocn/VertCoord.cpp +++ b/components/omega/src/ocn/VertCoord.cpp @@ -142,10 +142,12 @@ VertCoord::VertCoord(const std::string &Name_, //< [in] Name for new VertCoord NCellsSize = Decomp->NCellsSize; NEdgesOwned = Decomp->NEdgesOwned; + NEdgesHalo0 = Decomp->NEdgesHaloH(0); NEdgesAll = Decomp->NEdgesAll; NEdgesSize = Decomp->NEdgesSize; NVerticesOwned = Decomp->NVerticesOwned; + NVerticesHalo0 = Decomp->NVerticesHaloH(0); NVerticesAll = Decomp->NVerticesAll; NVerticesSize = Decomp->NVerticesSize; VertexDegree = Decomp->VertexDegree; @@ -626,6 +628,23 @@ void VertCoord::minMaxLayerEdge(Halo *MeshHalo) { LocMaxLayerEdgeBot(LocNEdgesAll) = -1; }); + // Set the [MinLayerEdgeBot, MaxLayerEdgeTop] range to be invalid + // on the outermost edges of the halo layer. + OMEGA_SCOPE(LocNEdgesHalo0, NEdgesHalo0); + OMEGA_SCOPE(LocNCellsAll, NCellsAll); + // start from NEdgesHalo(0) to exclude any edges of the owned cells + parallelFor( + {NEdgesAll - NEdgesHalo0}, KOKKOS_LAMBDA(int EdgeOffset) { + const int IEdge = LocNEdgesHalo0 + EdgeOffset; + + // Is any cell on this edge an invalid (remote) cell ? + if (LocCellsOnEdge(IEdge, 0) == LocNCellsAll || + LocCellsOnEdge(IEdge, 1) == LocNCellsAll) { + LocMinLayerEdgeBot(IEdge) = LocNVertLayersP1; + LocMaxLayerEdgeTop(IEdge) = -1; + } + }); + MinLayerEdgeTopH = createHostMirrorCopy(MinLayerEdgeTop); MinLayerEdgeBotH = createHostMirrorCopy(MinLayerEdgeBot); MaxLayerEdgeTopH = createHostMirrorCopy(MaxLayerEdgeTop); @@ -708,6 +727,28 @@ void VertCoord::minMaxLayerVertex(Halo *MeshHalo) { LocMaxLayerVertexBot(LocNVerticesAll) = -1; }); + // Set the [MinLayerVertexBot, MaxLayerVertexTop] range to be invalid + // on the outermost vertices of the halo layer. + OMEGA_SCOPE(LocNVerticesHalo0, NVerticesHalo0); + OMEGA_SCOPE(LocNCellsAll, NCellsAll); + // start from NVerticesHalo(0) to exclude any vertices of the owned cells + parallelFor( + {NVerticesAll - NVerticesHalo0}, KOKKOS_LAMBDA(int VertexOffset) { + const int IVertex = LocNVerticesHalo0 + VertexOffset; + + // Is any cell on this vertex an invalid (remote) cell ? + bool IsOuterMost = LocCellsOnVertex(IVertex, 0) == LocNCellsAll; + for (int I = 1; I < LocVertexDegree; ++I) { + IsOuterMost = + IsOuterMost || LocCellsOnVertex(IVertex, I) == LocNCellsAll; + } + + if (IsOuterMost) { + LocMinLayerVertexBot(IVertex) = LocNVertLayersP1; + LocMaxLayerVertexTop(IVertex) = -1; + } + }); + MinLayerVertexTopH = createHostMirrorCopy(MinLayerVertexTop); MinLayerVertexBotH = createHostMirrorCopy(MinLayerVertexBot); MaxLayerVertexTopH = createHostMirrorCopy(MaxLayerVertexTop); diff --git a/components/omega/src/ocn/VertCoord.h b/components/omega/src/ocn/VertCoord.h index d39d3676b225..d7afe16739be 100644 --- a/components/omega/src/ocn/VertCoord.h +++ b/components/omega/src/ocn/VertCoord.h @@ -59,9 +59,11 @@ class VertCoord { I4 NCellsAll; I4 NCellsSize; I4 NEdgesOwned; + I4 NEdgesHalo0; I4 NEdgesAll; I4 NEdgesSize; I4 NVerticesOwned; + I4 NVerticesHalo0; I4 NVerticesAll; I4 NVerticesSize; I4 VertexDegree;