paraFoam: Added support to read vol internal fields

This is useful to visualise sources which are created as
volScalarField::Internal, e.g. the turbulence generation term for models like
kEpsilon in which it is named kEpsilon:G.
This commit is contained in:
Henry Weller
2019-07-15 22:26:34 +01:00
parent d1fb1944e5
commit 67d3a8dc1b
15 changed files with 477 additions and 395 deletions

View File

@ -118,7 +118,7 @@ int Foam::vtkPVFoam::setTime(int nRequest, const double requestTimes[])
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::setTime(";
InfoInFunction<< endl << " (";
for (int requestI = 0; requestI < nRequest; ++requestI)
{
if (requestI)
@ -133,13 +133,13 @@ int Foam::vtkPVFoam::setTime(int nRequest, const double requestTimes[])
}
// see what has changed
// See what has changed
if (timeIndex_ != nearestIndex)
{
timeIndex_ = nearestIndex;
runTime.setTime(Times[nearestIndex], nearestIndex);
// the fields change each time
// The fields change each time
fieldsChanged_ = true;
if (meshPtr_)
@ -157,7 +157,7 @@ int Foam::vtkPVFoam::setTime(int nRequest, const double requestTimes[])
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::setTime() - selectedTime="
Info<< " selectedTime="
<< Times[nearestIndex].name() << " index=" << timeIndex_
<< "/" << Times.size()
<< " meshChanged=" << Switch(meshChanged_)
@ -172,7 +172,7 @@ void Foam::vtkPVFoam::updateMeshPartsStatus()
{
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::updateMeshPartsStatus" << endl;
InfoInFunction << endl;
}
vtkDataArraySelection* selection = reader_->GetPartSelection();
@ -185,7 +185,7 @@ void Foam::vtkPVFoam::updateMeshPartsStatus()
meshChanged_ = true;
}
// this needs fixing if we wish to re-use the datasets
// This needs fixing if we wish to re-use the datasets
partDataset_.setSize(nElem);
partDataset_ = -1;
@ -202,15 +202,11 @@ void Foam::vtkPVFoam::updateMeshPartsStatus()
if (debug)
{
Info<< " part[" << partId << "] = "
Info<< " part[" << partId << "] = "
<< partStatus_[partId]
<< " : " << selection->GetArrayName(partId) << endl;
}
}
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::updateMeshPartsStatus" << endl;
}
}
@ -242,13 +238,13 @@ Foam::vtkPVFoam::vtkPVFoam
{
if (debug)
{
Info<< "Foam::vtkPVFoam::vtkPVFoam - " << vtkFileName << endl;
InfoInFunction << vtkFileName << endl;
printMemory();
}
fileName FileName(vtkFileName);
// avoid argList and get rootPath/caseName directly from the file
// Avoid argList and get rootPath/caseName directly from the file
fileName fullCasePath(FileName.path());
if (!isDir(fullCasePath))
@ -286,7 +282,7 @@ Foam::vtkPVFoam::vtkPVFoam
setEnv("FOAM_CASENAME", fullCasePath.name(), true);
}
// look for 'case{region}.OpenFOAM'
// Look for 'case{region}.OpenFOAM'
// could be stringent and insist the prefix match the directory name...
// Note: cannot use fileName::name() due to the embedded '{}'
string caseName(FileName.lessExt());
@ -301,7 +297,7 @@ Foam::vtkPVFoam::vtkPVFoam
{
meshRegion_ = caseName.substr(beg+1, end-beg-1);
// some safety
// Some safety
if (meshRegion_.empty())
{
meshRegion_ = polyMesh::defaultRegion;
@ -315,10 +311,10 @@ Foam::vtkPVFoam::vtkPVFoam
if (debug)
{
Info<< "fullCasePath=" << fullCasePath << nl
<< "FOAM_CASE=" << getEnv("FOAM_CASE") << nl
<< "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << nl
<< "region=" << meshRegion_ << endl;
Info<< " fullCasePath=" << fullCasePath << nl
<< " FOAM_CASE=" << getEnv("FOAM_CASE") << nl
<< " FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << nl
<< " region=" << meshRegion_ << endl;
}
// Pre-load any libraries
@ -364,7 +360,7 @@ Foam::vtkPVFoam::~vtkPVFoam()
{
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::~vtkPVFoam" << endl;
InfoInFunction << endl;
}
delete meshPtr_;
@ -377,16 +373,17 @@ void Foam::vtkPVFoam::updateInfo()
{
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::updateInfo"
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "] timeIndex="
<< timeIndex_ << endl;
InfoInFunction << endl
<< " [meshPtr="
<< (meshPtr_ ? "set" : "nullptr")
<< "] timeIndex=" << timeIndex_ << endl;
}
resetCounters();
vtkDataArraySelection* partSelection = reader_->GetPartSelection();
// there are two ways to ensure we have the correct list of parts:
// There are two ways to ensure we have the correct list of parts:
// 1. remove everything and then set particular entries 'on'
// 2. build a 'char **' list and call SetArraysWithDefault()
//
@ -394,7 +391,7 @@ void Foam::vtkPVFoam::updateInfo()
// time of the vtkDataArraySelection, but the qt/paraview proxy
// layer doesn't care about that anyhow.
// enable 'internalMesh' on the first call
// Enable 'internalMesh' on the first call
// or preserve the enabled selections
stringList enabledEntries;
bool first = !partSelection->GetNumberOfArrays() && !meshPtr_;
@ -418,7 +415,7 @@ void Foam::vtkPVFoam::updateInfo()
updateInfoZones(partSelection);
updateInfoLagrangian(partSelection);
// restore the enabled selections
// Restore the enabled selections
setSelectedArrayEntries(partSelection, enabledEntries);
if (meshChanged_)
@ -426,61 +423,15 @@ void Foam::vtkPVFoam::updateInfo()
fieldsChanged_ = true;
}
// Update volume, point and lagrangian fields
// Update fields
updateInfoFields();
updateInfoLagrangianFields();
{
// Use the db directly since this might be called without a mesh,
// but the region must get added back in
word regionPrefix;
if (meshRegion_ != polyMesh::defaultRegion)
{
regionPrefix = meshRegion_;
}
vtkDataArraySelection* select = reader_->GetFieldSelection();
stringList enabledEntries(getSelectedArrayEntries(select));
select->RemoveAllArrays();
const Time& runTime = dbPtr_();
const instantList times = runTime.times();
addToSelection<fvPatchField, volMesh>
(
select,
runTime,
times,
regionPrefix
);
addToSelection<fvsPatchField, surfaceMesh>
(
select,
runTime,
times,
regionPrefix
);
addToSelection<pointPatchField, pointMesh>
(
select,
runTime,
times,
regionPrefix
);
// Restore the enabled selections
setSelectedArrayEntries(select, enabledEntries);
}
updateInfoLagrangianFields();
if (debug)
{
// just for debug info
// For debug info
getSelectedArrayEntries(partSelection);
Info<< "<end> Foam::vtkPVFoam::updateInfo" << endl;
}
}
@ -488,7 +439,7 @@ void Foam::vtkPVFoam::updateFoamMesh()
{
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::updateFoamMesh" << endl;
InfoInFunction<< endl;
printMemory();
}
@ -503,7 +454,8 @@ void Foam::vtkPVFoam::updateFoamMesh()
{
if (debug)
{
Info<< "Creating OpenFOAM mesh for region " << meshRegion_
InfoInFunction << endl
<< " Creating OpenFOAM mesh for region " << meshRegion_
<< " at time=" << dbPtr_().timeName()
<< endl;
@ -526,13 +478,12 @@ void Foam::vtkPVFoam::updateFoamMesh()
{
if (debug)
{
Info<< "Using existing OpenFOAM mesh" << endl;
Info<< " Using existing OpenFOAM mesh" << endl;
}
}
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::updateFoamMesh" << endl;
printMemory();
}
}
@ -546,9 +497,10 @@ void Foam::vtkPVFoam::Update
{
if (debug)
{
cout<< "<beg> Foam::vtkPVFoam::Update - output with "
InfoInFunction << "Output with "
<< output->GetNumberOfBlocks() << " and "
<< lagrangianOutput->GetNumberOfBlocks() << " blocks\n";
<< lagrangianOutput->GetNumberOfBlocks() << " blocks" << endl;
output->Print(cout);
lagrangianOutput->Print(cout);
printMemory();
@ -597,7 +549,7 @@ void Foam::vtkPVFoam::Update
if (debug)
{
Info<< "done reader part" << endl;
Info<< " done reader part" << endl;
}
reader_->UpdateProgress(0.95);
@ -608,7 +560,7 @@ void Foam::vtkPVFoam::Update
void Foam::vtkPVFoam::CleanUp()
{
// reclaim some memory
// Reclaim some memory
reduceMemory();
reader_->UpdateProgress(1.0);
}
@ -626,7 +578,7 @@ double* Foam::vtkPVFoam::findTimes(int& nTimeSteps)
fileHandler().flush();
instantList timeLst = runTime.times();
// find the first time for which this mesh appears to exist
// Find the first time for which this mesh appears to exist
label timeI = 0;
for (; timeI < timeLst.size(); ++timeI)
{
@ -649,7 +601,7 @@ double* Foam::vtkPVFoam::findTimes(int& nTimeSteps)
nTimes = timeLst.size() - timeI;
// skip "constant" time whenever possible
// Skip "constant" time whenever possible
if (timeI == 0 && nTimes > 1)
{
if (timeLst[timeI].name() == runTime.constant())
@ -660,7 +612,7 @@ double* Foam::vtkPVFoam::findTimes(int& nTimeSteps)
}
// skip "0/" time if requested and possible
// Skip "0/" time if requested and possible
if (nTimes > 1 && reader_->GetSkipZeroTime())
{
if (mag(timeLst[timeI].value()) < small)
@ -687,7 +639,7 @@ double* Foam::vtkPVFoam::findTimes(int& nTimeSteps)
}
}
// vector length returned via the parameter
// Vector length returned via the parameter
nTimeSteps = nTimes;
return tsteps;
@ -705,7 +657,7 @@ void Foam::vtkPVFoam::renderPatchNames
return;
}
// always remove old actors first
// Always remove old actors first
forAll(patchTextActorsPtrs_, patchi)
{
@ -716,7 +668,7 @@ void Foam::vtkPVFoam::renderPatchNames
if (show)
{
// get the display patches, strip off any suffix
// Get the display patches, strip off any suffix
wordHashSet selectedPatches = getSelected
(
reader_->GetPartSelection(),
@ -812,8 +764,8 @@ void Foam::vtkPVFoam::renderPatchNames
if (debug)
{
Info<< "displayed zone centres = " << displayZoneI << nl
<< "zones per patch = " << nZones << endl;
Info<< " displayed zone centres = " << displayZoneI << nl
<< " zones per patch = " << nZones << endl;
}
// Set the size of the patch labels to max number of zones
@ -821,7 +773,7 @@ void Foam::vtkPVFoam::renderPatchNames
if (debug)
{
Info<< "constructing patch labels" << endl;
Info<< " constructing patch labels" << endl;
}
// Actor index
@ -845,9 +797,10 @@ void Foam::vtkPVFoam::renderPatchNames
{
if (debug)
{
Info<< "patch name = " << pp.name() << nl
<< "anchor = " << zoneCentre[patchi][globalZoneI] << nl
<< "globalZoneI = " << globalZoneI << endl;
Info<< " patch name = " << pp.name() << nl
<< " anchor = " << zoneCentre[patchi][globalZoneI]
<< nl
<< " globalZoneI = " << globalZoneI << endl;
}
vtkTextActor* txt = vtkTextActor::New();

View File

@ -383,12 +383,19 @@ class vtkPVFoam
//- Add objects of Type to paraview array selection
template<template<class> class patchType, class meshType>
void addToSelection
void addFieldsToSelection
(
vtkDataArraySelection *select,
const Time& runTime,
const instantList& times,
const word& regionPrefix,
const IOobjectList& objects,
const string& suffix=string::null
);
//- Add objects of Type to paraview array selection
template<template<class> class patchType, class meshType>
void addInternalFieldsToSelection
(
vtkDataArraySelection *select,
const IOobjectList& objects,
const string& suffix=string::null
);
@ -517,6 +524,15 @@ class vtkPVFoam
vtkMultiBlockDataSet* output
);
//- Volume internal fields - all types
template<class Type>
void convertVolInternalFields
(
const fvMesh&,
const IOobjectList&,
vtkMultiBlockDataSet* output
);
//- Volume field - all selected parts
template<class Type>
void convertVolFieldBlock
@ -528,11 +544,23 @@ class vtkPVFoam
const List<polyDecomp>& decompLst
);
//- Volume internal field - all selected parts
template<class Type>
void convertVolInternalFieldBlock
(
const typename GeometricField<Type, fvPatchField, volMesh>
::Internal&,
vtkMultiBlockDataSet* output,
const arrayRange&,
const List<polyDecomp>& decompLst
);
//- Volume field
template<class Type>
void convertVolField
void convertVolInternalField
(
const GeometricField<Type, fvPatchField, volMesh>&,
const typename GeometricField<Type, fvPatchField, volMesh>
::Internal&,
vtkMultiBlockDataSet* output,
const arrayRange&,
const label datasetNo,

View File

@ -69,52 +69,112 @@ Foam::label Foam::vtkPVFoam::addToSelection
template<template<class> class patchType, class meshType>
void Foam::vtkPVFoam::addToSelection
void Foam::vtkPVFoam::addFieldsToSelection
(
vtkDataArraySelection *select,
const Time& runTime,
const instantList& times,
const word& regionPrefix,
const IOobjectList& objects,
const string& suffix
)
{
forAll(times, timei)
{
// Search for list of objects for this time and mesh region
IOobjectList objects(runTime, times[timei].name(), regionPrefix);
addToSelection<GeometricField<scalar, patchType, meshType>>
(
select,
objects,
suffix
);
//- Add volume fields to GUI
addToSelection<GeometricField<scalar, patchType, meshType>>
(
select,
objects,
suffix
);
addToSelection<GeometricField<vector, patchType, meshType>>
(
select,
objects,
suffix
);
addToSelection<GeometricField<sphericalTensor, patchType, meshType>>
(
select,
objects,
suffix
);
addToSelection<GeometricField<symmTensor, patchType, meshType>>
(
select,
objects,
suffix
);
addToSelection<GeometricField<tensor, patchType, meshType>>
(
select,
objects,
suffix
);
}
addToSelection<GeometricField<vector, patchType, meshType>>
(
select,
objects,
suffix
);
addToSelection<GeometricField<sphericalTensor, patchType, meshType>>
(
select,
objects,
suffix
);
addToSelection<GeometricField<symmTensor, patchType, meshType>>
(
select,
objects,
suffix
);
addToSelection<GeometricField<tensor, patchType, meshType>>
(
select,
objects,
suffix
);
}
template<template<class> class patchType, class meshType>
void Foam::vtkPVFoam::addInternalFieldsToSelection
(
vtkDataArraySelection *select,
const IOobjectList& objects,
const string& suffix
)
{
addToSelection
<
typename
GeometricField<scalar, patchType, meshType>::Internal
>
(
select,
objects,
suffix
);
addToSelection
<
typename
GeometricField<vector, patchType, meshType>::Internal
>
(
select,
objects,
suffix
);
addToSelection
<
typename
GeometricField<sphericalTensor, patchType, meshType>::Internal
>
(
select,
objects,
suffix
);
addToSelection
<
typename
GeometricField<symmTensor, patchType, meshType>::Internal
>
(
select,
objects,
suffix
);
addToSelection
<
typename
GeometricField<tensor, patchType, meshType>::Internal
>
(
select,
objects,
suffix
);
}

View File

@ -82,10 +82,7 @@ Foam::IOobjectList Foam::vtkPVFoam::getObjects
}
void Foam::vtkPVFoam::convertFields
(
vtkMultiBlockDataSet* output
)
void Foam::vtkPVFoam::convertFields(vtkMultiBlockDataSet* output)
{
const fvMesh& mesh = *meshPtr_;
@ -118,8 +115,8 @@ void Foam::vtkPVFoam::convertFields
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::convertVolFields" << nl
<< "converting OpenFOAM volume fields" << endl;
InfoInFunction<< nl
<< " converting OpenFOAM volume fields" << endl;
forAllConstIter(IOobjectList, objects, iter)
{
Info<< " " << iter()->name()
@ -168,6 +165,27 @@ void Foam::vtkPVFoam::convertFields
mesh, ppInterpList, objects, interpFields, output
);
convertVolInternalFields<scalar>
(
mesh, objects, output
);
convertVolInternalFields<vector>
(
mesh, objects, output
);
convertVolInternalFields<sphericalTensor>
(
mesh, objects, output
);
convertVolInternalFields<symmTensor>
(
mesh, objects, output
);
convertVolInternalFields<tensor>
(
mesh, objects, output
);
convertSurfaceFields<scalar>(mesh, objects, output);
convertSurfaceFields<vector>(mesh, objects, output);
convertSurfaceFields<sphericalTensor>(mesh, objects, output);
@ -185,16 +203,12 @@ void Foam::vtkPVFoam::convertFields
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::convertVolFields" << endl;
printMemory();
}
}
void Foam::vtkPVFoam::convertLagrangianFields
(
vtkMultiBlockDataSet* output
)
void Foam::vtkPVFoam::convertLagrangianFields(vtkMultiBlockDataSet* output)
{
arrayRange& range = arrayRangeLagrangian_;
const fvMesh& mesh = *meshPtr_;
@ -211,7 +225,7 @@ void Foam::vtkPVFoam::convertLagrangianFields
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::convertLagrangianFields" << endl;
InfoInFunction << endl;
printMemory();
}
@ -247,7 +261,8 @@ void Foam::vtkPVFoam::convertLagrangianFields
if (debug)
{
Info<< "converting OpenFOAM lagrangian fields" << nl;
InfoInFunction
<< "converting OpenFOAM lagrangian fields" << nl << " ";
forAllConstIter(IOobjectList, objects, iter)
{
Info<< " " << iter()->name()
@ -283,7 +298,6 @@ void Foam::vtkPVFoam::convertLagrangianFields
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::convertLagrangianFields" << endl;
printMemory();
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -48,21 +48,21 @@ void Foam::vtkPVFoam::convertMeshVolume
)
{
arrayRange& range = arrayRangeVolume_;
range.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
range.block(blockNo); // Set output block
label datasetNo = 0; // Restart at dataset 0
const fvMesh& mesh = *meshPtr_;
// resize for decomposed polyhedra
// Resize for decomposed polyhedra
regionPolyDecomp_.setSize(range.size());
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::convertMeshVolume" << endl;
InfoInFunction << endl;
printMemory();
}
// Convert the internalMesh
// this looks like more than one part, but it isn't
// This looks like more than one part, but it isn't
for (int partId = range.start(); partId < range.end(); ++partId)
{
const word partName = "internalMesh";
@ -87,7 +87,7 @@ void Foam::vtkPVFoam::convertMeshVolume
}
}
// anything added?
// Anything added?
if (datasetNo)
{
++blockNo;
@ -95,7 +95,6 @@ void Foam::vtkPVFoam::convertMeshVolume
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::convertMeshVolume" << endl;
printMemory();
}
}
@ -108,13 +107,13 @@ void Foam::vtkPVFoam::convertMeshLagrangian
)
{
arrayRange& range = arrayRangeLagrangian_;
range.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
range.block(blockNo); // Set output block
label datasetNo = 0; // Restart at dataset 0
const fvMesh& mesh = *meshPtr_;
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::convertMeshLagrangian" << endl;
InfoInFunction << endl;
printMemory();
}
@ -138,7 +137,7 @@ void Foam::vtkPVFoam::convertMeshLagrangian
}
}
// anything added?
// Anything added?
if (datasetNo)
{
++blockNo;
@ -146,7 +145,6 @@ void Foam::vtkPVFoam::convertMeshLagrangian
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::convertMeshLagrangian" << endl;
printMemory();
}
}
@ -159,14 +157,14 @@ void Foam::vtkPVFoam::convertMeshPatches
)
{
arrayRange& range = arrayRangePatches_;
range.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
range.block(blockNo); // Set output block
label datasetNo = 0; // Restart at dataset 0
const fvMesh& mesh = *meshPtr_;
const polyBoundaryMesh& patches = mesh.boundaryMesh();
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::convertMeshPatches" << endl;
InfoInFunction << endl;
printMemory();
}
@ -184,7 +182,8 @@ void Foam::vtkPVFoam::convertMeshPatches
if (debug)
{
Info<< "Creating VTK mesh for patches [" << patchIds <<"] "
InfoInFunction
<< "Creating VTK mesh for patches [" << patchIds <<"] "
<< patchName << endl;
}
@ -227,7 +226,7 @@ void Foam::vtkPVFoam::convertMeshPatches
}
}
// anything added?
// Anything added?
if (datasetNo)
{
++blockNo;
@ -235,7 +234,6 @@ void Foam::vtkPVFoam::convertMeshPatches
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::convertMeshPatches" << endl;
printMemory();
}
}
@ -248,11 +246,11 @@ void Foam::vtkPVFoam::convertMeshCellZones
)
{
arrayRange& range = arrayRangeCellZones_;
range.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
range.block(blockNo); // Set output block
label datasetNo = 0; // Restart at dataset 0
const fvMesh& mesh = *meshPtr_;
// resize for decomposed polyhedra
// Resize for decomposed polyhedra
zonePolyDecomp_.setSize(range.size());
if (range.empty())
@ -262,7 +260,7 @@ void Foam::vtkPVFoam::convertMeshCellZones
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::convertMeshCellZones" << endl;
InfoInFunction << endl;
printMemory();
}
@ -279,7 +277,8 @@ void Foam::vtkPVFoam::convertMeshCellZones
if (debug)
{
Info<< "Creating VTK mesh for cellZone[" << zoneId << "] "
InfoInFunction
<< "Creating VTK mesh for cellZone[" << zoneId << "] "
<< zoneName << endl;
}
@ -306,7 +305,7 @@ void Foam::vtkPVFoam::convertMeshCellZones
zonePolyDecomp_[datasetNo].addPointCellLabels()
);
// copy pointMap as well, otherwise pointFields fail
// Copy pointMap as well, otherwise pointFields fail
zonePolyDecomp_[datasetNo].pointMap() = subsetter.pointMap();
AddToBlock(output, vtkmesh, range, datasetNo, zoneName);
@ -316,7 +315,7 @@ void Foam::vtkPVFoam::convertMeshCellZones
}
}
// anything added?
// Anything added?
if (datasetNo)
{
++blockNo;
@ -324,7 +323,6 @@ void Foam::vtkPVFoam::convertMeshCellZones
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::convertMeshCellZones" << endl;
printMemory();
}
}
@ -337,16 +335,16 @@ void Foam::vtkPVFoam::convertMeshCellSets
)
{
arrayRange& range = arrayRangeCellSets_;
range.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
range.block(blockNo); // Set output block
label datasetNo = 0; // Restart at dataset 0
const fvMesh& mesh = *meshPtr_;
// resize for decomposed polyhedra
// Resize for decomposed polyhedra
csetPolyDecomp_.setSize(range.size());
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::convertMeshCellSets" << endl;
InfoInFunction << endl;
printMemory();
}
@ -361,7 +359,8 @@ void Foam::vtkPVFoam::convertMeshCellSets
if (debug)
{
Info<< "Creating VTK mesh for cellSet=" << partName << endl;
InfoInFunction
<< "Creating VTK mesh for cellSet=" << partName << endl;
}
const cellSet cSet(mesh, partName);
@ -388,7 +387,7 @@ void Foam::vtkPVFoam::convertMeshCellSets
csetPolyDecomp_[datasetNo].addPointCellLabels()
);
// copy pointMap as well, otherwise pointFields fail
// Copy pointMap as well, otherwise pointFields fail
csetPolyDecomp_[datasetNo].pointMap() = subsetter.pointMap();
AddToBlock(output, vtkmesh, range, datasetNo, partName);
@ -398,7 +397,7 @@ void Foam::vtkPVFoam::convertMeshCellSets
}
}
// anything added?
// Anything added?
if (datasetNo)
{
++blockNo;
@ -406,7 +405,6 @@ void Foam::vtkPVFoam::convertMeshCellSets
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::convertMeshCellSets" << endl;
printMemory();
}
}
@ -419,8 +417,8 @@ void Foam::vtkPVFoam::convertMeshFaceZones
)
{
arrayRange& range = arrayRangeFaceZones_;
range.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
range.block(blockNo); // Set output block
label datasetNo = 0; // Restart at dataset 0
const fvMesh& mesh = *meshPtr_;
if (range.empty())
@ -430,7 +428,7 @@ void Foam::vtkPVFoam::convertMeshFaceZones
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::convertMeshFaceZones" << endl;
InfoInFunction << endl;
printMemory();
}
@ -447,7 +445,8 @@ void Foam::vtkPVFoam::convertMeshFaceZones
if (debug)
{
Info<< "Creating VTKmesh for faceZone[" << zoneId << "] "
InfoInFunction
<< "Creating VTKmesh for faceZone[" << zoneId << "] "
<< zoneName << endl;
}
@ -462,7 +461,7 @@ void Foam::vtkPVFoam::convertMeshFaceZones
}
}
// anything added?
// Anything added?
if (datasetNo)
{
++blockNo;
@ -470,7 +469,6 @@ void Foam::vtkPVFoam::convertMeshFaceZones
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::convertMeshFaceZones" << endl;
printMemory();
}
}
@ -483,13 +481,13 @@ void Foam::vtkPVFoam::convertMeshFaceSets
)
{
arrayRange& range = arrayRangeFaceSets_;
range.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
range.block(blockNo); // Set output block
label datasetNo = 0; // Restart at dataset 0
const fvMesh& mesh = *meshPtr_;
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::convertMeshFaceSets" << endl;
InfoInFunction << endl;
printMemory();
}
@ -504,7 +502,8 @@ void Foam::vtkPVFoam::convertMeshFaceSets
if (debug)
{
Info<< "Creating VTK mesh for faceSet=" << partName << endl;
InfoInFunction
<< "Creating VTK mesh for faceSet=" << partName << endl;
}
const faceSet fSet(mesh, partName);
@ -519,7 +518,7 @@ void Foam::vtkPVFoam::convertMeshFaceSets
}
}
// anything added?
// Anything added?
if (datasetNo)
{
++blockNo;
@ -527,7 +526,6 @@ void Foam::vtkPVFoam::convertMeshFaceSets
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::convertMeshFaceSets" << endl;
printMemory();
}
}
@ -540,13 +538,13 @@ void Foam::vtkPVFoam::convertMeshPointZones
)
{
arrayRange& range = arrayRangePointZones_;
range.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
range.block(blockNo); // Set output block
label datasetNo = 0; // Restart at dataset 0
const fvMesh& mesh = *meshPtr_;
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::convertMeshPointZones" << endl;
InfoInFunction << endl;
printMemory();
}
@ -574,7 +572,7 @@ void Foam::vtkPVFoam::convertMeshPointZones
}
}
// anything added?
// Anything added?
if (datasetNo)
{
++blockNo;
@ -582,7 +580,6 @@ void Foam::vtkPVFoam::convertMeshPointZones
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::convertMeshPointZones" << endl;
printMemory();
}
}
@ -596,13 +593,13 @@ void Foam::vtkPVFoam::convertMeshPointSets
)
{
arrayRange& range = arrayRangePointSets_;
range.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
range.block(blockNo); // Set output block
label datasetNo = 0; // Restart at dataset 0
const fvMesh& mesh = *meshPtr_;
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::convertMeshPointSets" << endl;
InfoInFunction << endl;
printMemory();
}
@ -617,7 +614,8 @@ void Foam::vtkPVFoam::convertMeshPointSets
if (debug)
{
Info<< "Creating VTK mesh for pointSet=" << partName << endl;
InfoInFunction
<< "Creating VTK mesh for pointSet=" << partName << endl;
}
const pointSet pSet(mesh, partName);
@ -632,7 +630,7 @@ void Foam::vtkPVFoam::convertMeshPointSets
}
}
// anything added?
// Anything added?
if (datasetNo)
{
++blockNo;
@ -640,7 +638,6 @@ void Foam::vtkPVFoam::convertMeshPointSets
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::convertMeshPointSets" << endl;
printMemory();
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -49,13 +49,13 @@ vtkPolyData* Foam::vtkPVFoam::lagrangianVTKMesh
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::lagrangianVTKMesh - timePath "
InfoInFunction<< "timePath "
<< mesh.time().timePath()/cloud::prefix/cloudName << endl;
printMemory();
}
// the region name is already in the mesh db
// The region name is already in the mesh db
IOobjectList sprayObjs
(
mesh,
@ -70,7 +70,8 @@ vtkPolyData* Foam::vtkPVFoam::lagrangianVTKMesh
if (debug)
{
Info<< "cloud with " << parcels.size() << " parcels" << endl;
Info<< " cloud with " << parcels.size()
<< " parcels" << endl;
}
vtkmesh = vtkPolyData::New();
@ -98,7 +99,6 @@ vtkPolyData* Foam::vtkPVFoam::lagrangianVTKMesh
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::lagrangianVTKMesh" << endl;
printMemory();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -47,7 +47,7 @@ vtkPolyData* Foam::vtkPVFoam::faceSetVTKMesh
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::faceSetVTKMesh" << endl;
InfoInFunction << endl;
printMemory();
}
@ -100,7 +100,6 @@ vtkPolyData* Foam::vtkPVFoam::faceSetVTKMesh
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::faceSetVTKMesh" << endl;
printMemory();
}
@ -118,7 +117,7 @@ vtkPolyData* Foam::vtkPVFoam::pointSetVTKMesh
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::pointSetVTKMesh" << endl;
InfoInFunction << endl;
printMemory();
}
@ -137,7 +136,6 @@ vtkPolyData* Foam::vtkPVFoam::pointSetVTKMesh
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::pointSetVTKMesh" << endl;
printMemory();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -56,7 +56,7 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::volumeVTKMesh" << endl;
InfoInFunction << endl;
printMemory();
}
@ -80,7 +80,8 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
{
if (debug)
{
Info<< "... scanning for polyhedra" << endl;
InfoInFunction
<< "... scanning for polyhedra" << endl;
}
forAll(cellShapes, celli)
@ -125,17 +126,17 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
if (debug)
{
Info<<" mesh nCells = " << mesh.nCells() << nl
<<" nPoints = " << mesh.nPoints() << nl
<<" nAddCells = " << nAddCells << nl
<<" nAddPoints = " << nAddPoints << endl;
Info<< " mesh nCells = " << mesh.nCells() << nl
<< " nPoints = " << mesh.nPoints() << nl
<< " nAddCells = " << nAddCells << nl
<< " nAddPoints = " << nAddPoints << endl;
}
superCells.setSize(mesh.nCells() + nAddCells);
if (debug)
{
Info<< "... converting points" << endl;
Info<< " ... converting points" << endl;
}
// Convert OpenFOAM mesh vertices to VTK
@ -152,7 +153,7 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
if (debug)
{
Info<< "... converting cells" << endl;
Info<< " ... converting cells" << endl;
}
vtkmesh->Allocate(mesh.nCells() + nAddCells);
@ -310,7 +311,7 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
}
else
{
// fairly immaterial if we reverse the list
// Fairly immaterial if we reverse the list
// or use face::reverseFace()
forAllReverse(f, fp)
{
@ -321,10 +322,10 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
vtkmesh->InsertNextCell(VTK_POLYHEDRON, nFaces, faceStream.data());
#else
// this is a horrible substitute
// This is a horrible substitute
// but avoids crashes when there is no vtkPolyhedron support
// establish unique node ids used
// Establish unique node ids used
HashSet<vtkIdType, Hash<label>> hashUniqId(2*256);
forAll(cFaces, cFacei)
@ -337,7 +338,7 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
}
}
// use face stream to store unique node ids:
// Use face stream to store unique node ids:
faceStream = hashUniqId.sortedToc();
vtkmesh->InsertNextCell
@ -469,7 +470,6 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::volumeVTKMesh" << endl;
printMemory();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,7 +45,7 @@ vtkPolyData* Foam::vtkPVFoam::pointZoneVTKMesh
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::pointZoneVTKMesh" << endl;
InfoInFunction << endl;
printMemory();
}
@ -64,7 +64,7 @@ vtkPolyData* Foam::vtkPVFoam::pointZoneVTKMesh
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::pointZoneVTKMesh" << endl;
InfoInFunction << endl;
printMemory();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -48,7 +48,7 @@ vtkPolyData* Foam::vtkPVFoam::patchVTKMesh
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::patchVTKMesh - " << name << endl;
InfoInFunction << " - " << name << endl;
printMemory();
}
@ -88,7 +88,6 @@ vtkPolyData* Foam::vtkPVFoam::patchVTKMesh
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::patchVTKMesh - " << name << endl;
printMemory();
}

