mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use vtk::surfaceWriter instead of sampleSurface version
This commit is contained in:
@ -17,7 +17,6 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
|
||||
-I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
@ -27,7 +26,6 @@ EXE_INC = \
|
||||
LIB_LIBS = \
|
||||
${CGAL_LIBS} \
|
||||
-lmeshTools \
|
||||
-lsampling \
|
||||
-ldecompose \
|
||||
-ldynamicMesh \
|
||||
-lsnappyHexMesh
|
||||
|
||||
@ -26,7 +26,7 @@ License
|
||||
#include "automatic.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "triSurfaceMesh.H"
|
||||
#include "vtkSurfaceWriter.H"
|
||||
#include "foamVtkSurfaceWriter.H"
|
||||
#include "primitivePatchInterpolation.H"
|
||||
#include "Time.H"
|
||||
|
||||
@ -288,20 +288,23 @@ Foam::tmp<Foam::triSurfacePointScalarField> Foam::automatic::load()
|
||||
faces[fI] = surface_.triSurface::operator[](fI);
|
||||
}
|
||||
|
||||
vtkSurfaceWriter().write
|
||||
vtk::surfaceWriter vtkWriter
|
||||
(
|
||||
surface_.searchableSurface::time().constant()/"triSurface",
|
||||
surfaceName_.nameLessExt(),
|
||||
meshedSurfRef
|
||||
surface_.points(),
|
||||
faces,
|
||||
(
|
||||
surface_.points(),
|
||||
faces
|
||||
),
|
||||
"cellSize",
|
||||
pointCellSize,
|
||||
true,
|
||||
true
|
||||
surface_.searchableSurface::time().constant()
|
||||
/ "triSurface"
|
||||
/ surfaceName_.nameLessExt() + "_cellSize"
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
vtkWriter.writeGeometry();
|
||||
|
||||
vtkWriter.beginPointData(1);
|
||||
|
||||
vtkWriter.write("cellSize", pointCellSize);
|
||||
}
|
||||
|
||||
return tPointCellSize;
|
||||
|
||||
@ -14,7 +14,6 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I../vectorTools
|
||||
@ -25,6 +24,5 @@ EXE_LIBS = \
|
||||
-ldecompositionMethods /* -L$(FOAM_LIBBIN)/dummy -lscotchDecomp */ \
|
||||
-ldecompose \
|
||||
-lmeshTools \
|
||||
-lsampling \
|
||||
-ldynamicMesh \
|
||||
-lfiniteVolume
|
||||
|
||||
@ -41,7 +41,7 @@ Description
|
||||
#include "cellShape.H"
|
||||
#include "DynamicField.H"
|
||||
#include "isoSurfaceCell.H"
|
||||
#include "vtkSurfaceWriter.H"
|
||||
#include "foamVtkSurfaceWriter.H"
|
||||
#include "syncTools.H"
|
||||
#include "decompositionModel.H"
|
||||
|
||||
@ -739,14 +739,18 @@ int main(int argc, char *argv[])
|
||||
pointMergeMap
|
||||
);
|
||||
|
||||
vtkSurfaceWriter writer;
|
||||
writer.write
|
||||
(
|
||||
runTime.path(),
|
||||
"iso",
|
||||
mergedPoints,
|
||||
mergedFaces
|
||||
);
|
||||
if (Pstream::master())
|
||||
{
|
||||
vtk::surfaceWriter writer
|
||||
(
|
||||
mergedPoints,
|
||||
mergedFaces,
|
||||
(runTime.path() / "iso"),
|
||||
false // serial only
|
||||
);
|
||||
|
||||
writer.writeGeometry();
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-ldynamicFvMesh \
|
||||
-lmeshTools \
|
||||
-lsampling \
|
||||
-ldynamicMesh
|
||||
|
||||
@ -36,9 +36,9 @@ Description
|
||||
#include "Time.H"
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "vtkSurfaceWriter.H"
|
||||
#include "cyclicAMIPolyPatch.H"
|
||||
#include "PatchTools.H"
|
||||
#include "foamVtkSurfaceWriter.H"
|
||||
#include "functionObject.H"
|
||||
|
||||
using namespace Foam;
|
||||
@ -53,11 +53,9 @@ void writeWeights
|
||||
const primitivePatch& patch,
|
||||
const fileName& directory,
|
||||
const fileName& prefix,
|
||||
const word& timeName
|
||||
const Time& runTime
|
||||
)
|
||||
{
|
||||
vtkSurfaceWriter writer;
|
||||
|
||||
// Collect geometry
|
||||
labelList pointToGlobal;
|
||||
labelList uniqueMeshPointLabels;
|
||||
@ -94,37 +92,36 @@ void writeWeights
|
||||
mergedWeights
|
||||
);
|
||||
|
||||
instant inst(runTime.value(), runTime.timeName());
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writer.write
|
||||
vtk::surfaceWriter writer
|
||||
(
|
||||
directory,
|
||||
prefix + "_" + timeName,
|
||||
meshedSurfRef
|
||||
(
|
||||
mergedPoints,
|
||||
mergedFaces
|
||||
),
|
||||
"weightsSum",
|
||||
mergedWeights,
|
||||
false
|
||||
mergedPoints,
|
||||
mergedFaces,
|
||||
(directory/prefix + "_" + inst.name()),
|
||||
false // serial: master-only
|
||||
);
|
||||
|
||||
writer.setTime(inst);
|
||||
writer.writeTimeValue();
|
||||
writer.writeGeometry();
|
||||
|
||||
writer.beginCellData(1);
|
||||
writer.write("weightsSum", mergedWeights);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void writeWeights(const polyMesh& mesh)
|
||||
{
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
|
||||
const word tmName(mesh.time().timeName());
|
||||
|
||||
forAll(pbm, patchi)
|
||||
for (const polyPatch& pp : mesh.boundaryMesh())
|
||||
{
|
||||
if (isA<cyclicAMIPolyPatch>(pbm[patchi]))
|
||||
if (isA<cyclicAMIPolyPatch>(pp))
|
||||
{
|
||||
const cyclicAMIPolyPatch& cpp =
|
||||
refCast<const cyclicAMIPolyPatch>(pbm[patchi]);
|
||||
refCast<const cyclicAMIPolyPatch>(pp);
|
||||
|
||||
if (cpp.owner())
|
||||
{
|
||||
@ -142,7 +139,7 @@ void writeWeights(const polyMesh& mesh)
|
||||
cpp.neighbPatch(),
|
||||
functionObject::outputPrefix,
|
||||
"tgt",
|
||||
tmName
|
||||
mesh.time()
|
||||
);
|
||||
writeWeights
|
||||
(
|
||||
@ -151,7 +148,7 @@ void writeWeights(const polyMesh& mesh)
|
||||
cpp,
|
||||
functionObject::outputPrefix,
|
||||
"src",
|
||||
tmName
|
||||
mesh.time()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
EXE_INC = \
|
||||
-IextractionMethod/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lsurfaceFeatureExtract \
|
||||
-lmeshTools \
|
||||
-lsampling
|
||||
-lmeshTools
|
||||
|
||||
@ -193,7 +193,7 @@ Note
|
||||
#include "meshTools.H"
|
||||
#include "OBJstream.H"
|
||||
#include "triSurfaceMesh.H"
|
||||
#include "vtkSurfaceWriter.H"
|
||||
#include "foamVtkSurfaceWriter.H"
|
||||
#include "unitConversion.H"
|
||||
#include "plane.H"
|
||||
#include "point.H"
|
||||
@ -656,8 +656,55 @@ int main(int argc, char *argv[])
|
||||
bfeMesh.regIOobject::write();
|
||||
}
|
||||
|
||||
|
||||
// Output information
|
||||
|
||||
const bool optCloseness =
|
||||
surfaceDict.lookupOrDefault("closeness", false);
|
||||
|
||||
const bool optProximity =
|
||||
surfaceDict.lookupOrDefault("featureProximity", false);
|
||||
|
||||
const bool optCurvature =
|
||||
surfaceDict.lookupOrDefault("curvature", false);
|
||||
|
||||
|
||||
// For VTK legacy format, we would need an a priori count of
|
||||
// CellData and PointData fields.
|
||||
// For convenience, we therefore only use the XML formats
|
||||
|
||||
autoPtr<vtk::surfaceWriter> vtkWriter;
|
||||
|
||||
if (optCloseness || optProximity || optCurvature)
|
||||
{
|
||||
if (writeVTK)
|
||||
{
|
||||
vtkWriter.reset
|
||||
(
|
||||
new vtk::surfaceWriter
|
||||
(
|
||||
surf.points(),
|
||||
faces,
|
||||
(vtkOutputDir / outputName),
|
||||
false // serial only
|
||||
)
|
||||
);
|
||||
|
||||
vtkWriter->writeGeometry();
|
||||
|
||||
Info<< "Writing VTK to "
|
||||
<< ((vtkOutputDir/outputName).ext(vtkWriter->ext()))
|
||||
.relative(runTime.globalPath()) << nl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
continue; // Nothing to output
|
||||
}
|
||||
|
||||
|
||||
// Option: "closeness"
|
||||
if (surfaceDict.lookupOrDefault("closeness", false))
|
||||
if (optCloseness)
|
||||
{
|
||||
Pair<tmp<scalarField>> tcloseness =
|
||||
triSurfaceTools::writeCloseness
|
||||
@ -669,73 +716,20 @@ int main(int argc, char *argv[])
|
||||
10 // externalAngleTolerance
|
||||
);
|
||||
|
||||
if (writeVTK)
|
||||
if (vtkWriter.valid())
|
||||
{
|
||||
vtkSurfaceWriter().write
|
||||
(
|
||||
vtkOutputDir,
|
||||
outputName,
|
||||
meshedSurfRef
|
||||
(
|
||||
surf.points(),
|
||||
faces
|
||||
),
|
||||
"internalCloseness", // fieldName
|
||||
tcloseness[0](),
|
||||
false, // isNodeValues
|
||||
true // verbose
|
||||
);
|
||||
|
||||
vtkSurfaceWriter().write
|
||||
(
|
||||
vtkOutputDir,
|
||||
outputName,
|
||||
meshedSurfRef
|
||||
(
|
||||
surf.points(),
|
||||
faces
|
||||
),
|
||||
"externalCloseness", // fieldName
|
||||
tcloseness[1](),
|
||||
false, // isNodeValues
|
||||
true // verbose
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Option: "curvature"
|
||||
if (surfaceDict.lookupOrDefault("curvature", false))
|
||||
{
|
||||
tmp<scalarField> tcurvatureField =
|
||||
triSurfaceTools::writeCurvature
|
||||
(
|
||||
runTime,
|
||||
outputName,
|
||||
surf
|
||||
);
|
||||
|
||||
if (writeVTK)
|
||||
{
|
||||
vtkSurfaceWriter().write
|
||||
(
|
||||
vtkOutputDir,
|
||||
outputName,
|
||||
meshedSurfRef
|
||||
(
|
||||
surf.points(),
|
||||
faces
|
||||
),
|
||||
"curvature", // fieldName
|
||||
tcurvatureField(),
|
||||
true, // isNodeValues
|
||||
true // verbose
|
||||
);
|
||||
vtkWriter->beginCellData();
|
||||
vtkWriter->write("internalCloseness", tcloseness[0]());
|
||||
vtkWriter->write("externalCloseness", tcloseness[1]());
|
||||
}
|
||||
}
|
||||
|
||||
// Option: "featureProximity"
|
||||
if (surfaceDict.lookupOrDefault("featureProximity", false))
|
||||
if (optCloseness)
|
||||
{
|
||||
const scalar maxProximity =
|
||||
surfaceDict.lookupOrDefault<scalar>("maxFeatureProximity", 1);
|
||||
|
||||
tmp<scalarField> tproximity =
|
||||
edgeMeshTools::writeFeatureProximity
|
||||
(
|
||||
@ -743,25 +737,31 @@ int main(int argc, char *argv[])
|
||||
outputName,
|
||||
feMesh,
|
||||
surf,
|
||||
surfaceDict.get<scalar>("maxFeatureProximity")
|
||||
maxProximity
|
||||
);
|
||||
|
||||
if (writeVTK)
|
||||
if (vtkWriter.valid())
|
||||
{
|
||||
vtkSurfaceWriter().write
|
||||
vtkWriter->beginCellData();
|
||||
vtkWriter->write("featureProximity", tproximity());
|
||||
}
|
||||
}
|
||||
|
||||
// Option: "curvature"
|
||||
if (optCurvature)
|
||||
{
|
||||
tmp<scalarField> tcurvature =
|
||||
triSurfaceTools::writeCurvature
|
||||
(
|
||||
vtkOutputDir,
|
||||
runTime,
|
||||
outputName,
|
||||
meshedSurfRef
|
||||
(
|
||||
surf.points(),
|
||||
faces
|
||||
),
|
||||
"featureProximity", // fieldName
|
||||
tproximity(),
|
||||
false, // isNodeValues
|
||||
true // verbose
|
||||
surf
|
||||
);
|
||||
|
||||
if (vtkWriter.valid())
|
||||
{
|
||||
vtkWriter->beginPointData();
|
||||
vtkWriter->write("curvature", tcurvature());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ surface1.stl
|
||||
// Tolerance for surface intersections
|
||||
// tolerance 1e-3;
|
||||
|
||||
// Output options:
|
||||
// Output options:
|
||||
|
||||
// Write features to obj format for postprocessing
|
||||
writeObj yes;
|
||||
@ -59,7 +59,7 @@ outputName1
|
||||
// Tolerance for surface intersections
|
||||
// tolerance 1e-3;
|
||||
|
||||
// Output options:
|
||||
// Output options:
|
||||
|
||||
// Write features to OBJ format for postprocessing
|
||||
writeObj yes;
|
||||
@ -117,7 +117,7 @@ surface2.nas
|
||||
// Tolerance for surface intersections
|
||||
// tolerance 1e-3;
|
||||
|
||||
// Output options:
|
||||
// Output options:
|
||||
|
||||
// Output the closeness of surface elements to other surface elements.
|
||||
closeness no;
|
||||
@ -128,7 +128,7 @@ surface2.nas
|
||||
// Output the proximity of feature points and edges to another
|
||||
featureProximity no;
|
||||
|
||||
// The maximum search distance when checking feature proximity
|
||||
// Maximum search distance when checking feature proximity (default: 1m)
|
||||
maxFeatureProximity 1;
|
||||
|
||||
// Write features to OBJ format for postprocessing
|
||||
|
||||
@ -30,8 +30,10 @@ License
|
||||
#include "OBJstream.H"
|
||||
#include "PatchTools.H"
|
||||
#include "Time.H"
|
||||
//Note: cannot use vtkSurfaceWriter here - circular linkage
|
||||
//#include "vtkSurfaceWriter.H"
|
||||
// Note: cannot use vtkSurfaceWriter here - circular linkage
|
||||
// but foamVtkSurfaceWriter (vtk::surfaceWriter) would be okay.
|
||||
//
|
||||
// #include "foamVtkSurfaceWriter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -26,4 +26,13 @@ trimFeatures
|
||||
|
||||
writeObj yes; // writes out .obj files to view features
|
||||
|
||||
writeVTK no; // writes vtk files to view features
|
||||
|
||||
// Output items
|
||||
/*
|
||||
closeness yes;
|
||||
curvature yes;
|
||||
featureProxmity yes;
|
||||
*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Reference in New Issue
Block a user