Commit 0054b9f4 authored by Mark Olesen's avatar Mark Olesen

ENH: use wordHashSet instead of hashedWordList in PV readers

- we don't need the GUI sort order of the values.
parent f4693076
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -128,44 +128,44 @@ void Foam::foamPvCore::addToBlock
}
Foam::hashedWordList Foam::foamPvCore::getSelected
Foam::wordHashSet Foam::foamPvCore::getSelected
(
vtkDataArraySelection* select
)
{
const int n = select->GetNumberOfArrays();
DynamicList<word> selected(n);
wordHashSet selected(2*n);
for (int i=0; i < n; ++i)
{
if (select->GetArraySetting(i))
{
selected.append(getFoamName(select->GetArrayName(i)));
selected.set(getFoamName(select->GetArrayName(i)));
}
}
return hashedWordList(selected, true);
return selected;
}
Foam::hashedWordList Foam::foamPvCore::getSelected
Foam::wordHashSet Foam::foamPvCore::getSelected
(
vtkDataArraySelection* select,
const arrayRange& selector
const labelRange& selector
)
{
const int n = select->GetNumberOfArrays();
DynamicList<word> selected(n);
wordHashSet selected(2*n);
for (auto i : selector)
{
if (select->GetArraySetting(i))
{
selected.append(getFoamName(select->GetArrayName(i)));
selected.set(getFoamName(select->GetArrayName(i)));
}
}
return hashedWordList(selected, true);
return selected;
}
......
......@@ -44,7 +44,6 @@ SourceFiles
#include "Hash.H"
#include "HashSet.H"
#include "Map.H"
#include "hashedWordList.H"
#include "labelRange.H"
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
......@@ -250,20 +249,20 @@ public:
);
//- Retrieve the current selections as a hashedWordList,
// while stripping off any prefix or suffix
static hashedWordList getSelected
//- Retrieve the current selections as a wordHashSet,
//- while stripping off any prefix or suffix
static wordHashSet getSelected
(
vtkDataArraySelection* select
);
//- Retrieve a sub-list of the current selections as a hashedWordList,
// while stripping off any prefix or suffix
static hashedWordList getSelected
//- Retrieve sub-list of the current selections as a wordHashSet,
//- while stripping off any prefix or suffix
static wordHashSet getSelected
(
vtkDataArraySelection* select,
const arrayRange& selector
const labelRange& selector
);
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -789,11 +789,10 @@ void Foam::vtkPVFoam::renderPatchNames
if (show && volMeshPtr_)
{
// get the display patches, strip off any prefix/suffix
hashedWordList selectedPatches = getSelected
// Get the display patches, strip off any prefix/suffix
wordHashSet selectedPatches
(
reader_->GetPartSelection(),
rangePatches_
getSelected(reader_->GetPartSelection(), rangePatches_)
);
if (selectedPatches.empty())
......
......@@ -49,9 +49,12 @@ void Foam::vtkPVFoam::convertVolFields()
const fvMesh& mesh = *volMeshPtr_;
const bool interpFields = reader_->GetInterpolateVolFields();
hashedWordList selectedFields = getSelected
wordHashSet selectedFields
(
reader_->GetVolFieldSelection()
getSelected
(
reader_->GetVolFieldSelection()
)
);
if (selectedFields.empty())
......@@ -124,9 +127,12 @@ void Foam::vtkPVFoam::convertPointFields()
{
const fvMesh& mesh = *volMeshPtr_;
hashedWordList selectedFields = getSelected
wordHashSet selectedFields
(
reader_->GetPointFieldSelection()
getSelected
(
reader_->GetPointFieldSelection()
)
);
if (selectedFields.empty())
......@@ -184,7 +190,10 @@ void Foam::vtkPVFoam::convertAreaFields()
vtkDataArraySelection* select = reader_->GetVolFieldSelection();
hashedWordList selectedFields = getSelected(select);
wordHashSet selectedFields
(
getSelected(select)
);
if (selectedFields.empty())
{
......@@ -233,9 +242,12 @@ void Foam::vtkPVFoam::convertLagrangianFields()
const fvMesh& mesh = *volMeshPtr_;
hashedWordList selectedFields = getSelected
wordHashSet selectedFields
(
reader_->GetLagrangianFieldSelection()
getSelected
(
reader_->GetLagrangianFieldSelection()
)
);
if (selectedFields.empty())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment