35 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
38 const typename GeoMesh::Mesh&
mesh,
39 const IOobjectList& objects,
40 PtrList<GeometricField<Type, PatchField, GeoMesh>>&
fields,
42 const bool readOldTime
45 typedef GeometricField<Type, PatchField, GeoMesh> GeoField;
48 const wordList fieldNames(objects.sortedNames<GeoField>(syncPar));
51 fields.resize_null(fieldNames.size());
55 for (
const word& fieldName : fieldNames)
59 Info<<
"Reading " << GeoField::typeName <<
':';
61 Info<<
' ' << fieldName;
63 const IOobject&
io = *objects[fieldName];
76 IOobjectOption::MUST_READ,
77 IOobjectOption::AUTO_WRITE,
92 template<
class GeoField,
class Mesh>
96 const IOobjectList& objects,
102 const wordList fieldNames(objects.sortedNames<GeoField>(syncPar));
105 fields.resize_null(fieldNames.size());
109 for (
const word& fieldName : fieldNames)
113 Info<<
"Reading " << GeoField::typeName <<
':';
115 Info<<
' ' << fieldName;
117 const IOobject&
io = *objects[fieldName];
130 IOobjectOption::MUST_READ,
131 IOobjectOption::AUTO_WRITE,
145 template<
class GeoField>
148 const IOobjectList& objects,
149 PtrList<GeoField>&
fields,
154 const wordList fieldNames(objects.sortedNames<GeoField>(syncPar));
157 fields.resize_null(fieldNames.size());
161 for (
const word& fieldName : fieldNames)
165 Info<<
"Reading " << GeoField::typeName <<
':';
167 Info<<
' ' << fieldName;
169 const IOobject&
io = *objects[fieldName];
182 IOobjectOption::MUST_READ,
183 IOobjectOption::AUTO_WRITE,
196 template<
class GeoField>
199 const word& fieldName,
200 const typename GeoField::Mesh&
mesh,
202 objectRegistry& fieldsCache
208 unusedTimes.
erase(timeNames);
212 for (
const word&
timeName : unusedTimes)
214 objectRegistry& timeCache =
215 fieldsCache.lookupObjectRef<objectRegistry>(
timeName);
217 fieldsCache.checkOut(timeCache);
223 for (
const word&
timeName : timeNames)
231 objectRegistry* timeCachePtr =
new objectRegistry
238 IOobjectOption::NO_READ,
239 IOobjectOption::NO_WRITE,
240 IOobjectOption::REGISTER
243 timeCachePtr->store();
247 const objectRegistry& timeCache =
248 fieldsCache.lookupObject<objectRegistry>(
timeName);
251 if (!timeCache.found(fieldName))
263 IOobjectOption::MUST_READ,
264 IOobjectOption::NO_WRITE,
265 IOobjectOption::NO_REGISTER
271 GeoField* fldPtr =
new GeoField
278 IOobjectOption::NO_READ,
279 IOobjectOption::NO_WRITE,
280 IOobjectOption::REGISTER
290 template<
class GeoField>
293 const word& fieldName,
294 const typename GeoField::Mesh&
mesh,
296 const word& registryName
304 const_cast<objectRegistry&
> 306 mesh.thisDb().subRegistry(registryName,
true)
312 template<
class GeoFieldType,
class NameMatchPredicate>
315 const typename GeoFieldType::Mesh&
mesh,
316 const IOobjectList& objects,
317 const NameMatchPredicate& selectedFields,
318 DynamicList<regIOobject*>& storedObjects
322 const UPtrList<const IOobject> fieldObjects
324 objects.csorted<GeoFieldType>(selectedFields)
329 storedObjects.reserve(storedObjects.size() + fieldObjects.size());
333 for (
const IOobject&
io : fieldObjects)
337 Info<<
" " << GeoFieldType::typeName <<
':';
341 GeoFieldType* fieldPtr =
new GeoFieldType
349 IOobjectOption::MUST_READ,
350 IOobjectOption::NO_WRITE,
351 IOobjectOption::REGISTER
356 storedObjects.push_back(fieldPtr);
365 template<
class UniformFieldType,
class NameMatchPredicate>
368 const IOobjectList& objects,
369 const NameMatchPredicate& selectedFields,
370 DynamicList<regIOobject*>& storedObjects,
375 const UPtrList<const IOobject> fieldObjects
377 objects.csorted<UniformFieldType>(selectedFields, syncPar)
381 storedObjects.reserve(storedObjects.size() + fieldObjects.size());
385 for (
const IOobject&
io : fieldObjects)
389 Info<<
" " << UniformFieldType::typeName <<
':';
393 UniformFieldType* fieldPtr =
new UniformFieldType
401 IOobjectOption::MUST_READ,
402 IOobjectOption::NO_WRITE,
403 IOobjectOption::REGISTER
407 storedObjects.push_back(fieldPtr);
416 template<
class GeoFieldType,
class NameMatchPredicate>
419 const typename GeoFieldType::Mesh&
mesh,
420 const IOobjectList& objects,
421 const NameMatchPredicate& selectedFields,
422 LIFOStack<regIOobject*>& storedObjects
425 DynamicList<regIOobject*> newObjects;
427 readFields<GeoFieldType, NameMatchPredicate>
436 for (regIOobject* fieldPtr : newObjects)
438 storedObjects.push(fieldPtr);
443 template<
class UniformFieldType,
class NameMatchPredicate>
446 const IOobjectList& objects,
447 const NameMatchPredicate& selectedFields,
448 LIFOStack<regIOobject*>& storedObjects,
452 DynamicList<regIOobject*> newObjects;
454 readUniformFields<UniformFieldType, NameMatchPredicate>
463 for (regIOobject* fieldPtr : newObjects)
465 storedObjects.push(fieldPtr);
wordList ReadFields(const typename GeoMesh::Mesh &mesh, const IOobjectList &objects, PtrList< GeometricField< Type, PatchField, GeoMesh >> &fields, const bool syncPar=true, const bool readOldTime=false)
Read Geometric fields of templated type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Field reading functions for post-processing utilities.
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject *> &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
void readUniformFields(const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject *> &storedObjects, const bool syncPar=true)
Read the selected UniformDimensionedFields of the templated type and store on the objectRegistry...
bool erase(const iterator &iter)
Erase an entry specified by given iterator.
List< word > wordList
List of word.
messageStream Info
Information stream (stdout output on master, null elsewhere)
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)