View File

@ -107,7 +107,7 @@ Foam::wordList Foam::vtkPVFoam::getZoneNames(const word& zoneType) const
{
wordList names;
// mesh not loaded - read from file
// Mesh not loaded - read from file
IOobject ioObj
(
zoneType,
@ -146,7 +146,7 @@ void Foam::vtkPVFoam::updateInfoInternalMesh
{
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::updateInfoInternalMesh" << endl;
InfoInFunction << endl;
}
// Determine mesh parts (internalMesh, patches...)
@ -160,10 +160,8 @@ void Foam::vtkPVFoam::updateInfoInternalMesh
if (debug)
{
// just for debug info
// Just for debug info
getSelectedArrayEntries(arraySelection);
Info<< "<end> Foam::vtkPVFoam::updateInfoInternalMesh" << endl;
}
}
@ -175,12 +173,12 @@ void Foam::vtkPVFoam::updateInfoLagrangian
{
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::updateInfoLagrangian" << nl
InfoInFunction << nl
<< " " << dbPtr_->timePath()/cloud::prefix << endl;
}
// use the db directly since this might be called without a mesh,
// Use the db directly since this might be called without a mesh,
// but the region must get added back in
fileName lagrangianPrefix(cloud::prefix);
if (meshRegion_ != polyMesh::defaultRegion)
@ -218,10 +216,8 @@ void Foam::vtkPVFoam::updateInfoLagrangian
if (debug)
{
// just for debug info
// Just for debug info
getSelectedArrayEntries(arraySelection);
Info<< "<end> Foam::vtkPVFoam::updateInfoLagrangian" << endl;
}
}
@ -235,7 +231,7 @@ void Foam::vtkPVFoam::updateInfoPatches
{
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::updateInfoPatches"
InfoInFunction
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
}
@ -323,7 +319,7 @@ void Foam::vtkPVFoam::updateInfoPatches
}
else
{
// mesh not loaded - read from file
// Mesh not loaded - read from file
// but this could fail if we've supplied a bad region name
IOobject ioObj
(
@ -341,7 +337,7 @@ void Foam::vtkPVFoam::updateInfoPatches
false
);
// this should only ever fail if the mesh region doesn't exist
// This should only ever fail if the mesh region doesn't exist
if (ioObj.typeHeaderOk<polyBoundaryMesh>(true))
{
polyBoundaryMeshEntries patchEntries(ioObj);
@ -496,10 +492,8 @@ void Foam::vtkPVFoam::updateInfoPatches
if (debug)
{
// just for debug info
// Just for debug info
getSelectedArrayEntries(arraySelection);
Info<< "<end> Foam::vtkPVFoam::updateInfoPatches" << endl;
}
}
@ -516,7 +510,7 @@ void Foam::vtkPVFoam::updateInfoZones
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::updateInfoZones"
InfoInFunction
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
}
@ -586,10 +580,8 @@ void Foam::vtkPVFoam::updateInfoZones
if (debug)
{
// just for debug info
// Just for debug info
getSelectedArrayEntries(arraySelection);
Info<< "<end> Foam::vtkPVFoam::updateInfoZones" << endl;
}
}
@ -606,7 +598,7 @@ void Foam::vtkPVFoam::updateInfoSets
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::updateInfoSets" << endl;
InfoInFunction << endl;
}
// Add names of sets. Search for last time directory with a sets
@ -662,10 +654,8 @@ void Foam::vtkPVFoam::updateInfoSets
if (debug)
{
// just for debug info
// Just for debug info
getSelectedArrayEntries(arraySelection);
Info<< "<end> Foam::vtkPVFoam::updateInfoSets" << endl;
}
}
@ -674,8 +664,8 @@ void Foam::vtkPVFoam::updateInfoFields()
{
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::updateInfoFields "
" [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]"
InfoInFunction
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]"
<< endl;
}
@ -737,35 +727,38 @@ void Foam::vtkPVFoam::updateInfoFields()
fieldSelection->RemoveAllArrays();
addToSelection<fvPatchField, volMesh>
(
fieldSelection,
runTime,
times,
regionPrefix
);
addToSelection<fvsPatchField, surfaceMesh>
(
fieldSelection,
runTime,
times,
regionPrefix
);
addToSelection<pointPatchField, pointMesh>
(
fieldSelection,
runTime,
times,
regionPrefix
);
forAll(times, timei)
{
// Search for list of objects for this time and mesh region
IOobjectList objects(runTime, times[timei].name(), regionPrefix);
addFieldsToSelection<fvPatchField, volMesh>
(
fieldSelection,
objects
);
addInternalFieldsToSelection<fvPatchField, volMesh>
(
fieldSelection,
objects
);
addFieldsToSelection<fvsPatchField, surfaceMesh>
(
fieldSelection,
objects
);
addFieldsToSelection<pointPatchField, pointMesh>
(
fieldSelection,
objects
);
}
// Restore the enabled selections
setSelectedArrayEntries(fieldSelection, enabledEntries);
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::updateInfoFields" << endl;
}
}
@ -773,18 +766,17 @@ void Foam::vtkPVFoam::updateInfoLagrangianFields()
{
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::updateInfoLagrangianFields"
<< endl;
InfoInFunction << endl;
}
vtkDataArraySelection* fieldSelection =
reader_->GetLagrangianFieldSelection();
// preserve the enabled selections
// Preserve the enabled selections
stringList enabledEntries = getSelectedArrayEntries(fieldSelection);
fieldSelection->RemoveAllArrays();
// use the db directly since this might be called without a mesh,
// Use the db directly since this might be called without a mesh,
// but the region must get added back in
fileName lagrangianPrefix(cloud::prefix);
if (meshRegion_ != polyMesh::defaultRegion)
@ -820,13 +812,8 @@ void Foam::vtkPVFoam::updateInfoLagrangianFields()
}
}
// restore the enabled selections
// Restore the enabled selections
setSelectedArrayEntries(fieldSelection, enabledEntries);
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::updateInfoLagrangianFields" << endl;
}
}

