67 template<
class ZoneType>
78 Info<<
"Removing zone " << setName <<
" at index " << zoneID <<
endl;
89 oldToNew[zoneID] = newI;
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 " 205 int main(
int argc,
char *argv[])
209 "Operates on cellSets/faceSets/pointSets through a dictionary," 210 " normally system/topoSetDict" 221 "Do not synchronise selection across coupled patches" 231 const bool noSync =
args.
found(
"noSync");
249 meshReadUpdate(
mesh);
274 << currentSet().type() <<
' ' << setName <<
endl;
298 << currentSet().type() <<
' ' << setName
315 Info<<
" Applying source " << sourceType <<
endl;
323 source().applyToSet(action, currentSet());
325 if (!noSync) currentSet().sync(
mesh);
326 if (!currentSet().
write())
329 <<
"Failed writing set " 330 << currentSet().objectPath() <<
endl;
340 Info<<
" Applying source " << sourceType <<
endl;
355 currentSet().
name() +
"_old2",
360 currentSet().
clear();
364 currentSet().subset(oldSet());
366 if (!noSync) currentSet().sync(
mesh);
367 if (!currentSet().
write())
370 <<
"Failed writing set " 371 << currentSet().objectPath() <<
endl;
380 Info<<
" Clearing " << currentSet().type() <<
endl;
381 currentSet().
clear();
382 if (!currentSet().
write())
385 <<
"Failed writing set " 386 << currentSet().objectPath() <<
endl;
395 Info<<
" Inverting " << currentSet().type() <<
endl;
396 currentSet().invert(currentSet().maxSize(
mesh));
397 if (!currentSet().
write())
400 <<
"Failed writing set " 401 << currentSet().objectPath() <<
endl;
411 removeSet(
mesh, setType, setName);
418 <<
"Unhandled action: " 425 << currentSet().type() <<
' ' 426 << currentSet().name() <<
" now size " EnumType get(const word &enumName) const
The enumeration corresponding to the given name.
static void addNote(const string ¬e)
Add extra notes for the usage information.
void clearAddressing()
Clear addressing.
static const Enum< setAction > actionNames
The setActions enum text. Names: "new", add", "subtract", "subset", "invert", "clear", "remove", "list", "ignore".
A class for handling file names.
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable, so the various sorted methods should be used if traversing in parallel.
const fileName & facesInstance() const
Return the current instance directory for faces.
word findInstance(const fileName &dir, const word &name=word::null, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, const word &stopInstance=word::null) const
Return time instance (location) of dir that contains the file name (eg, used in reading mesh data)...
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const word & name() const noexcept
Return the object name.
Create a new set and ADD elements to it.
Add elements to current set.
constexpr char nl
The newline '\n' character (0x0a)
Clear the set, possibly creating it.
const word dictName("faMeshDefinition")
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
Ostream & endl(Ostream &os)
Add newline and flush stream.
void reorder(const labelUList &oldToNew, const bool check=false)
Reorder elements. Reordering must be unique (ie, shuffle).
void clear() noexcept
Same as reset(nullptr)
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler()
Invert the elements in the current set.
Remove the set (from the file system)
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
const Time & time() const
Return the top-level database.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
label nTotalPoints() const noexcept
Return total number of points in decomposed mesh. Not compensated for duplicate points! ...
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
#define forAll(list, i)
Loop across all elements in list.
const dictionary & optionalSubDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary, otherwise return this dictionary.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
virtual readUpdateState readUpdate()
Update the mesh based on the mesh files saved in time.
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
label size() const noexcept
The number of entries in the list.
Union of elements with current set.
setAction
Enumeration defining various actions.
Reading is optional [identical to LAZY_READ].
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
static const word null
An empty word.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
const globalMeshData & globalData() const
Return parallel info (demand-driven)
static instantList selectIfPresent(Time &runTime, const argList &args)
If any time option provided return the set of times (as select0) otherwise return just the current ti...
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
errorManip< error > abort(error &err)
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.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
void setSize(const label newLen)
Same as resize()
label nTotalCells() const noexcept
Return total number of cells in decomposed mesh.
static autoPtr< topoSetSource > New(const word &topoSetSourceType, const polyMesh &mesh, const dictionary &dict)
Return a reference to the selected topoSetSource.
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
Subtract elements from current set.
#define WarningInFunction
Report a warning using Foam::Warning.
A tuple of keyType and dictionary, which can be used when reading named or unnamed dictionary entries...
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
messageStream Info
Information stream (stdout output on master, null elsewhere)
label nTotalFaces() const noexcept
Return total number of faces in decomposed mesh. Not compensated for duplicate faces! ...
const boundBox & bounds() const noexcept
Return mesh bounding box.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Mesh consisting of general polyhedral cells.
readUpdateState
Enumeration defining the state of the mesh after a read update.
Foam::argList args(argc, argv)
bool found(const word &optName) const
Return true if the named option is found.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.