Go to the documentation of this file.
83 Info<<
"Reading boundary from " << typeFilePath<IOPtrList<entry>>(io)
96 label nOldCyclics = 0;
101 if (patchDict.
get<
word>(
"type") == cyclicPolyPatch::typeName)
103 if (!patchDict.
found(
"neighbourPatch"))
106 <<
" does not have 'neighbourPatch' entry; assuming it"
107 <<
" is of the old type." <<
endl;
113 Info<<
"Detected " << nOldCyclics <<
" old cyclics." <<
nl <<
endl;
120 label nOldPatches =
patches.size();
128 label addedPatchi = nOldPatches;
130 forAll(oldPatches, patchi)
132 const dictionary& patchDict = oldPatches[patchi].dict();
136 patchDict.
get<
word>(
"type") == cyclicPolyPatch::typeName
139 const word&
name = oldPatches[patchi].keyword();
141 if (patchDict.
found(
"neighbourPatch"))
143 patches.
set(patchi, oldPatches.set(patchi,
nullptr));
144 oldToNew[patchi] = newPatchi++;
150 if (i != string::npos)
152 oldName =
name.substr(0, i);
154 Info<<
"Detected converted cyclic patch " <<
name
155 <<
" ; assuming it originates from " << oldName
160 i =
name.rfind(
"_half1");
161 if (i != string::npos)
163 oldName =
name.substr(0, i);
165 Info<<
"Detected converted cyclic patch " <<
name
166 <<
" ; assuming it originates from " << oldName
173 label nFaces = patchDict.
get<label>(
"nFaces");
174 label startFace = patchDict.
get<label>(
"startFace");
176 Info<<
"Detected old style " << patchDict.
get<
word>(
"type")
177 <<
" patch " <<
name <<
" with" <<
nl
178 <<
" nFaces : " << nFaces <<
nl
179 <<
" startFace : " << startFace <<
endl;
191 patches.
set(patchi, oldPatches.set(patchi,
nullptr));
192 oldToNew[patchi] = newPatchi++;
194 thisPatchDict.
add(
"neighbourPatch", nbrName);
195 thisPatchDict.
set(
"nFaces", nFaces/2);
196 patches[patchi].keyword() = thisName;
209 oldToNew[addedPatchi] = newPatchi++;
211 nbrPatchDict.
set(
"neighbourPatch", thisName);
212 nbrPatchDict.
set(
"nFaces", nFaces/2);
213 nbrPatchDict.
set(
"startFace", startFace+nFaces/2);
214 patches[addedPatchi].keyword() = nbrName;
216 Info<<
"Replaced with patches" <<
nl
217 <<
patches[patchi].keyword() <<
" with" <<
nl
219 << thisPatchDict.
get<label>(
"nFaces") <<
nl
221 << thisPatchDict.
get<label>(
"startFace") <<
nl
222 <<
patches[addedPatchi].keyword() <<
" with" <<
nl
224 << nbrPatchDict.
get<label>(
"nFaces") <<
nl
226 << nbrPatchDict.
get<label>(
"startFace") <<
nl
234 patches.
set(patchi, oldPatches.set(patchi,
nullptr));
235 oldToNew[patchi] = newPatchi++;
262 Info<<
"No changes made to boundary file." <<
nl <<
endl;
271 const word& fieldName,
278 Info<<
"Loading field " << fieldName <<
endl;
279 const word oldTypeName = IOdictionary::typeName;
294 const_cast<word&
>(IOdictionary::typeName) = oldTypeName;
296 const_cast<word&
>(fieldDict.type()) = fieldDict.headerClassName();
306 const word& patchName = iter.key();
307 const word& newName = iter.val();
309 Info<<
"Looking for entry for patch " << patchName <<
endl;
316 boundaryField.
found(patchName)
320 Info<<
" Changing entry " << patchName <<
" to " << newName
325 if (patchDict.
found(
"value"))
328 patchDict.
remove(
"value");
338 Info<<
" Adding entry " << nbrNames[patchName] <<
endl;
354 if (
mvBak(fieldDict.objectPath(),
"old"))
357 << (fieldDict.objectPath() +
".old") <<
nl;
361 << fieldDict.objectPath() <<
endl;
362 fieldDict.regIOobject::write();
367 Info<<
"No changes made to field " << fieldName <<
endl;
397 int main(
int argc,
char *argv[])
401 "Tool to upgrade mesh and fields for split cyclics"
409 "Test only do not change any files"
413 "enableFunctionEntries",
414 "Enable expansion of dictionary directives - #include, #codeStream etc"
429 const bool dryrun =
args.
found(
"dry-run");
432 Info<<
"-dry-run option: no changes made" <<
nl <<
endl;
434 const bool enableEntries =
args.
found(
"enableFunctionEntries");
526 objects.
names(volScalarField::typeName),
534 objects.
names(volVectorField::typeName),
542 objects.
names(volSphericalTensorField::typeName),
550 objects.
names(volSymmTensorField::typeName),
558 objects.
names(volTensorField::typeName),
571 objects.
names(pointScalarField::typeName),
579 objects.
names(pointVectorField::typeName),
587 objects.
names(pointSphericalTensorField::typeName),
595 objects.
names(pointSymmTensorField::typeName),
603 objects.
names(pointTensorField::typeName),
616 objects.
names(surfaceScalarField::typeName),
624 objects.
names(surfaceVectorField::typeName),
632 objects.
names(surfaceSphericalTensorField::typeName),
640 objects.
names(surfaceSymmTensorField::typeName),
648 objects.
names(surfaceTensorField::typeName),
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A keyword and a list of tokens is a 'dictionaryEntry'.
bool changeKeyword(const keyType &oldKeyword, const keyType &newKeyword, bool overwrite=false)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
A class for handling file names.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
A PtrList of objects of type <T> with automated input and output.
static word defaultRegion
T getOrDefault(const word &optName, const T &deflt) const
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
void reorder(const labelUList &oldToNew, const bool validBoundary)
static word timeName(const scalar t, const int precision=precision_)
static fileCheckTypes fileModificationChecking
static void addNote(const string ¬e)
bool insert(const Key &key, const T &obj)
static void addOptionCompat(const word &optName, std::pair< const char *, int > compat)
defineTemplateTypeNameAndDebug(faScalarMatrix, 0)
Ostream & endl(Ostream &os)
const T * set(const label i) const
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
entry * set(entry *entryPtr)
static const dictionary null
virtual bool write(const bool valid=true) const
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
void setSize(const label newLen)
graph_traits< Graph >::vertices_size_type size_type
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const word & headerClassName() const noexcept
const wordRes fieldNames(propsDict.getOrDefault< wordRes >("fields", wordRes()))
static int disableFunctionEntries
List of IOobjects with searching and retrieving facilities.
static void addDryRunOption(const string &usage, bool advanced=false)
A HashTable similar to std::unordered_map.
bool mvBak(const fileName &src, const std::string &ext="bak")
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
forAllConstIters(mixture.phases(), phase)
static void addOptions(const bool constant=true, const bool withZero=false)
bool remove(const word &keyword)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
virtual void setTime(const Time &t)
const polyBoundaryMesh & patches
word name(const expressions::valueTypeCode typeCode)
entry * add(entry *entryPtr, bool mergeEntry=false)
fileName objectPath() const
static instantList select0(Time &runTime, const argList &args)
const word & constant() const
Foam::argList args(argc, argv)
bool found(const word &optName) const