mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: use vtp output for AMIWeights function object
- allows inclusion of the cyclicACMIPolyPatch mask in the same file
This commit is contained in:
@ -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
|
|||||||
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
|
|||||||
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
|
|||||||
pp.mask(),
|
pp.mask(),
|
||||||
mergedMask
|
mergedMask
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
writer.write
|
instant inst(mesh_.time().value(), mesh_.time().timeName());
|
||||||
|
|
||||||
|
vtk::surfaceWriter writer
|
||||||
(
|
(
|
||||||
baseTimeDir(),
|
mergedPoints,
|
||||||
cpp.name() + "_" + side,
|
mergedFaces,
|
||||||
meshedSurfRef(mergedPoints, mergedFaces),
|
(baseTimeDir()/cpp.name() + "_" + side),
|
||||||
"mask",
|
false // serial: master-only
|
||||||
mergedMask,
|
|
||||||
false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
writer.setTime(inst);
|
||||||
|
writer.writeTimeValue();
|
||||||
|
writer.writeGeometry();
|
||||||
|
|
||||||
|
writer.beginCellData(1 + (isACMI ? 1 : 0));
|
||||||
|
writer.write("weightsSum", mergedWeights);
|
||||||
|
|
||||||
|
if (isACMI)
|
||||||
|
{
|
||||||
|
writer.write("mask", mergedMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ AMIWeights
|
|||||||
libs ("libfieldFunctionObjects.so");
|
libs ("libfieldFunctionObjects.so");
|
||||||
writeControl writeTime;
|
writeControl writeTime;
|
||||||
writeFields no;
|
writeFields no;
|
||||||
|
// writeFields yes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
Reference in New Issue
Block a user