30 #include "vtkPVblockMeshReader.h" 33 #include "vtkDataArraySelection.h" 34 #include "vtkDataSet.h" 35 #include "vtkMultiBlockDataSet.h" 36 #include "vtkInformation.h" 44 inline word getFirstWord(
const char* str)
53 return word(str, n,
true);
69 void Foam::vtkPVblockMesh::AddToBlock
71 vtkMultiBlockDataSet* output,
73 const arrayRange& range,
74 const label datasetNo,
75 const std::string& datasetName
78 const int blockNo = range.block();
80 vtkDataObject* blockDO = output->GetBlock(blockNo);
81 vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
88 <<
"Block already has a vtkDataSet assigned to it" 94 output->SetBlock(blockNo, block);
101 <<
"block[" << blockNo <<
"] has " 102 << block->GetNumberOfBlocks()
103 <<
" datasets prior to adding set " << datasetNo
104 <<
" with name: " << datasetName <<
endl;
107 block->SetBlock(datasetNo, dataset);
112 output->GetMetaData(blockNo)->Set
114 vtkCompositeDataSet::NAME(),
119 if (datasetName.size())
121 block->GetMetaData(datasetNo)->Set
123 vtkCompositeDataSet::NAME(),
130 vtkDataSet* Foam::vtkPVblockMesh::GetDataSetFromBlock
132 vtkMultiBlockDataSet* output,
133 const arrayRange& range,
134 const label datasetNo
137 const int blockNo = range.block();
139 vtkDataObject* blockDO = output->GetBlock(blockNo);
140 vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
144 return vtkDataSet::SafeDownCast(block->GetBlock(datasetNo));
151 Foam::label Foam::vtkPVblockMesh::GetNumberOfDataSets
153 vtkMultiBlockDataSet* output,
154 const arrayRange& range
157 const int blockNo = range.block();
159 vtkDataObject* blockDO = output->GetBlock(blockNo);
160 vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
163 return block->GetNumberOfBlocks();
172 vtkDataArraySelection* select
175 int nElem = select->GetNumberOfArrays();
178 for (
int elemI=0; elemI < nElem; ++elemI)
180 if (select->GetArraySetting(elemI))
182 selections.insert(getFirstWord(select->GetArrayName(elemI)));
192 vtkDataArraySelection* select,
193 const arrayRange& range
196 int nElem = select->GetNumberOfArrays();
199 for (
int elemI = range.start(); elemI < range.end(); ++elemI)
201 if (select->GetArraySetting(elemI))
203 selections.insert(getFirstWord(select->GetArrayName(elemI)));
213 vtkDataArraySelection* select
216 stringList selections(select->GetNumberOfArrays());
221 if (select->GetArraySetting(elemI))
223 selections[nElem++] = select->GetArrayName(elemI);
226 selections.setSize(nElem);
231 label nElem = select->GetNumberOfArrays();
234 for (
int elemI = 0; elemI < nElem; ++elemI)
236 Info<<
" \"" << select->GetArrayName(elemI) <<
"\"";
238 Info<<
" )\nselected(";
242 Info<<
" " << selections[elemI];
253 vtkDataArraySelection* select,
254 const arrayRange& range
260 for (
int elemI = range.start(); elemI < range.end(); ++elemI)
262 if (select->GetArraySetting(elemI))
264 selections[nElem++] = select->GetArrayName(elemI);
267 selections.setSize(nElem);
274 for (
int elemI = range.start(); elemI < range.end(); ++elemI)
276 Info<<
" \"" << select->GetArrayName(elemI) <<
"\"";
278 Info<<
" )\nselected(";
282 Info<<
" " << selections[elemI];
291 void Foam::vtkPVblockMesh::setSelectedArrayEntries
293 vtkDataArraySelection* select,
297 const int nElem = select->GetNumberOfArrays();
298 select->DisableAllArrays();
301 for (
int elemI=0; elemI < nElem; ++elemI)
303 string arrayName(select->GetArrayName(elemI));
307 if (selections[elemI] == arrayName)
309 select->EnableArray(arrayName.c_str());
317 void Foam::vtkPVblockMesh::updateBoolListStatus
320 vtkDataArraySelection* selection
328 const label nElem = selection->GetNumberOfArrays();
329 if (status.size() != nElem)
331 status.setSize(nElem);
337 const int setting = selection->GetArraySetting(elemI);
339 status[elemI] = setting;
343 Info<<
" part[" << elemI <<
"] = " 345 <<
" : " << selection->GetArrayName(elemI) <<
endl;
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.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Ostream & endl(Ostream &os)
Add newline and flush stream.
Holds information (coordinate and normal) regarding nearest wall point.
List< bool > boolList
Bool container classes.
static const word null
An empty word.
HashSet wordHashSet
A HashSet with word keys.
List< string > stringList
A List of strings.
#define InfoInFunction
Report an information message using Foam::Info.