From fc6780cd23606579f54daf829d2f6ed6d9998040 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 24 Jul 2008 08:28:32 +0200 Subject: [PATCH 01/16] restored and updated (doxygen) usage for blockMesh --- .../mesh/generation/blockMesh/blockMeshApp.C | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C index e337b0d167..57e006d3df 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C @@ -22,9 +22,29 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +Application + blockMesh + Description A multi-block mesh generator. + Uses the block mesh description found in + @a constant/polyMesh/blockMeshDict + (or @a constant/\/polyMesh/blockMeshDict). + +Usage + + - blockMesh [OPTION] + + @param -blockTopology \n + Write the topology as a set of edges in OBJ format. + + @param -region \ \n + Specify an alternative mesh region. + + @param -dict \ \n + Specify an alternative dictionary for the block mesh description. + \*---------------------------------------------------------------------------*/ #include "Time.H" @@ -74,9 +94,6 @@ int main(int argc, char *argv[]) polyMeshDir = polyMesh::meshSubDir; } - - Info<< nl << "Reading block mesh description dictionary" << endl; - word dictName("blockMeshDict"); fileName dictPath(runTime.constant()/polyMeshDir); @@ -88,6 +105,8 @@ int main(int argc, char *argv[]) dictPath = userDict.path(); } + Info<< nl << "Reading block mesh description dictionary" << endl; + IOobject meshDescriptionIOobject ( dictName, @@ -108,7 +127,6 @@ int main(int argc, char *argv[]) IOdictionary meshDescription(meshDescriptionIOobject); - Info<< nl << "Creating block mesh" << endl; blockMesh blocks(meshDescription); From af5674aca54aabdbea648e336f2bdc78e4b9dad0 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 24 Jul 2008 15:58:59 +0200 Subject: [PATCH 02/16] PV3FoamReader - remove old time-selection arrays --- .../graphics/PV3FoamReader/Allwclean | 4 +- .../PV3FoamReader/PV3FoamReader_SM.xml | 65 ++---- .../PV3FoamReader/vtkPV3FoamReader.cxx | 194 ++++-------------- .../PV3FoamReader/vtkPV3FoamReader.h | 46 ++--- .../PV3FoamReader/vtkPV3Foam/Make/options | 1 - .../PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C | 124 ++--------- .../PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H | 3 - .../vtkPV3Foam/vtkPV3FoamUpdate.C | 9 +- 8 files changed, 100 insertions(+), 346 deletions(-) diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/Allwclean b/applications/utilities/postProcessing/graphics/PV3FoamReader/Allwclean index 0993c14cee..206ee02089 100755 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/Allwclean +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/Allwclean @@ -1,7 +1,5 @@ #!/bin/sh set -x -rm -r PV3FoamReader/Make - +rm -rf PV3FoamReader/Make wclean libso vtkPV3Foam - diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml index c097562a53..07620fd849 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml @@ -31,26 +31,6 @@ - - - - - - - - - - - - + + + -PV3FOAM_TIMESELECTION ---> + + + + diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx index 3e576a77db..b44d919d6f 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx @@ -21,32 +21,19 @@ // VTK includes #include "vtkCallbackCommand.h" -#include "vtkCellArray.h" -#include "vtkCellData.h" #include "vtkDataArraySelection.h" -#include "vtkDirectory.h" -#include "vtkDoubleArray.h" -#include "vtkErrorCode.h" -#include "vtkFloatArray.h" #include "vtkInformation.h" #include "vtkInformationVector.h" -#include "vtkIntArray.h" #include "vtkMultiBlockDataSet.h" #include "vtkObjectFactory.h" -#include "vtkPoints.h" -#include "vtkRenderer.h" #include "vtkSMRenderViewProxy.h" #include "vtkStreamingDemandDrivenPipeline.h" #include "vtkStringArray.h" -#include "vtkUnstructuredGrid.h" -#include "vtkUnstructuredGridAlgorithm.h" -#include "vtkAlgorithmOutput.h" -#include "vtkMultiBlockDataSet.h" // Foam includes #include "vtkPV3Foam.H" -vtkCxxRevisionMacro(vtkPV3FoamReader, "$Revision: 1.2$"); +vtkCxxRevisionMacro(vtkPV3FoamReader, "$Revision: 1.5$"); vtkStandardNewMacro(vtkPV3FoamReader); @@ -60,17 +47,21 @@ vtkPV3FoamReader::vtkPV3FoamReader() FileName = NULL; foamData_ = NULL; - CacheMesh = 0; - - UpdateGUI = 1; - UpdateGUIOld = 1; TimeStep = 0; TimeStepRange[0] = 0; TimeStepRange[1] = 0; + CacheMesh = 0; + + ExtrapolateWalls = 0; + IncludeSets = 0; + IncludeZones = 0; ShowPatchNames = 0; - TimeSelection = vtkDataArraySelection::New(); + UpdateGUI = 1; + UpdateGUIOld = 1; + + RegionSelection = vtkDataArraySelection::New(); VolFieldSelection = vtkDataArraySelection::New(); PointFieldSelection = vtkDataArraySelection::New(); @@ -85,11 +76,6 @@ vtkPV3FoamReader::vtkPV3FoamReader() ); SelectionObserver->SetClientData(this); - TimeSelection->AddObserver - ( - vtkCommand::ModifiedEvent, - this->SelectionObserver - ); RegionSelection->AddObserver ( vtkCommand::ModifiedEvent, @@ -112,6 +98,7 @@ vtkPV3FoamReader::vtkPV3FoamReader() ); } + vtkPV3FoamReader::~vtkPV3FoamReader() { vtkDebugMacro(<<"Deconstructor"); @@ -126,7 +113,6 @@ vtkPV3FoamReader::~vtkPV3FoamReader() delete [] FileName; } - TimeSelection->RemoveObserver(this->SelectionObserver); RegionSelection->RemoveObserver(this->SelectionObserver); VolFieldSelection->RemoveObserver(this->SelectionObserver); PointFieldSelection->RemoveObserver(this->SelectionObserver); @@ -134,7 +120,6 @@ vtkPV3FoamReader::~vtkPV3FoamReader() SelectionObserver->Delete(); - TimeSelection->Delete(); RegionSelection->Delete(); VolFieldSelection->Delete(); PointFieldSelection->Delete(); @@ -152,7 +137,6 @@ int vtkPV3FoamReader::RequestInformation { vtkDebugMacro(<<"RequestInformation"); - if (Foam::vtkPV3Foam::debug) { cout<<"REQUEST_INFORMATION\n"; @@ -180,7 +164,7 @@ int vtkPV3FoamReader::RequestInformation } else { - cout << "no output\n"; + cout<< "no output\n"; } this->GetExecutive()->GetOutputInformation(0)->Print(cout); @@ -189,7 +173,7 @@ int vtkPV3FoamReader::RequestInformation cout<< "requestInfo with " << nInfo << " items:\n"; - for (int i=0; iGetInformationObject(i); info->Print(cout); @@ -230,7 +214,7 @@ int vtkPV3FoamReader::RequestInformation timeRange[0] = timeSteps[0]; timeRange[1] = timeSteps[nTimeSteps-1]; - if (Foam::vtkPV3Foam::debug) + if (Foam::vtkPV3Foam::debug > 1) { cout<<"nTimeSteps " << nTimeSteps << "\n"; cout<<"timeRange " << timeRange[0] << " to " << timeRange[1] << "\n"; @@ -271,20 +255,15 @@ int vtkPV3FoamReader::RequestData return 0; } + if (Foam::vtkPV3Foam::debug) { int nInfo = outputVector->GetNumberOfInformationObjects(); - if (Foam::vtkPV3Foam::debug) - { - cout<<"requestData with " << nInfo << " items\n"; - } - for (int i=0; iGetInformationObject(i); - - if (Foam::vtkPV3Foam::debug) - { - info->Print(cout); - } + info->Print(cout); } } @@ -330,7 +309,7 @@ int vtkPV3FoamReader::RequestData } else { - cout << "no data_object\n"; + cout<< "no data_object\n"; } } @@ -447,67 +426,12 @@ void vtkPV3FoamReader::PrintSelf } -vtkDataArraySelection* vtkPV3FoamReader::GetTimeSelection() -{ - vtkDebugMacro(<<"GetTimeSelection"); - - return TimeSelection; -} - - -int vtkPV3FoamReader::GetNumberOfTimeArrays() -{ - vtkDebugMacro(<<"GetNumberOf TimeArrays"); - - return TimeSelection->GetNumberOfArrays(); -} - - -const char* vtkPV3FoamReader::GetTimeArrayName -( - int index -) -{ - vtkDebugMacro(<<"GetTimeArrayName"); - - return TimeSelection->GetArrayName(index); -} - - -int vtkPV3FoamReader::GetTimeArrayStatus -( - const char* name -) -{ - vtkDebugMacro(<<"GetTimeArrayStatus"); - - return TimeSelection->ArrayIsEnabled(name); -} - - -void vtkPV3FoamReader::SetTimeArrayStatus -( - const char* name, - int status -) -{ - vtkDebugMacro(<<"SetTimeArrayStatus"); - - if (status) - { - TimeSelection->EnableArray(name); - } - else - { - TimeSelection->DisableArray(name); - } -} - +// ---------------------------------------------------------------------- +// Region selection list control vtkDataArraySelection* vtkPV3FoamReader::GetRegionSelection() { vtkDebugMacro(<<"GetRegionSelection"); - return RegionSelection; } @@ -515,42 +439,29 @@ vtkDataArraySelection* vtkPV3FoamReader::GetRegionSelection() int vtkPV3FoamReader::GetNumberOfRegionArrays() { vtkDebugMacro(<<"GetNumberOfRegionArrays"); - return RegionSelection->GetNumberOfArrays(); } -const char* vtkPV3FoamReader::GetRegionArrayName -( - int index -) +const char* vtkPV3FoamReader::GetRegionArrayName(int index) { vtkDebugMacro(<<"GetRegionArrayName"); - return RegionSelection->GetArrayName(index); } -int vtkPV3FoamReader::GetRegionArrayStatus -( - const char* name -) +int vtkPV3FoamReader::GetRegionArrayStatus(const char* name) { vtkDebugMacro(<<"GetRegionArrayStatus"); - return RegionSelection->ArrayIsEnabled(name); } -void vtkPV3FoamReader::SetRegionArrayStatus -( - const char* name, - int status -) +void vtkPV3FoamReader::SetRegionArrayStatus(const char* name, int status) { vtkDebugMacro(<<"SetRegionArrayStatus"); - if(status) + if (status) { RegionSelection->EnableArray(name); } @@ -561,6 +472,9 @@ void vtkPV3FoamReader::SetRegionArrayStatus } +// ---------------------------------------------------------------------- +// volField selection list control + vtkDataArraySelection* vtkPV3FoamReader::GetVolFieldSelection() { vtkDebugMacro(<<"GetVolFieldSelection"); @@ -577,10 +491,7 @@ int vtkPV3FoamReader::GetNumberOfVolFieldArrays() } -const char* vtkPV3FoamReader::GetVolFieldArrayName -( - int index -) +const char* vtkPV3FoamReader::GetVolFieldArrayName(int index) { vtkDebugMacro(<<"GetVolFieldArrayName"); @@ -588,10 +499,7 @@ const char* vtkPV3FoamReader::GetVolFieldArrayName } -int vtkPV3FoamReader::GetVolFieldArrayStatus -( - const char* name -) +int vtkPV3FoamReader::GetVolFieldArrayStatus(const char* name) { vtkDebugMacro(<<"GetVolFieldArrayStatus"); @@ -599,11 +507,7 @@ int vtkPV3FoamReader::GetVolFieldArrayStatus } -void vtkPV3FoamReader::SetVolFieldArrayStatus -( - const char* name, - int status -) +void vtkPV3FoamReader::SetVolFieldArrayStatus(const char* name, int status) { vtkDebugMacro(<<"SetVolFieldArrayStatus"); @@ -618,6 +522,9 @@ void vtkPV3FoamReader::SetVolFieldArrayStatus } +// ---------------------------------------------------------------------- +// pointField selection list control + vtkDataArraySelection* vtkPV3FoamReader::GetPointFieldSelection() { vtkDebugMacro(<<"GetPointFieldSelection"); @@ -634,10 +541,7 @@ int vtkPV3FoamReader::GetNumberOfPointFieldArrays() } -const char* vtkPV3FoamReader::GetPointFieldArrayName -( - int index -) +const char* vtkPV3FoamReader::GetPointFieldArrayName(int index) { vtkDebugMacro(<<"GetPointFieldArrayName"); @@ -645,10 +549,7 @@ const char* vtkPV3FoamReader::GetPointFieldArrayName } -int vtkPV3FoamReader::GetPointFieldArrayStatus -( - const char* name -) +int vtkPV3FoamReader::GetPointFieldArrayStatus(const char* name) { vtkDebugMacro(<<"GetPointFieldArrayStatus"); @@ -656,11 +557,7 @@ int vtkPV3FoamReader::GetPointFieldArrayStatus } -void vtkPV3FoamReader::SetPointFieldArrayStatus -( - const char* name, - int status -) +void vtkPV3FoamReader::SetPointFieldArrayStatus(const char* name, int status) { vtkDebugMacro(<<"SetPointFieldArrayStatus"); @@ -675,6 +572,9 @@ void vtkPV3FoamReader::SetPointFieldArrayStatus } +// ---------------------------------------------------------------------- +// lagrangianField selection list control + vtkDataArraySelection* vtkPV3FoamReader::GetLagrangianFieldSelection() { vtkDebugMacro(<<"GetLagrangianFieldSelection"); @@ -691,10 +591,7 @@ int vtkPV3FoamReader::GetNumberOfLagrangianFieldArrays() } -const char* vtkPV3FoamReader::GetLagrangianFieldArrayName -( - int index -) +const char* vtkPV3FoamReader::GetLagrangianFieldArrayName(int index) { vtkDebugMacro(<<"GetLagrangianFieldArrayName"); @@ -702,10 +599,7 @@ const char* vtkPV3FoamReader::GetLagrangianFieldArrayName } -int vtkPV3FoamReader::GetLagrangianFieldArrayStatus -( - const char* name -) +int vtkPV3FoamReader::GetLagrangianFieldArrayStatus(const char* name) { vtkDebugMacro(<<"GetLagrangianFieldArrayStatus"); @@ -731,6 +625,7 @@ void vtkPV3FoamReader::SetLagrangianFieldArrayStatus } } +// ---------------------------------------------------------------------- void vtkPV3FoamReader::SelectionModifiedCallback ( @@ -751,3 +646,4 @@ void vtkPV3FoamReader::SelectionModified() Modified(); } +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h index 9e64260f81..0878bc5c56 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h @@ -14,11 +14,9 @@ =========================================================================*/ // .NAME vtkPV3FoamReader - reads a dataset in OpenFOAM format // .SECTION Description -// vtkPV3FoamReader creates an multiblock dataset. It reads a controlDict -// file, mesh information, and time dependent data. The controlDict file -// contains timestep information. The polyMesh folders contain mesh information -// The time folders contain transient data for the cells Each folder can -// contain any number of data files. +// vtkPV3FoamReader creates an multiblock dataset. +// It uses the OpenFOAM infrastructure (fvMesh, etc) to +// handle mesh and field data. #ifndef __vtkPV3FoamReader_h #define __vtkPV3FoamReader_h @@ -66,6 +64,13 @@ public: vtkSetStringMacro(FileName); vtkGetStringMacro(FileName); + // Time control + // Set/Get the timestep and the timestep range + vtkSetMacro(TimeStep, int); + vtkGetMacro(TimeStep, int); + vtkSetVector2Macro(TimeStepRange, int); + vtkGetVector2Macro(TimeStepRange, int); + // GUI update control vtkSetMacro(UpdateGUI, int); vtkGetMacro(UpdateGUI, int); @@ -86,24 +91,10 @@ public: vtkSetMacro(IncludeZones, int); vtkGetMacro(IncludeZones, int); - // FOAM patch names control + // FOAM display patch names control vtkSetMacro(ShowPatchNames, int); vtkGetMacro(ShowPatchNames, int); - // Time-step slider control - vtkSetMacro(TimeStep, int); - vtkGetMacro(TimeStep, int); - vtkSetVector2Macro(TimeStepRange, int); - vtkGetVector2Macro(TimeStepRange, int); - - // Time selection list control - vtkDataArraySelection* GetTimeSelection(); - int GetNumberOfTimeArrays(); - const char* GetTimeArrayName(int index); - int GetTimeArrayStatus(const char* name); - void SetTimeArrayStatus(const char* name, int status); - - // Region selection list control vtkDataArraySelection* GetRegionSelection(); int GetNumberOfRegionArrays(); @@ -121,16 +112,16 @@ public: // pointField selection list control vtkDataArraySelection* GetPointFieldSelection(); int GetNumberOfPointFieldArrays(); - const char* GetPointFieldArrayName(int index); int GetPointFieldArrayStatus(const char* name); void SetPointFieldArrayStatus(const char* name, int status); + const char* GetPointFieldArrayName(int index); // lagrangianField selection list control vtkDataArraySelection* GetLagrangianFieldSelection(); int GetNumberOfLagrangianFieldArrays(); - const char* GetLagrangianFieldArrayName(int index); int GetLagrangianFieldArrayStatus(const char* name); void SetLagrangianFieldArrayStatus(const char* name, int status); + const char* GetLagrangianFieldArrayName(int index); // Callback registered with the SelectionObserver // for all the selection lists @@ -182,7 +173,11 @@ private: //- Remove patch names from the view void removePatchNamesFromView(); + int TimeStep; + int TimeStepRange[2]; + int CacheMesh; + int ExtrapolateWalls; int IncludeSets; int IncludeZones; @@ -190,10 +185,7 @@ private: int UpdateGUI; int UpdateGUIOld; - int TimeStep; - int TimeStepRange[2]; - vtkDataArraySelection* TimeSelection; vtkDataArraySelection* RegionSelection; vtkDataArraySelection* VolFieldSelection; vtkDataArraySelection* PointFieldSelection; @@ -204,4 +196,8 @@ private: //ETX }; +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/options b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/options index 2cebe55112..b40ecb51d7 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/options +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/options @@ -1,5 +1,4 @@ EXE_INC = \ - /* -DPV3FOAM_TIMESELECTION */ \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index 7699e94cf2..d62064dac3 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C @@ -172,38 +172,6 @@ void Foam::vtkPV3Foam::resetCounters() } -void Foam::vtkPV3Foam::initializeTime() -{ -#ifdef PV3FOAM_TIMESELECTION - Time& runTime = dbPtr_(); - - // Get times list - instantList times = runTime.times(); - - vtkDataArraySelection* arraySelection = reader_->GetTimeSelection(); - - // only execute this if there is a mismatch between - // the times available according to FOAM and according to VTK - int nArrays = arraySelection->GetNumberOfArrays(); - - if (nArrays && nArrays == times.size() - 1) - { - return; - } - - // "constant" is implicit - skip it - // All the time selections are enabled by default - for (label timeI = 1; timeI < times.size(); ++timeI) - { - arraySelection->AddArray - ( - times[timeI].name().c_str() - ); - } -#endif /* PV3FOAM_TIMESELECTION */ -} - - bool Foam::vtkPV3Foam::setTime(const double& requestedTime) { if (debug) @@ -301,7 +269,7 @@ Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries if (debug) { - Info << "selections("; + Info<< "selections("; } forAll (selections, elemI) @@ -322,7 +290,7 @@ Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries if (debug) { - Info << " " << selections[nElem]; + Info<< " " << selections[nElem]; } ++nElem; @@ -331,7 +299,7 @@ Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries if (debug) { - Info << " )" << endl; + Info<< " )" << endl; } selections.setSize(nElem); @@ -351,7 +319,7 @@ Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries if (debug) { - Info << "selections("; + Info<< "selections("; } for @@ -377,7 +345,7 @@ Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries if (debug) { - Info << " " << selections[nElem]; + Info<< " " << selections[nElem]; } ++nElem; @@ -386,7 +354,7 @@ Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries if (debug) { - Info << " )" << endl; + Info<< " )" << endl; } @@ -569,8 +537,6 @@ void Foam::vtkPV3Foam::UpdateInformation() // Clear current region list/array reader_->GetRegionSelection()->RemoveAllArrays(); - initializeTime(); - // Update region array updateInformationInternalMesh(); @@ -693,16 +659,13 @@ void Foam::vtkPV3Foam::Update << GetNumberOfDataSets(output, selectInfoPointSets_) << nl; // traverse blocks: - - int nBlocks = output->GetNumberOfBlocks(); - Info << "nBlocks = " << nBlocks << endl; - + cout<< "nBlocks = " << output->GetNumberOfBlocks() << "\n"; cout<< "done Update\n"; output_->Print(cout); cout<< " has " << output_->GetNumberOfBlocks() << " blocks\n"; output_->GetInformation()->Print(cout); - cout <<"ShouldIReleaseData :" << output_->ShouldIReleaseData() << "\n"; + cout<<"ShouldIReleaseData :" << output_->ShouldIReleaseData() << "\n"; } } @@ -710,71 +673,13 @@ void Foam::vtkPV3Foam::Update double* Foam::vtkPV3Foam::timeSteps(int& nTimeSteps) { int nTimes = 0; - double* ts = NULL; + double* tsteps = NULL; if (dbPtr_.valid()) { Time& runTime = dbPtr_(); - instantList times = runTime.times(); -#ifdef PV3FOAM_TIMESELECTION - List selected = List(times.size(), false); - - vtkDataArraySelection* arraySelection = reader_->GetTimeSelection(); - const label nSelectedTimes = arraySelection->GetNumberOfArrays(); - - for (int i = 0; i < nSelectedTimes; ++i) - { - // always skip "constant" time - const int timeI = i + 1; - if - ( - arraySelection->GetArraySetting(i) - && timeI < times.size() - ) - { - if (debug > 1) - { - Info<<"timeSelection[" - << i - <<"] = " - << arraySelection->GetArraySetting(i) - << " is " - << arraySelection->GetArrayName(i) << endl; - } - selected[timeI] = true; - ++nTimes; - } - } - - if (debug > 1) - { - Info<< "selected " << nTimes << " times "; - Info<< "found " << times.size() << " times: ("; - forAll(times, timeI) - { - Info<< " " << times[timeI].value(); - } - Info<< " )" << endl; - } - - if (nTimes) - { - ts = new double[nTimes]; - int stepI = 0; - - forAll(selected, selectI) - { - if (selected[selectI]) - { - ts[stepI] = times[selectI].value(); - stepI++; - } - } - } - -#else /* PV3FOAM_TIMESELECTION */ // always skip "constant" time, unless there are no other times nTimes = times.size(); label timeI = 0; @@ -787,26 +692,25 @@ double* Foam::vtkPV3Foam::timeSteps(int& nTimeSteps) if (nTimes) { - ts = new double[nTimes]; + tsteps = new double[nTimes]; for (label stepI = 0; stepI < nTimes; ++stepI, ++timeI) { - ts[stepI] = times[timeI].value(); + tsteps[stepI] = times[timeI].value(); } } -#endif /* PV3FOAM_TIMESELECTION */ } else { if (debug) { - Info<< "no valid dbPtr:" < Foam::vtkPV3Foam::updateFoamMesh" << endl; } - if - ( - !reader_->GetCacheMesh() -#ifdef PV3FOAM_TIMESELECTION - // This is only useful if the times are individually selectable - || reader_->GetTimeSelection()->GetArraySetting(0) -#endif - ) + if (!reader_->GetCacheMesh()) { delete meshPtr_; meshPtr_ = NULL; From 8a2596a05cc0ca03ab06642bb3a53a89b57af5cd Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 25 Jul 2008 10:46:10 +0200 Subject: [PATCH 03/16] PV3FoamReader repaired several misfeatures - On the first call, select 'internalMesh' and the 'p', 'U' fields. This corresponds to a fairly common default case without loading all possible fields etc. - Include zones should now work without issuing a FatalError when the corresponding files are missing. I must have tried too many things at once and didn't notice this before. - Use ZoneMesh for zone names if the fvMesh is already cached (skips re-reading the same files). - Change reader description to "OpenFOAM Reader" to distinguish it a bit from the vtkOpenFOAMReader built into paraview/vtk - Misc. file and method names reorganized - Remaining problem: mixing internalMesh and cellZones is clunky since there aren't yet interpolated point values for cellSets/cellZones. Paraview complains about the mismatch, but extracting a block is still okay. TODO: - multi-port output for Lagrangian - hold all the vtk mesh parts (including multiblock) and just pass the reference. With this, the pipeline might notice that the geometry is actually identical and skip the PVGeometryFilter that takes so long. --- .../PV3FoamReader/PV3FoamReader.xml | 2 +- .../PV3FoamReader/vtkPV3Foam/Make/files | 6 +- .../PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C | 98 +++++--- .../PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H | 39 +-- .../vtkPV3Foam/vtkPV3FoamAddPointSetMesh.C | 73 ------ .../vtkPV3Foam/vtkPV3FoamAddPointZoneMesh.C | 72 ------ ...ddFaceSetMesh.C => vtkPV3FoamAddSetMesh.C} | 33 +++ ...AddFields.H => vtkPV3FoamAddToSelection.H} | 39 ++- ...FaceZoneMesh.C => vtkPV3FoamAddZoneMesh.C} | 33 +++ .../vtkPV3Foam/vtkPV3FoamConvertMesh.C | 29 +-- .../PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H | 29 --- .../vtkPV3Foam/vtkPV3FoamUpdateInformation.C | 224 ++++++++++-------- .../vtkPV3FoamUpdateInformationFields.H | 34 ++- 13 files changed, 332 insertions(+), 379 deletions(-) delete mode 100644 applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddPointSetMesh.C delete mode 100644 applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddPointZoneMesh.C rename applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/{vtkPV3FoamAddFaceSetMesh.C => vtkPV3FoamAddSetMesh.C} (82%) rename applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/{vtkPV3FoamAddFields.H => vtkPV3FoamAddToSelection.H} (70%) rename applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/{vtkPV3FoamAddFaceZoneMesh.C => vtkPV3FoamAddZoneMesh.C} (82%) diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader.xml b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader.xml index 41b44048d9..123c736f54 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader.xml +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader.xml @@ -1,6 +1,6 @@ + file_description="OpenFOAM Reader"> diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/files b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/files index ba65793d66..0a5e64ddf1 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/files +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/files @@ -2,10 +2,8 @@ vtkPV3Foam.C vtkPV3FoamAddVolumeMesh.C vtkPV3FoamAddLagrangianMesh.C vtkPV3FoamAddPatchMesh.C -vtkPV3FoamAddFaceZoneMesh.C -vtkPV3FoamAddPointZoneMesh.C -vtkPV3FoamAddFaceSetMesh.C -vtkPV3FoamAddPointSetMesh.C +vtkPV3FoamAddZoneMesh.C +vtkPV3FoamAddSetMesh.C vtkPV3FoamUpdate.C vtkPV3FoamUpdateInformation.C vtkPV3FoamConvertMesh.C diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index d62064dac3..a24eb02b76 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C @@ -52,7 +52,7 @@ defineTypeNameAndDebug(Foam::vtkPV3Foam, 0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -#include "vtkPV3FoamAddFields.H" +#include "vtkPV3FoamAddToSelection.H" #include "vtkPV3FoamUpdateInformationFields.H" @@ -233,13 +233,13 @@ void Foam::vtkPV3Foam::updateSelectedRegions() vtkDataArraySelection* arraySelection = reader_->GetRegionSelection(); - const label nRegions = arraySelection->GetNumberOfArrays(); + const label nSelect = arraySelection->GetNumberOfArrays(); - selectedRegions_.setSize(nRegions); - selectedRegionDatasetIds_.setSize(nRegions); + selectedRegions_.setSize(nSelect); + selectedRegionDatasetIds_.setSize(nSelect); // Read the selected patches and add to the region list - for (int regionId=0; regionId < nRegions; ++regionId) + forAll (selectedRegions_, regionId) { selectedRegions_[regionId] = arraySelection->GetArraySetting(regionId); selectedRegionDatasetIds_[regionId] = -1; @@ -269,7 +269,13 @@ Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries if (debug) { - Info<< "selections("; + Info<< "available("; + forAll (selections, elemI) + { + Info<< " \"" << arraySelection->GetArrayName(elemI) << "\""; + } + Info<< " )\n" + << "selected("; } forAll (selections, elemI) @@ -319,28 +325,40 @@ Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries if (debug) { - Info<< "selections("; + Info<< "available("; + for + ( + int elemI = selector.start(); + elemI < selector.end(); + ++elemI + ) + { + Info<< " \"" << arraySelection->GetArrayName(elemI) << "\""; + } + + Info<< " )\n" + << "selected("; } for ( - int regionId = selector.start(); - regionId < selector.end(); - ++regionId + int elemI = selector.start(); + elemI < selector.end(); + ++elemI ) { - if (arraySelection->GetArraySetting(regionId)) + if (arraySelection->GetArraySetting(elemI)) { if (firstWord) { selections[nElem] = getFirstWord ( - arraySelection->GetArrayName(regionId) + arraySelection->GetArrayName(elemI) ); } else { - selections[nElem] = arraySelection->GetArrayName(regionId); + selections[nElem] = arraySelection->GetArrayName(elemI); } if (debug) @@ -400,10 +418,7 @@ void Foam::vtkPV3Foam::setSelectedArrayEntries << endl; } - arraySelection->EnableArray - ( - arrayName.c_str() - ); + arraySelection->EnableArray(arrayName.c_str()); break; } } @@ -523,25 +538,37 @@ void Foam::vtkPV3Foam::UpdateInformation() { if (debug) { - Info<< " Foam::vtkPV3Foam::UpdateInformation - " - << "TimeStep = " << reader_->GetTimeStep() << endl; + Info<< " Foam::vtkPV3Foam::UpdateInformation" + << " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "] TimeStep=" + << reader_->GetTimeStep() << endl; } resetCounters(); - // preserve the currently selected values - const stringList selectedEntries = getSelectedArrayEntries - ( - reader_->GetRegionSelection() - ); + vtkDataArraySelection* arraySelection = reader_->GetRegionSelection(); + + stringList selectedEntries; + // enable 'internalMesh' on the first call + if (arraySelection->GetNumberOfArrays() == 0) + { + selectedEntries.setSize(1); + selectedEntries[0] = "internalMesh"; + } + else + { + // preserve the currently selected values + selectedEntries = getSelectedArrayEntries + ( + arraySelection + ); + } + // Clear current region list/array - reader_->GetRegionSelection()->RemoveAllArrays(); + arraySelection->RemoveAllArrays(); // Update region array updateInformationInternalMesh(); - updateInformationLagrangian(); - updateInformationPatches(); if (reader_->GetIncludeSets()) @@ -554,10 +581,10 @@ void Foam::vtkPV3Foam::UpdateInformation() updateInformationZones(); } - // Update region selection with the data just read in + // restore the currently enabled values setSelectedArrayEntries ( - reader_->GetRegionSelection(), + arraySelection, selectedEntries ); @@ -610,9 +637,7 @@ void Foam::vtkPV3Foam::Update // Convert meshes convertMeshVolume(output); - convertMeshLagrangian(output); - convertMeshPatches(output); if (reader_->GetIncludeZones()) @@ -624,16 +649,14 @@ void Foam::vtkPV3Foam::Update if (reader_->GetIncludeSets()) { - convertMeshCellSet(output); - convertMeshFaceSet(output); - convertMeshPointSet(output); + convertMeshCellSets(output); + convertMeshFaceSets(output); + convertMeshPointSets(output); } // Update fields updateVolFields(output); - updatePointFields(output); - updateLagrangianFields(output); if (debug) @@ -724,8 +747,7 @@ void Foam::vtkPV3Foam::addPatchNames(vtkRenderer* renderer) Info<< " Foam::vtkPV3Foam::addPatchNames" << endl; } - const fvMesh& mesh = *meshPtr_; - const polyBoundaryMesh& pbMesh = mesh.boundaryMesh(); + const polyBoundaryMesh& pbMesh = meshPtr_->boundaryMesh(); const selectionInfo& selector = selectInfoPatches_; diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index 8474798f7d..39f52c2f32 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -29,18 +29,16 @@ Description Provides a reader interface for OpenFOAM to VTK interaction. SourceFiles - interpolatePointToCell.C - interpolatePointToCell.H vtkPV3Foam.C vtkPV3Foam.H - vtkPV3FoamAddFaceSetMesh.C - vtkPV3FoamAddFaceZoneMesh.C - vtkPV3FoamAddFields.H + vtkPV3FoamI.H vtkPV3FoamAddLagrangianMesh.C vtkPV3FoamAddPatchMesh.C - vtkPV3FoamAddPointSetMesh.C - vtkPV3FoamAddPointZoneMesh.C + vtkPV3FoamAddSetMesh.C + vtkPV3FoamAddToSelection.H vtkPV3FoamAddVolumeMesh.C + vtkPV3FoamAddZoneMesh.C + vtkPV3FoamConvertFaceField.H vtkPV3FoamConvertLagrangianFields.H vtkPV3FoamConvertMesh.C vtkPV3FoamConvertPatchFaceField.H @@ -52,7 +50,7 @@ SourceFiles vtkPV3FoamUpdateInformation.C vtkPV3FoamUpdateInformationFields.H - // Needed by VTK? + // Needed by VTK: vtkDataArrayTemplateImplicit.txx \*---------------------------------------------------------------------------*/ @@ -64,6 +62,7 @@ SourceFiles #include "fileName.H" #include "volPointInterpolation.H" #include "stringList.H" +#include "wordList.H" #include "primitivePatch.H" // * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * // @@ -304,9 +303,21 @@ private: //- Set info void updateInformationSets(); + //- Read zone names for zoneType from file + wordList readZoneNames(const word& zoneType); + //- Zone info void updateInformationZones(); + //- Add to paraview array selection + template + label addToSelection + ( + vtkDataArraySelection *arraySelection, + const IOobjectList&, + const string& suffix = "" + ); + //- Field info template class patchType, class meshType> void updateInformationFields @@ -347,20 +358,20 @@ private: //- Cell zone meshes void convertMeshCellZones(vtkMultiBlockDataSet* output); - //- Cell zone meshes + //- Face zone meshes void convertMeshFaceZones(vtkMultiBlockDataSet* output); - //- Cell zone meshes + //- Point zone meshes void convertMeshPointZones(vtkMultiBlockDataSet* output); //- Cell set meshes - void convertMeshCellSet(vtkMultiBlockDataSet* output); + void convertMeshCellSets(vtkMultiBlockDataSet* output); //- Face set meshes - void convertMeshFaceSet(vtkMultiBlockDataSet* output); + void convertMeshFaceSets(vtkMultiBlockDataSet* output); //- Point set meshes - void convertMeshPointSet(vtkMultiBlockDataSet* output); + void convertMeshPointSets(vtkMultiBlockDataSet* output); // Add mesh functions @@ -430,7 +441,7 @@ private: //- Add the fields in the selected time directory to the selection // lists template - label addFields + label addObjectsToSelection ( vtkDataArraySelection* fieldSelection, const IOobjectList& objects, diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddPointSetMesh.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddPointSetMesh.C deleted file mode 100644 index 4a19fab3d4..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddPointSetMesh.C +++ /dev/null @@ -1,73 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Description - -\*---------------------------------------------------------------------------*/ - -#include "vtkPV3Foam.H" - -// Foam includes -#include "pointSet.H" -#include "vtkPV3FoamInsertNextPoint.H" - -// VTK includes -#include "vtkPoints.h" -#include "vtkPolyData.h" - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::vtkPV3Foam::addPointSetMesh -( - const fvMesh& mesh, - const pointSet& pSet, - vtkPolyData* vtkmesh -) -{ - if (debug) - { - Info<< " Foam::vtkPV3Foam::addPointSetMesh" << endl; - } - - const pointField& meshPoints = mesh.points(); - - vtkPoints *vtkpoints = vtkPoints::New(); - vtkpoints->Allocate(pSet.size()); - - forAllConstIter(pointSet, pSet, iter) - { - vtkPV3FoamInsertNextPoint(vtkpoints, meshPoints[iter.key()]); - } - - vtkmesh->SetPoints(vtkpoints); - vtkpoints->Delete(); - - if (debug) - { - Info<< " Foam::vtkPV3Foam::addPointSetMesh" << endl; - } -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddPointZoneMesh.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddPointZoneMesh.C deleted file mode 100644 index f6369bfa23..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddPointZoneMesh.C +++ /dev/null @@ -1,72 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Description - -\*---------------------------------------------------------------------------*/ - -#include "vtkPV3Foam.H" - -// Foam includes -#include "vtkPV3FoamInsertNextPoint.H" - -// VTK includes -#include "vtkPoints.h" -#include "vtkPolyData.h" - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::vtkPV3Foam::addPointZoneMesh -( - const fvMesh& mesh, - const labelList& pointLabels, - vtkPolyData* vtkmesh -) -{ - if (debug) - { - Info<< " Foam::vtkPV3Foam::addPointZoneMesh" << endl; - } - - const pointField& meshPoints = mesh.points(); - - vtkPoints *vtkpoints = vtkPoints::New(); - vtkpoints->Allocate(pointLabels.size()); - - forAll(pointLabels, pointI) - { - vtkPV3FoamInsertNextPoint(vtkpoints, meshPoints[pointLabels[pointI]]); - } - - vtkmesh->SetPoints(vtkpoints); - vtkpoints->Delete(); - - if (debug) - { - Info<< " Foam::vtkPV3Foam::addPointZoneMesh" << endl; - } -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddFaceSetMesh.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddSetMesh.C similarity index 82% rename from applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddFaceSetMesh.C rename to applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddSetMesh.C index 116f503a4d..8b17ace185 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddFaceSetMesh.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddSetMesh.C @@ -30,6 +30,7 @@ Description // Foam includes #include "faceSet.H" +#include "pointSet.H" #include "vtkPV3FoamInsertNextPoint.H" // VTK includes @@ -103,4 +104,36 @@ void Foam::vtkPV3Foam::addFaceSetMesh } } + +void Foam::vtkPV3Foam::addPointSetMesh +( + const fvMesh& mesh, + const pointSet& pSet, + vtkPolyData* vtkmesh +) +{ + if (debug) + { + Info<< " Foam::vtkPV3Foam::addPointSetMesh" << endl; + } + + const pointField& meshPoints = mesh.points(); + + vtkPoints *vtkpoints = vtkPoints::New(); + vtkpoints->Allocate(pSet.size()); + + forAllConstIter(pointSet, pSet, iter) + { + vtkPV3FoamInsertNextPoint(vtkpoints, meshPoints[iter.key()]); + } + + vtkmesh->SetPoints(vtkpoints); + vtkpoints->Delete(); + + if (debug) + { + Info<< " Foam::vtkPV3Foam::addPointSetMesh" << endl; + } +} + // ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddToSelection.H similarity index 70% rename from applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddFields.H rename to applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddToSelection.H index ff6c48bfe5..08a3162686 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddFields.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddToSelection.H @@ -22,13 +22,10 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -InClass - vtkPV3Foam - \*---------------------------------------------------------------------------*/ -#ifndef vtkPV3FoamAddFields_H -#define vtkPV3FoamAddFields_H +#ifndef vtkPV3FoamAddToSelection_H +#define vtkPV3FoamAddToSelection_H // FOAM includes #include "SortableList.H" @@ -38,48 +35,48 @@ InClass // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template -Foam::label Foam::vtkPV3Foam::addFields +template +Foam::label Foam::vtkPV3Foam::addToSelection ( - vtkDataArraySelection *fieldSelection, - const IOobjectList& objects, + vtkDataArraySelection *arraySelection, + const IOobjectList& objectLst, const string& suffix ) { - IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName)); + IOobjectList objects(objectLst.lookupClass(Type::typeName)); - SortableList fields(fieldObjects.size()); + SortableList objectNames(objects.size()); label count = 0; - forAllConstIter(IOobjectList, fieldObjects, iter) + forAllConstIter(IOobjectList, objects, iter) { - fields[count++] = iter()->name(); + objectNames[count++] = iter()->name(); } if (count) { - fields.sort(); + objectNames.sort(); - forAll(fields, fieldI) + forAll (objectNames, objI) { if (debug) { - Info<<" addField to GUI " << GeoField::typeName - << ":" << fields[fieldI] << endl; + Info<<" addToSelection<" << Type::typeName << "> to GUI " + << ":" << objectNames[objI] << endl; } if (suffix.size()) { - fieldSelection->AddArray + arraySelection->AddArray ( - (fields[fieldI] + suffix).c_str() + (objectNames[objI] + suffix).c_str() ); } else { - fieldSelection->AddArray + arraySelection->AddArray ( - fields[fieldI].c_str() + objectNames[objI].c_str() ); } } diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddFaceZoneMesh.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddZoneMesh.C similarity index 82% rename from applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddFaceZoneMesh.C rename to applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddZoneMesh.C index 044d4cedaf..b9c733eeed 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddFaceZoneMesh.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddZoneMesh.C @@ -38,6 +38,7 @@ Description // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + void Foam::vtkPV3Foam::addFaceZoneMesh ( const fvMesh& mesh, @@ -102,4 +103,36 @@ void Foam::vtkPV3Foam::addFaceZoneMesh } + +void Foam::vtkPV3Foam::addPointZoneMesh +( + const fvMesh& mesh, + const labelList& pointLabels, + vtkPolyData* vtkmesh +) +{ + if (debug) + { + Info<< " Foam::vtkPV3Foam::addPointZoneMesh" << endl; + } + + const pointField& meshPoints = mesh.points(); + + vtkPoints *vtkpoints = vtkPoints::New(); + vtkpoints->Allocate(pointLabels.size()); + + forAll(pointLabels, pointI) + { + vtkPV3FoamInsertNextPoint(vtkpoints, meshPoints[pointLabels[pointI]]); + } + + vtkmesh->SetPoints(vtkpoints); + vtkpoints->Delete(); + + if (debug) + { + Info<< " Foam::vtkPV3Foam::addPointZoneMesh" << endl; + } +} + // ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertMesh.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertMesh.C index 47239f02d7..432372d296 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertMesh.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertMesh.C @@ -76,7 +76,7 @@ void Foam::vtkPV3Foam::convertMeshVolume if (debug) { - Info<< "Creating VTK internal mesh" << endl; + Info<< "Creating VTK internalMesh" << endl; } const label datasetId = 0; @@ -285,14 +285,14 @@ void Foam::vtkPV3Foam::convertMeshCellZones } -void Foam::vtkPV3Foam::convertMeshCellSet +void Foam::vtkPV3Foam::convertMeshCellSets ( vtkMultiBlockDataSet* output ) { if (debug) { - Info<< " Foam::vtkPV3Foam::convertMeshCellSet" << endl; + Info<< " Foam::vtkPV3Foam::convertMeshCellSets" << endl; } const selectionInfo& selector = selectInfoCellSets_; @@ -359,10 +359,11 @@ void Foam::vtkPV3Foam::convertMeshCellSet if (debug) { - Info<< " Foam::vtkPV3Foam::convertMeshCellSet" << endl; + Info<< " Foam::vtkPV3Foam::convertMeshCellSets" << endl; } } + void Foam::vtkPV3Foam::convertMeshFaceZones ( vtkMultiBlockDataSet* output @@ -417,7 +418,7 @@ void Foam::vtkPV3Foam::convertMeshFaceZones vtkmesh->Delete(); } } - + if (debug) { Info<< " Foam::vtkPV3Foam::convertMeshFaceZones" << endl; @@ -425,14 +426,14 @@ void Foam::vtkPV3Foam::convertMeshFaceZones } -void Foam::vtkPV3Foam::convertMeshFaceSet +void Foam::vtkPV3Foam::convertMeshFaceSets ( vtkMultiBlockDataSet* output ) { if (debug) { - Info<< " Foam::vtkPV3Foam::convertMeshFaceSet" << endl; + Info<< " Foam::vtkPV3Foam::convertMeshFaceSets" << endl; } const selectionInfo& selector = selectInfoFaceSets_; @@ -487,10 +488,10 @@ void Foam::vtkPV3Foam::convertMeshFaceSet vtkmesh->Delete(); } } - + if (debug) { - Info<< " Foam::vtkPV3Foam::convertMeshFaceSet" << endl; + Info<< " Foam::vtkPV3Foam::convertMeshFaceSets" << endl; } } @@ -549,7 +550,7 @@ void Foam::vtkPV3Foam::convertMeshPointZones vtkmesh->Delete(); } } - + if (debug) { Info<< " Foam::vtkPV3Foam::convertMeshPointZones" << endl; @@ -558,14 +559,14 @@ void Foam::vtkPV3Foam::convertMeshPointZones -void Foam::vtkPV3Foam::convertMeshPointSet +void Foam::vtkPV3Foam::convertMeshPointSets ( vtkMultiBlockDataSet* output ) { if (debug) { - Info<< " Foam::vtkPV3Foam::convertMeshPointSet" << endl; + Info<< " Foam::vtkPV3Foam::convertMeshPointSets" << endl; } const selectionInfo& selector = selectInfoPointSets_; @@ -620,10 +621,10 @@ void Foam::vtkPV3Foam::convertMeshPointSet vtkmesh->Delete(); } } - + if (debug) { - Info<< " Foam::vtkPV3Foam::convertMeshPointSet" << endl; + Info<< " Foam::vtkPV3Foam::convertMeshPointSets" << endl; } } diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H index 37f9543c56..8f9f682cdc 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H @@ -28,7 +28,6 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -//- Extract up to the first non-word characters inline Foam::word Foam::vtkPV3Foam::getFirstWord(const char* str) { if (str) @@ -46,32 +45,4 @@ inline Foam::word Foam::vtkPV3Foam::getFirstWord(const char* str) } } - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - // ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformation.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformation.C index 9c2d144dea..d47b7a191b 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformation.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformation.C @@ -22,8 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "vtkPV3Foam.H" @@ -31,9 +29,9 @@ Description // Foam includes #include "cellSet.H" #include "faceSet.H" +#include "pointSet.H" #include "IOobjectList.H" #include "IOPtrList.H" -#include "pointSet.H" #include "polyBoundaryMeshEntries.H" #include "entry.H" #include "vtkPV3FoamReader.h" @@ -79,7 +77,7 @@ public: // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -#include "vtkPV3FoamAddFields.H" +#include "vtkPV3FoamAddToSelection.H" #include "vtkPV3FoamUpdateInformationFields.H" void Foam::vtkPV3Foam::updateInformationInternalMesh() @@ -103,6 +101,9 @@ void Foam::vtkPV3Foam::updateInformationInternalMesh() if (debug) { + // just for debug info + getSelectedArrayEntries(arraySelection); + Info<< " Foam::vtkPV3Foam::updateInformationInternalMesh" << endl; } @@ -132,7 +133,7 @@ void Foam::vtkPV3Foam::updateInformationLagrangian() arraySelection->AddArray("lagrangian"); selectInfoLagrangian_ += 1; - Info<<"added cloudDirs\n"; + Info<< "... added cloudDirs\n"; if (cloudDirs.size() > 1) { @@ -149,13 +150,16 @@ void Foam::vtkPV3Foam::updateInformationLagrangian() { if (debug) { - Info<<"no clouds identified in " <timePath()/"lagrangian" << endl; } } if (debug) { + // just for debug info + getSelectedArrayEntries(arraySelection); + Info<< " Foam::vtkPV3Foam::updateInformationLagrangian" << endl; } } @@ -165,7 +169,8 @@ void Foam::vtkPV3Foam::updateInformationPatches() { if (debug) { - Info<< " Foam::vtkPV3Foam::updateInformationPatches" << endl; + Info<< " Foam::vtkPV3Foam::updateInformationPatches" + << " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl; } vtkDataArraySelection *arraySelection = reader_->GetRegionSelection(); @@ -209,117 +214,130 @@ void Foam::vtkPV3Foam::updateInformationPatches() if (debug) { + // just for debug info + getSelectedArrayEntries(arraySelection); + Info<< " Foam::vtkPV3Foam::updateInformationPatches" << endl; } } +Foam::wordList Foam::vtkPV3Foam::readZoneNames(const word& zoneType) +{ + wordList zoneNames; + + // mesh not loaded - read from file + IOobject ioObj + ( + zoneType, + dbPtr_().findInstance + ( + polyMesh::meshSubDir, + zoneType, + IOobject::READ_IF_PRESENT + ), + polyMesh::meshSubDir, + dbPtr_(), + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE, + false + ); + + if (ioObj.headerOk()) + { + zonesEntries zones(ioObj); + + zoneNames.setSize(zones.size()); + forAll (zones, zoneI) + { + zoneNames[zoneI] = zones[zoneI].keyword(); + } + } + + return zoneNames; +} + + void Foam::vtkPV3Foam::updateInformationZones() { if (debug) { - Info<< " Foam::vtkPV3Foam::updateInformationZones" << endl; + Info<< " Foam::vtkPV3Foam::updateInformationZones" + << " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl; } vtkDataArraySelection *arraySelection = reader_->GetRegionSelection(); - // Read cell zone information + wordList zoneNames; + + // + // cellZones information + // ~~~~~~~~~~~~~~~~~~~~~ + if (meshPtr_) { - zonesEntries zones - ( - IOobject - ( - "cellZones", - dbPtr_().findInstance(polyMesh::meshSubDir, "cellZones"), - polyMesh::meshSubDir, - dbPtr_(), - IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE, - false - ) - ); - - selectInfoCellZones_ = arraySelection->GetNumberOfArrays(); - if (zones.headerOk()) - { - forAll(zones, zoneI) - { - arraySelection->AddArray - ( - (zones[zoneI].keyword() + " - cellZone").c_str() - ); - } - selectInfoCellZones_ += zones.size(); - } - - superCellZonesCells_.setSize(selectInfoCellZones_.size()); + zoneNames = meshPtr_->cellZones().names(); + } + else + { + zoneNames = readZoneNames("cellZones"); } - // Read face zone information + selectInfoCellZones_ = arraySelection->GetNumberOfArrays(); + forAll (zoneNames, zoneI) { - zonesEntries zones - ( - IOobject - ( - "faceZones", - dbPtr_().findInstance(polyMesh::meshSubDir, "faceZones"), - polyMesh::meshSubDir, - dbPtr_(), - IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE, - false - ) - ); + arraySelection->AddArray((zoneNames[zoneI] + " - cellZone").c_str()); + } + selectInfoCellZones_ += zoneNames.size(); + superCellZonesCells_.setSize(selectInfoCellZones_.size()); - selectInfoFaceZones_ = arraySelection->GetNumberOfArrays(); - if (zones.headerOk()) - { - forAll(zones, zoneI) - { - arraySelection->AddArray - ( - (zones[zoneI].keyword() + " - faceZone").c_str() - ); - } - selectInfoFaceZones_ += zones.size(); - } + + // + // faceZones information + // ~~~~~~~~~~~~~~~~~~~~~ + if (meshPtr_) + { + zoneNames = meshPtr_->faceZones().names(); + } + else + { + zoneNames = readZoneNames("faceZones"); } - // Read point zone information + selectInfoFaceZones_ = arraySelection->GetNumberOfArrays(); + forAll (zoneNames, zoneI) { - zonesEntries zones - ( - IOobject - ( - "pointZones", - dbPtr_().findInstance(polyMesh::meshSubDir, "pointZones"), - polyMesh::meshSubDir, - dbPtr_(), - IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE, - false - ) - ); - - selectInfoPointZones_ = arraySelection->GetNumberOfArrays(); - if (zones.headerOk()) - { - forAll(zones, zoneI) - { - arraySelection->AddArray - ( - (zones[zoneI].keyword() + " - pointZone").c_str() - ); - } - selectInfoPointZones_ += zones.size(); - } + arraySelection->AddArray((zoneNames[zoneI] + " - faceZone").c_str()); } + selectInfoFaceZones_ += zoneNames.size(); + + + // + // pointZones information + // ~~~~~~~~~~~~~~~~~~~~~~ + if (meshPtr_) + { + zoneNames = meshPtr_->pointZones().names(); + } + else + { + zoneNames = readZoneNames("pointZones"); + } + + selectInfoPointZones_ = arraySelection->GetNumberOfArrays(); + forAll (zoneNames, zoneI) + { + arraySelection->AddArray((zoneNames[zoneI] + " - pointZone").c_str()); + } + selectInfoPointZones_ += zoneNames.size(); + if (debug) { + // just for debug info + getSelectedArrayEntries(arraySelection); + Info<< " Foam::vtkPV3Foam::updateInformationZones" << endl; } - } @@ -332,7 +350,7 @@ void Foam::vtkPV3Foam::updateInformationSets() vtkDataArraySelection *arraySelection = reader_->GetRegionSelection(); - // Add sets + // Add names of sets IOobjectList objects ( dbPtr_(), @@ -342,7 +360,7 @@ void Foam::vtkPV3Foam::updateInformationSets() selectInfoCellSets_ = arraySelection->GetNumberOfArrays(); - selectInfoCellSets_ += addFields + selectInfoCellSets_ += addToSelection ( arraySelection, objects, @@ -351,7 +369,7 @@ void Foam::vtkPV3Foam::updateInformationSets() superCellSetCells_.setSize(selectInfoCellSets_.size()); selectInfoFaceSets_ = arraySelection->GetNumberOfArrays(); - selectInfoFaceSets_ += addFields + selectInfoFaceSets_ += addToSelection ( arraySelection, objects, @@ -359,7 +377,7 @@ void Foam::vtkPV3Foam::updateInformationSets() ); selectInfoPointSets_ = arraySelection->GetNumberOfArrays(); - selectInfoPointSets_ += addFields + selectInfoPointSets_ += addToSelection ( arraySelection, objects, @@ -368,6 +386,9 @@ void Foam::vtkPV3Foam::updateInformationSets() if (debug) { + // just for debug info + getSelectedArrayEntries(arraySelection); + Info<< " Foam::vtkPV3Foam::updateInformationSets" << endl; } } @@ -399,32 +420,32 @@ void Foam::vtkPV3Foam::updateInformationLagrangianFields() "lagrangian"/cloudName_ ); - addFields > + addToSelection > ( arraySelection, objects ); - addFields > + addToSelection > ( arraySelection, objects ); - addFields > + addToSelection > ( arraySelection, objects ); - addFields > + addToSelection > ( arraySelection, objects ); - addFields > + addToSelection > ( arraySelection, objects ); - addFields > + addToSelection > ( arraySelection, objects @@ -444,5 +465,4 @@ void Foam::vtkPV3Foam::updateInformationLagrangianFields() } } - // ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformationFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformationFields.H index 170ad74ed1..a5c110e3b9 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformationFields.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInformationFields.H @@ -43,11 +43,23 @@ void Foam::vtkPV3Foam::updateInformationFields Info<< " Foam::vtkPV3Foam::updateInformationFields" << endl; } - // preserve the currently selected values - const stringList selectedEntries = getSelectedArrayEntries - ( - arraySelection - ); + stringList selectedEntries; + // enable 'p' and 'U' on the first call + if (arraySelection->GetNumberOfArrays() == 0) + { + selectedEntries.setSize(2); + selectedEntries[0] = "p"; + selectedEntries[1] = "U"; + } + else + { + // preserve the currently selected values + selectedEntries = getSelectedArrayEntries + ( + arraySelection + ); + } + arraySelection->RemoveAllArrays(); // Search for list of objects for this time @@ -56,33 +68,33 @@ void Foam::vtkPV3Foam::updateInformationFields //- Add volume fields to GUI /* - addFields > + addToSelection > ( arraySelection, objects ); */ - addFields > + addToSelection > ( arraySelection, objects ); - addFields > + addToSelection > ( arraySelection, objects ); - addFields > + addToSelection > ( arraySelection, objects ); - addFields > + addToSelection > ( arraySelection, objects ); - addFields > + addToSelection > ( arraySelection, objects From 3cdc8ca03c1a524e6c26d4ee3a50602441e345c1 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 25 Jul 2008 15:37:38 +0200 Subject: [PATCH 04/16] static label Time::findClosestTimeIndex(const instantList&, const scalar) - avoid code duplication in vtkPV3Foam.C and checkTimeOption.H - can also be used in Time::findClosestTime(), but didn't touch that --- .../PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C | 22 ++------- src/OpenFOAM/db/Time/Time.C | 46 +++++++++++++++++-- src/OpenFOAM/db/Time/Time.H | 3 ++ src/OpenFOAM/db/Time/findInstance.C | 12 +---- src/OpenFOAM/db/Time/findTimes.C | 12 +---- src/OpenFOAM/include/checkTimeOption.H | 21 ++------- 6 files changed, 54 insertions(+), 62 deletions(-) diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index a24eb02b76..7fab0ec3f9 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C @@ -183,24 +183,10 @@ bool Foam::vtkPV3Foam::setTime(const double& requestedTime) Time& runTime = dbPtr_(); // Get times list - instantList times = runTime.times(); + instantList Times = runTime.times(); - // logic as per "checkTimeOption.H" bool found = false; - int nearestIndex = -1; - scalar nearestDiff = Foam::GREAT; - - forAll (times, timeIndex) - { - if (times[timeIndex].name() == "constant") continue; - - scalar diff = fabs(times[timeIndex].value() - requestedTime); - if (diff < nearestDiff) - { - nearestDiff = diff; - nearestIndex = timeIndex; - } - } + int nearestIndex = Time::findClosestTimeIndex(Times, requestedTime); if (nearestIndex == -1) { @@ -212,12 +198,12 @@ bool Foam::vtkPV3Foam::setTime(const double& requestedTime) found = true; } - runTime.setTime(times[nearestIndex], nearestIndex); + runTime.setTime(Times[nearestIndex], nearestIndex); if (debug) { Info<< " Foam::vtkPV3Foam::setTime() - selected time " - << times[nearestIndex].name() << endl; + << Times[nearestIndex].name() << endl; } return found; diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index dd1e944067..ef4fb9c21f 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -418,19 +418,55 @@ Foam::instant Foam::Time::findClosestTime(const scalar t) const return times[times.size() - 1]; } + label nearestIndex = -1; scalar deltaT = GREAT; - label closesti = 0; for (label i=1; i Date: Fri, 25 Jul 2008 16:04:32 +0200 Subject: [PATCH 05/16] minor cleanup of Allwmake - Remove paraFoam/Allwmake leftover junk - Always attempt make of libccmio to ensure lnInclude/ exists --- applications/utilities/mesh/conversion/Optional/Allwmake | 7 ++----- .../postProcessing/graphics/fieldview9Reader/Allwmake | 9 +++++++-- .../utilities/postProcessing/graphics/paraFoam/Allwmake | 0 3 files changed, 9 insertions(+), 7 deletions(-) delete mode 100755 applications/utilities/postProcessing/graphics/paraFoam/Allwmake diff --git a/applications/utilities/mesh/conversion/Optional/Allwmake b/applications/utilities/mesh/conversion/Optional/Allwmake index 31617e3b12..ca1fbac090 100755 --- a/applications/utilities/mesh/conversion/Optional/Allwmake +++ b/applications/utilities/mesh/conversion/Optional/Allwmake @@ -5,15 +5,12 @@ set -x # run from this directory only cd ${0%/*} || exit 1 -# build libccmio if required -if [ ! -e $FOAM_LIBBIN/libccmio.so ] -then +# build libccmio and create lnInclude directory ( cd $WM_THIRD_PARTY_DIR && ./AllwmakeLibccmio ) -fi -# if the library built okay, the headers must exist too +# if the library built okay, the headers should exist too if [ -e $FOAM_LIBBIN/libccmio.so ] then wmake ccm26ToFoam diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake b/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake index ff9f5f412e..a2dc313fb1 100755 --- a/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake +++ b/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake @@ -1,3 +1,8 @@ -#if [ "$FV_HOME" -a -r $FV_HOME ] ; then +#!/bin/sh + +# disabled + +# if [ "$FV_HOME" -a -r $FV_HOME ] +# then # wmake fieldview9Reader -#fi +# fi diff --git a/applications/utilities/postProcessing/graphics/paraFoam/Allwmake b/applications/utilities/postProcessing/graphics/paraFoam/Allwmake deleted file mode 100755 index e69de29bb2..0000000000 From 6663702c457a17cb59430c8f5754d969f5b63f32 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 25 Jul 2008 18:01:06 +0100 Subject: [PATCH 06/16] cleaned up output message (removed dims etc) --- .../utilities/postProcessing/wall/yPlusLES/yPlusLES.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.C b/applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.C index c5524896c1..d7c145b953 100644 --- a/applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.C +++ b/applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.C @@ -107,11 +107,12 @@ int main(int argc, char *argv[]) *mag(U.boundaryField()[patchi].snGrad()) ) /sgsModel->nu().boundaryField()[patchi]; + const scalarField& Yp = yPlus.boundaryField()[patchi]; Info<< "Patch " << patchi << " named " << currPatch.name() - << " y+ : min: " << min(yPlus) << " max: " << max(yPlus) - << " average: " << average(yPlus) << nl << endl; + << " y+ : min: " << min(Yp) << " max: " << max(Yp) + << " average: " << average(Yp) << nl << endl; } } From e2d12e73067ddc5557796f5340f5581c7393e86f Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 28 Jul 2008 10:30:50 +0200 Subject: [PATCH 07/16] cuttingPlane : handle cutting planes that coincide with a mesh face --- src/sampling/cuttingPlane/cuttingPlane.C | 31 ++++++++++++++++++++---- src/sampling/cuttingPlane/cuttingPlane.H | 4 +++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/sampling/cuttingPlane/cuttingPlane.C b/src/sampling/cuttingPlane/cuttingPlane.C index f546c31dbe..472d30e782 100644 --- a/src/sampling/cuttingPlane/cuttingPlane.C +++ b/src/sampling/cuttingPlane/cuttingPlane.C @@ -29,6 +29,15 @@ License #include "linePointRef.H" #include "meshTools.H" +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +// set values for what is close to zero and what is considered to +// be positive (and not just rounding noise) +//! @cond localScope +const Foam::scalar zeroish = Foam::SMALL; +const Foam::scalar positive = Foam::SMALL * 1E3; +//! @endcond localScope + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // Find cut cells @@ -71,8 +80,8 @@ void Foam::cuttingPlane::calcCutCells if ( - (dotProducts[e[0]] < 0 && dotProducts[e[1]] > 0) - || (dotProducts[e[1]] < 0 && dotProducts[e[0]] > 0) + (dotProducts[e[0]] < zeroish && dotProducts[e[1]] > positive) + || (dotProducts[e[1]] < zeroish && dotProducts[e[0]] > positive) ) { nCutEdges++; @@ -116,8 +125,8 @@ Foam::labelList Foam::cuttingPlane::intersectEdges if ( - (dotProducts[e[0]] < 0 && dotProducts[e[1]] > 0) - || (dotProducts[e[1]] < 0 && dotProducts[e[0]] > 0) + (dotProducts[e[0]] < zeroish && dotProducts[e[1]] > positive) + || (dotProducts[e[1]] < zeroish && dotProducts[e[0]] > positive) ) { // Edge is cut. @@ -126,7 +135,19 @@ Foam::labelList Foam::cuttingPlane::intersectEdges scalar alpha = lineIntersect(linePointRef(p0, p1)); - dynCuttingPoints.append((1-alpha)*p0 + alpha*p1); + if (alpha < zeroish) + { + dynCuttingPoints.append(p0); + } + else if (alpha > 1.0) + { + dynCuttingPoints.append(p1); + } + else + { + dynCuttingPoints.append((1-alpha)*p0 + alpha*p1); + } + edgePoint[edgeI] = dynCuttingPoints.size() - 1; } } diff --git a/src/sampling/cuttingPlane/cuttingPlane.H b/src/sampling/cuttingPlane/cuttingPlane.H index 32dec6908d..3e33be9da7 100644 --- a/src/sampling/cuttingPlane/cuttingPlane.H +++ b/src/sampling/cuttingPlane/cuttingPlane.H @@ -30,6 +30,10 @@ Description No attempt at resolving degenerate cases. +Note + When the cutting plane coincides with a mesh face, the cell edge on the + positive side of the plane is taken. + SourceFiles cuttingPlane.C From f8b27463273118b82ab45fd8dcfe3a36c35ca86a Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 28 Jul 2008 13:36:23 +0200 Subject: [PATCH 08/16] PV3FoamReader reorganization - vtkPV3Foam get PrintSelf (reduces number of methods) - move output data member from vtkPV3Foam -> PV3FoamReader in preparation for rewriting output method - roughed in code to track mesh/field changes in preparation for rewriting output method - progress bar with arbitrary values to give the user something to watch --- .../PV3FoamReader/vtkPV3FoamReader.cxx | 81 ++-------- .../PV3FoamReader/vtkPV3FoamReader.h | 3 + .../PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C | 147 ++++++++++-------- .../PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H | 41 ++--- .../vtkPV3Foam/vtkPV3FoamConvertMesh.C | 8 +- .../vtkPV3Foam/vtkPV3FoamConvertVolFields.H | 7 +- .../vtkPV3Foam/vtkPV3FoamUpdate.C | 2 + .../vtkPV3Foam/vtkPV3FoamUpdateInformation.C | 86 +++++----- 8 files changed, 172 insertions(+), 203 deletions(-) diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx index b44d919d6f..81885deee7 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx @@ -47,6 +47,8 @@ vtkPV3FoamReader::vtkPV3FoamReader() FileName = NULL; foamData_ = NULL; + output1_ = NULL; + TimeStep = 0; TimeStepRange[0] = 0; TimeStepRange[1] = 0; @@ -61,7 +63,6 @@ vtkPV3FoamReader::vtkPV3FoamReader() UpdateGUI = 1; UpdateGUIOld = 1; - RegionSelection = vtkDataArraySelection::New(); VolFieldSelection = vtkDataArraySelection::New(); PointFieldSelection = vtkDataArraySelection::New(); @@ -148,38 +149,6 @@ int vtkPV3FoamReader::RequestInformation return 0; } - if (Foam::vtkPV3Foam::debug) - { - vtkInformation* outputInfo = this->GetOutputPortInformation(0); - - vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast - ( - outputInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT()) - ); - - outputInfo->Print(cout); - if (output) - { - output->Print(cout); - } - else - { - cout<< "no output\n"; - } - - this->GetExecutive()->GetOutputInformation(0)->Print(cout); - - int nInfo = outputVector->GetNumberOfInformationObjects(); - - cout<< "requestInfo with " << nInfo << " items:\n"; - - for (int i = 0; i < nInfo; ++i) - { - vtkInformation *info = outputVector->GetInformationObject(i); - info->Print(cout); - } - } - vtkInformation *outInfo = outputVector->GetInformationObject(0); if (!foamData_) @@ -189,17 +158,22 @@ int vtkPV3FoamReader::RequestInformation ( outInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT()) ); - foamData_ = new Foam::vtkPV3Foam(FileName, this, output); - foamData_->UpdateInformation(); + + if (Foam::vtkPV3Foam::debug) + { + cout<< "constructed vtkPV3Foam with output: "; + output->Print(cout); + } + + foamData_ = new Foam::vtkPV3Foam(FileName, this); } else { - vtkDebugMacro("RequestInformation: updating information"); foamData_->UpdateInformation(); } int nTimeSteps = 0; - double* timeSteps = foamData_->timeSteps(nTimeSteps); + double* timeSteps = foamData_->findTimes(nTimeSteps); outInfo->Set ( @@ -402,27 +376,20 @@ void vtkPV3FoamReader::removePatchNamesFromView() } -void vtkPV3FoamReader::PrintSelf -( - ostream& os, - vtkIndent indent -) +void vtkPV3FoamReader::PrintSelf(ostream& os, vtkIndent indent) { vtkDebugMacro(<<"PrintSelf"); this->Superclass::PrintSelf(os,indent); os<< indent << "File name: " << (this->FileName ? this->FileName : "(none)") << "\n"; - os<< indent << "Number of meshes: " << foamData_->numberOfMeshes() << "\n"; - os<< indent << "Number of nodes: " << foamData_->numberOfPoints() << "\n"; - os<< indent << "Number of cells: " << foamData_->numberOfCells() << "\n"; - os<< indent << "Number of available time steps: " << foamData_->numberOfAvailableTimes() - << endl; + + foamData_->PrintSelf(os, indent); + os<< indent << "Time step range: " << this->TimeStepRange[0] << " - " << this->TimeStepRange[1] - << endl; + << "\n"; os<< indent << "Time step: " << this->TimeStep << endl; - return; } @@ -478,7 +445,6 @@ void vtkPV3FoamReader::SetRegionArrayStatus(const char* name, int status) vtkDataArraySelection* vtkPV3FoamReader::GetVolFieldSelection() { vtkDebugMacro(<<"GetVolFieldSelection"); - return VolFieldSelection; } @@ -486,7 +452,6 @@ vtkDataArraySelection* vtkPV3FoamReader::GetVolFieldSelection() int vtkPV3FoamReader::GetNumberOfVolFieldArrays() { vtkDebugMacro(<<"GetNumberOfVolFieldArrays"); - return VolFieldSelection->GetNumberOfArrays(); } @@ -494,7 +459,6 @@ int vtkPV3FoamReader::GetNumberOfVolFieldArrays() const char* vtkPV3FoamReader::GetVolFieldArrayName(int index) { vtkDebugMacro(<<"GetVolFieldArrayName"); - return VolFieldSelection->GetArrayName(index); } @@ -502,7 +466,6 @@ const char* vtkPV3FoamReader::GetVolFieldArrayName(int index) int vtkPV3FoamReader::GetVolFieldArrayStatus(const char* name) { vtkDebugMacro(<<"GetVolFieldArrayStatus"); - return VolFieldSelection->ArrayIsEnabled(name); } @@ -510,7 +473,6 @@ int vtkPV3FoamReader::GetVolFieldArrayStatus(const char* name) void vtkPV3FoamReader::SetVolFieldArrayStatus(const char* name, int status) { vtkDebugMacro(<<"SetVolFieldArrayStatus"); - if (status) { VolFieldSelection->EnableArray(name); @@ -528,7 +490,6 @@ void vtkPV3FoamReader::SetVolFieldArrayStatus(const char* name, int status) vtkDataArraySelection* vtkPV3FoamReader::GetPointFieldSelection() { vtkDebugMacro(<<"GetPointFieldSelection"); - return PointFieldSelection; } @@ -536,7 +497,6 @@ vtkDataArraySelection* vtkPV3FoamReader::GetPointFieldSelection() int vtkPV3FoamReader::GetNumberOfPointFieldArrays() { vtkDebugMacro(<<"GetNumberOfPointFieldArrays"); - return PointFieldSelection->GetNumberOfArrays(); } @@ -544,7 +504,6 @@ int vtkPV3FoamReader::GetNumberOfPointFieldArrays() const char* vtkPV3FoamReader::GetPointFieldArrayName(int index) { vtkDebugMacro(<<"GetPointFieldArrayName"); - return PointFieldSelection->GetArrayName(index); } @@ -552,7 +511,6 @@ const char* vtkPV3FoamReader::GetPointFieldArrayName(int index) int vtkPV3FoamReader::GetPointFieldArrayStatus(const char* name) { vtkDebugMacro(<<"GetPointFieldArrayStatus"); - return PointFieldSelection->ArrayIsEnabled(name); } @@ -560,7 +518,6 @@ int vtkPV3FoamReader::GetPointFieldArrayStatus(const char* name) void vtkPV3FoamReader::SetPointFieldArrayStatus(const char* name, int status) { vtkDebugMacro(<<"SetPointFieldArrayStatus"); - if (status) { PointFieldSelection->EnableArray(name); @@ -578,7 +535,6 @@ void vtkPV3FoamReader::SetPointFieldArrayStatus(const char* name, int status) vtkDataArraySelection* vtkPV3FoamReader::GetLagrangianFieldSelection() { vtkDebugMacro(<<"GetLagrangianFieldSelection"); - return LagrangianFieldSelection; } @@ -586,7 +542,6 @@ vtkDataArraySelection* vtkPV3FoamReader::GetLagrangianFieldSelection() int vtkPV3FoamReader::GetNumberOfLagrangianFieldArrays() { vtkDebugMacro(<<"GetNumberOfLagrangianFieldArrays"); - return LagrangianFieldSelection->GetNumberOfArrays(); } @@ -594,7 +549,6 @@ int vtkPV3FoamReader::GetNumberOfLagrangianFieldArrays() const char* vtkPV3FoamReader::GetLagrangianFieldArrayName(int index) { vtkDebugMacro(<<"GetLagrangianFieldArrayName"); - return LagrangianFieldSelection->GetArrayName(index); } @@ -602,7 +556,6 @@ const char* vtkPV3FoamReader::GetLagrangianFieldArrayName(int index) int vtkPV3FoamReader::GetLagrangianFieldArrayStatus(const char* name) { vtkDebugMacro(<<"GetLagrangianFieldArrayStatus"); - return LagrangianFieldSelection->ArrayIsEnabled(name); } @@ -614,7 +567,6 @@ void vtkPV3FoamReader::SetLagrangianFieldArrayStatus ) { vtkDebugMacro(<<"SetLagrangianFieldArrayStatus"); - if (status) { LagrangianFieldSelection->EnableArray(name); @@ -642,7 +594,6 @@ void vtkPV3FoamReader::SelectionModifiedCallback void vtkPV3FoamReader::SelectionModified() { vtkDebugMacro(<<"SelectionModified"); - Modified(); } diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h index 0878bc5c56..8611884b51 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h @@ -191,6 +191,9 @@ private: vtkDataArraySelection* PointFieldSelection; vtkDataArraySelection* LagrangianFieldSelection; + //- Access to the output port1 + vtkMultiBlockDataSet* output1_; + //BTX Foam::vtkPV3Foam* foamData_; //ETX diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index 7fab0ec3f9..7cc7fc8698 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C @@ -198,12 +198,34 @@ bool Foam::vtkPV3Foam::setTime(const double& requestedTime) found = true; } - runTime.setTime(Times[nearestIndex], nearestIndex); + // see what has changed + if (timeIndex_ != nearestIndex) + { + timeIndex_ = nearestIndex; + runTime.setTime(Times[nearestIndex], nearestIndex); + + // the fields change each time + fieldsChanged_ = true; + + if (meshPtr_) + { + if (meshPtr_->readUpdate() != polyMesh::UNCHANGED) + { + meshChanged_ = true; + } + } + else + { + meshChanged_ = true; + } + } if (debug) { Info<< " Foam::vtkPV3Foam::setTime() - selected time " - << Times[nearestIndex].name() << endl; + << Times[nearestIndex].name() << " index=" << nearestIndex + << " meshChanged=" << meshChanged_ + << " fieldsChanged=" << fieldsChanged_ << endl; } return found; @@ -221,13 +243,26 @@ void Foam::vtkPV3Foam::updateSelectedRegions() const label nSelect = arraySelection->GetNumberOfArrays(); - selectedRegions_.setSize(nSelect); + if (selectedRegions_.size() != nSelect) + { + selectedRegions_.setSize(nSelect); + selectedRegions_ = 0; + meshChanged_ = true; + } + selectedRegionDatasetIds_.setSize(nSelect); - // Read the selected patches and add to the region list + // Read the selected cell regions, zones, patches and add to region list forAll (selectedRegions_, regionId) { - selectedRegions_[regionId] = arraySelection->GetArraySetting(regionId); + int setting = arraySelection->GetArraySetting(regionId); + + if (selectedRegions_[regionId] != setting) + { + selectedRegions_[regionId] = setting; + meshChanged_ = true; + } + selectedRegionDatasetIds_[regionId] = -1; if (debug) @@ -421,12 +456,10 @@ void Foam::vtkPV3Foam::setSelectedArrayEntries Foam::vtkPV3Foam::vtkPV3Foam ( const char* const FileName, - vtkPV3FoamReader* reader, - vtkMultiBlockDataSet* output + vtkPV3FoamReader* reader ) : reader_(reader), - output_(output), dbPtr_(NULL), meshPtr_(NULL), selectInfoVolume_(VOLUME, "unzoned"), @@ -439,7 +472,10 @@ Foam::vtkPV3Foam::vtkPV3Foam selectInfoFaceSets_(FACESET, "faceSet"), selectInfoPointSets_(POINTSET, "pointSet"), patchTextActorsPtrs_(0), - nMesh_(0) + nMesh_(0), + timeIndex_(-1), + meshChanged_(true), + fieldsChanged_(true) { if (debug) { @@ -487,17 +523,11 @@ Foam::vtkPV3Foam::vtkPV3Foam dbPtr_().functionObjects().off(); - if (debug) - { - cout<< "constructed with output: "; - output_->Print(cout); - } - - resetCounters(); - // Set initial cloud name // TODO - TEMPORARY MEASURE UNTIL CAN PROCESS MULTIPLE CLOUDS cloudName_ = ""; + + UpdateInformation(); } @@ -574,6 +604,11 @@ void Foam::vtkPV3Foam::UpdateInformation() selectedEntries ); + if (meshChanged_) + { + fieldsChanged_ = true; + } + // Update volField array updateInformationFields ( @@ -609,22 +644,23 @@ void Foam::vtkPV3Foam::Update output->Print(cout); cout<<"Internally:\n"; - output_->Print(cout); + output->Print(cout); - cout<< " has " << output_->GetNumberOfBlocks() << " blocks\n"; + cout<< " has " << output->GetNumberOfBlocks() << " blocks\n"; } - // Set up region selection(s) updateSelectedRegions(); // Update the Foam mesh updateFoamMesh(); + reader_->UpdateProgress(0.2); // Convert meshes convertMeshVolume(output); convertMeshLagrangian(output); convertMeshPatches(output); + reader_->UpdateProgress(0.4); if (reader_->GetIncludeZones()) { @@ -639,11 +675,13 @@ void Foam::vtkPV3Foam::Update convertMeshFaceSets(output); convertMeshPointSets(output); } + reader_->UpdateProgress(0.8); // Update fields updateVolFields(output); updatePointFields(output); updateLagrangianFields(output); + reader_->UpdateProgress(1.0); if (debug) { @@ -670,16 +708,18 @@ void Foam::vtkPV3Foam::Update // traverse blocks: cout<< "nBlocks = " << output->GetNumberOfBlocks() << "\n"; cout<< "done Update\n"; - output_->Print(cout); - cout<< " has " << output_->GetNumberOfBlocks() << " blocks\n"; - output_->GetInformation()->Print(cout); + output->Print(cout); + cout<< " has " << output->GetNumberOfBlocks() << " blocks\n"; + output->GetInformation()->Print(cout); - cout<<"ShouldIReleaseData :" << output_->ShouldIReleaseData() << "\n"; + cout<<"ShouldIReleaseData :" << output->ShouldIReleaseData() << "\n"; } + + meshChanged_ = fieldsChanged_ = false; } -double* Foam::vtkPV3Foam::timeSteps(int& nTimeSteps) +double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps) { int nTimes = 0; double* tsteps = NULL; @@ -687,10 +727,10 @@ double* Foam::vtkPV3Foam::timeSteps(int& nTimeSteps) if (dbPtr_.valid()) { Time& runTime = dbPtr_(); - instantList times = runTime.times(); + instantList timeLst = runTime.times(); // always skip "constant" time, unless there are no other times - nTimes = times.size(); + nTimes = timeLst.size(); label timeI = 0; if (nTimes > 1) @@ -704,7 +744,7 @@ double* Foam::vtkPV3Foam::timeSteps(int& nTimeSteps) tsteps = new double[nTimes]; for (label stepI = 0; stepI < nTimes; ++stepI, ++timeI) { - tsteps[stepI] = times[timeI].value(); + tsteps[stepI] = timeLst[timeI].value(); } } } @@ -924,48 +964,17 @@ void Foam::vtkPV3Foam::removePatchNames(vtkRenderer* renderer) } -int Foam::vtkPV3Foam::numberOfAvailableTimes() const +void Foam::vtkPV3Foam::PrintSelf(ostream& os, vtkIndent indent) const { - if (dbPtr_.valid()) - { - return dbPtr_().times().size(); - } - else - { - return 0; - } + os << indent << "Number of meshes: " << nMesh_ << "\n"; + os << indent << "Number of nodes: " + << (meshPtr_ ? meshPtr_->nPoints() : 0) << "\n"; + + os << indent << "Number of cells: " + << (meshPtr_ ? meshPtr_->nCells() : 0) << "\n"; + + os << indent << "Number of available time steps: " + << (dbPtr_.valid() ? dbPtr_().times().size() : 0) << endl; } - -int Foam::vtkPV3Foam::numberOfPoints() -{ - if (meshPtr_) - { - return meshPtr_->nPoints(); - } - else - { - return 0; - } -} - - -int Foam::vtkPV3Foam::numberOfCells() -{ - if (meshPtr_) - { - return meshPtr_->nCells(); - } - { - return 0; - } -} - - -int Foam::vtkPV3Foam::numberOfMeshes() const -{ - return nMesh_; -} - - // ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index 39f52c2f32..b8f75c6939 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -69,13 +69,14 @@ SourceFiles class vtkDataArraySelection; class vtkDataSet; -class vtkMultiBlockDataSet; class vtkPoints; class vtkPV3FoamReader; class vtkRenderer; class vtkTextActor; +class vtkMultiBlockDataSet; class vtkPolyData; class vtkUnstructuredGrid; +class vtkIndent; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -195,9 +196,6 @@ private: //- Access to the controlling vtkPV3FoamReader vtkPV3FoamReader* reader_; - //- Access to the output block - vtkMultiBlockDataSet* output_; - //- Foam time control autoPtr