mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
code tidying
This commit is contained in:
@ -35,6 +35,7 @@ InClass
|
|||||||
#include "vtkFloatArray.h"
|
#include "vtkFloatArray.h"
|
||||||
#include "vtkMultiBlockDataSet.h"
|
#include "vtkMultiBlockDataSet.h"
|
||||||
#include "vtkPolyData.h"
|
#include "vtkPolyData.h"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
@ -53,11 +54,11 @@ void Foam::vtkPV3Foam::convertFaceField
|
|||||||
const labelList& faceOwner = mesh.faceOwner();
|
const labelList& faceOwner = mesh.faceOwner();
|
||||||
const labelList& faceNeigh = mesh.faceNeighbour();
|
const labelList& faceNeigh = mesh.faceNeighbour();
|
||||||
|
|
||||||
vtkFloatArray *cellData = vtkFloatArray::New();
|
vtkFloatArray* cellData = vtkFloatArray::New();
|
||||||
cellData->SetNumberOfTuples( faceLabels.size() );
|
cellData->SetNumberOfTuples(faceLabels.size());
|
||||||
cellData->SetNumberOfComponents( nComp );
|
cellData->SetNumberOfComponents(nComp);
|
||||||
cellData->Allocate( nComp*faceLabels.size() );
|
cellData->Allocate(nComp*faceLabels.size());
|
||||||
cellData->SetName( tf.name().c_str() );
|
cellData->SetName(tf.name().c_str());
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -123,11 +124,11 @@ void Foam::vtkPV3Foam::convertFaceField
|
|||||||
const labelList& faceOwner = mesh.faceOwner();
|
const labelList& faceOwner = mesh.faceOwner();
|
||||||
const labelList& faceNeigh = mesh.faceNeighbour();
|
const labelList& faceNeigh = mesh.faceNeighbour();
|
||||||
|
|
||||||
vtkFloatArray *cellData = vtkFloatArray::New();
|
vtkFloatArray* cellData = vtkFloatArray::New();
|
||||||
cellData->SetNumberOfTuples( fSet.size() );
|
cellData->SetNumberOfTuples(fSet.size());
|
||||||
cellData->SetNumberOfComponents( nComp );
|
cellData->SetNumberOfComponents(nComp);
|
||||||
cellData->Allocate( nComp*fSet.size() );
|
cellData->Allocate(nComp*fSet.size());
|
||||||
cellData->SetName( tf.name().c_str() );
|
cellData->SetName(tf.name().c_str());
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -80,8 +80,8 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh
|
|||||||
vtkPoints* vtkpoints = vtkPoints::New();
|
vtkPoints* vtkpoints = vtkPoints::New();
|
||||||
vtkCellArray* vtkcells = vtkCellArray::New();
|
vtkCellArray* vtkcells = vtkCellArray::New();
|
||||||
|
|
||||||
vtkpoints->Allocate( parcels.size() );
|
vtkpoints->Allocate(parcels.size());
|
||||||
vtkcells->Allocate( parcels.size() );
|
vtkcells->Allocate(parcels.size());
|
||||||
|
|
||||||
vtkIdType particleId = 0;
|
vtkIdType particleId = 0;
|
||||||
forAllConstIter(Cloud<passiveParticle>, parcels, iter)
|
forAllConstIter(Cloud<passiveParticle>, parcels, iter)
|
||||||
|
|||||||
@ -22,8 +22,6 @@ License
|
|||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Description
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
@ -40,10 +38,7 @@ Description
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh
|
vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh(const polyPatch& p)
|
||||||
(
|
|
||||||
const polyPatch& p
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::New();
|
vtkPolyData* vtkmesh = vtkPolyData::New();
|
||||||
|
|
||||||
@ -56,8 +51,8 @@ vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh
|
|||||||
// Convert Foam mesh vertices to VTK
|
// Convert Foam mesh vertices to VTK
|
||||||
const Foam::pointField& points = p.localPoints();
|
const Foam::pointField& points = p.localPoints();
|
||||||
|
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
vtkPoints* vtkpoints = vtkPoints::New();
|
||||||
vtkpoints->Allocate( points.size() );
|
vtkpoints->Allocate(points.size());
|
||||||
forAll(points, i)
|
forAll(points, i)
|
||||||
{
|
{
|
||||||
vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
|
vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
|
||||||
@ -71,7 +66,7 @@ vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh
|
|||||||
const faceList& faces = p.localFaces();
|
const faceList& faces = p.localFaces();
|
||||||
|
|
||||||
vtkCellArray* vtkcells = vtkCellArray::New();
|
vtkCellArray* vtkcells = vtkCellArray::New();
|
||||||
vtkcells->Allocate( faces.size() );
|
vtkcells->Allocate(faces.size());
|
||||||
forAll(faces, faceI)
|
forAll(faces, faceI)
|
||||||
{
|
{
|
||||||
const face& f = faces[faceI];
|
const face& f = faces[faceI];
|
||||||
|
|||||||
@ -22,8 +22,6 @@ License
|
|||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Description
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
@ -71,8 +69,8 @@ vtkPolyData* Foam::vtkPV3Foam::faceSetVTKMesh
|
|||||||
// Convert Foam mesh vertices to VTK
|
// Convert Foam mesh vertices to VTK
|
||||||
const pointField& points = p.localPoints();
|
const pointField& points = p.localPoints();
|
||||||
|
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
vtkPoints* vtkpoints = vtkPoints::New();
|
||||||
vtkpoints->Allocate( points.size() );
|
vtkpoints->Allocate(points.size());
|
||||||
forAll(points, i)
|
forAll(points, i)
|
||||||
{
|
{
|
||||||
vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
|
vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
|
||||||
@ -84,7 +82,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceSetVTKMesh
|
|||||||
const faceList& faces = p.localFaces();
|
const faceList& faces = p.localFaces();
|
||||||
|
|
||||||
vtkCellArray* vtkcells = vtkCellArray::New();
|
vtkCellArray* vtkcells = vtkCellArray::New();
|
||||||
vtkcells->Allocate( faces.size() );
|
vtkcells->Allocate(faces.size());
|
||||||
|
|
||||||
forAll(faces, faceI)
|
forAll(faces, faceI)
|
||||||
{
|
{
|
||||||
@ -127,8 +125,8 @@ vtkPolyData* Foam::vtkPV3Foam::pointSetVTKMesh
|
|||||||
|
|
||||||
const pointField& meshPoints = mesh.points();
|
const pointField& meshPoints = mesh.points();
|
||||||
|
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
vtkPoints* vtkpoints = vtkPoints::New();
|
||||||
vtkpoints->Allocate( pSet.size() );
|
vtkpoints->Allocate(pSet.size());
|
||||||
|
|
||||||
forAllConstIter(pointSet, pSet, iter)
|
forAllConstIter(pointSet, pSet, iter)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -22,8 +22,6 @@ License
|
|||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Description
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
@ -136,8 +134,8 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert Foam mesh vertices to VTK
|
// Convert Foam mesh vertices to VTK
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
vtkPoints* vtkpoints = vtkPoints::New();
|
||||||
vtkpoints->Allocate( mesh.nPoints() + nAddPoints );
|
vtkpoints->Allocate(mesh.nPoints() + nAddPoints);
|
||||||
|
|
||||||
const Foam::pointField& points = mesh.points();
|
const Foam::pointField& points = mesh.points();
|
||||||
|
|
||||||
@ -152,7 +150,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
|
|||||||
Info<< "... converting cells" << endl;
|
Info<< "... converting cells" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkmesh->Allocate( mesh.nCells() + nAddCells );
|
vtkmesh->Allocate(mesh.nCells() + nAddCells);
|
||||||
|
|
||||||
// Set counters for additional points and additional cells
|
// Set counters for additional points and additional cells
|
||||||
label addPointI = 0, addCellI = 0;
|
label addPointI = 0, addCellI = 0;
|
||||||
|
|||||||
@ -22,8 +22,6 @@ License
|
|||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Description
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
@ -69,7 +67,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh
|
|||||||
const pointField& points = p.localPoints();
|
const pointField& points = p.localPoints();
|
||||||
|
|
||||||
vtkPoints* vtkpoints = vtkPoints::New();
|
vtkPoints* vtkpoints = vtkPoints::New();
|
||||||
vtkpoints->Allocate( points.size() );
|
vtkpoints->Allocate(points.size());
|
||||||
forAll(points, i)
|
forAll(points, i)
|
||||||
{
|
{
|
||||||
vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
|
vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
|
||||||
@ -83,7 +81,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh
|
|||||||
const faceList& faces = p.localFaces();
|
const faceList& faces = p.localFaces();
|
||||||
|
|
||||||
vtkCellArray* vtkcells = vtkCellArray::New();
|
vtkCellArray* vtkcells = vtkCellArray::New();
|
||||||
vtkcells->Allocate( faces.size() );
|
vtkcells->Allocate(faces.size());
|
||||||
|
|
||||||
forAll(faces, faceI)
|
forAll(faces, faceI)
|
||||||
{
|
{
|
||||||
@ -126,8 +124,8 @@ vtkPolyData* Foam::vtkPV3Foam::pointZoneVTKMesh
|
|||||||
|
|
||||||
const pointField& meshPoints = mesh.points();
|
const pointField& meshPoints = mesh.points();
|
||||||
|
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
vtkPoints* vtkpoints = vtkPoints::New();
|
||||||
vtkpoints->Allocate( pointLabels.size() );
|
vtkpoints->Allocate(pointLabels.size());
|
||||||
|
|
||||||
forAll(pointLabels, pointI)
|
forAll(pointLabels, pointI)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -52,10 +52,10 @@ void Foam::vtkPV3Foam::convertPatchField
|
|||||||
const label nComp = pTraits<Type>::nComponents;
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
|
||||||
vtkFloatArray* cellData = vtkFloatArray::New();
|
vtkFloatArray* cellData = vtkFloatArray::New();
|
||||||
cellData->SetNumberOfTuples( ptf.size() );
|
cellData->SetNumberOfTuples(ptf.size());
|
||||||
cellData->SetNumberOfComponents( nComp );
|
cellData->SetNumberOfComponents(nComp);
|
||||||
cellData->Allocate( nComp*ptf.size() );
|
cellData->Allocate(nComp*ptf.size());
|
||||||
cellData->SetName( name.c_str() );
|
cellData->SetName(name.c_str());
|
||||||
|
|
||||||
float vec[nComp];
|
float vec[nComp];
|
||||||
forAll(ptf, i)
|
forAll(ptf, i)
|
||||||
@ -91,11 +91,11 @@ void Foam::vtkPV3Foam::convertPatchPointField
|
|||||||
{
|
{
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
|
||||||
vtkFloatArray *pointData = vtkFloatArray::New();
|
vtkFloatArray* pointData = vtkFloatArray::New();
|
||||||
pointData->SetNumberOfTuples( pptf.size() );
|
pointData->SetNumberOfTuples(pptf.size());
|
||||||
pointData->SetNumberOfComponents( nComp );
|
pointData->SetNumberOfComponents(nComp);
|
||||||
pointData->Allocate( nComp*pptf.size() );
|
pointData->Allocate(nComp*pptf.size());
|
||||||
pointData->SetName( name.c_str() );
|
pointData->SetName(name.c_str());
|
||||||
|
|
||||||
float vec[nComp];
|
float vec[nComp];
|
||||||
forAll(pptf, i)
|
forAll(pptf, i)
|
||||||
|
|||||||
@ -110,9 +110,9 @@ void Foam::vtkPV3Foam::convertPointFields
|
|||||||
++partId
|
++partId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word patchName = getPartName(partId);
|
const word patchName = getPartName(partId);
|
||||||
const label datasetNo = partDataset_[partId];
|
const label datasetNo = partDataset_[partId];
|
||||||
const label patchId = patches.findPatchID(patchName);
|
const label patchId = patches.findPatchID(patchName);
|
||||||
|
|
||||||
if (!partStatus_[partId] || datasetNo < 0 || patchId < 0)
|
if (!partStatus_[partId] || datasetNo < 0 || patchId < 0)
|
||||||
{
|
{
|
||||||
@ -187,7 +187,7 @@ void Foam::vtkPV3Foam::convertPointField
|
|||||||
nPoints = ptf.size();
|
nPoints = ptf.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkFloatArray *pointData = vtkFloatArray::New();
|
vtkFloatArray* pointData = vtkFloatArray::New();
|
||||||
pointData->SetNumberOfTuples(nPoints + addPointCellLabels.size());
|
pointData->SetNumberOfTuples(nPoints + addPointCellLabels.size());
|
||||||
pointData->SetNumberOfComponents(nComp);
|
pointData->SetNumberOfComponents(nComp);
|
||||||
pointData->Allocate(nComp*(nPoints + addPointCellLabels.size()));
|
pointData->Allocate(nComp*(nPoints + addPointCellLabels.size()));
|
||||||
|
|||||||
@ -140,7 +140,6 @@ void Foam::vtkPV3Foam::updateInfoInternalMesh()
|
|||||||
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::updateInfoInternalMesh" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::updateInfoInternalMesh" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -440,14 +439,13 @@ void Foam::vtkPV3Foam::updateInfoLagrangianFields()
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkDataArraySelection *fieldSelection =
|
vtkDataArraySelection* fieldSelection =
|
||||||
reader_->GetLagrangianFieldSelection();
|
reader_->GetLagrangianFieldSelection();
|
||||||
|
|
||||||
// preserve the enabled selections
|
// preserve the enabled selections
|
||||||
stringList enabledEntries = getSelectedArrayEntries(fieldSelection);
|
stringList enabledEntries = getSelectedArrayEntries(fieldSelection);
|
||||||
fieldSelection->RemoveAllArrays();
|
fieldSelection->RemoveAllArrays();
|
||||||
|
|
||||||
//
|
|
||||||
// TODO - currently only get fields from ONE cloud
|
// TODO - currently only get fields from ONE cloud
|
||||||
// have to decide if the second set of fields get mixed in
|
// have to decide if the second set of fields get mixed in
|
||||||
// or dealt with separately
|
// or dealt with separately
|
||||||
|
|||||||
@ -35,7 +35,7 @@ InClass
|
|||||||
template<template<class> class patchType, class meshType>
|
template<template<class> class patchType, class meshType>
|
||||||
void Foam::vtkPV3Foam::updateInfoFields
|
void Foam::vtkPV3Foam::updateInfoFields
|
||||||
(
|
(
|
||||||
vtkDataArraySelection *select
|
vtkDataArraySelection* select
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -112,4 +112,5 @@ void Foam::vtkPV3Foam::updateInfoFields
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -69,6 +69,7 @@ namespace Foam
|
|||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::AddToBlock
|
void Foam::vtkPV3Foam::AddToBlock
|
||||||
|
|||||||
Reference in New Issue
Block a user