diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml index ef25ac03786e43e5dd407cd7ef992d6b1c3b91b4..a78bceb7d5495847af7734fe3e896d589fc639d5 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml @@ -106,7 +106,7 @@ animateable="0"> <BooleanDomain name="bool"/> <Documentation> - A simple way cause a reader GUI modification. + A simple way to cause a reader GUI modification. </Documentation> </IntVectorProperty> diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx index 47e919c9c310efda544786f239c8904977f4ee55..55964e95407a3d4bdf6ab2a03075efce68009515 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx @@ -385,14 +385,7 @@ int vtkPV3FoamReader::RequestData foamData_->Update(output, output); #endif - if (ShowPatchNames) - { - addPatchNamesToView(); - } - else - { - removePatchNamesFromView(); - } + updatePatchNamesView(ShowPatchNames); #endif @@ -403,27 +396,7 @@ int vtkPV3FoamReader::RequestData } -void vtkPV3FoamReader::addPatchNamesToView() -{ - pqApplicationCore* appCore = pqApplicationCore::instance(); - - // Server manager model for querying items in the server manager - pqServerManagerModel* smModel = appCore->getServerManagerModel(); - - // Get all the pqRenderView instances - QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>(); - - for (int viewI=0; viewI<renderViews.size(); viewI++) - { - foamData_->addPatchNames - ( - renderViews[viewI]->getRenderViewProxy()->GetRenderer() - ); - } -} - - -void vtkPV3FoamReader::removePatchNamesFromView() +void vtkPV3FoamReader::updatePatchNamesView(const bool show) { pqApplicationCore* appCore = pqApplicationCore::instance(); @@ -435,9 +408,10 @@ void vtkPV3FoamReader::removePatchNamesFromView() for (int viewI=0; viewI<renderViews.size(); viewI++) { - foamData_->removePatchNames + foamData_->renderPatchNames ( - renderViews[viewI]->getRenderViewProxy()->GetRenderer() + renderViews[viewI]->getRenderViewProxy()->GetRenderer(), + show ); } } diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h index bc21cd8ce816978129720a4822454c455897780d..4a6eb3723edb3d67fc27a876c5cd32613ef72b01 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h @@ -174,11 +174,8 @@ private: //- Disallow default bitwise assignment void operator=(const vtkPV3FoamReader&); - //- Add patch names to the view - void addPatchNamesToView(); - - //- Remove patch names from the view - void removePatchNamesFromView(); + //- Add/remove patch names to/from the view + void updatePatchNamesView(const bool show); int TimeStepRange[2]; int CacheMesh; diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPoints.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMPoints.H similarity index 91% rename from applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPoints.H rename to applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMPoints.H index adb4d724b0019f5fd9036b9d667e6ad92ac66969..6e90e75db006f1f4a2cd045ca2e7b26767c650d1 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPoints.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMPoints.H @@ -27,15 +27,15 @@ InClass \*---------------------------------------------------------------------------*/ -#ifndef vtkPV3FoamPoints_H -#define vtkPV3FoamPoints_H +#ifndef vtkOpenFOAMPoints_H +#define vtkOpenFOAMPoints_H // VTK includes #include "vtkPoints.h" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -inline void vtkPV3FoamInsertNextPoint +inline void vtkInsertNextOpenFOAMPoint ( vtkPoints *points, const Foam::point& p @@ -46,7 +46,7 @@ inline void vtkPV3FoamInsertNextPoint #if 0 // this should be faster, but didn't get it working ... -inline void vtkPV3FoamSetPoint +inline void vtkSetOpenFOAMPoint ( vtkPoints *points, const Foam::label id, @@ -58,7 +58,7 @@ inline void vtkPV3FoamSetPoint // Convert Foam mesh vertices to VTK -inline vtkPoints* vtkPV3FoamVTKPoints(const Foam::pointField& points) +inline vtkPoints* vtkSetOpenFOAMPoints(const Foam::pointField& points) { vtkPoints *vtkpoints = vtkPoints::New(); vtkpoints->SetNumberOfPoints(points.size()); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index 34628ac9d1ed1a6afa49ef128625ba8b661c6bf6..6a5ab601fb4be12d8f3d424b4f661bf84da1e51a 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C @@ -590,219 +590,203 @@ double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps) } -void Foam::vtkPV3Foam::addPatchNames(vtkRenderer* renderer) +void Foam::vtkPV3Foam::renderPatchNames(vtkRenderer* renderer, const bool show) { - // Remove any patch names previously added to the renderer - removePatchNames(renderer); + // always remove old actors first - // get the display patches, strip off any suffix - wordHashSet selectedPatches = getSelected - ( - reader_->GetPartSelection(), - partInfoPatches_ - ); - - if (!selectedPatches.size()) + forAll(patchTextActorsPtrs_, patchI) { - return; + renderer->RemoveViewProp(patchTextActorsPtrs_[patchI]); + patchTextActorsPtrs_[patchI]->Delete(); } + patchTextActorsPtrs_.clear(); - if (debug) + if (show) { - Info<< "<beg> Foam::vtkPV3Foam::addPatchNames" << nl - <<"... add patches: " << selectedPatches << endl; - } + // get the display patches, strip off any suffix + wordHashSet selectedPatches = getSelected + ( + reader_->GetPartSelection(), + partInfoPatches_ + ); - const polyBoundaryMesh& pbMesh = meshPtr_->boundaryMesh(); + if (!selectedPatches.size()) + { + return; + } - // Find the total number of zones - // Each zone will take the patch name - // Number of zones per patch ... zero zones should be skipped - labelList nZones(pbMesh.size(), 0); + const polyBoundaryMesh& pbMesh = meshPtr_->boundaryMesh(); - // Per global zone number the average face centre position - DynamicList<point> zoneCentre(pbMesh.size()); + // Find the total number of zones + // Each zone will take the patch name + // Number of zones per patch ... zero zones should be skipped + labelList nZones(pbMesh.size(), 0); - if (debug) - { - Info<< "... determining patch zones" << endl; - } + // Per global zone number the average face centre position + DynamicList<point> zoneCentre(pbMesh.size()); - // Loop through all patches to determine zones, and centre of each zone - forAll(pbMesh, patchI) - { - const polyPatch& pp = pbMesh[patchI]; - // Only include the patch if it is selected - if (!selectedPatches.found(pp.name())) + // Loop through all patches to determine zones, and centre of each zone + forAll(pbMesh, patchI) { - continue; - } + const polyPatch& pp = pbMesh[patchI]; - const labelListList& edgeFaces = pp.edgeFaces(); - const vectorField& n = pp.faceNormals(); + // Only include the patch if it is selected + if (!selectedPatches.found(pp.name())) + { + continue; + } - boolList featEdge(pp.nEdges(), false); + const labelListList& edgeFaces = pp.edgeFaces(); + const vectorField& n = pp.faceNormals(); - forAll(edgeFaces, edgeI) - { - const labelList& eFaces = edgeFaces[edgeI]; + boolList featEdge(pp.nEdges(), false); - if (eFaces.size() == 1) + forAll(edgeFaces, edgeI) { - // Note: could also do ones with > 2 faces but this gives - // too many zones for baffles - featEdge[edgeI] = true; + const labelList& eFaces = edgeFaces[edgeI]; + + if (eFaces.size() == 1) + { + // Note: could also do ones with > 2 faces but this gives + // too many zones for baffles + featEdge[edgeI] = true; + } + else if (mag(n[eFaces[0]] & n[eFaces[1]]) < 0.5) + { + featEdge[edgeI] = true; + } } - else if (mag(n[eFaces[0]] & n[eFaces[1]]) < 0.5) - { - featEdge[edgeI] = true; - } - } - // Do topological analysis of patch, find disconnected regions - patchZones pZones(pp, featEdge); + // Do topological analysis of patch, find disconnected regions + patchZones pZones(pp, featEdge); - nZones[patchI] = pZones.nZones(); + nZones[patchI] = pZones.nZones(); - labelList zoneNFaces(pZones.nZones(), 0); + labelList zoneNFaces(pZones.nZones(), 0); - // Save start of information for current patch - label patchStart = zoneCentre.size(); + // Save start of information for current patch + label patchStart = zoneCentre.size(); - // Create storage for additional zone centres - forAll(zoneNFaces, zoneI) - { - zoneCentre.append(vector::zero); - } + // Create storage for additional zone centres + forAll(zoneNFaces, zoneI) + { + zoneCentre.append(vector::zero); + } - // Do averaging per individual zone - forAll(pp, faceI) - { - label zoneI = pZones[faceI]; - zoneCentre[patchStart+zoneI] += pp[faceI].centre(pp.points()); - zoneNFaces[zoneI]++; - } + // Do averaging per individual zone + forAll(pp, faceI) + { + label zoneI = pZones[faceI]; + zoneCentre[patchStart+zoneI] += pp[faceI].centre(pp.points()); + zoneNFaces[zoneI]++; + } - for (label i=0; i<nZones[patchI]; i++) - { - zoneCentre[patchStart + i] /= zoneNFaces[i]; + for (label i=0; i<nZones[patchI]; i++) + { + zoneCentre[patchStart + i] /= zoneNFaces[i]; + } } - } - - // Count number of zones we're actually going to display. This is truncated - // to a max per patch - const label MAXPATCHZONES = 20; + // Count number of zones we're actually going to display. This is truncated + // to a max per patch - label displayZoneI = 0; + const label MAXPATCHZONES = 20; - forAll(pbMesh, patchI) - { - displayZoneI += min(MAXPATCHZONES, nZones[patchI]); - } + label displayZoneI = 0; + forAll(pbMesh, patchI) + { + displayZoneI += min(MAXPATCHZONES, nZones[patchI]); + } - zoneCentre.shrink(); - if (debug) - { - Info<< "patch zone centres = " << zoneCentre << nl - << "displayed zone centres = " << displayZoneI << nl - << "zones per patch = " << nZones << endl; - } + zoneCentre.shrink(); - // Set the size of the patch labels to max number of zones - patchTextActorsPtrs_.setSize(displayZoneI); + if (debug) + { + Info<< "patch zone centres = " << zoneCentre << nl + << "displayed zone centres = " << displayZoneI << nl + << "zones per patch = " << nZones << endl; + } - if (debug) - { - Info<< "constructing patch labels" << endl; - } + // Set the size of the patch labels to max number of zones + patchTextActorsPtrs_.setSize(displayZoneI); - // Actor index - displayZoneI = 0; + if (debug) + { + Info<< "constructing patch labels" << endl; + } - // Index in zone centres - label globalZoneI = 0; + // Actor index + displayZoneI = 0; - forAll(pbMesh, patchI) - { - const polyPatch& pp = pbMesh[patchI]; + // Index in zone centres + label globalZoneI = 0; - // Only selected patches will have a non-zero number of zones - label nDisplayZones = min(MAXPATCHZONES, nZones[patchI]); - label increment = 1; - if (nZones[patchI] >= MAXPATCHZONES) + forAll(pbMesh, patchI) { - increment = nZones[patchI]/MAXPATCHZONES; - } + const polyPatch& pp = pbMesh[patchI]; - for (label i = 0; i < nDisplayZones; i++) - { - if (debug) + // Only selected patches will have a non-zero number of zones + label nDisplayZones = min(MAXPATCHZONES, nZones[patchI]); + label increment = 1; + if (nZones[patchI] >= MAXPATCHZONES) { - Info<< "patch name = " << pp.name() << nl - << "anchor = " << zoneCentre[globalZoneI] << nl - << "globalZoneI = " << globalZoneI << endl; + increment = nZones[patchI]/MAXPATCHZONES; } - vtkTextActor* txt = vtkTextActor::New(); - - txt->SetInput(pp.name().c_str()); - - // Set text properties - vtkTextProperty* tprop = txt->GetTextProperty(); - tprop->SetFontFamilyToArial(); - tprop->BoldOff(); - tprop->ShadowOff(); - tprop->SetLineSpacing(1.0); - tprop->SetFontSize(12); - tprop->SetColor(1.0, 0.0, 0.0); - tprop->SetJustificationToCentered(); - - // Set text to use 3-D world co-ordinates - txt->GetPositionCoordinate()->SetCoordinateSystemToWorld(); - - txt->GetPositionCoordinate()->SetValue - ( - zoneCentre[globalZoneI].x(), - zoneCentre[globalZoneI].y(), - zoneCentre[globalZoneI].z() - ); - - // Add text to each renderer - renderer->AddViewProp(txt); - - // Maintain a list of text labels added so that they can be - // removed later - patchTextActorsPtrs_[displayZoneI] = txt; - - globalZoneI += increment; - displayZoneI++; + for (label i = 0; i < nDisplayZones; i++) + { + if (debug) + { + Info<< "patch name = " << pp.name() << nl + << "anchor = " << zoneCentre[globalZoneI] << nl + << "globalZoneI = " << globalZoneI << endl; + } + + vtkTextActor* txt = vtkTextActor::New(); + + txt->SetInput(pp.name().c_str()); + + // Set text properties + vtkTextProperty* tprop = txt->GetTextProperty(); + tprop->SetFontFamilyToArial(); + tprop->BoldOff(); + tprop->ShadowOff(); + tprop->SetLineSpacing(1.0); + tprop->SetFontSize(12); + tprop->SetColor(1.0, 0.0, 0.0); + tprop->SetJustificationToCentered(); + + // Set text to use 3-D world co-ordinates + txt->GetPositionCoordinate()->SetCoordinateSystemToWorld(); + + txt->GetPositionCoordinate()->SetValue + ( + zoneCentre[globalZoneI].x(), + zoneCentre[globalZoneI].y(), + zoneCentre[globalZoneI].z() + ); + + // Add text to each renderer + renderer->AddViewProp(txt); + + // Maintain a list of text labels added so that they can be + // removed later + patchTextActorsPtrs_[displayZoneI] = txt; + + globalZoneI += increment; + displayZoneI++; + } } - } - // Resize the patch names list to the actual number of patch names added - patchTextActorsPtrs_.setSize(displayZoneI); - - if (debug) - { - Info<< "<end> Foam::vtkPV3Foam::addPatchNames" << endl; + // Resize the patch names list to the actual number of patch names added + patchTextActorsPtrs_.setSize(displayZoneI); } } -void Foam::vtkPV3Foam::removePatchNames(vtkRenderer* renderer) -{ - forAll(patchTextActorsPtrs_, patchI) - { - renderer->RemoveViewProp(patchTextActorsPtrs_[patchI]); - patchTextActorsPtrs_[patchI]->Delete(); - } - patchTextActorsPtrs_.clear(); -} - void Foam::vtkPV3Foam::PrintSelf(ostream& os, vtkIndent indent) const { diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index 4e203eacec8e83c9f720257c21870c039a9ef5a4..d56b62d7d1dec87bd7e28d272cdaa09f15f30d94 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -31,7 +31,6 @@ Description SourceFiles vtkPV3Foam.C vtkPV3Foam.H - vtkPV3FoamI.H vtkPV3FoamFields.C vtkPV3FoamMesh.C vtkPV3FoamMeshLagrangian.C @@ -627,9 +626,6 @@ class vtkPV3Foam // GUI selection helper functions - //- Extract up to the first non-word characters - inline static word getFirstWord(const char*); - //- Only keep what is listed in hashSet static void pruneObjectList ( @@ -715,11 +711,8 @@ public: // returns the count via the parameter double* findTimes(int& nTimeSteps); - //- Add patch names to the display - void addPatchNames(vtkRenderer* renderer); - - //- Remove patch names from the display - void removePatchNames(vtkRenderer* renderer); + //- Add/remove patch names to/from the view + void renderPatchNames(vtkRenderer*, const bool show); //- set the runTime to the first plausible request time, // returns the timeIndex @@ -751,8 +744,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -# include "vtkPV3FoamI.H" - #endif // ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H deleted file mode 100644 index 626c90a7a425960acd8abc2fef199892cdd70b4b..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H +++ /dev/null @@ -1,48 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 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 - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -inline Foam::word Foam::vtkPV3Foam::getFirstWord(const char* str) -{ - if (str) - { - label n = 0; - while (str[n] && word::valid(str[n])) - { - ++n; - } - return word(str, n, true); - } - else - { - return word::null; - } -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C index 07d322d54250876e929526d46274ecf8e3bece92..e653b05adb5ada83590b9d1646f1434c5f2b0b8b 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C @@ -33,7 +33,7 @@ Description #include "fvMesh.H" #include "IOobjectList.H" #include "passiveParticle.H" -#include "vtkPV3FoamPoints.H" +#include "vtkOpenFOAMPoints.H" // VTK includes #include "vtkCellArray.h" @@ -86,7 +86,7 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh vtkIdType particleId = 0; forAllConstIter(Cloud<passiveParticle>, parcels, iter) { - vtkPV3FoamInsertNextPoint(vtkpoints, iter().position()); + vtkInsertNextOpenFOAMPoint(vtkpoints, iter().position()); vtkcells->InsertNextCell(1, &particleId); particleId++; diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C index 29e8d07020852cca5fe2c74fb74438e813a0824f..d7c0f2f013b6ff47eb3e4f5f6d1a03b7e10fce72 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C @@ -31,7 +31,7 @@ Description // Foam includes #include "polyPatch.H" #include "primitivePatch.H" -#include "vtkPV3FoamPoints.H" +#include "vtkOpenFOAMPoints.H" // VTK includes #include "vtkCellArray.h" @@ -60,7 +60,7 @@ vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh vtkpoints->Allocate( points.size() ); forAll(points, i) { - vtkPV3FoamInsertNextPoint(vtkpoints, points[i]); + vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); } vtkmesh->SetPoints(vtkpoints); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C index 7f08a215a3bc6e4db38136383a7d545fb67cca46..f363beae45c2588834788a4ff321b5de064f88e3 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C @@ -31,7 +31,7 @@ Description // Foam includes #include "faceSet.H" #include "pointSet.H" -#include "vtkPV3FoamPoints.H" +#include "vtkOpenFOAMPoints.H" // VTK includes #include "vtkPoints.h" @@ -75,7 +75,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceSetVTKMesh vtkpoints->Allocate( points.size() ); forAll(points, i) { - vtkPV3FoamInsertNextPoint(vtkpoints, points[i]); + vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); } vtkmesh->SetPoints(vtkpoints); vtkpoints->Delete(); @@ -132,7 +132,7 @@ vtkPolyData* Foam::vtkPV3Foam::pointSetVTKMesh forAllConstIter(pointSet, pSet, iter) { - vtkPV3FoamInsertNextPoint(vtkpoints, meshPoints[iter.key()]); + vtkInsertNextOpenFOAMPoint(vtkpoints, meshPoints[iter.key()]); } vtkmesh->SetPoints(vtkpoints); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C index 49f9016dc1ff2906a8bb5523b69e5b0efd462a8d..e1fd59ccd0d1c50262ac43d7c2d12b22b4b94020 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C @@ -31,7 +31,7 @@ Description // Foam includes #include "fvMesh.H" #include "cellModeller.H" -#include "vtkPV3FoamPoints.H" +#include "vtkOpenFOAMPoints.H" // VTK includes #include "vtkCellArray.h" @@ -143,7 +143,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh forAll(points, i) { - vtkPV3FoamInsertNextPoint(vtkpoints, points[i]); + vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); } @@ -267,7 +267,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh // Insert the new vertex from the cell-centre label newVertexLabel = mesh.nPoints() + addPointI; - vtkPV3FoamInsertNextPoint(vtkpoints, mesh.C()[cellI]); + vtkInsertNextOpenFOAMPoint(vtkpoints, mesh.C()[cellI]); // Whether to insert cell in place of original or not. bool substituteCell = true; diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C index 14c5da92c2ab27bdb462d2acb0b22aa4f5913582..0a21310a633b868c8b489943c749cc3b90c48545 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C @@ -29,7 +29,7 @@ Description #include "vtkPV3Foam.H" // Foam includes -#include "vtkPV3FoamPoints.H" +#include "vtkOpenFOAMPoints.H" // VTK includes #include "vtkPoints.h" @@ -72,7 +72,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh vtkpoints->Allocate( points.size() ); forAll(points, i) { - vtkPV3FoamInsertNextPoint(vtkpoints, points[i]); + vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); } vtkmesh->SetPoints(vtkpoints); @@ -131,7 +131,7 @@ vtkPolyData* Foam::vtkPV3Foam::pointZoneVTKMesh forAll(pointLabels, pointI) { - vtkPV3FoamInsertNextPoint(vtkpoints, meshPoints[pointLabels[pointI]]); + vtkInsertNextOpenFOAMPoint(vtkpoints, meshPoints[pointLabels[pointI]]); } vtkmesh->SetPoints(vtkpoints); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtilities.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtilities.C index aff0ea4eec14334b336a568665ea4d44d18adb0d..3e38b301622c967f9d0b45397320a2046307ca51 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtilities.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtilities.C @@ -41,6 +41,34 @@ Description #include "vtkMultiBlockDataSet.h" #include "vtkInformation.h" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + //! @cond fileScope + // Extract up to the first non-word characters + inline word getFirstWord(const char* str) + { + if (str) + { + label n = 0; + while (str[n] && word::valid(str[n])) + { + ++n; + } + return word(str, n, true); + } + else + { + return word::null; + } + + } + //! @endcond fileScope + +} // End namespace Foam + + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::vtkPV3Foam::AddToBlock