89 label nOldCyclics = 0;
94 if (
word(patchDict[
"type"]) == cyclicPolyPatch::typeName)
96 if (!patchDict.
found(
"neighbourPatch"))
99 <<
" does not have 'neighbourPatch' entry; assuming it" 100 <<
" is of the old type." <<
endl;
106 Info<<
"Detected " << nOldCyclics <<
" old cyclics." <<
nl <<
endl;
114 patches.setSize(nOldPatches+nOldCyclics);
121 label addedPatchi = nOldPatches;
129 word(patchDict[
"type"]) == cyclicPolyPatch::typeName
132 const word& name = oldPatches[
patchi].keyword();
134 if (patchDict.
found(
"neighbourPatch"))
137 oldToNew[
patchi] = newPatchi++;
143 if (i != string::npos)
145 oldName = name.substr(0, i);
146 thisNames.
insert(oldName, name);
147 Info<<
"Detected converted cyclic patch " << name
148 <<
" ; assuming it originates from " << oldName
153 i = name.rfind(
"_half1");
154 if (i != string::npos)
156 oldName = name.substr(0, i);
157 nbrNames.
insert(oldName, name);
158 Info<<
"Detected converted cyclic patch " << name
159 <<
" ; assuming it originates from " << oldName
169 Info<<
"Detected old style " <<
word(patchDict[
"type"])
170 <<
" patch " << name <<
" with" <<
nl 171 <<
" nFaces : " << nFaces <<
nl 172 <<
" startFace : " << startFace <<
endl;
174 word thisName = name +
"_half0";
175 word nbrName = name +
"_half1";
177 thisNames.
insert(name, thisName);
178 nbrNames.
insert(name, nbrName);
185 oldToNew[
patchi] = newPatchi++;
187 thisPatchDict.
add(
"neighbourPatch", nbrName);
188 thisPatchDict.
set(
"nFaces", nFaces/2);
202 oldToNew[addedPatchi] = newPatchi++;
204 nbrPatchDict.
set(
"neighbourPatch", thisName);
205 nbrPatchDict.
set(
"nFaces", nFaces/2);
206 nbrPatchDict.
set(
"startFace", startFace+nFaces/2);
207 patches[addedPatchi].keyword() = nbrName;
209 Info<<
"Replaced with patches" <<
nl 216 <<
patches[addedPatchi].keyword() <<
" with" <<
nl 230 oldToNew[
patchi] = newPatchi++;
247 << (
patches.objectPath() +
".old") <<
nl;
257 Info<<
"No changes made to boundary file." <<
nl <<
endl;
264 const bool isTestRun,
266 const word& fieldName,
273 Info<<
"Loading field " << fieldName <<
endl;
274 const word oldTypeName = IOdictionary::typeName;
289 const_cast<word&
>(IOdictionary::typeName) = oldTypeName;
291 const_cast<word&
>(fieldDict.type()) = fieldDict.headerClassName();
301 const word& patchName = iter.key();
302 const word& newName = iter();
304 Info<<
"Looking for entry for patch " << patchName <<
endl;
311 boundaryField.
found(patchName)
312 && !boundaryField.
found(newName,
false,
false)
315 Info<<
" Changing entry " << patchName <<
" to " << newName
320 if (patchDict.
found(
"value"))
323 patchDict.
remove(
"value");
333 Info<<
" Adding entry " << nbrNames[patchName] <<
endl;
349 if (
mvBak(fieldDict.objectPath(),
"old"))
352 << (fieldDict.objectPath() +
".old") <<
nl;
356 << fieldDict.objectPath() <<
endl;
357 fieldDict.regIOobject::write();
362 Info<<
"No changes made to field " << fieldName <<
endl;
370 const bool isTestRun,
392 int main(
int argc,
char *argv[])
399 "enableFunctionEntries",
400 "enable expansion of dictionary directives - #include, #codeStream etc" 418 Info<<
"-test option: no changes made" <<
nl <<
endl;
467 runTime.setTime(timeDirs[timeI], timeI);
469 Info<<
"Time: " << runTime.timeName() <<
endl;
#define forAll(list, i)
Loop across all elements in list.
bool remove(const word &)
Remove an entry specified by keyword.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
List of IOobjects with searching and retrieving facilities.
A list of keyword definitions, which are a keyword followed by any number of values (e...
static const char *const typeName
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
static const dictionary null
Null dictionary.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
A keyword and a list of tokens is a 'dictionaryEntry'.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
bool mvBak(const fileName &, const std::string &ext="bak")
Rename to a corresponding backup file.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
static List< word > fieldNames
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
static fileCheckTypes fileModificationChecking
bool changeKeyword(const keyType &oldKeyword, const keyType &newKeyword, bool forceOverwrite=false)
Change the keyword for an entry,.
static int disableFunctionEntries
fileName filePath() const
Return complete path + object name if the file exists.
bool optionFound(const word &opt) const
Return true if the named option is found.
A class for handling words, derived from string.
static const word null
An empty word.
const word & constant() const
Return constant name.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
An STL-conforming hash table.
graph_traits< Graph >::vertices_size_type size_type
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
label readLabel(Istream &is)
defineTemplateTypeNameAndDebug(IOPtrList< ensightPart >, 0)
static instantList select0(Time &runTime, const argList &args)
Return the set of times selected based on the argList options.
A PtrList of objects of type <T> with automated input and output.
void set(entry *)
Assign a new entry, overwrite any existing entry.
bool headerOk()
Read and check header info.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
Foam::argList args(argc, argv)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static void addOptions(const bool constant=true, const bool withZero=false)
Add the options handled by timeSelector to argList::validOptions.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.