View File

@ -37,7 +37,6 @@ InClass
#include "vtkPVFoamSurfaceField.H"
#include "vtkPVFoamPatchField.H"
#include "vtkOpenFOAMTupleRemap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,7 +55,7 @@ void Foam::vtkPVFoam::convertVolFields
forAllConstIter(IOobjectList, objects, iter)
{
// restrict to GeometricField<Type, ...>
// Restrict to GeometricField<Type, ...>
if
(
iter()->headerClassName()
@ -79,8 +78,7 @@ void Foam::vtkPVFoam::convertVolFields
{
if (debug)
{
Info<< "convertVolFieldBlock interpolating:" << tf.name()
<< endl;
InfoInFunction<< "interpolating:" << tf.name() << endl;
}
ptfPtr.reset
@ -270,6 +268,63 @@ void Foam::vtkPVFoam::convertVolFields
}
template<class Type>
void Foam::vtkPVFoam::convertVolInternalFields
(
const fvMesh& mesh,
const IOobjectList& objects,
vtkMultiBlockDataSet* output
)
{
forAllConstIter(IOobjectList, objects, iter)
{
// Restrict to GeometricField<Type, ...>::Internal
if
(
iter()->headerClassName()
!= GeometricField<Type, fvPatchField, volMesh>::Internal::typeName
)
{
continue;
}
// Load field
typename GeometricField<Type, fvPatchField, volMesh>::Internal tf
(
*iter(),
mesh
);
// Convert activated internalMesh regions
convertVolInternalFieldBlock<Type>
(
tf,
output,
arrayRangeVolume_,
regionPolyDecomp_
);
// Convert activated cellZones
convertVolInternalFieldBlock<Type>
(
tf,
output,
arrayRangeCellZones_,
zonePolyDecomp_
);
// Convert activated cellSets
convertVolInternalFieldBlock<Type>
(
tf,
output,
arrayRangeCellSets_,
csetPolyDecomp_
);
}
}
template<class Type>
void Foam::vtkPVFoam::convertVolFieldBlock
(
@ -286,7 +341,7 @@ void Foam::vtkPVFoam::convertVolFieldBlock
if (datasetNo >= 0 && partStatus_[partId])
{
convertVolField
convertVolInternalField<Type>
(
tf,
output,
@ -313,9 +368,37 @@ void Foam::vtkPVFoam::convertVolFieldBlock
template<class Type>
void Foam::vtkPVFoam::convertVolField
void Foam::vtkPVFoam::convertVolInternalFieldBlock
(
const GeometricField<Type, fvPatchField, volMesh>& tf,
const typename GeometricField<Type, fvPatchField, volMesh>::Internal& tf,
vtkMultiBlockDataSet* output,
const arrayRange& range,
const List<polyDecomp>& decompLst
)
{
for (int partId = range.start(); partId < range.end(); ++partId)
{
const label datasetNo = partDataset_[partId];
if (datasetNo >= 0 && partStatus_[partId])
{
convertVolInternalField<Type>
(
tf,
output,
range,
datasetNo,
decompLst[datasetNo]
);
}
}
}
template<class Type>
void Foam::vtkPVFoam::convertVolInternalField
(
const typename GeometricField<Type, fvPatchField, volMesh>::Internal& tf,
vtkMultiBlockDataSet* output,
const arrayRange& range,
const label datasetNo,
@ -333,8 +416,8 @@ void Foam::vtkPVFoam::convertVolField
if (debug)
{
Info<< "convert volField: "
<< tf.name()
InfoInFunction
<< "converting volField::Internal: " << tf.name()
<< " size = " << tf.size()
<< " nComp=" << nComp
<< " nTuples = " << superCells.size() << endl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -65,7 +65,7 @@ void Foam::vtkPVblockMesh::updateInfoBlocks
{
if (debug)
{
Info<< "<beg> Foam::vtkPVblockMesh::updateInfoBlocks"
InfoInFunction << nl
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
}
@ -98,10 +98,8 @@ void Foam::vtkPVblockMesh::updateInfoBlocks
if (debug)
{
// just for debug info
// Just for debug info
getSelectedArrayEntries(arraySelection);
Info<< "<end> Foam::vtkPVblockMesh::updateInfoBlocks" << endl;
}
}
@ -113,7 +111,7 @@ void Foam::vtkPVblockMesh::updateInfoEdges
{
if (debug)
{
Info<< "<beg> Foam::vtkPVblockMesh::updateInfoEdges"
InfoInFunction
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
}
@ -139,10 +137,8 @@ void Foam::vtkPVblockMesh::updateInfoEdges
if (debug)
{
// just for debug info
// Just for debug info
getSelectedArrayEntries(arraySelection);
Info<< "<end> Foam::vtkPVblockMesh::updateInfoEdges" << endl;
}
}
@ -166,11 +162,10 @@ Foam::vtkPVblockMesh::vtkPVblockMesh
{
if (debug)
{
Info<< "Foam::vtkPVblockMesh::vtkPVblockMesh - "
<< FileName << endl;
InfoInFunction<< " - " << FileName << endl;
}
// avoid argList and get rootPath/caseName directly from the file
// Avoid argList and get rootPath/caseName directly from the file
fileName fullCasePath(fileName(FileName).path());
if (!isDir(fullCasePath))
@ -196,7 +191,7 @@ Foam::vtkPVblockMesh::vtkPVblockMesh
setEnv("FOAM_CASENAME", fullCasePath.name(), true);
}
// look for 'case{region}.OpenFOAM'
// Look for 'case{region}.OpenFOAM'
// could be stringent and insist the prefix match the directory name...
// Note: cannot use fileName::name() due to the embedded '{}'
string caseName(fileName(FileName).lessExt());
@ -211,7 +206,7 @@ Foam::vtkPVblockMesh::vtkPVblockMesh
{
meshRegion_ = caseName.substr(beg+1, end-beg-1);
// some safety
// Some safety
if (meshRegion_.empty())
{
meshRegion_ = polyMesh::defaultRegion;
@ -225,9 +220,9 @@ Foam::vtkPVblockMesh::vtkPVblockMesh
if (debug)
{
Info<< "fullCasePath=" << fullCasePath << nl
<< "FOAM_CASE=" << getEnv("FOAM_CASE") << nl
<< "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << endl;
Info<< " fullCasePath=" << fullCasePath << nl
<< " FOAM_CASE=" << getEnv("FOAM_CASE") << nl
<< " FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << endl;
}
// Create time object
@ -253,7 +248,7 @@ Foam::vtkPVblockMesh::~vtkPVblockMesh()
{
if (debug)
{
Info<< "<end> Foam::vtkPVblockMesh::~vtkPVblockMesh" << endl;
InfoInFunction << endl;
}
// Hmm. pointNumberTextActors are not getting removed
@ -274,7 +269,7 @@ void Foam::vtkPVblockMesh::updateInfo()
{
if (debug)
{
Info<< "<beg> Foam::vtkPVblockMesh::updateInfo"
InfoInFunction
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "] " << endl;
}
@ -283,7 +278,7 @@ void Foam::vtkPVblockMesh::updateInfo()
vtkDataArraySelection* blockSelection = reader_->GetBlockSelection();
vtkDataArraySelection* edgeSelection = reader_->GetCurvedEdgesSelection();
// enable 'internalMesh' on the first call
// Enable 'internalMesh' on the first call
// or preserve the enabled selections
stringList enabledParts;
stringList enabledEdges;
@ -302,7 +297,7 @@ void Foam::vtkPVblockMesh::updateInfo()
blockSelection->RemoveAllArrays();
edgeSelection->RemoveAllArrays();
// need a blockMesh
// Need a blockMesh
updateFoamMesh();
// Update mesh parts list
@ -311,17 +306,12 @@ void Foam::vtkPVblockMesh::updateInfo()
// Update curved edges list
updateInfoEdges( edgeSelection );
// restore the enabled selections
// Restore the enabled selections
if (!firstTime)
{
setSelectedArrayEntries(blockSelection, enabledParts);
setSelectedArrayEntries(edgeSelection, enabledEdges);
}
if (debug)
{
Info<< "<end> Foam::vtkPVblockMesh::updateInfo" << endl;
}
}
@ -329,7 +319,7 @@ void Foam::vtkPVblockMesh::updateFoamMesh()
{
if (debug)
{
Info<< "<beg> Foam::vtkPVblockMesh::updateFoamMesh" << endl;
InfoInFunction << endl;
}
// Check to see if the OpenFOAM mesh has been created
@ -337,8 +327,8 @@ void Foam::vtkPVblockMesh::updateFoamMesh()
{
if (debug)
{
Info<< "Creating blockMesh at time=" << dbPtr_().timeName()
<< endl;
InfoInFunction
<< "Creating blockMesh at time=" << dbPtr_().timeName() << endl;
}
// Set path for the blockMeshDict
@ -375,12 +365,6 @@ void Foam::vtkPVblockMesh::updateFoamMesh()
meshPtr_ = new blockMesh(*meshDictPtr, meshRegion_);
}
if (debug)
{
Info<< "<end> Foam::vtkPVblockMesh::updateFoamMesh" << endl;
}
}
@ -427,7 +411,7 @@ void Foam::vtkPVblockMesh::renderPointNumbers
const bool show
)
{
// always remove old actors first
// Always remove old actors first
forAll(pointNumberTextActorsPtrs_, pointi)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -51,15 +51,15 @@ void Foam::vtkPVblockMesh::convertMeshBlocks
{
vtkDataArraySelection* selection = reader_->GetBlockSelection();
arrayRange& range = arrayRangeBlocks_;
range.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
range.block(blockNo); // Set output block
label datasetNo = 0; // Restart at dataset 0
const blockMesh& blkMesh = *meshPtr_;
const Foam::pointField& blockPoints = blkMesh.vertices();
if (debug)
{
Info<< "<beg> Foam::vtkPVblockMesh::convertMeshBlocks" << endl;
InfoInFunction << endl;
}
int blockI = 0;
@ -122,16 +122,11 @@ void Foam::vtkPVblockMesh::convertMeshBlocks
}
// anything added?
// Anything added?
if (datasetNo)
{
++blockNo;
}
if (debug)
{
Info<< "<end> Foam::vtkPVblockMesh::convertMeshBlocks" << endl;
}
}
@ -144,8 +139,8 @@ void Foam::vtkPVblockMesh::convertMeshEdges
vtkDataArraySelection* selection = reader_->GetCurvedEdgesSelection();
arrayRange& range = arrayRangeEdges_;
range.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
range.block(blockNo); // Set output block
label datasetNo = 0; // Restart at dataset 0
const blockMesh& blkMesh = *meshPtr_;
const blockEdgeList& edges = blkMesh.edges();
@ -165,7 +160,7 @@ void Foam::vtkPVblockMesh::convertMeshEdges
continue;
}
// search each block
// Search each block
forAll(blkMesh, blockI)
{
const blockDescriptor& blockDef = blkMesh[blockI];
@ -177,7 +172,7 @@ void Foam::vtkPVblockMesh::convertMeshEdges
scalarList edgesWeights[12];
blockDef.edgesPointsWeights(edgesPoints, edgesWeights);
// find the corresponding edge within the block
// Find the corresponding edge within the block
label foundEdgeI = -1;
forAll(blkEdges, blkEdgeI)
{
@ -235,17 +230,11 @@ void Foam::vtkPVblockMesh::convertMeshEdges
}
// anything added?
// Anything added?
if (datasetNo)
{
++blockNo;
}
if (debug)
{
Info<< "<end> Foam::vtkPVblockMesh::convertMeshEdges" << endl;
}
}
@ -256,18 +245,18 @@ void Foam::vtkPVblockMesh::convertMeshCorners
)
{
arrayRange& range = arrayRangeCorners_;
range.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
range.block(blockNo); // Set output block
label datasetNo = 0; // Restart at dataset 0
const pointField& blockPoints = meshPtr_->vertices();
const scalar& scaleFactor = meshPtr_->scaleFactor();
if (debug)
{
Info<< "<beg> Foam::vtkPVblockMesh::convertMeshCorners" << endl;
InfoInFunction << endl;
}
if (true) // or some flag or other condition
if (true) // Or some flag or other condition
{
vtkPolyData* vtkmesh = vtkPolyData::New();
vtkPoints* vtkpoints = vtkPoints::New();
@ -306,16 +295,11 @@ void Foam::vtkPVblockMesh::convertMeshCorners
datasetNo++;
}
// anything added?
// Anything added?
if (datasetNo)
{
++blockNo;
}
if (debug)
{
Info<< "<end> Foam::vtkPVblockMesh::convertMeshCorners" << endl;
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -97,7 +97,8 @@ void Foam::vtkPVblockMesh::AddToBlock
if (debug)
{
Info<< "block[" << blockNo << "] has "
InfoInFunction
<< "block[" << blockNo << "] has "
<< block->GetNumberOfBlocks()
<< " datasets prior to adding set " << datasetNo
<< " with name: " << datasetName << endl;
@ -228,7 +229,8 @@ Foam::stringList Foam::vtkPVblockMesh::getSelectedArrayEntries
if (debug)
{
label nElem = select->GetNumberOfArrays();
Info<< "available(";
InfoInFunction
<< "available(";
for (int elemI = 0; elemI < nElem; ++elemI)
{
Info<< " \"" << select->GetArrayName(elemI) << "\"";
@ -267,7 +269,8 @@ Foam::stringList Foam::vtkPVblockMesh::getSelectedArrayEntries
if (debug)
{
Info<< "available(";
InfoInFunction
<< "available(";
for (int elemI = range.start(); elemI < range.end(); ++elemI)
{
Info<< " \"" << select->GetArrayName(elemI) << "\"";
@ -319,7 +322,7 @@ void Foam::vtkPVblockMesh::updateBoolListStatus
{
if (debug)
{
Info<< "<beg> Foam::vtkPVblockMesh::updateBoolListStatus" << endl;
InfoInFunction << endl;
}
const label nElem = selection->GetNumberOfArrays();
@ -337,20 +340,12 @@ void Foam::vtkPVblockMesh::updateBoolListStatus
if (debug)
{
Info<< " part[" << elemI << "] = "
Info<< " part[" << elemI << "] = "
<< status[elemI]
<< " : " << selection->GetArrayName(elemI) << endl;
}
}
if (debug)
{
Info<< "<end> Foam::vtkPVblockMesh::updateBoolListStatus" << endl;
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// ************************************************************************* //