1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
11 cfMesh is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 3 of the License, or (at your
14 option) any later version.
16 cfMesh is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
26 \*---------------------------------------------------------------------------*/
28 #include "checkMeshDict.H"
29 #include "patchRefinementList.H"
32 #include "objectRefinement.H"
33 #include "coordinateModification.H"
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 void checkMeshDict::checkBasicSettings() const
44 //- check if maxCellSize is valid
45 const scalar maxCellSize = readScalar(meshDict_.lookup("maxCellSize"));
50 "void checkMeshDict::checkBasicSettings() const"
51 ) << "maxCellSize is negative! Cannot generate the mesh!!"
54 //- check if boundaryCellSize makes sense
55 if( meshDict_.found("boundaryCellSize") )
57 const scalar bcs = readScalar(meshDict_.lookup("boundaryCellSize"));
63 "void checkMeshDict::checkBasicSettings() const"
64 ) << "Boundary cell size is negative!!" << endl;
67 if( meshDict_.found("boundaryCellSizeRefinementThickness") )
69 const scalar thickness =
72 meshDict_.lookup("boundaryCellSizeRefinementThickness")
79 "void checkMeshDict::checkBasicSettings() const"
80 ) << "Boundary cell size refinement thickness is negative!!"
86 //- check if minCellSize is valid
87 if( meshDict_.found("minCellSize") )
89 const scalar mcs = readScalar(meshDict_.lookup("minCellSize"));
95 "void checkMeshDict::checkBasicSettings() const"
96 ) << "Minimum cell size for automatic refinement is negative!!"
102 //- check if keepCellsIntersectingBoundary can be read correctly
103 if( meshDict_.found("keepCellsIntersectingBoundary") )
106 readBool(meshDict_.lookup("keepCellsIntersectingBoundary"));
108 if( keep && meshDict_.found("checkForGluedMesh") )
110 readBool(meshDict_.lookup("checkForGluedMesh"));
114 //- check if enforceConstraints is available
115 if( meshDict_.found("enforceGeometryConstraints") )
117 readBool(meshDict_.lookup("enforceGeometryConstraints"));
121 void checkMeshDict::checkPatchCellSize() const
123 if( meshDict_.found("patchCellSize") )
125 if( meshDict_.isDict("patchCellSize") )
127 const dictionary& dict = meshDict_.subDict("patchCellSize");
129 const wordList patchNames = dict.toc();
134 patchRefinementList prl(meshDict_.lookup("patchCellSize"));
140 void checkMeshDict::checkSubsetCellSize() const
142 if( meshDict_.found("subsetCellSize") )
144 if( meshDict_.isDict("subsetCellSize") )
146 const dictionary& dict = meshDict_.subDict("subsetCellSize");
148 const wordList subsetNames = dict.toc();
153 patchRefinementList prl(meshDict_.lookup("patchCellSize"));
158 void checkMeshDict::checkLocalRefinementLevel() const
160 if( meshDict_.found("localRefinement") )
162 if( meshDict_.isDict("localRefinement") )
164 const dictionary& refDict = meshDict_.subDict("localRefinement");
165 const wordList entries = refDict.toc();
167 forAll(entries, dictI)
169 const dictionary& dict = refDict.subDict(entries[dictI]);
171 if( dict.found("cellSize") )
173 const scalar cs = readScalar(dict.lookup("cellSize"));
179 "void checkMeshDict::checkLocalRefinementLevel() const"
180 ) << "Cell size for " << entries[dictI]
181 << " is negative" << endl;
184 else if( dict.found("additionalRefinementLevels") )
186 const label nLevels =
187 readLabel(dict.lookup("additionalRefinementLevels"));
193 "void checkMeshDict::checkLocalRefinementLevel() const"
194 ) << "Refinement level for " << entries[dictI]
195 << " is negative" << endl;
202 "void checkMeshDict::checkLocalRefinementLevel() const"
203 ) << "Cannot read keyword"
204 << " additionalRefinementLevels or cellSize"
205 << "for " << entries[dictI] << exit(FatalError);
208 if( dict.found("refinementThickness") )
211 readScalar(dict.lookup("refinementThickness"));
217 "void checkMeshDict::checkLocalRefinementLevel() const"
218 ) << "Refinement thickness for " << entries[dictI]
219 << " is negative" << endl;
228 "void checkMeshDict::checkLocalRefinementLevel() const"
229 ) << "Cannot read localRefinement" << exit(FatalError);
234 void checkMeshDict::checkKeepCellsIntersectingPatches() const
236 if( meshDict_.found("keepCellsIntersectingPatches") )
238 if( meshDict_.isDict("keepCellsIntersectingPatches") )
240 const dictionary& dict =
241 meshDict_.subDict("keepCellsIntersectingPatches");
243 const wordList patchNames = dict.toc();
248 wordList kcip(meshDict_.lookup("keepCellsIntersectingPatches"));
253 void checkMeshDict::checkRemoveCellsIntersectingPatches() const
255 if( meshDict_.found("removeCellsIntersectingPatches") )
257 if( meshDict_.isDict("removeCellsIntersectingPatches") )
259 const dictionary& dict =
260 meshDict_.subDict("removeCellsIntersectingPatches");
262 const wordList patchNames = dict.toc();
267 wordList kcip(meshDict_.lookup("removeCellsIntersectingPatches"));
272 void checkMeshDict::checkObjectRefinements() const
274 if( meshDict_.found("objectRefinements") )
276 PtrList<objectRefinement> refObjects;
278 if( meshDict_.isDict("objectRefinements") )
280 const dictionary& dict = meshDict_.subDict("objectRefinements");
281 const wordList objectNames = dict.toc();
283 refObjects.setSize(objectNames.size());
285 forAll(refObjects, objectI)
287 const entry& objectEntry =
288 dict.lookupEntry(objectNames[objectI], false, false);
293 objectRefinement::New
295 objectEntry.keyword(),
303 Istream& is = meshDict_.lookup("objectRefinements");
305 PtrList<entry> objectEntries(is);
306 refObjects.setSize(objectEntries.size());
308 forAll(refObjects, objectI)
313 objectRefinement::New
315 objectEntries[objectI].keyword(),
316 objectEntries[objectI].dict()
322 forAll(refObjects, oI)
324 if( refObjects[oI].refinementThickness() < 0.0 )
328 "void checkMeshDict::checkObjectRefinements() const"
329 ) << "Refinement thickness specified for object "
330 << refObjects[oI].name() << " is negative!!" << endl;
336 void checkMeshDict::checkAnisotropicSources() const
338 if( meshDict_.found("anisotropicSources") )
340 PtrList<coordinateModification> anisotropicObjects;
342 if( meshDict_.isDict("anisotropicSources") )
344 const dictionary& dict = meshDict_.subDict("anisotropicSources");
345 const wordList objectNames = dict.toc();
347 anisotropicObjects.setSize(objectNames.size());
349 forAll(anisotropicObjects, objectI)
351 const entry& objectEntry =
352 dict.lookupEntry(objectNames[objectI], false, false);
354 anisotropicObjects.set
357 coordinateModification::New
359 objectEntry.keyword(),
368 void checkMeshDict::checkSurfaceRefinements() const
370 if( meshDict_.found("surfaceMeshRefinement") )
372 const dictionary& surfaces = meshDict_.subDict("surfaceMeshRefinement");
374 const wordList surfaceSources = surfaces.toc();
376 forAll(surfaceSources, surfI)
378 if( surfaces.isDict(surfaceSources[surfI]) )
380 const dictionary& dict =
381 surfaces.subDict(surfaceSources[surfI]);
383 if( dict.found("surfaceFile") )
385 const fileName fName(dict.lookup("surfaceFile"));
390 "void checkMeshDict::checkSurfaceRefinements() const"
391 ) << "Surface file " << fName
392 << " does not exist or is not readable!!"
399 "void checkMeshDict::checkSurfaceRefinements() const"
400 ) << "Missing surfaceFile for entry "
401 << surfaceSources[surfI] << exit(FatalError);
404 if( dict.found("cellSize") )
406 const scalar cs = readScalar(dict.lookup("cellSize"));
411 "void checkMeshDict::"
412 "checkSurfaceRefinements() const"
413 ) << "Cell size for entry " << surfaceSources[surfI]
414 << " is extremely small or negative!!"
417 else if( dict.found("additionalRefinementLevels") )
420 readLabel(dict.lookup("additionalRefinementLevels"));
426 "void checkMeshDict::"
427 "checkSurfaceRefinements() const"
428 ) << "Number refinement levels for entry "
429 << surfaceSources[surfI] << " is negative!!"
437 "void checkMeshDict::checkSurfaceRefinements() const"
438 ) << "Missing cellSize or additionalRefinementLevels"
439 << " for entry " << surfaceSources[surfI]
443 if( dict.found("refinementThickness") )
446 readScalar(dict.lookup("refinementThickness"));
451 "void checkMeshDict::"
452 "checkSurfaceRefinements() const"
453 ) << "Refinement thickness for entry "
454 << surfaceSources[surfI]
455 << " is extremely small or negative!!" << endl;
462 "void checkMeshDict::checkSurfaceRefinements() const"
463 ) << "Dictionary " << surfaceSources[surfI]
464 << " does not exist!!"
471 void checkMeshDict::checkEdgeMeshRefinements() const
473 if( meshDict_.found("edgeMeshRefinement") )
475 const dictionary& edgeMeshes = meshDict_.subDict("edgeMeshRefinement");
477 const wordList edgeMeshSources = edgeMeshes.toc();
479 forAll(edgeMeshSources, emI)
481 if( edgeMeshes.isDict(edgeMeshSources[emI]) )
483 const dictionary& dict =
484 edgeMeshes.subDict(edgeMeshSources[emI]);
486 if( dict.found("edgeFile") )
488 const fileName fName(dict.lookup("edgeFile"));
493 "void checkMeshDict::checkEdgeMeshRefinements() const"
494 ) << "Edge mesh file " << fName
495 << " does not exist or is not readable!!"
502 "void checkMeshDict::checkEdgeMeshRefinements() const"
503 ) << "Missing edgeFilw for entry "
504 << edgeMeshSources[emI] << exit(FatalError);
507 if( dict.found("cellSize") )
509 const scalar cs = readScalar(dict.lookup("cellSize"));
514 "void checkMeshDict::"
515 "checkEdgeMeshRefinements() const"
516 ) << "Cell size for entry " << edgeMeshSources[emI]
517 << " is extremely small or negative!!"
520 else if( dict.found("additionalRefinementLevels") )
523 readLabel(dict.lookup("additionalRefinementLevels"));
529 "void checkMeshDict::"
530 "checkEdgeMeshRefinements() const"
531 ) << "Number refinement levels for entry "
532 << edgeMeshSources[emI] << " is negative!!"
540 "void checkMeshDict::checkEdgeMeshRefinements() const"
541 ) << "Missing cellSize or additionalRefinementLevels"
542 << " for entry " << edgeMeshSources[emI]
546 if( dict.found("refinementThickness") )
549 readScalar(dict.lookup("refinementThickness"));
554 "void checkMeshDict::"
555 "checkEdgeMeshRefinements() const"
556 ) << "Refinement thickness for entry "
557 << edgeMeshSources[emI]
558 << " is extremely small or negative!!" << endl;
565 "void checkMeshDict::checkEdgeMeshRefinements() const"
566 ) << "Dictionary " << edgeMeshSources[emI]
567 << " does not exist!!"
574 void checkMeshDict::checkBoundaryLayers() const
576 if( meshDict_.found("boundaryLayers") )
578 const dictionary& bndLayers = meshDict_.subDict("boundaryLayers");
580 //- read global properties
581 if( bndLayers.found("nLayers") )
583 readLabel(bndLayers.lookup("nLayers"));
585 if( bndLayers.found("thicknessRatio") )
587 readScalar(bndLayers.lookup("thicknessRatio"));
589 if( bndLayers.found("maxFirstLayerThickness") )
591 readScalar(bndLayers.lookup("maxFirstLayerThickness"));
594 //- patch-based properties
595 if( bndLayers.isDict("patchBoundaryLayers") )
597 const dictionary& patchBndLayers =
598 bndLayers.subDict("patchBoundaryLayers");
599 const wordList patchNames = patchBndLayers.toc();
601 forAll(patchNames, patchI)
603 const word pName = patchNames[patchI];
605 if( patchBndLayers.isDict(pName) )
607 const dictionary& patchDict =
608 patchBndLayers.subDict(pName);
610 if( patchDict.found("nLayers") )
612 readLabel(patchDict.lookup("nLayers"));
614 if( patchDict.found("thicknessRatio") )
616 readScalar(patchDict.lookup("thicknessRatio"));
618 if( patchDict.found("maxFirstLayerThickness") )
620 readScalar(patchDict.lookup("maxFirstLayerThickness"));
622 if( patchDict.found("allowDiscontinuity") )
624 readBool(patchDict.lookup("allowDiscontinuity"));
629 Warning << "Cannot refine layer for patch "
630 << patchNames[patchI] << endl;
635 //- check for existence of boundary layer smoothing
636 if( bndLayers.found("optimiseLayer") )
638 readBool(bndLayers.lookup("optimiseLayer"));
641 if( bndLayers.found("optimisationParameters") )
643 const dictionary& optParams =
644 bndLayers.subDict("optimisationParameters");
646 if( optParams.found("reCalculateNormals") )
648 readBool(optParams.lookup("reCalculateNormals"));
651 if( optParams.found("nSmoothNormals") )
653 const label nSmoothNormals =
654 readLabel(optParams.lookup("nSmoothNormals"));
656 if( nSmoothNormals < 0 )
659 "void checkMeshDict::checkBoundaryLayers() const"
660 ) << "nSmoothNormals must not be negative!"
664 if( optParams.found("featureSizeFactor") )
666 const scalar featureSizeFactor =
667 readScalar(optParams.lookup("featureSizeFactor"));
669 if( featureSizeFactor >= 1.0 || featureSizeFactor < 0.0 )
672 "void checkMeshDict::checkBoundaryLayers() const"
673 ) << "Feature size factor is out"
674 << " of a valid range 0 to 1" << exit(FatalError);
677 if( optParams.found("relThicknessTol") )
679 const scalar relThicknessTol =
680 readScalar(optParams.lookup("relThicknessTol"));
682 if( relThicknessTol >= 1.0 || relThicknessTol < 0.0 )
685 "void checkMeshDict::checkBoundaryLayers() const"
686 ) << "Relative thickness tolerance is out"
687 << " of a valid range 0 to 1" << exit(FatalError);
690 if( optParams.found("maxNumIterations") )
692 const label maxNumIterations =
693 readLabel(optParams.lookup("maxNumIterations"));
695 if( maxNumIterations < 0 )
698 "void checkMeshDict::checkBoundaryLayers() const"
699 ) << "maxNumIterations must not be negative!"
706 void checkMeshDict::checkRenameBoundary() const
708 if( meshDict_.found("renameBoundary") )
710 const dictionary& dict = meshDict_.subDict("renameBoundary");
711 if( dict.found("newPatchNames") )
713 if( dict.isDict("newPatchNames") )
715 const dictionary& patchDicts = dict.subDict("newPatchNames");
717 const wordList patchNames = patchDicts.toc();
719 forAll(patchNames, patchI)
721 const word& pName = patchNames[patchI];
723 if( !patchDicts.isDict(pName) )
726 "void checkMeshDict::checkRenameBoundary() const"
727 ) << "Entry " << pName
728 << " is not a dictionary" << exit(FatalError);
730 const dictionary dict = patchDicts.subDict(pName);
732 if( !dict.found("newName") )
735 "void checkMeshDict::checkRenameBoundary() const"
736 ) << "Dictionary " << pName
737 << " does not contain a newName keyword"
743 const PtrList<entry> patchesToRename
745 dict.lookup("newPatchNames")
748 forAll(patchesToRename, patchI)
750 const word& pName = patchesToRename[patchI].keyword();
752 const dictionary dict = patchesToRename[patchI].dict();
754 if( !dict.found("newName") )
757 "void checkMeshDict::checkRenameBoundary() const"
758 ) << "Dictionary " << pName
759 << " does not contain a newName keyword"
767 void checkMeshDict::checkEntries() const
769 checkBasicSettings();
771 checkPatchCellSize();
773 checkSubsetCellSize();
775 checkSurfaceRefinements();
777 checkKeepCellsIntersectingPatches();
779 checkRemoveCellsIntersectingPatches();
781 checkObjectRefinements();
783 checkAnisotropicSources();
785 checkBoundaryLayers();
787 checkRenameBoundary();
790 void checkMeshDict::updatePatchCellSize
792 const std::map<word, wordList>& patchesFromPatch
795 if( meshDict_.found("patchCellSize") )
797 LongList<patchRefinement> updatedPatchRefinement;
799 if( meshDict_.isDict("patchCellSize") )
801 const dictionary dict = meshDict_.subDict("patchCellSize");
803 const wordList patchNames = dict.toc();
805 forAll(patchNames, patchI)
807 const word& pName = patchNames[patchI];
809 std::map<word, wordList>::const_iterator it =
810 patchesFromPatch.find(pName);
811 if( it == patchesFromPatch.end() )
814 const wordList& updatedPatchNames = it->second;
816 const dictionary& pDict = dict.subDict(pName);
817 const scalar cellSize = readScalar(pDict.lookup("cellSize"));
819 forAll(updatedPatchNames, nameI)
820 updatedPatchRefinement.append
824 updatedPatchNames[nameI],
832 patchRefinementList prl(meshDict_.lookup("patchCellSize"));
835 const word& pName = prl[prlI].patchName();
836 const scalar cellSize = prl[prlI].cellSize();
838 std::map<word, wordList>::const_iterator it =
839 patchesFromPatch.find(pName);
841 if( it == patchesFromPatch.end() )
844 const wordList& updatedPatchNames = it->second;
845 forAll(updatedPatchNames, nameI)
846 updatedPatchRefinement.append
850 updatedPatchNames[nameI],
857 meshDict_.add("patchCellSize", updatedPatchRefinement, true);
861 void checkMeshDict::updateSubsetCellSize
863 const std::map<word, wordList>& patchesFromPatch
869 void checkMeshDict::updateLocalRefinement
871 const std::map<word, wordList>& patchesFromPatch
874 if( meshDict_.found("localRefinement") )
876 if( meshDict_.isDict("localRefinement") )
878 dictionary& dict = meshDict_.subDict("localRefinement");
880 const wordList entries = dict.toc();
882 forAll(entries, dictI)
884 const word& pName = entries[dictI];
886 std::map<word, wordList>::const_iterator it =
887 patchesFromPatch.find(pName);
888 if( it == patchesFromPatch.end() )
891 const wordList& updatedPatchNames = it->second;
893 const dictionary& pDict = dict.subDict(pName);
894 dictionary copy = pDict;
897 forAll(updatedPatchNames, nameI)
898 dict.add(updatedPatchNames[nameI], copy);
900 //- remove the current patch
907 void checkMeshDict::updateKeepCellsIntersectingPatches
909 const std::map<word, wordList>& patchesFromPatch
912 if( meshDict_.found("keepCellsIntersectingPatches") )
914 LongList<word> updatedPatchNames;
915 if( meshDict_.isDict("keepCellsIntersectingPatches") )
917 const dictionary& dict =
918 meshDict_.subDict("keepCellsIntersectingPatches");
920 const wordList patchNames = dict.toc();
921 forAll(patchNames, patchI)
923 const word& pName = patchNames[patchI];
925 std::map<word, wordList>::const_iterator it =
926 patchesFromPatch.find(pName);
928 if( it == patchesFromPatch.end() )
930 updatedPatchNames.append(pName);
934 const wordList& newPatchNames = it->second;
936 forAll(newPatchNames, nameI)
937 updatedPatchNames.append(newPatchNames[nameI]);
942 wordList kcip(meshDict_.lookup("keepCellsIntersectingPatches"));
946 const word& pName = kcip[i];
948 std::map<word, wordList>::const_iterator it =
949 patchesFromPatch.find(pName);
951 if( it == patchesFromPatch.end() )
952 updatedPatchNames.append(pName);
954 const wordList& newPatchNames = it->second;
956 forAll(newPatchNames, nameI)
957 updatedPatchNames.append(newPatchNames[nameI]);
961 meshDict_.add("keepCellsIntersectingPatches", updatedPatchNames, true);
966 void checkMeshDict::updateRemoveCellsIntersectingPatches
968 const std::map<word, wordList>& patchesFromPatch
971 if( meshDict_.found("removeCellsIntersectingPatches") )
973 LongList<word> updatedPatchNames;
974 if( meshDict_.isDict("removeCellsIntersectingPatches") )
976 const dictionary& dict =
977 meshDict_.subDict("removeCellsIntersectingPatches");
979 const wordList patchNames = dict.toc();
980 forAll(patchNames, patchI)
982 const word& pName = patchNames[patchI];
984 std::map<word, wordList>::const_iterator it =
985 patchesFromPatch.find(pName);
987 if( it == patchesFromPatch.end() )
989 updatedPatchNames.append(pName);
993 const wordList& newPatchNames = it->second;
995 forAll(newPatchNames, nameI)
996 updatedPatchNames.append(newPatchNames[nameI]);
1001 wordList kcip(meshDict_.lookup("removeCellsIntersectingPatches"));
1005 const word& pName = kcip[i];
1007 std::map<word, wordList>::const_iterator it =
1008 patchesFromPatch.find(pName);
1010 if( it == patchesFromPatch.end() )
1011 updatedPatchNames.append(pName);
1013 const wordList& newPatchNames = it->second;
1015 forAll(newPatchNames, nameI)
1016 updatedPatchNames.append(newPatchNames[nameI]);
1022 "removeCellsIntersectingPatches",
1029 void checkMeshDict::updateObjectRefinements
1031 const std::map<word, wordList>& patchesFromPatch
1037 void checkMeshDict::updateBoundaryLayers
1039 const std::map<word, wordList>& patchesFromPatch
1042 if( meshDict_.isDict("boundaryLayers") )
1044 dictionary& bndLayersDict = meshDict_.subDict("boundaryLayers");
1045 if( bndLayersDict.isDict("patchBoundaryLayers") )
1047 dictionary& patchBndLayers =
1048 bndLayersDict.subDict("patchBoundaryLayers");
1050 const wordList patchLayers = patchBndLayers.toc();
1052 forAll(patchLayers, patchI)
1054 const word& pName = patchLayers[patchI];
1056 dictionary dict = patchBndLayers.subDict(pName);
1058 const std::map<word, wordList>::const_iterator it =
1059 patchesFromPatch.find(pName);
1061 //- patch name may be a regex
1062 if( it != patchesFromPatch.end() )
1064 const wordList& newNames = it->second;
1068 patchBndLayers.add(newNames[i], dict);
1071 patchBndLayers.remove(pName);
1078 void checkMeshDict::updateRenameBoundary
1080 const std::map<word, wordList>& patchesFromPatch,
1081 const std::map<word, word>& patchTypes
1086 newDict.add("newPatchNames", dictionary());
1088 if( meshDict_.found("renameBoundary") )
1090 const dictionary& dict = meshDict_.subDict("renameBoundary");
1092 //- transfer or generate the default name entry
1093 if( dict.found("defaultName") )
1095 const word name(dict.lookup("defaultName"));
1096 newDict.add("defaultName", name);
1099 //- transfer or generate the defaultType entry
1100 if( dict.found("defaultType") )
1102 const word type(dict.lookup("defaultType"));
1103 newDict.add("defaultType", type);
1106 if( dict.found("newPatchNames") )
1108 //- stores the updated dictionary
1109 dictionary& newPatchesDict = newDict.subDict("newPatchNames");
1111 if( dict.isDict("newPatchNames") )
1113 //- current state of the dictionary
1114 const dictionary& patchDicts = dict.subDict("newPatchNames");
1116 std::map<word, wordList>::const_iterator it;
1117 for(it=patchesFromPatch.begin();it!=patchesFromPatch.end();++it)
1119 const word& pName = it->first;
1120 const wordList& newNames = it->second;
1122 if( patchDicts.found(pName) )
1124 //- patch renaming is already requested by the user
1125 //- use the new name for all newly created patches
1126 const dictionary& patchDict = patchDicts.subDict(pName);
1127 if( !patchDict.found("newName") )
1129 if( !patchDict.found("type") )
1132 const word newName(patchDict.lookup("newName"));
1133 const word newType(patchDict.lookup("type"));
1137 dictionary newPatchDict;
1138 newPatchDict.add("newName", newName);
1139 newPatchDict.add("type", newType);
1141 newPatchesDict.add(newNames[i], newPatchDict);
1146 //- rename all newly create patches
1147 //- with the original name
1150 dictionary newPatchDict;
1152 newPatchDict.add("newName", it->first);
1153 std::map<word, word>::const_iterator tIter =
1154 patchTypes.find(it->first);
1155 newPatchDict.add("type", tIter->second);
1157 newPatchesDict.add(newNames[i], newPatchDict);
1164 const PtrList<entry> patchEntries(dict.lookup("newPatchNames"));
1166 forAll(patchEntries, entryI)
1168 const word& pName = patchEntries[entryI].keyword();
1169 dictionary patchDict(patchEntries[entryI].dict());
1171 std::map<word, wordList>::const_iterator it =
1172 patchesFromPatch.find(pName);
1174 if( it == patchesFromPatch.end() )
1177 const wordList& newNames = it->second;
1180 newPatchesDict.add(newNames[i], patchDict, true);
1183 std::map<word, wordList>::const_iterator it;
1184 for(it=patchesFromPatch.begin();it!=patchesFromPatch.end();++it)
1186 const word& pName = it->first;
1187 const wordList& newNames = it->second;
1189 if( newPatchesDict.found(pName) )
1192 //- rename all newly created patches
1193 //- with the original name
1196 dictionary newPatchDict;
1198 newPatchDict.add("newName", it->first);
1199 std::map<word, word>::const_iterator tIter =
1200 patchTypes.find(it->first);
1201 newPatchDict.add("type", tIter->second);
1203 newPatchesDict.add(newNames[i], newPatchDict);
1210 //- newPatchNames is not used
1211 dictionary& newPatchesDict = newDict.subDict("newPatchNames");
1213 std::map<word, wordList>::const_iterator it;
1214 for(it=patchesFromPatch.begin();it!=patchesFromPatch.end();++it)
1216 const wordList& newPatchNames = it->second;
1218 forAll(newPatchNames, i)
1220 const word& pName = newPatchNames[i];
1221 dictionary newPatchDict;
1222 newPatchDict.add("newName", it->first);
1223 std::map<word, word>::const_iterator tIter =
1224 patchTypes.find(it->first);
1225 newPatchDict.add("type", tIter->second);
1227 newPatchesDict.add(pName, newPatchDict);
1232 //- delete all previus entries from the dictionary
1233 meshDict_.subDict("renameBoundary").clear();
1237 //- create the dictionary if it has not existed before
1238 dictionary& newPatchesDict = newDict.subDict("newPatchNames");
1240 std::map<word, wordList>::const_iterator it;
1241 for(it=patchesFromPatch.begin();it!=patchesFromPatch.end();++it)
1243 const wordList& newPatchNames = it->second;
1245 forAll(newPatchNames, i)
1247 const word& pName = newPatchNames[i];
1248 dictionary newPatchDict;
1249 newPatchDict.add("newName", it->first);
1250 std::map<word, word>::const_iterator tIter =
1251 patchTypes.find(it->first);
1252 newPatchDict.add("type", tIter->second);
1254 newPatchesDict.add(pName, newPatchDict);
1259 meshDict_.add("renameBoundary", newDict, true);
1262 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
1264 checkMeshDict::checkMeshDict
1266 IOdictionary& meshDict
1274 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
1276 checkMeshDict::~checkMeshDict()
1279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1281 void checkMeshDict::updateDictionaries
1283 const std::map<word, wordList>& patchesFromPatch,
1284 const std::map<word, word>& patchTypes,
1285 const bool renamePatches
1288 updatePatchCellSize(patchesFromPatch);
1290 updateSubsetCellSize(patchesFromPatch);
1292 updateLocalRefinement(patchesFromPatch);
1294 updateKeepCellsIntersectingPatches(patchesFromPatch);
1296 updateRemoveCellsIntersectingPatches(patchesFromPatch);
1298 updateObjectRefinements(patchesFromPatch);
1300 updateBoundaryLayers(patchesFromPatch);
1303 updateRenameBoundary(patchesFromPatch, patchTypes);
1306 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1308 } // End namespace Foam
1310 // ************************************************************************* //