38 const fileName& baseDir,
40 const word& solverType
46 Info<<
" Reading boundary templates" <<
endl;
48 fileName BCDir(baseDir/
"boundaryConditions");
50 IOdictionary regionBCs
54 fileName(BCDir/
"boundaries"),
60 for (
const entry& dEntry : regionBCs)
62 const word& regionType = dEntry.keyword();
65 dictionary regionTemplate;
66 dictionary regionOptions;
89 fileName(BCDir/regionType/solverType/
patchTypes[i]),
94 if (io.typeHeaderOk<IOdictionary>(
true))
96 IOdictionary
dict(io);
104 fileName optFile(BCDir/regionType/
patchTypes[i] +
"Options");
106 IFstream is(optFile);
131 BCDir/regionType/solverType/
patchTypes[i] +
"Options"
134 IFstream is(optFile);
152 templates_.add(regionType, regionTemplate);
153 options_.add(regionType, regionOptions);
168 const word& regionPrefix,
169 const word& fieldName,
170 const word& condition,
171 const word& category,
172 const word& patchType,
173 const dictionary& conditionOptions
176 const dictionary& regionTemplates = templates_.
subDict(regionPrefix);
179 if (regionTemplates.found(category))
181 const dictionary& categoryDict = regionTemplates.
subDict(category);
184 if (categoryDict.found(patchType))
186 dictionary patchDict = categoryDict.
subDict(patchType);
189 if (patchDict.found(
"OPTIONS"))
191 const dictionary& regionOptions =
192 options_.
subDict(regionPrefix);
194 if (!regionOptions.found(category))
197 <<
"No options available for category "
201 const dictionary&
dict = regionOptions.
subDict(category);
203 const wordList requiredOptions(patchDict.lookup(
"OPTIONS"));
205 for (
const word& option : requiredOptions)
208 if (!conditionOptions.readIfPresent(option, selected))
211 <<
"Condition " << condition <<
": "
212 <<
"No option '" << option
213 <<
"' available for category '" << category
214 <<
"' and patch type '" << patchType
215 <<
"'. Valid options are: "
216 << conditionOptions.toc()
223 <<
"Condition " << condition <<
": "
224 <<
"No option '" << option
225 <<
"' available for category '" << category
226 <<
"' and patch type '" << patchType
227 <<
"'. Valid options are " <<
dict.
toc()
231 const dictionary& optionDict =
dict.
subDict(option);
233 if (!optionDict.found(selected))
236 <<
"Condition " << condition <<
": "
237 <<
"No option '" << selected
238 <<
"' available for category '" << category
239 <<
"' and patch type '" << patchType
240 <<
"'. Valid options are " << optionDict.toc()
244 const dictionary&
dict = optionDict.
subDict(selected);
251 if (patchDict.found(fieldName))
254 const dictionary& fieldDict = patchDict.
subDict(fieldName);
256 for (
const entry& dEntry : fieldDict)
262 s.replace(dEntry.keyword(),
"");
266 "boundaryConditions." + condition +
".values"
268 dict.
add(dEntry.keyword(),
s.c_str());
276 <<
"Condition " << condition <<
": "
277 <<
"No '" << patchType
278 <<
"' condition found for field '" << fieldName
279 <<
"' in category type '" << category <<
"'"
286 <<
"Condition " << condition <<
": "
287 <<
"No '" << patchType <<
"' boundary types defined in "
288 << categoryDict.dictName() <<
" templates. "
289 <<
"Available types are: " << categoryDict.toc()
296 <<
"Condition " << condition <<
": "
297 <<
"Invalid boundary condition type '" << patchType
298 <<
"'. Valid types are:" << regionTemplates.toc()
308 const word& regionPrefix,
309 const word& condition,
310 const word& category,
311 const word& patchType
314 const dictionary& regionTemplates = templates_.subDict(regionPrefix);
316 if (!regionTemplates.found(category))
319 <<
"Condition " << condition <<
": "
320 <<
"Unknown category '" << category
321 <<
"'. Valid categories are: " << regionTemplates.toc()
325 const dictionary& categoryDict = regionTemplates.subDict(category);
327 if (!categoryDict.found(patchType))
330 <<
"Condition " << condition <<
": "
331 <<
"Unknown type '" << patchType <<
"' in category '"
332 << category <<
"'. Valid types are: " << categoryDict.toc()
340 const word& regionPrefix,
341 const word& category,
342 const word& patchType
345 const dictionary& regionTemplates = templates_.subDict(regionPrefix);
347 if (regionTemplates.found(category))
349 const dictionary& categoryDict = regionTemplates.subDict(category);
351 if (categoryDict.found(patchType))
353 const dictionary& patchDict = categoryDict.subDict(patchType);
355 if (patchDict.found(
"OPTIONS"))
363 <<
"No type '" << patchType <<
"' found in category '"
364 << category <<
"'. Valid types are "
365 << categoryDict.toc()
372 <<
"No category '" << category <<
"' found in templates. "
373 <<
"Valid categories are " << templates_.toc()