35template<
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,
92template<
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,
145template<
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,
196template<
class GeoField>
199 const word& fieldName,
200 const typename GeoField::Mesh&
mesh,
201 const wordList& timeNames,
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
290template<
class GeoField>
293 const word& fieldName,
294 const typename GeoField::Mesh&
mesh,
295 const wordList& timeNames,
296 const word& registryName
304 const_cast<objectRegistry&
>
306 mesh.thisDb().subRegistry(registryName,
true)
312template<
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);
361 if (nFields) Info<< endl;
365template<
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);
412 if (nFields) Info<< endl;
416template<
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);
443template<
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);
Field reading functions for post-processing utilities.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void push_back(const T &val)
Copy append an element to the end of this list.
void reserve(const label len)
Reserve allocation space for at least this size, allocating new space if required and retaining old c...
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable,...
UPtrList< const IOobject > csorted() const
The sorted list of IOobjects with headerClassName == Type::typeName.
@ REGISTER
Request registration (bool: true).
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A LIFO stack based on a singly-linked list.
void push(const T &elem)
Push an element onto the front of the stack.
void size(const label n)
Older name for setAddressableSize.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
label size() const noexcept
The number of entries in the list.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
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.
List< word > wordList
List of word.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
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.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields