Go to the documentation of this file.
45 Info <<
"Renaming boundary patches" <<
endl;
49 std::map<word, label> patchToLabel;
54 std::pair<word, label>
66 std::map<word, label> newNameToPos;
70 if(
dict.found(
"newPatchNames") )
74 if(
dict.isDict(
"newPatchNames") )
96 patchesToRename.
transfer(copyPatchesToRename);
99 forAll(patchesToRename, patchI)
101 const word patchName = patchesToRename[patchI].keyword();
105 if(matchedPatches.empty())
107 Warning <<
"No matches for " << patchName <<
" found!!" <<
endl;
111 if( !patchesToRename[patchI].isDict() )
113 Warning <<
"Cannot rename patch " << patchName <<
endl;
114 Warning <<
"This is due to incorrect settings! Exitting."
119 const dictionary pDict = patchesToRename[patchI].dict();
121 forAll(matchedPatches, matchI)
125 if( pDict.
found(
"newName") )
128 if( newNameToPos.find(newName) != newNameToPos.end() )
131 patchToNew[matchedPatches[matchI]] = newNameToPos[newName];
136 newNameToPos.insert(std::pair<word, label>(newName, newPatchI));
137 newPatchNames[newPatchI] = newName;
138 if( pDict.
found(
"type") )
141 newPatchTypes[newPatchI] = newType;
145 newPatchTypes[newPatchI] =
"wall";
148 patchToNew[matchedPatches[matchI]] = newPatchI;
154 word defaultName(
"walls");
155 if(
dict.found(
"defaultName") )
156 defaultName =
word(
dict.lookup(
"defaultName"));
157 word defaultType(
"wall");
158 if(
dict.found(
"defaultType") )
159 defaultType =
word(
dict.lookup(
"defaultType"));
161 if(
dict.found(
"defaultName") && (newPatchI < patchToNew.
size()) )
163 bool addPatch(
false);
164 forAll(patchToNew, patchI)
165 if( patchToNew[patchI] == -1 )
173 newNameToPos.insert(std::pair<word, label>(defaultName, newPatchI));
174 newPatchNames[newPatchI] = defaultName;
175 newPatchTypes[newPatchI] = defaultType;
181 forAll(patchToNew, patchI)
183 if( patchToNew[patchI] != -1 )
186 patchToNew[patchI] = newPatchI;
196 newPatchNames.
setSize(newPatchI);
197 newPatchTypes.
setSize(newPatchI);
207 forAll(boundaries, patchI)
210 const label start = wp.patchStart();
211 const label end = start + wp.patchSize();
213 if( patchToNew[patchI] == -1 )
216 for(
label faceI=start;faceI<end;++faceI)
219 newBoundaryPatches.
append(newPatchI-1);
220 newBoundaryOwners.
append(owner[faceI]);
226 for(
label faceI=start;faceI<end;++faceI)
229 newBoundaryPatches.
append(patchToNew[patchI]);
230 newBoundaryOwners.
append(owner[faceI]);
246 newPatchTypes[patchI];
248 Info <<
"Finished renaming boundary patches" <<
endl;
262 if( meshDict.
found(
"renameBoundary") )
263 calculateNewBoundary();
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
const labelList & owner() const
owner and neighbour cells for faces
const entry & lookupEntry(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream if present otherwise error.
void append(const T &e)
Append an element at the end of the list.
A class for handling words, derived from string.
#define forAll(list, i)
Loop across all elements in list.
labelList findPatches(const word &patchName) const
return a list of patch indices corresponding to the given
Template functions to aid in the implementation of demand driven data.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
void replaceBoundary(const wordList &patchNames, const VRWGraph &boundaryFaces, const labelLongList &faceOwners, const labelLongList &facePatches)
replace the boundary with new boundary faces
Ostream & endl(Ostream &os)
Add newline and flush stream.
const faceListPMG & faces() const
access to faces
Like polyPatch but without reference to mesh. patchIdentifier::index is not used. Used in boundaryMes...
PtrList< boundaryPatch > & boundariesAccess()
access to boundary data
bool set(const label) const
Is element set.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
renameBoundaryPatches(const renameBoundaryPatches &)
Disallow default bitwise copy construct.
word getPatchName(const label patchID) const
return the name of a patch given its ID
void transfer(PtrList< T > &)
Transfer the contents of the argument PtrList into this PtrList.
A list of keyword definitions, which are a keyword followed by any number of values (e....
void calculateNewBoundary()
calculate new boundary and replace the existing one
const IOdictionary & meshDict_
dictionary containing relevant information
void setSize(const label)
Reset size of List.
void appendList(const ListType &l)
Append a list as a row at the end of the graph.
const PtrList< boundaryPatch > & boundaries() const
ordinary boundaries
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
virtual autoPtr< entry > clone(const dictionary &parentDict) const =0
Construct on freestore as copy with reference to the.
wordList toc() const
Return the table of contents.
void size(const label)
Override size to be inconsistent with allocated storage.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.