59 <<
" cells:" <<
mesh.globalData().nTotalCells()
60 <<
" faces:" <<
mesh.globalData().nTotalFaces()
61 <<
" points:" <<
mesh.globalData().nTotalPoints()
62 <<
" patches:" <<
mesh.boundaryMesh().size()
63 <<
" bb:" <<
mesh.bounds() <<
nl;
67template<
class ZoneType>
78 Info<<
"Removing zone " << setName <<
" at index " <<
zoneID <<
endl;
115 mesh.time().findInstance
117 polyMesh::meshSubDir/
"sets",
119 IOobject::READ_IF_PRESENT,
122 polyMesh::meshSubDir/
"sets"
125 if (objects.found(setName))
128 fileName object = objects[setName]->objectPath();
129 Info<<
"Removing file " <<
object <<
endl;
134 if (setType == cellZoneSet::typeName)
142 else if (setType == faceZoneSet::typeName)
150 else if (setType == pointZoneSet::typeName)
167 case polyMesh::UNCHANGED:
169 Info<<
" mesh not changed." <<
endl;
172 case polyMesh::POINTS_MOVED:
174 Info<<
" points moved; topology unchanged." <<
endl;
177 case polyMesh::TOPO_CHANGE:
179 Info<<
" topology changed; patches unchanged." <<
nl
184 case polyMesh::TOPO_PATCH_CHANGE:
186 Info<<
" topology changed and patches changed." <<
nl
195 <<
"Illegal mesh update state "
196 << stat <<
abort(FatalError);
205int main(
int argc,
char *argv[])
209 "Operates on cellSets/faceSets/pointSets through a dictionary,"
210 " normally system/topoSetDict"
213 timeSelector::addOptions(
true,
false);
215 argList::addOption(
"dict",
"file",
"Alternative topoSetDict");
218 argList::addBoolOption
221 "Do not synchronise selection across coupled patches"
231 const bool noSync =
args.
found(
"noSync");
245 runTime.setTime(timeDirs[timeI], timeI);
249 meshReadUpdate(
mesh);
263 topoSetSource::actionNames.get(
"action",
dict);
269 case topoSetSource::NEW :
270 case topoSetSource::CLEAR :
272 currentSet = topoSet::New(setType,
mesh, setName, 16384);
274 << currentSet().type() <<
' ' << setName <<
endl;
278 case topoSetSource::IGNORE :
282 case topoSetSource::REMOVE :
289 currentSet = topoSet::New
298 << currentSet().type() <<
' ' << setName
309 case topoSetSource::NEW :
310 case topoSetSource::ADD :
311 case topoSetSource::SUBTRACT :
315 Info<<
" Applying source " << sourceType <<
endl;
320 dict.optionalSubDict(
"sourceInfo")
323 source().applyToSet(action, currentSet());
325 if (!noSync) currentSet().sync(
mesh);
326 if (!currentSet().
write())
329 <<
"Failed writing set "
330 << currentSet().objectPath() <<
endl;
336 case topoSetSource::SUBSET :
340 Info<<
" Applying source " << sourceType <<
endl;
345 dict.optionalSubDict(
"sourceInfo")
355 currentSet().
name() +
"_old2",
360 currentSet().
clear();
361 source().applyToSet(topoSetSource::NEW, currentSet());
364 currentSet().subset(oldSet());
366 if (!noSync) currentSet().sync(
mesh);
367 if (!currentSet().
write())
370 <<
"Failed writing set "
371 << currentSet().objectPath() <<
endl;
378 case topoSetSource::CLEAR :
380 Info<<
" Clearing " << currentSet().type() <<
endl;
381 currentSet().
clear();
382 if (!currentSet().
write())
385 <<
"Failed writing set "
386 << currentSet().objectPath() <<
endl;
393 case topoSetSource::INVERT :
395 Info<<
" Inverting " << currentSet().type() <<
endl;
396 currentSet().invert(currentSet().maxSize(
mesh));
397 if (!currentSet().
write())
400 <<
"Failed writing set "
401 << currentSet().objectPath() <<
endl;
408 case topoSetSource::REMOVE :
411 removeSet(
mesh, setType, setName);
418 <<
"Unhandled action: "
419 << topoSetSource::actionNames[action] <<
endl;
425 << currentSet().type() <<
' '
426 << currentSet().name() <<
" now size "
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
List of IOobjects with searching and retrieving facilities.
void setSize(const label newLen)
Same as resize()
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
void reorder(const labelUList &oldToNew, const bool check=false)
label size() const noexcept
The number of elements in the list.
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
void clearAddressing()
Clear addressing.
bool found(const word &optName) const
Return true if the named option is found.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void clear() noexcept
Same as reset(nullptr)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling file names.
virtual void flush() const
Forcibly wait until all output done. Flush any cached data.
A tuple of keyType and dictionary, which can be used when reading named or unnamed dictionary entries...
Mesh consisting of general polyhedral cells.
readUpdateState
Enumeration defining the state of the mesh after a read update.
virtual bool write(const bool valid=true) const
Write using setting from DB.
setAction
Enumeration defining various actions.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const word dictName("faMeshDefinition")
const labelIOList & zoneID
#define WarningInFunction
Report a warning using Foam::Warning.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
const fileOperation & fileHandler()
Get current file handler.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
constexpr char nl
The newline '\n' character (0x0a)
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.