mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: enable vtkPolyhedron support when detected
This commit is contained in:
@ -39,7 +39,7 @@ License
|
|||||||
#include "vtkStreamingDemandDrivenPipeline.h"
|
#include "vtkStreamingDemandDrivenPipeline.h"
|
||||||
#include "vtkStringArray.h"
|
#include "vtkStringArray.h"
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
|
|
||||||
#undef EXPERIMENTAL_TIME_CACHING
|
#undef EXPERIMENTAL_TIME_CACHING
|
||||||
@ -413,7 +413,7 @@ int vtkPV3FoamReader::RequestData
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Do any cleanup on the Foam side
|
// Do any cleanup on the OpenFOAM side
|
||||||
foamData_->CleanUp();
|
foamData_->CleanUp();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -47,7 +47,7 @@ SourceFiles
|
|||||||
class vtkDataArraySelection;
|
class vtkDataArraySelection;
|
||||||
class vtkCallbackCommand;
|
class vtkCallbackCommand;
|
||||||
|
|
||||||
// Foam forward declarations
|
// OpenFOAM forward declarations
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
class vtkPV3Foam;
|
class vtkPV3Foam;
|
||||||
@ -78,16 +78,16 @@ public:
|
|||||||
vtkGetStringMacro(FileName);
|
vtkGetStringMacro(FileName);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// FOAM mesh caching control
|
// OpenFOAM mesh caching control
|
||||||
vtkSetMacro(CacheMesh, int);
|
vtkSetMacro(CacheMesh, int);
|
||||||
vtkGetMacro(CacheMesh, int);
|
vtkGetMacro(CacheMesh, int);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// FOAM refresh times/fields
|
// OpenFOAM refresh times/fields
|
||||||
virtual void SetRefresh(int);
|
virtual void SetRefresh(int);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// FOAM Skip/include the 0/ time directory
|
// OpenFOAM skip/include the 0/ time directory
|
||||||
vtkSetMacro(SkipZeroTime, int);
|
vtkSetMacro(SkipZeroTime, int);
|
||||||
vtkGetMacro(SkipZeroTime, int);
|
vtkGetMacro(SkipZeroTime, int);
|
||||||
|
|
||||||
@ -97,27 +97,27 @@ public:
|
|||||||
vtkGetMacro(UpdateGUI, int);
|
vtkGetMacro(UpdateGUI, int);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// FOAM extrapolate internal values onto the patches
|
// OpenFOAM extrapolate internal values onto the patches
|
||||||
vtkSetMacro(ExtrapolatePatches, int);
|
vtkSetMacro(ExtrapolatePatches, int);
|
||||||
vtkGetMacro(ExtrapolatePatches, int);
|
vtkGetMacro(ExtrapolatePatches, int);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// FOAM use vtkPolyhedron instead of decomposing polyhedra
|
// OpenFOAM use vtkPolyhedron instead of decomposing polyhedra
|
||||||
vtkSetMacro(UseVTKPolyhedron, int);
|
vtkSetMacro(UseVTKPolyhedron, int);
|
||||||
vtkGetMacro(UseVTKPolyhedron, int);
|
vtkGetMacro(UseVTKPolyhedron, int);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// FOAM read sets control
|
// OpenFOAM read sets control
|
||||||
virtual void SetIncludeSets(int);
|
virtual void SetIncludeSets(int);
|
||||||
vtkGetMacro(IncludeSets, int);
|
vtkGetMacro(IncludeSets, int);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// FOAM read zones control
|
// OpenFOAM read zones control
|
||||||
virtual void SetIncludeZones(int);
|
virtual void SetIncludeZones(int);
|
||||||
vtkGetMacro(IncludeZones, int);
|
vtkGetMacro(IncludeZones, int);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// FOAM display patch names control
|
// OpenFOAM display patch names control
|
||||||
virtual void SetShowPatchNames(int);
|
virtual void SetShowPatchNames(int);
|
||||||
vtkGetMacro(ShowPatchNames, int);
|
vtkGetMacro(ShowPatchNames, int);
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,18 @@
|
|||||||
|
/* Note: enable vtkPolyhedron when available */
|
||||||
|
|
||||||
|
PARAVIEW_INC=$(ParaView_DIR)/include/paraview-$(ParaView_MAJOR)
|
||||||
|
|
||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
-I$(ParaView_DIR)/include/paraview-$(ParaView_MAJOR) \
|
|
||||||
-I../../vtkPV3Readers/lnInclude \
|
-I../../vtkPV3Readers/lnInclude \
|
||||||
-I../PV3FoamReader
|
-I../PV3FoamReader \
|
||||||
|
-I$(PARAVIEW_INC) \
|
||||||
|
$(shell \
|
||||||
|
test -f $(PARAVIEW_INC)/vtkPolyhedron.h && \
|
||||||
|
echo "-DHAS_VTK_POLYHEDRON" || echo "-UHAS_VTK_POLYHEDRON" \
|
||||||
|
)
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-lvtkPV3Readers \
|
-lvtkPV3Readers \
|
||||||
|
|||||||
@ -56,7 +56,7 @@ inline void vtkSetOpenFOAMPoint
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Convert Foam mesh vertices to VTK
|
// Convert OpenFOAM mesh vertices to VTK
|
||||||
inline vtkPoints* vtkSetOpenFOAMPoints(const Foam::pointField& points)
|
inline vtkPoints* vtkSetOpenFOAMPoints(const Foam::pointField& points)
|
||||||
{
|
{
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
vtkPoints *vtkpoints = vtkPoints::New();
|
||||||
|
|||||||
@ -26,7 +26,7 @@ License
|
|||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
#include "vtkPV3FoamReader.h"
|
#include "vtkPV3FoamReader.h"
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "patchZones.H"
|
#include "patchZones.H"
|
||||||
@ -426,12 +426,12 @@ void Foam::vtkPV3Foam::updateFoamMesh()
|
|||||||
meshPtr_ = NULL;
|
meshPtr_ = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if the FOAM mesh has been created
|
// Check to see if the OpenFOAM mesh has been created
|
||||||
if (!meshPtr_)
|
if (!meshPtr_)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "Creating Foam mesh for region " << meshRegion_
|
Info<< "Creating OpenFOAM mesh for region " << meshRegion_
|
||||||
<< " at time=" << dbPtr_().timeName()
|
<< " at time=" << dbPtr_().timeName()
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
@ -454,7 +454,7 @@ void Foam::vtkPV3Foam::updateFoamMesh()
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "Using existing Foam mesh" << endl;
|
Info<< "Using existing OpenFOAM mesh" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,7 +488,7 @@ void Foam::vtkPV3Foam::Update
|
|||||||
|
|
||||||
reader_->UpdateProgress(0.15);
|
reader_->UpdateProgress(0.15);
|
||||||
|
|
||||||
// Update the Foam mesh
|
// Update the OpenFOAM mesh
|
||||||
updateFoamMesh();
|
updateFoamMesh();
|
||||||
reader_->UpdateProgress(0.4);
|
reader_->UpdateProgress(0.4);
|
||||||
|
|
||||||
@ -527,6 +527,10 @@ void Foam::vtkPV3Foam::Update
|
|||||||
convertVolFields(output);
|
convertVolFields(output);
|
||||||
convertPointFields(output);
|
convertPointFields(output);
|
||||||
convertLagrangianFields(lagrangianOutput);
|
convertLagrangianFields(lagrangianOutput);
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "done reader part" << endl;
|
||||||
|
}
|
||||||
reader_->UpdateProgress(0.95);
|
reader_->UpdateProgress(0.95);
|
||||||
|
|
||||||
meshChanged_ = fieldsChanged_ = false;
|
meshChanged_ = fieldsChanged_ = false;
|
||||||
|
|||||||
@ -89,7 +89,7 @@ class vtkIndent;
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Foam class forward declarations
|
// OpenFOAM class forward declarations
|
||||||
class argList;
|
class argList;
|
||||||
class Time;
|
class Time;
|
||||||
class fvMesh;
|
class fvMesh;
|
||||||
@ -249,10 +249,10 @@ class vtkPV3Foam
|
|||||||
//- Access to the controlling vtkPV3FoamReader
|
//- Access to the controlling vtkPV3FoamReader
|
||||||
vtkPV3FoamReader* reader_;
|
vtkPV3FoamReader* reader_;
|
||||||
|
|
||||||
//- Foam time control
|
//- OpenFOAM time control
|
||||||
autoPtr<Time> dbPtr_;
|
autoPtr<Time> dbPtr_;
|
||||||
|
|
||||||
//- Foam mesh
|
//- OpenFOAM mesh
|
||||||
fvMesh* meshPtr_;
|
fvMesh* meshPtr_;
|
||||||
|
|
||||||
//- The mesh region
|
//- The mesh region
|
||||||
@ -384,7 +384,7 @@ class vtkPV3Foam
|
|||||||
|
|
||||||
// Update helper functions
|
// Update helper functions
|
||||||
|
|
||||||
//- Foam mesh
|
//- OpenFOAM mesh
|
||||||
void updateFoamMesh();
|
void updateFoamMesh();
|
||||||
|
|
||||||
//- Reduce memory footprint after conversion
|
//- Reduce memory footprint after conversion
|
||||||
@ -496,7 +496,7 @@ class vtkPV3Foam
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Convert Foam fields
|
// Convert OpenFOAM fields
|
||||||
|
|
||||||
//- Volume fields - all types
|
//- Volume fields - all types
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -26,7 +26,7 @@ License
|
|||||||
#ifndef vtkPV3FoamAddToSelection_H
|
#ifndef vtkPV3FoamAddToSelection_H
|
||||||
#define vtkPV3FoamAddToSelection_H
|
#define vtkPV3FoamAddToSelection_H
|
||||||
|
|
||||||
// FOAM includes
|
// OpenFOAM includes
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
#include "SortableList.H"
|
#include "SortableList.H"
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ License
|
|||||||
|
|
||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
#include "vtkPV3FoamReader.h"
|
#include "vtkPV3FoamReader.h"
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::convertVolFields" << nl
|
Info<< "<beg> Foam::vtkPV3Foam::convertVolFields" << nl
|
||||||
<< "converting Foam volume fields" << endl;
|
<< "converting OpenFOAM volume fields" << endl;
|
||||||
forAllConstIter(IOobjectList, objects, iter)
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
{
|
{
|
||||||
Info<< " " << iter()->name()
|
Info<< " " << iter()->name()
|
||||||
@ -163,6 +163,10 @@ void Foam::vtkPV3Foam::convertPointFields
|
|||||||
|
|
||||||
if (selectedFields.empty())
|
if (selectedFields.empty())
|
||||||
{
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "no point fields selected" << endl;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +183,7 @@ void Foam::vtkPV3Foam::convertPointFields
|
|||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::convertPointFields" << nl
|
Info<< "<beg> Foam::vtkPV3Foam::convertPointFields" << nl
|
||||||
<< "converting Foam volume fields" << endl;
|
<< "converting OpenFOAM volume fields -> point fields" << endl;
|
||||||
forAllConstIter(IOobjectList, objects, iter)
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
{
|
{
|
||||||
Info<< " " << iter()->name()
|
Info<< " " << iter()->name()
|
||||||
@ -274,7 +278,7 @@ void Foam::vtkPV3Foam::convertLagrangianFields
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "converting Foam lagrangian fields" << nl;
|
Info<< "converting OpenFOAM lagrangian fields" << nl;
|
||||||
forAllConstIter(IOobjectList, objects, iter)
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
{
|
{
|
||||||
Info<< " " << iter()->name()
|
Info<< " " << iter()->name()
|
||||||
|
|||||||
@ -25,7 +25,7 @@ License
|
|||||||
|
|
||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "cellSet.H"
|
#include "cellSet.H"
|
||||||
#include "faceSet.H"
|
#include "faceSet.H"
|
||||||
#include "pointSet.H"
|
#include "pointSet.H"
|
||||||
|
|||||||
@ -25,7 +25,7 @@ License
|
|||||||
|
|
||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "Cloud.H"
|
#include "Cloud.H"
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
|
|||||||
@ -25,7 +25,7 @@ License
|
|||||||
|
|
||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "polyPatch.H"
|
#include "polyPatch.H"
|
||||||
#include "primitivePatch.H"
|
#include "primitivePatch.H"
|
||||||
#include "vtkOpenFOAMPoints.H"
|
#include "vtkOpenFOAMPoints.H"
|
||||||
@ -47,7 +47,7 @@ vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh(const polyPatch& p)
|
|||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert Foam mesh vertices to VTK
|
// Convert OpenFOAM mesh vertices to VTK
|
||||||
const Foam::pointField& points = p.localPoints();
|
const Foam::pointField& points = p.localPoints();
|
||||||
|
|
||||||
vtkPoints* vtkpoints = vtkPoints::New();
|
vtkPoints* vtkpoints = vtkPoints::New();
|
||||||
|
|||||||
@ -25,7 +25,7 @@ License
|
|||||||
|
|
||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "faceSet.H"
|
#include "faceSet.H"
|
||||||
#include "pointSet.H"
|
#include "pointSet.H"
|
||||||
#include "vtkOpenFOAMPoints.H"
|
#include "vtkOpenFOAMPoints.H"
|
||||||
@ -65,7 +65,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceSetVTKMesh
|
|||||||
|
|
||||||
// The balance of this routine should be identical to patchVTKMesh
|
// The balance of this routine should be identical to patchVTKMesh
|
||||||
|
|
||||||
// Convert Foam mesh vertices to VTK
|
// Convert OpenFOAM mesh vertices to VTK
|
||||||
const pointField& points = p.localPoints();
|
const pointField& points = p.localPoints();
|
||||||
|
|
||||||
vtkPoints* vtkpoints = vtkPoints::New();
|
vtkPoints* vtkpoints = vtkPoints::New();
|
||||||
|
|||||||
@ -26,7 +26,7 @@ License
|
|||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
#include "vtkPV3FoamReader.h"
|
#include "vtkPV3FoamReader.h"
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "cellModeller.H"
|
#include "cellModeller.H"
|
||||||
#include "vtkOpenFOAMPoints.H"
|
#include "vtkOpenFOAMPoints.H"
|
||||||
@ -74,15 +74,15 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
|
|||||||
labelList& superCells = decompInfo.superCells();
|
labelList& superCells = decompInfo.superCells();
|
||||||
labelList& addPointCellLabels = decompInfo.addPointCellLabels();
|
labelList& addPointCellLabels = decompInfo.addPointCellLabels();
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "... scanning" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scan for cells which need to be decomposed and count additional points
|
// Scan for cells which need to be decomposed and count additional points
|
||||||
// and cells
|
// and cells
|
||||||
if (!reader_->GetUseVTKPolyhedron())
|
if (!reader_->GetUseVTKPolyhedron())
|
||||||
{
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "... scanning for polyhedra" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
forAll(cellShapes, cellI)
|
forAll(cellShapes, cellI)
|
||||||
{
|
{
|
||||||
const cellModel& model = cellShapes[cellI].model();
|
const cellModel& model = cellShapes[cellI].model();
|
||||||
@ -138,7 +138,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
|
|||||||
Info<< "... converting points" << endl;
|
Info<< "... converting points" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert Foam mesh vertices to VTK
|
// Convert OpenFOAM mesh vertices to VTK
|
||||||
vtkPoints* vtkpoints = vtkPoints::New();
|
vtkPoints* vtkpoints = vtkPoints::New();
|
||||||
vtkpoints->Allocate(mesh.nPoints() + nAddPoints);
|
vtkpoints->Allocate(mesh.nPoints() + nAddPoints);
|
||||||
|
|
||||||
@ -164,6 +164,17 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
|
|||||||
// data types - max 'order' = hex = 8 points
|
// data types - max 'order' = hex = 8 points
|
||||||
vtkIdType nodeIds[8];
|
vtkIdType nodeIds[8];
|
||||||
|
|
||||||
|
// hash to establish unique node ids for a polyhedral cell
|
||||||
|
HashSet<vtkIdType, Hash<label> > hashUniqId(2*256);
|
||||||
|
|
||||||
|
// unique node ids for a polyhedral cell
|
||||||
|
DynamicList<vtkIdType> uniqueNodeIds(256);
|
||||||
|
|
||||||
|
// face-stream for a polyhedral cell
|
||||||
|
// [numFace0Pts, id1, id2, id3, numFace1Pts, id1, id2, id3, ...]
|
||||||
|
DynamicList<vtkIdType> faceStream(256);
|
||||||
|
|
||||||
|
|
||||||
forAll(cellShapes, cellI)
|
forAll(cellShapes, cellI)
|
||||||
{
|
{
|
||||||
const cellShape& cellShape = cellShapes[cellI];
|
const cellShape& cellShape = cellShapes[cellI];
|
||||||
@ -272,7 +283,6 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
|
|||||||
const labelList& cFaces = mesh.cells()[cellI];
|
const labelList& cFaces = mesh.cells()[cellI];
|
||||||
|
|
||||||
vtkIdType nFaces = cFaces.size();
|
vtkIdType nFaces = cFaces.size();
|
||||||
vtkIdType nodeCount = 0;
|
|
||||||
vtkIdType nLabels = nFaces;
|
vtkIdType nLabels = nFaces;
|
||||||
|
|
||||||
// count size for face stream
|
// count size for face stream
|
||||||
@ -282,46 +292,51 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
|
|||||||
nLabels += f.size();
|
nLabels += f.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// hash to establish unique node ids for a polyhedral cell
|
||||||
|
hashUniqId.clear();
|
||||||
|
|
||||||
// unique node ids - approximately equal to the number of point ids
|
// unique node ids - approximately equal to the number of point ids
|
||||||
DynamicList<vtkIdType> uniqueNodeIds(nLabels-nFaces);
|
uniqueNodeIds.clear();
|
||||||
|
uniqueNodeIds.reserve(nLabels-nFaces);
|
||||||
|
|
||||||
// zero-based index into uniqueNodeIds
|
// build face-stream
|
||||||
DynamicList<vtkIdType> faceLabels(nLabels);
|
// [numFace0Pts, id1, id2, id3, numFace1Pts, id1, id2, id3, ...]
|
||||||
|
// point Ids are global
|
||||||
|
faceStream.clear();
|
||||||
|
faceStream.reserve(nLabels + nFaces);
|
||||||
|
|
||||||
// localized point id within the cell
|
|
||||||
Map<label> mapLocalId(2*nLabels);
|
|
||||||
|
|
||||||
// establish the unique point ids,
|
|
||||||
// record the local mapping ids,
|
|
||||||
// create new face list
|
|
||||||
forAll(cFaces, cFaceI)
|
forAll(cFaces, cFaceI)
|
||||||
{
|
{
|
||||||
const face& f = mesh.faces()[cFaces[cFaceI]];
|
const face& f = mesh.faces()[cFaces[cFaceI]];
|
||||||
|
const bool isOwner = (owner[cFaces[cFaceI]] == cellI);
|
||||||
const label nFacePoints = f.size();
|
const label nFacePoints = f.size();
|
||||||
|
|
||||||
// number of labels for this face
|
// number of labels for this face
|
||||||
faceLabels.append(nFacePoints);
|
faceStream.append(nFacePoints);
|
||||||
|
|
||||||
forAll(f, fp)
|
if (isOwner)
|
||||||
{
|
{
|
||||||
const label nodeId = f[fp];
|
forAll(f, fp)
|
||||||
|
|
||||||
if (mapLocalId.insert(nodeId, nodeCount))
|
|
||||||
{
|
{
|
||||||
// insertion was successful (node Id was unique)
|
hashUniqId.insert(f[fp]);
|
||||||
uniqueNodeIds.append(nodeId);
|
faceStream.append(f[fp]);
|
||||||
// map orig vertex id -> localized point label
|
|
||||||
faceLabels.append(nodeCount);
|
|
||||||
++nodeCount;
|
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// fairly immaterial if we reverse the list
|
||||||
|
// or use face::reverseFace()
|
||||||
|
forAllReverse(f, fp)
|
||||||
{
|
{
|
||||||
// map orig vertex id -> localized point label
|
hashUniqId.insert(f[fp]);
|
||||||
faceLabels.append(mapLocalId[nodeId]);
|
faceStream.append(f[fp]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uniqueNodeIds.append(hashUniqId.sortedToc());
|
||||||
|
vtkIdType nodeCount = uniqueNodeIds.size();
|
||||||
|
|
||||||
#ifdef HAS_VTK_POLYHEDRON
|
#ifdef HAS_VTK_POLYHEDRON
|
||||||
vtkmesh->InsertNextCell
|
vtkmesh->InsertNextCell
|
||||||
(
|
(
|
||||||
@ -329,9 +344,11 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
|
|||||||
nodeCount,
|
nodeCount,
|
||||||
uniqueNodeIds.data(),
|
uniqueNodeIds.data(),
|
||||||
nFaces,
|
nFaces,
|
||||||
faceLabels.data()
|
faceStream.data()
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
|
// this is a horrible substitute
|
||||||
|
// but avoids crashes when there is no vtkPolyhedron support
|
||||||
vtkmesh->InsertNextCell
|
vtkmesh->InsertNextCell
|
||||||
(
|
(
|
||||||
VTK_CONVEX_POINT_SET,
|
VTK_CONVEX_POINT_SET,
|
||||||
|
|||||||
@ -25,7 +25,7 @@ License
|
|||||||
|
|
||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "vtkOpenFOAMPoints.H"
|
#include "vtkOpenFOAMPoints.H"
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
@ -62,7 +62,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh
|
|||||||
|
|
||||||
// The balance of this routine should be identical to patchVTKMesh
|
// The balance of this routine should be identical to patchVTKMesh
|
||||||
|
|
||||||
// Convert Foam mesh vertices to VTK
|
// Convert OpenFOAM mesh vertices to VTK
|
||||||
const pointField& points = p.localPoints();
|
const pointField& points = p.localPoints();
|
||||||
|
|
||||||
vtkPoints* vtkpoints = vtkPoints::New();
|
vtkPoints* vtkpoints = vtkPoints::New();
|
||||||
|
|||||||
@ -29,7 +29,7 @@ InClass
|
|||||||
#ifndef vtkPV3FoamPointFields_H
|
#ifndef vtkPV3FoamPointFields_H
|
||||||
#define vtkPV3FoamPointFields_H
|
#define vtkPV3FoamPointFields_H
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "interpolatePointToCell.H"
|
#include "interpolatePointToCell.H"
|
||||||
|
|
||||||
#include "vtkOpenFOAMTupleRemap.H"
|
#include "vtkOpenFOAMTupleRemap.H"
|
||||||
|
|||||||
@ -25,7 +25,7 @@ License
|
|||||||
|
|
||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "cellSet.H"
|
#include "cellSet.H"
|
||||||
#include "faceSet.H"
|
#include "faceSet.H"
|
||||||
#include "pointSet.H"
|
#include "pointSet.H"
|
||||||
|
|||||||
@ -29,7 +29,7 @@ Description
|
|||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
#include "vtkPV3FoamReader.h"
|
#include "vtkPV3FoamReader.h"
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
|
|||||||
@ -29,7 +29,7 @@ InClass
|
|||||||
#ifndef vtkPV3FoamVolFields_H
|
#ifndef vtkPV3FoamVolFields_H
|
||||||
#define vtkPV3FoamVolFields_H
|
#define vtkPV3FoamVolFields_H
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "emptyFvPatchField.H"
|
#include "emptyFvPatchField.H"
|
||||||
#include "wallPolyPatch.H"
|
#include "wallPolyPatch.H"
|
||||||
#include "faceSet.H"
|
#include "faceSet.H"
|
||||||
|
|||||||
@ -39,7 +39,7 @@ License
|
|||||||
#include "vtkStreamingDemandDrivenPipeline.h"
|
#include "vtkStreamingDemandDrivenPipeline.h"
|
||||||
#include "vtkStringArray.h"
|
#include "vtkStringArray.h"
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "vtkPV3blockMesh.H"
|
#include "vtkPV3blockMesh.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
@ -226,7 +226,7 @@ int vtkPV3blockMeshReader::RequestData
|
|||||||
foamData_->Update(output);
|
foamData_->Update(output);
|
||||||
updatePointNumbersView(ShowPointNumbers);
|
updatePointNumbersView(ShowPointNumbers);
|
||||||
|
|
||||||
// Do any cleanup on the Foam side
|
// Do any cleanup on the OpenFOAM side
|
||||||
foamData_->CleanUp();
|
foamData_->CleanUp();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -26,7 +26,7 @@ License
|
|||||||
#include "vtkPV3blockMesh.H"
|
#include "vtkPV3blockMesh.H"
|
||||||
#include "vtkPV3blockMeshReader.h"
|
#include "vtkPV3blockMeshReader.h"
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "blockMesh.H"
|
#include "blockMesh.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "patchZones.H"
|
#include "patchZones.H"
|
||||||
@ -298,7 +298,7 @@ void Foam::vtkPV3blockMesh::updateFoamMesh()
|
|||||||
Info<< "<beg> Foam::vtkPV3blockMesh::updateFoamMesh" << endl;
|
Info<< "<beg> Foam::vtkPV3blockMesh::updateFoamMesh" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if the FOAM mesh has been created
|
// Check to see if the OpenFOAM mesh has been created
|
||||||
if (!meshPtr_)
|
if (!meshPtr_)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -347,7 +347,7 @@ void Foam::vtkPV3blockMesh::Update
|
|||||||
|
|
||||||
reader_->UpdateProgress(0.2);
|
reader_->UpdateProgress(0.2);
|
||||||
|
|
||||||
// Update the Foam mesh
|
// Update the OpenFOAM mesh
|
||||||
updateFoamMesh();
|
updateFoamMesh();
|
||||||
reader_->UpdateProgress(0.5);
|
reader_->UpdateProgress(0.5);
|
||||||
|
|
||||||
|
|||||||
@ -71,7 +71,7 @@ class vtkIndent;
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Foam class forward declarations
|
// OpenFOAM class forward declarations
|
||||||
class argList;
|
class argList;
|
||||||
class Time;
|
class Time;
|
||||||
class blockMesh;
|
class blockMesh;
|
||||||
@ -167,10 +167,10 @@ class vtkPV3blockMesh
|
|||||||
//- Access to the controlling vtkPV3blockMeshReader
|
//- Access to the controlling vtkPV3blockMeshReader
|
||||||
vtkPV3blockMeshReader* reader_;
|
vtkPV3blockMeshReader* reader_;
|
||||||
|
|
||||||
//- Foam time control
|
//- OpenFOAM time control
|
||||||
autoPtr<Time> dbPtr_;
|
autoPtr<Time> dbPtr_;
|
||||||
|
|
||||||
//- Foam mesh
|
//- OpenFOAM mesh
|
||||||
blockMesh* meshPtr_;
|
blockMesh* meshPtr_;
|
||||||
|
|
||||||
//- Selected geometrical parts
|
//- Selected geometrical parts
|
||||||
@ -242,7 +242,7 @@ class vtkPV3blockMesh
|
|||||||
|
|
||||||
// Update helper functions
|
// Update helper functions
|
||||||
|
|
||||||
//- Foam mesh
|
//- OpenFOAM mesh
|
||||||
void updateFoamMesh();
|
void updateFoamMesh();
|
||||||
|
|
||||||
// Mesh conversion functions
|
// Mesh conversion functions
|
||||||
|
|||||||
@ -26,7 +26,7 @@ License
|
|||||||
#include "vtkPV3blockMesh.H"
|
#include "vtkPV3blockMesh.H"
|
||||||
#include "vtkPV3blockMeshReader.h"
|
#include "vtkPV3blockMeshReader.h"
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "blockMesh.H"
|
#include "blockMesh.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ void Foam::vtkPV3blockMesh::convertMeshBlocks
|
|||||||
|
|
||||||
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
|
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
|
||||||
|
|
||||||
// Convert Foam mesh vertices to VTK
|
// Convert OpenFOAM mesh vertices to VTK
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
vtkPoints *vtkpoints = vtkPoints::New();
|
||||||
vtkpoints->Allocate( blockDef.nPoints() );
|
vtkpoints->Allocate( blockDef.nPoints() );
|
||||||
const labelList& blockLabels = blockDef.blockShape();
|
const labelList& blockLabels = blockDef.blockShape();
|
||||||
|
|||||||
@ -28,7 +28,7 @@ Description
|
|||||||
|
|
||||||
#include "vtkPV3Readers.H"
|
#include "vtkPV3Readers.H"
|
||||||
|
|
||||||
// Foam includes
|
// OpenFOAM includes
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
|
|||||||
@ -73,7 +73,7 @@ extern "C"
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
// slightly changed with 2.0 from 1.0
|
// slightly changed with 2.0 from 1.0
|
||||||
// (to handle complex variables - not used by FOAM anyway)
|
// (to handle complex variables - not used by OpenFOAM anyway)
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "USERD_get_constant_val.H"
|
#include "USERD_get_constant_val.H"
|
||||||
|
|||||||
@ -117,7 +117,7 @@ void register_functions()
|
|||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Storage for all Foam state (mainly database & mesh)
|
// Storage for all OpenFOAM state (mainly database & mesh)
|
||||||
//
|
//
|
||||||
static readerDatabase db_;
|
static readerDatabase db_;
|
||||||
|
|
||||||
@ -521,7 +521,7 @@ void user_query_file_function
|
|||||||
(
|
(
|
||||||
"Could not find system/ and constant/ directory in\n"
|
"Could not find system/ and constant/ directory in\n"
|
||||||
+ rootAndCase
|
+ rootAndCase
|
||||||
+ "\nPlease select a Foam case directory."
|
+ "\nPlease select an OpenFOAM case directory."
|
||||||
);
|
);
|
||||||
|
|
||||||
*iret = 1;
|
*iret = 1;
|
||||||
|
|||||||
@ -25,7 +25,7 @@ Class
|
|||||||
Foam::readerDatabase
|
Foam::readerDatabase
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Singleton caching Foam database and mesh and various. Used in Fv reader
|
Singleton caching OpenFOAM database and mesh and various. Used in Fv reader
|
||||||
to keep track of data inbetween callbacks.
|
to keep track of data inbetween callbacks.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
|
|||||||
Reference in New Issue
Block a user