35 #include "vtkDataArraySelection.h" 36 #include "vtkDataSet.h" 37 #include "vtkMultiBlockDataSet.h" 38 #include "vtkInformation.h" 54 inline word getFirstWord(
const char* str)
63 return word(str, n,
true);
80 vtkMultiBlockDataSet* output,
83 const label datasetNo,
84 const std::string& datasetName
87 const int blockNo = selector.
block();
89 vtkDataObject* blockDO = output->GetBlock(blockNo);
90 vtkMultiBlockDataSet*
block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
97 <<
"Block already has a vtkDataSet assigned to it" 103 output->SetBlock(blockNo, block);
109 Info<<
"block[" << blockNo <<
"] has " 110 << block->GetNumberOfBlocks()
111 <<
" datasets prior to adding set " << datasetNo
112 <<
" with name: " << datasetName <<
endl;
115 block->SetBlock(datasetNo, dataset);
120 output->GetMetaData(blockNo)->Set
122 vtkCompositeDataSet::NAME(),
127 if (datasetName.size())
129 block->GetMetaData(datasetNo)->Set
131 vtkCompositeDataSet::NAME(),
140 vtkMultiBlockDataSet* output,
142 const label datasetNo
145 const int blockNo = selector.
block();
147 vtkDataObject* blockDO = output->GetBlock(blockNo);
148 vtkMultiBlockDataSet*
block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
152 return vtkDataSet::SafeDownCast(block->GetBlock(datasetNo));
162 vtkMultiBlockDataSet* output,
166 const int blockNo = selector.
block();
168 vtkDataObject* blockDO = output->GetBlock(blockNo);
169 vtkMultiBlockDataSet*
block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
172 return block->GetNumberOfBlocks();
187 vtkDataArraySelection* select
190 int nElem = select->GetNumberOfArrays();
193 for (
int elemI=0; elemI < nElem; ++elemI)
195 if (select->GetArraySetting(elemI))
197 selections.
insert(getFirstWord(select->GetArrayName(elemI)));
207 vtkDataArraySelection* select,
211 int nElem = select->GetNumberOfArrays();
214 for (
int elemI = selector.
start(); elemI < selector.
end(); ++elemI)
216 if (select->GetArraySetting(elemI))
218 selections.
insert(getFirstWord(select->GetArrayName(elemI)));
228 vtkDataArraySelection* select
231 stringList selections(select->GetNumberOfArrays());
236 if (select->GetArraySetting(elemI))
238 selections[nElem++] = select->GetArrayName(elemI);
241 selections.setSize(nElem);
246 label nElem = select->GetNumberOfArrays();
248 for (
int elemI = 0; elemI < nElem; ++elemI)
250 Info<<
" \"" << select->GetArrayName(elemI) <<
"\"";
252 Info<<
" )\nselected(";
256 Info<<
" " << selections[elemI];
267 vtkDataArraySelection* select,
274 for (
int elemI = selector.
start(); elemI < selector.
end(); ++elemI)
276 if (select->GetArraySetting(elemI))
278 selections[nElem++] = select->GetArrayName(elemI);
287 for (
int elemI = selector.
start(); elemI < selector.
end(); ++elemI)
289 Info<<
" \"" << select->GetArrayName(elemI) <<
"\"";
291 Info<<
" )\nselected(";
295 Info<<
" " << selections[elemI];
306 vtkDataArraySelection* select,
310 const int nElem = select->GetNumberOfArrays();
311 select->DisableAllArrays();
314 for (
int elemI=0; elemI < nElem; ++elemI)
316 string arrayName(select->GetArrayName(elemI));
320 if (selections[elemI] == arrayName)
322 select->EnableArray(arrayName.c_str());
void AddToBlock(vtkMultiBlockDataSet *output, vtkDataSet *dataset, const partInfo &selector, const label datasetNo, const std::string &datasetName)
Convenience method use to convert the readers from VTK 5.
static bool valid(char)
Is this character valid for a word.
A HashTable with keys but without contents.
#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.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool insert(const Key &key)
Insert a new entry.
int block() const
Return the block holding these datasets.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Bookkeeping for GUI checklists and the multi-block organization.
stringList getSelectedArrayEntries(vtkDataArraySelection *)
Retrieve the current selections.
label GetNumberOfDataSets(vtkMultiBlockDataSet *output, const partInfo &selector)
Convenience method use to convert the readers from VTK 5.
static const word null
An empty word.
Creates a single block of cells from point coordinates, numbers of cells in each direction and an exp...
defineTypeNameAndDebug(combustionModel, 0)
wordHashSet getSelected(vtkDataArraySelection *select)
Retrieve the current selections as a wordHashSet.
void setSize(const label)
Reset size of List.
vtkDataSet * GetDataSetFromBlock(vtkMultiBlockDataSet *output, const partInfo &selector, const label datasetNo)
Convenience method use to convert the readers from VTK 5.
void setSelectedArrayEntries(vtkDataArraySelection *, const stringList &)
Set selection(s)
const char * name() const