Commit b6fd326d authored by Mark Olesen's avatar Mark Olesen
Browse files

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 eb5a9821
...@@ -9,6 +9,7 @@ include_directories( ...@@ -9,6 +9,7 @@ include_directories(
$ENV{WM_PROJECT_DIR}/src/conversion/lnInclude $ENV{WM_PROJECT_DIR}/src/conversion/lnInclude
$ENV{WM_PROJECT_DIR}/src/meshTools/lnInclude $ENV{WM_PROJECT_DIR}/src/meshTools/lnInclude
$ENV{WM_PROJECT_DIR}/src/lagrangian/basic/lnInclude $ENV{WM_PROJECT_DIR}/src/lagrangian/basic/lnInclude
$ENV{WM_PROJECT_DIR}/src/overset/lnInclude
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
) )
...@@ -67,6 +68,7 @@ set(OPENFOAM_LIBRARIES ...@@ -67,6 +68,7 @@ set(OPENFOAM_LIBRARIES
Pstream Pstream
meshTools meshTools
lagrangian lagrangian
overset
) )
add_library( add_library(
......
...@@ -206,6 +206,7 @@ void Foam::vtk::fvMeshAdaptor::updateContent(const wordRes& selectFields) ...@@ -206,6 +206,7 @@ void Foam::vtk::fvMeshAdaptor::updateContent(const wordRes& selectFields)
convertGeometryInternal(); convertGeometryInternal();
convertGeometryPatches(); convertGeometryPatches();
applyGhosting();
convertVolFields(selectFields); convertVolFields(selectFields);
meshState_ = polyMesh::UNCHANGED; meshState_ = polyMesh::UNCHANGED;
} }
......
...@@ -183,6 +183,10 @@ private: ...@@ -183,6 +183,10 @@ private:
// There will be several for groups, but only one for regular patches. // There will be several for groups, but only one for regular patches.
void convertGeometryPatches(); void convertGeometryPatches();
//- Ghost cells to affect the visibility of the geometry.
// Currently only used for overset.
void applyGhosting();
// Field Conversion // Field Conversion
......
...@@ -24,6 +24,7 @@ License ...@@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "foamVtkFvMeshAdaptor.H" #include "foamVtkFvMeshAdaptor.H"
#include "cellCellStencilObject.H"
// VTK includes // VTK includes
#include <vtkMultiBlockDataSet.h> #include <vtkMultiBlockDataSet.h>
...@@ -155,4 +156,84 @@ void Foam::vtk::fvMeshAdaptor::convertGeometryPatches() ...@@ -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