50 bool Foam::functionObjects::vtkWrite::updateSubset
52 fvMeshSubset& subsetter
55 if (selection_.empty())
60 const fvMesh&
mesh = subsetter.baseMesh();
63 cellBitSet cellsToSelect(
mesh,
false);
65 for (
const entry& dEntry : selection_)
70 <<
"Ignoring non-dictionary entry "
75 const dictionary&
dict = dEntry.dict();
82 cellsToSelect.invert(
mesh.nCells());
88 dict.get<word>(
"source"),
90 dict.optionalSubDict(
"sourceInfo")
92 source->verbose(
false);
103 cellsToSelect.reset();
105 source->applyToSet(action, cellsToSelect);
110 cellBitSet other(
mesh,
false);
113 cellsToSelect.subset(other);
120 <<
"Ignoring unhandled action '"
126 subsetter.setCellSubset(cellsToSelect.addressing());
134 const polyBoundaryMesh&
patches
137 DynamicList<label> patchIDs(
patches.size());
139 for (
const polyPatch& pp :
patches)
141 if (isType<emptyPolyPatch>(pp))
145 else if (isA<processorPolyPatch>(pp))
152 selectPatches_.size()
153 ? selectPatches_.match(pp.name())
157 patchIDs.
append(pp.index());
161 return patchIDs.shrink();
165 bool Foam::functionObjects::vtkWrite::update()
170 && (meshes_.size() == meshSubsets_.size())
171 && (meshes_.size() == vtuMappings_.size())
177 meshSubsets_.resize(meshes_.size());
178 vtuMappings_.resize(meshes_.size());
181 for (
const word&
regionName : meshes_.sortedToc())
185 if (meshSubsets_.set(regioni))
187 meshSubsets_[regioni].clear();
192 meshSubsets_.set(regioni,
new fvMeshSubset(
mesh));
195 if (vtuMappings_.set(regioni))
198 vtuMappings_[regioni].clear();
206 new vtk::vtuCells(writeOpts_, decompose_)
214 for (
auto& subsetter : meshSubsets_)
216 updateSubset(subsetter);
217 vtuMappings_[regioni].reset(subsetter.mesh());
228 bool Foam::functionObjects::vtkWrite::readSelection(
const dictionary&
dict)
230 meshSubsets_.clear();
231 vtuMappings_.clear();
235 meshes_ = time_.lookupClass<fvMesh>();
237 selectRegions_.clear();
238 dict.readIfPresent(
"regions", selectRegions_);
240 if (selectRegions_.empty())
242 selectRegions_.resize(1);
243 selectRegions_.first() =
248 meshes_.filterKeys(selectRegions_);
253 <<
"No mesh regions selected for function object " <<
name()
257 selectPatches_.clear();
258 dict.readIfPresent(
"patches", selectPatches_);
260 selectFields_.clear();
261 dict.readEntry(
"fields", selectFields_);
262 selectFields_.uniq();
265 selection_ =
dict.subOrEmptyDict(
"selection");