37 #include "vtkPVFoamReader.h" 44 #include "vtkDataArraySelection.h" 63 explicit zonesEntries(
const IOobject& io)
66 PtrList<entry>(readStream(
"regIOobject"))
84 template<
class ZoneType>
87 const ZoneMesh<ZoneType, polyMesh>& zmesh
95 if (zmesh[zoneI].size())
97 names[nZone++] = zmesh[zoneI].name();
100 names.setSize(nZone);
106 Foam::wordList Foam::vtkPVFoam::getZoneNames(
const word& zoneType)
const 114 dbPtr_().findInstance
127 if (ioObj.headerOk())
129 zonesEntries zones(ioObj);
131 names.setSize(zones.size());
134 names[zoneI] = zones[zoneI].keyword();
142 void Foam::vtkPVFoam::updateInfoInternalMesh
144 vtkDataArraySelection* arraySelection
149 Info<<
"<beg> Foam::vtkPVFoam::updateInfoInternalMesh" <<
endl;
154 arrayRangeVolume_.reset(arraySelection->GetNumberOfArrays());
155 arraySelection->AddArray
159 arrayRangeVolume_ += 1;
166 Info<<
"<end> Foam::vtkPVFoam::updateInfoInternalMesh" <<
endl;
171 void Foam::vtkPVFoam::updateInfoLagrangian
173 vtkDataArraySelection* arraySelection
178 Info<<
"<beg> Foam::vtkPVFoam::updateInfoLagrangian" <<
nl 197 arrayRangeLagrangian_.reset(arraySelection->GetNumberOfArrays());
203 arraySelection->AddArray
205 (cloudDirs[cloudI] +
" - lagrangian").c_str()
210 arrayRangeLagrangian_ += nClouds;
217 Info<<
"<end> Foam::vtkPVFoam::updateInfoLagrangian" <<
endl;
222 void Foam::vtkPVFoam::updateInfoPatches
224 vtkDataArraySelection* arraySelection,
230 Info<<
"<beg> Foam::vtkPVFoam::updateInfoPatches" 231 <<
" [meshPtr=" << (meshPtr_ ?
"set" :
"NULL") <<
"]" <<
endl;
235 HashSet<string> enabledEntriesSet(enabledEntries);
237 arrayRangePatches_.reset(arraySelection->GetNumberOfArrays());
242 const polyBoundaryMesh& patches = meshPtr_->boundaryMesh();
243 const HashTable<labelList, word>& groups = patches.groupPatchIDs();
244 const wordList allPatchNames = patches.names();
252 iter != groups.end();
256 const word& groupName = iter.key();
262 nFaces += patches[patchIDs[i]].size();
268 string vtkGrpName = groupName +
" - group";
269 arraySelection->AddArray(vtkGrpName.c_str());
273 if (enabledEntriesSet.found(vtkGrpName))
275 if (!reader_->GetShowGroupsOnly())
277 enabledEntriesSet.erase(vtkGrpName);
280 const polyPatch& pp = patches[patchIDs[i]];
283 string vtkPatchName = pp.name() +
" - patch";
284 enabledEntriesSet.insert(vtkPatchName);
296 if (!reader_->GetShowGroupsOnly())
300 const polyPatch& pp = patches[
patchi];
305 arraySelection->AddArray
307 (pp.name() +
" - patch").c_str()
322 dbPtr_().findInstance
336 if (ioObj.headerOk())
338 polyBoundaryMeshEntries patchEntries(ioObj);
344 wordList names(patchEntries.size());
349 const dictionary& patchDict = patchEntries[
patchi].dict();
359 HashTable<labelList, word> groups(patchEntries.size());
363 const dictionary& patchDict = patchEntries[
patchi].dict();
366 patchDict.readIfPresent(
"inGroups", groupNames);
368 forAll(groupNames, groupI)
374 if (iter != groups.end())
389 iter != groups.end();
393 const word& groupName = iter.key();
399 nFaces += sizes[patchIDs[i]];
405 string vtkGrpName = groupName +
" - group";
406 arraySelection->AddArray(vtkGrpName.c_str());
410 if (enabledEntriesSet.found(vtkGrpName))
412 if (!reader_->GetShowGroupsOnly())
414 enabledEntriesSet.erase(vtkGrpName);
417 if (sizes[patchIDs[i]])
419 string vtkPatchName =
420 names[patchIDs[i]] +
" - patch";
421 enabledEntriesSet.insert(vtkPatchName);
433 if (!reader_->GetShowGroupsOnly())
440 arraySelection->AddArray
442 (names[patchi] +
" - patch").c_str()
454 enabledEntries = enabledEntriesSet.toc();
461 Info<<
"<end> Foam::vtkPVFoam::updateInfoPatches" <<
endl;
466 void Foam::vtkPVFoam::updateInfoZones
468 vtkDataArraySelection* arraySelection
471 if (!reader_->GetIncludeZones())
478 Info<<
"<beg> Foam::vtkPVFoam::updateInfoZones" 479 <<
" [meshPtr=" << (meshPtr_ ?
"set" :
"NULL") <<
"]" <<
endl;
489 namesLst = getZoneNames(meshPtr_->cellZones());
493 namesLst = getZoneNames(
"cellZones");
496 arrayRangeCellZones_.reset(arraySelection->GetNumberOfArrays());
499 arraySelection->AddArray
501 (namesLst[elemI] +
" - cellZone").c_str()
504 arrayRangeCellZones_ += namesLst.size();
512 namesLst = getZoneNames(meshPtr_->faceZones());
516 namesLst = getZoneNames(
"faceZones");
519 arrayRangeFaceZones_.reset(arraySelection->GetNumberOfArrays());
522 arraySelection->AddArray
524 (namesLst[elemI] +
" - faceZone").c_str()
527 arrayRangeFaceZones_ += namesLst.size();
535 namesLst = getZoneNames(meshPtr_->pointZones());
539 namesLst = getZoneNames(
"pointZones");
542 arrayRangePointZones_.reset(arraySelection->GetNumberOfArrays());
545 arraySelection->AddArray
547 (namesLst[elemI] +
" - pointZone").c_str()
550 arrayRangePointZones_ += namesLst.size();
557 Info<<
"<end> Foam::vtkPVFoam::updateInfoZones" <<
endl;
562 void Foam::vtkPVFoam::updateInfoSets
564 vtkDataArraySelection* arraySelection
567 if (!reader_->GetIncludeSets())
574 Info<<
"<beg> Foam::vtkPVFoam::updateInfoSets" <<
endl;
580 word facesInstance = dbPtr_().findInstance
587 word setsInstance = dbPtr_().findInstance
595 IOobjectList objects(dbPtr_(), setsInstance, meshDir_/
"sets");
599 Info<<
" Foam::vtkPVFoam::updateInfoSets read " 600 << objects.names() <<
" from " << setsInstance <<
endl;
604 arrayRangeCellSets_.reset(arraySelection->GetNumberOfArrays());
605 arrayRangeCellSets_ += addToSelection<cellSet>
612 arrayRangeFaceSets_.reset(arraySelection->GetNumberOfArrays());
613 arrayRangeFaceSets_ += addToSelection<faceSet>
620 arrayRangePointSets_.reset(arraySelection->GetNumberOfArrays());
621 arrayRangePointSets_ += addToSelection<pointSet>
633 Info<<
"<end> Foam::vtkPVFoam::updateInfoSets" <<
endl;
638 void Foam::vtkPVFoam::updateInfoLagrangianFields()
642 Info<<
"<beg> Foam::vtkPVFoam::updateInfoLagrangianFields" 646 vtkDataArraySelection* fieldSelection =
647 reader_->GetLagrangianFieldSelection();
651 fieldSelection->RemoveAllArrays();
657 const arrayRange& range = arrayRangeLagrangian_;
663 int partId = range.start();
664 word cloudName = getPartName(partId);
678 lagrangianPrefix/cloudName
681 addToSelection<IOField<label>>
686 addToSelection<IOField<scalar>>
691 addToSelection<IOField<vector>>
696 addToSelection<IOField<sphericalTensor>>
702 addToSelection<IOField<symmTensor>>
707 addToSelection<IOField<tensor>>
718 Info<<
"<end> Foam::vtkPVFoam::updateInfoLagrangianFields - " 719 <<
"lagrangian objects.size() = " << objects.size() <<
endl;
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
stringList getSelectedArrayEntries(vtkDataArraySelection *)
Retrieve the current selections.
friend class const_iterator
Declare friendship with the const_iterator.
static const word null
An empty word.
List< label > labelList
A List of labels.
label readLabel(Istream &is)
static const word prefix
The prefix to local: lagrangian.
const bool writeData(readBool(pdfDictionary.lookup("writeData")))
List< word > wordList
A List of words.
List< string > stringList
A List of strings.
void setSelectedArrayEntries(vtkDataArraySelection *, const stringList &)
Set selection(s)
friend class iterator
Declare friendship with the iterator.
List< fileName > fileNameList
A List of fileNames.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
fileNameList readDir(const fileName &, const fileName::Type=fileName::FILE, const bool filtergz=true)
Read a directory and return the entries as a string list.