55 addressing_ = UIndirectList<label>(addressing_,
order)();
56 flipMap_ = UIndirectList<bool>(flipMap_,
order)();
87 (r == IOobject::MUST_READ)
88 || (r == IOobject::MUST_READ_IF_MODIFIED)
89 || (r == IOobject::READ_IF_PRESENT && zoneID != -1)
92 const faceZone& fz = faceZones[zoneID];
94 flipMap_ = fz.flipMap();
103 faceZoneSet::faceZoneSet
105 const polyMesh&
mesh,
120 faceZoneSet::faceZoneSet
122 const polyMesh&
mesh,
130 addressing_(
refCast<const faceZoneSet>(set).addressing()),
131 flipMap_(
refCast<const faceZoneSet>(set).flipMap())
139 faceZoneSet::~faceZoneSet()
150 for (
label facei = 0; facei < maxLen; facei++)
159 addressing_.setSize(
n);
163 for (
label facei = 0; facei < maxLen; facei++)
167 addressing_[
n] = facei;
180 DynamicList<label> newAddressing(addressing_.size());
181 DynamicList<bool> newFlipMap(flipMap_.size());
183 Map<label> faceToIndex(addressing_.size());
186 faceToIndex.insert(addressing_[i], i);
189 const faceZoneSet& fSet = refCast<const faceZoneSet>(set);
191 forAll(fSet.addressing(), i)
193 label facei = fSet.addressing()[i];
197 if (iter != faceToIndex.end())
199 label index = iter();
201 if (fSet.flipMap()[i] != flipMap_[index])
205 newAddressing.append(facei);
206 newFlipMap.append(flipMap_[index]);
213 <<
"subset : there are " << nConflict
214 <<
" faces with different orientation in faceZonesSets "
215 <<
name() <<
" and " << set.name() <<
endl;
218 addressing_.transfer(newAddressing);
219 flipMap_.transfer(newFlipMap);
224 void faceZoneSet::addSet(
const topoSet& set)
228 DynamicList<label> newAddressing(addressing_);
229 DynamicList<bool> newFlipMap(flipMap_);
231 Map<label> faceToIndex(addressing_.size());
234 faceToIndex.insert(addressing_[i], i);
237 const faceZoneSet& fSet = refCast<const faceZoneSet>(set);
239 forAll(fSet.addressing(), i)
241 label facei = fSet.addressing()[i];
245 if (iter != faceToIndex.end())
247 label index = iter();
249 if (fSet.flipMap()[i] != flipMap_[index])
256 newAddressing.append(facei);
257 newFlipMap.append(fSet.flipMap()[i]);
264 <<
"addSet : there are " << nConflict
265 <<
" faces with different orientation in faceZonesSets "
266 <<
name() <<
" and " << set.name() <<
endl;
269 addressing_.transfer(newAddressing);
270 flipMap_.transfer(newFlipMap);
275 void faceZoneSet::deleteSet(
const topoSet& set)
279 DynamicList<label> newAddressing(addressing_.size());
280 DynamicList<bool> newFlipMap(flipMap_.size());
282 const faceZoneSet& fSet = refCast<const faceZoneSet>(set);
284 Map<label> faceToIndex(fSet.addressing().size());
285 forAll(fSet.addressing(), i)
287 faceToIndex.insert(fSet.addressing()[i], i);
292 label facei = addressing_[i];
296 if (iter != faceToIndex.end())
298 label index = iter();
300 if (fSet.flipMap()[index] != flipMap_[i])
308 newAddressing.append(facei);
309 newFlipMap.append(fSet.flipMap()[i]);
316 <<
"deleteSet : there are " << nConflict
317 <<
" faces with different orientation in faceZonesSets "
318 <<
name() <<
" and " << set.name() <<
endl;
321 addressing_.transfer(newAddressing);
322 flipMap_.transfer(newFlipMap);
327 void faceZoneSet::sync(
const polyMesh&
mesh)
348 <<
" faces that are in the faceZone but not"
349 <<
" in the faceSet or vice versa."
350 <<
" The faceZoneSet should only be manipulated"
364 const label UNFLIPPED = 1;
365 const label FLIPPED = -1;
376 myZoneFace[bFacei] = FLIPPED;
380 myZoneFace[bFacei] = UNFLIPPED;
386 syncTools::swapBoundaryFaceList(
mesh, neiZoneFace);
389 const PackedBoolList isMasterFace(syncTools::getMasterFaces(
mesh));
395 DynamicList<label> newAddressing(addressing_.size());
396 DynamicList<bool> newFlipMap(flipMap_.size());
400 label facei = addressing_[i];
403 newAddressing.append(facei);
404 newFlipMap.append(flipMap_[i]);
415 if (neiStat == UNFLIPPED)
418 newAddressing.append(facei);
419 newFlipMap.append(
true);
421 else if (neiStat == FLIPPED)
423 newAddressing.append(facei);
424 newFlipMap.append(
false);
429 if (myStat == neiStat)
432 newAddressing.append(facei);
433 if (isMasterFace[facei])
435 newFlipMap.append(myStat == FLIPPED);
439 newFlipMap.append(neiStat == UNFLIPPED);
444 newAddressing.append(facei);
445 newFlipMap.append(myStat == FLIPPED);
450 addressing_.transfer(newAddressing);
451 flipMap_.transfer(newFlipMap);
456 label faceZoneSet::maxSize(
const polyMesh&
mesh)
const
462 bool faceZoneSet::writeObject
464 IOstream::streamFormat
s,
465 IOstream::versionNumber v,
466 IOstream::compressionType
c,
473 bool ok = faceSet::writeObject(
s, v,
c,
write);
474 const_cast<word&
>(
type()) = oldTypeName;
477 faceZoneList& faceZones =
const_cast<polyMesh&
>(mesh_).faceZones();
478 label zoneID = faceZones.findIndex(
name());
482 zoneID = faceZones.size();
484 faceZones.setSize(zoneID+1);
499 faceZones[zoneID].resetAddressing(addressing_, flipMap_);
502 return ok && faceZones.write(
write);
506 void faceZoneSet::topoChange(
const polyTopoChangeMap& map)
509 labelList newAddressing(addressing_.size());
510 boolList newFlipMap(flipMap_.size());
515 label facei = addressing_[i];
516 label newFacei = map.reverseFaceMap()[facei];
519 newAddressing[
n] = newFacei;
520 newFlipMap[
n] = flipMap_[i];
524 newAddressing.setSize(
n);
525 newFlipMap.setSize(
n);
527 addressing_.transfer(newAddressing);
528 flipMap_.transfer(newFlipMap);
534 void faceZoneSet::writeDebug
537 const primitiveMesh&
mesh,
541 faceSet::writeDebug(os,
mesh, maxLen);
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
bool insert(const label &key)
Insert a new entry.
void clearStorage()
Clear the table entries and the table itself.
friend class const_iterator
Declare friendship with the const_iterator.
void resize(const label newSize)
Resize the hash table for efficiency.
void size(const label)
Override size to be inconsistent with allocated storage.
faceZoneSet(const polyMesh &mesh, const word &name, readOption r=MUST_READ, writeOption w=NO_WRITE)
Construct from objectRegistry and name.
void updateSet()
Sort addressing and make faceSet part consistent with addressing.
const faceZoneList & faceZones() const
Return face zones.
label nInternalFaces() const
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar c
Speed of light in a vacuum.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
To & refCast(From &r)
Reference type cast template function.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
int order(const scalar s)
List< bool > boolList
Bool container classes.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
void sortedOrder(const UList< T > &, labelList &order)
Generate the (stable) sort order for the list.
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
ListType subset(const UList< T > &select, const T &value, const ListType &)
Extract elements of List when select is a certain value.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.