Commit 14eaf2dd authored by Mark Olesen's avatar Mark Olesen

ENH: initial support for overset blanking (volume mesh only)

- uses the cellCellStencil information to blank holes and the
  interpolated cells.

- needs more detailed attention for handling cases when three or more
  meshes are overlapping.
parent 3c0a2e79
......@@ -9,6 +9,7 @@ include_directories(
$ENV{WM_PROJECT_DIR}/src/conversion/lnInclude
$ENV{WM_PROJECT_DIR}/src/meshTools/lnInclude
$ENV{WM_PROJECT_DIR}/src/lagrangian/basic/lnInclude
$ENV{WM_PROJECT_DIR}/src/overset/lnInclude
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
......@@ -67,6 +68,7 @@ set(OPENFOAM_LIBRARIES
Pstream
meshTools
lagrangian
overset
)
add_library(
......
......@@ -206,6 +206,7 @@ void Foam::vtk::fvMeshAdaptor::updateContent(const wordRes& selectFields)
convertGeometryInternal();
convertGeometryPatches();
applyGhosting();
convertVolFields(selectFields);
meshState_ = polyMesh::UNCHANGED;
}
......
......@@ -183,6 +183,10 @@ private:
// There will be several for groups, but only one for regular patches.
void convertGeometryPatches();
//- Ghost cells to affect the visibility of the geometry.
// Currently only used for overset.
void applyGhosting();
// Field Conversion
......
......@@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "foamVtkFvMeshAdaptor.H"
#include "cellCellStencilObject.H"
// VTK includes
#include <vtkMultiBlockDataSet.h>
......@@ -155,4 +156,84 @@ void Foam::vtk::fvMeshAdaptor::convertGeometryPatches()
}
// These need to be rebuild here, since the component mesh may just have point
// motion without topology changes.
void Foam::vtk::fvMeshAdaptor::applyGhosting()
{
if (!usingVolume())
{
return;
}
const auto* stencilPtr =
mesh_.lookupObjectPtr<cellCellStencilObject>
(
cellCellStencilObject::typeName
);
if (!stencilPtr)
{
return;
}
const auto& longName = internalName;
auto iter = cachedVtu_.find(longName);
if (!iter.found() || !iter.object().dataset)
{
// Should not happen, but for safety require a vtk geometry
return;
}
foamVtuData& vtuData = iter.object();
auto dataset = vtuData.dataset;
const auto& stencil = *stencilPtr;
const labelUList& cellMap = vtuData.cellMap();
auto vtkgcell = dataset->GetCellGhostArray();
if (!vtkgcell)
{
vtkgcell = dataset->AllocateCellGhostArray();
}
// auto vtkgpoint = dataset->GetPointGhostArray();
// if (!vtkgpoint)
// {
// vtkgpoint = dataset->AllocatePointGhostArray();
// }
UList<uint8_t> gcell =
vtk::Tools::asUList(vtkgcell, cellMap.size());
vtkgcell->FillValue(0); // Initialize to zero
const labelUList& types = stencil.cellTypes();
forAll(cellMap, i)
{
const label cellType = types[cellMap[i]];
if (cellType == cellCellStencil::INTERPOLATED)
{
gcell[i] |=
(
vtkDataSetAttributes::DUPLICATECELL
);
}
else if (cellType == cellCellStencil::HOLE)
{
// Need duplicate (not just HIDDENCELL) for it to be properly
// recognized
gcell[i] |=
(
vtkDataSetAttributes::DUPLICATECELL
| vtkDataSetAttributes::HIDDENCELL
);
}
}
dataset->GetCellData()->AddArray(vtkgcell);
}
// ************************************************************************* //
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment