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;
89 oldToNew[zoneID] = newI;
115 mesh.time().findInstance
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)
169 Info<<
" mesh not changed." <<
endl;
174 Info<<
" points moved; topology unchanged." <<
endl;
179 Info<<
" topology changed; patches unchanged." <<
nl
186 Info<<
" topology changed and patches changed." <<
nl
195 <<
"Illegal mesh update state "
207 std::pair(
"cellZoneSet",
"cellSet"),
208 std::pair(
"faceZoneSet",
"faceSet"),
209 std::pair(
"pointZoneSet",
"pointSet"),
213int main(
int argc,
char *argv[])
217 "Operates on cellSets/faceSets/pointSets through a dictionary,"
218 " normally system/topoSetDict"
229 "Do not synchronise selection across coupled patches"
239 const bool noSync =
args.found(
"noSync");
249 List<namedDictionary> actionEntries(topoSetDict.lookup(
"actions"));
253 runTime.setTime(timeDirs[timei], timei);
257 meshReadUpdate(
mesh);
282 << currentSet().type() <<
' ' << setName <<
endl;
306 << currentSet().type() <<
' ' << setName
323 Info<<
" Applying source " << sourceType <<
endl;
328 dict.optionalSubDict(
"sourceInfo")
331 source().applyToSet(action, currentSet());
333 if (!noSync) currentSet().sync(
mesh);
334 if (!currentSet().
write())
337 <<
"Failed writing set "
338 << currentSet().objectPath() <<
endl;
348 Info<<
" Applying source " << sourceType <<
endl;
353 dict.optionalSubDict(
"sourceInfo")
360 const auto typeFnd(basicType.find(setType));
365 (typeFnd ? typeFnd() : setType),
367 currentSet().
name() +
"_old2",
375 currentSet().subset(workSet());
379 if (!noSync) currentSet().sync(
mesh);
380 if (!currentSet().
write())
383 <<
"Failed writing set "
384 << currentSet().objectPath() <<
endl;
393 Info<<
" Clearing " << currentSet().type() <<
endl;
394 currentSet().
clear();
395 if (!currentSet().
write())
398 <<
"Failed writing set "
399 << currentSet().objectPath() <<
endl;
408 Info<<
" Inverting " << currentSet().type() <<
endl;
409 currentSet().invert(currentSet().maxSize(
mesh));
410 if (!currentSet().
write())
413 <<
"Failed writing set "
414 << currentSet().objectPath() <<
endl;
424 removeSet(
mesh, setType, setName);
431 <<
"Unhandled action: "
438 << currentSet().type() <<
' '
439 << currentSet().name() <<
" now size "
A HashTable similar to std::unordered_map.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable,...
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ MUST_READ
Reading required.
void setSize(const label n)
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)
Reorder elements. Reordering must be unique (ie, shuffle).
label size() const noexcept
The number of entries in the list.
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
void clearAddressing()
Clear addressing.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
static void addNote(const string ¬e)
Add extra notes for the usage information.
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.
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.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh").
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
static instantList selectIfPresent(Time &runTime, const argList &args)
If any time option provided return the set of times - as per select0() - otherwise return just the cu...
setAction
Enumeration defining various actions.
@ CLEAR
Clear the set, possibly creating it.
@ SUBSET
Union of elements with current set.
@ REMOVE
Remove the set (from the file system).
@ IGNORE
"ignore" no-op action
@ SUBTRACT
Subtract elements from current set.
@ INVERT
Invert the elements in the current set.
@ ADD
Add elements to current set.
@ NEW
Create a new set and ADD elements to it.
static autoPtr< topoSetSource > New(const word &topoSetSourceType, const polyMesh &mesh, const dictionary &dict)
Return a reference to the selected topoSetSource.
static const Enum< setAction > actionNames
The setActions enum text. Names: "new", add", "subtract", "subset", "invert","clear",...
static autoPtr< topoSet > New(const word &setType, const polyMesh &mesh, const word &name, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, IOobjectOption::writeOption wOpt=IOobjectOption::NO_WRITE)
Return a pointer to a toposet read from file.
A class for handling words, derived from Foam::string.
static const word null
An empty word.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const word dictName("faMeshDefinition")
return returnReduce(nRefine-oldNRefine, sumOp< label >())
#define WarningInFunction
Report a warning using Foam::Warning.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
ZoneMesh< pointZone, polyMesh > pointZoneMesh
A ZoneMesh with pointZone content on a polyMesh.
List< label > labelList
A List of labels.
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler().
messageStream Info
Information stream (stdout output on master, null elsewhere).
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with faceZone content on a polyMesh.
List< instant > instantList
List of instants.
Ostream & endl(Ostream &os)
Add newline and flush stream.
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with cellZone content on a polyMesh.
errorManip< error > abort(error &err)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
constexpr char nl
The newline '\n' character (0x0a).
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.