Skip to content
Snippets Groups Projects
Commit 23dc1ae9 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

ENH: use vtp output for AMIWeights function object

- allows inclusion of the cyclicACMIPolyPatch mask in the same file
parent 58eee5e0
Branches
Tags
No related merge requests found
...@@ -25,7 +25,7 @@ License ...@@ -25,7 +25,7 @@ License
#include "AMIWeights.H" #include "AMIWeights.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "vtkSurfaceWriter.H" #include "foamVtkSurfaceWriter.H"
#include "PatchTools.H" #include "PatchTools.H"
#include "cyclicACMIPolyPatch.H" #include "cyclicACMIPolyPatch.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
...@@ -212,8 +212,6 @@ void Foam::functionObjects::AMIWeights::writeWeightField ...@@ -212,8 +212,6 @@ void Foam::functionObjects::AMIWeights::writeWeightField
const word& side const word& side
) const ) const
{ {
vtkSurfaceWriter writer;
// Collect geometry // Collect geometry
labelList pointToGlobal; labelList pointToGlobal;
labelList uniqueMeshPointLabels; labelList uniqueMeshPointLabels;
...@@ -251,23 +249,13 @@ void Foam::functionObjects::AMIWeights::writeWeightField ...@@ -251,23 +249,13 @@ void Foam::functionObjects::AMIWeights::writeWeightField
mergedWeights mergedWeights
); );
if (Pstream::master()) const bool isACMI = isA<cyclicACMIPolyPatch>(cpp);
{
writer.write
(
baseTimeDir(),
cpp.name() + "_" + side,
meshedSurfRef(mergedPoints, mergedFaces),
"weightsSum",
mergedWeights,
false
);
}
if (isA<cyclicACMIPolyPatch>(cpp)) scalarField mergedMask;
if (isACMI)
{ {
const cyclicACMIPolyPatch& pp = refCast<const cyclicACMIPolyPatch>(cpp); const cyclicACMIPolyPatch& pp = refCast<const cyclicACMIPolyPatch>(cpp);
scalarField mergedMask;
globalFaces().gather globalFaces().gather
( (
UPstream::worldComm, UPstream::worldComm,
...@@ -279,18 +267,30 @@ void Foam::functionObjects::AMIWeights::writeWeightField ...@@ -279,18 +267,30 @@ void Foam::functionObjects::AMIWeights::writeWeightField
pp.mask(), pp.mask(),
mergedMask mergedMask
); );
}
if (Pstream::master()) if (Pstream::master())
{
instant inst(mesh_.time().value(), mesh_.time().timeName());
vtk::surfaceWriter writer
(
mergedPoints,
mergedFaces,
(baseTimeDir()/cpp.name() + "_" + side),
false // serial: master-only
);
writer.setTime(inst);
writer.writeTimeValue();
writer.writeGeometry();
writer.beginCellData(1 + (isACMI ? 1 : 0));
writer.write("weightsSum", mergedWeights);
if (isACMI)
{ {
writer.write writer.write("mask", mergedMask);
(
baseTimeDir(),
cpp.name() + "_" + side,
meshedSurfRef(mergedPoints, mergedFaces),
"mask",
mergedMask,
false
);
} }
} }
} }
......
...@@ -12,6 +12,7 @@ AMIWeights ...@@ -12,6 +12,7 @@ AMIWeights
libs ("libfieldFunctionObjects.so"); libs ("libfieldFunctionObjects.so");
writeControl writeTime; writeControl writeTime;
writeFields no; writeFields no;
// writeFields yes;
} }
// ************************************************************************* // // ************************************************************************* //
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment