34 template<
class MatchPredicate>
38 const MatchPredicate& matchName
61 template<
class MatchPredicate1,
class MatchPredicate2>
62 Foam::label Foam::IOobjectList::countImpl
65 const MatchPredicate1& matchClass,
66 const MatchPredicate2& matchName
86 template<
class Type,
class MatchPredicate>
87 Foam::label Foam::IOobjectList::countTypeImpl
90 const MatchPredicate& matchName
110 template<
class MatchPredicate1,
class MatchPredicate2>
114 const MatchPredicate1& matchClass,
115 const MatchPredicate2& matchName,
134 objNames.resize(
count);
146 template<
class Type,
class MatchPredicate>
150 const MatchPredicate& matchName,
169 objNames.resize(
count);
181 template<
class Type,
class MatchPredicate>
183 Foam::IOobjectList::objectsTypeImpl
186 const MatchPredicate& matchName,
205 result.resize(
count);
217 template<
class MatchPredicate>
221 const MatchPredicate& matchName
247 template<
class MatchPredicate1,
class MatchPredicate2>
251 const MatchPredicate1& matchClass,
252 const MatchPredicate2& matchName
278 template<
class Type,
class MatchPredicate>
282 const MatchPredicate& matchName
318 const const_iterator iter(cfind(objName));
335 <<
" with different type" <<
endl;
359 return cfindObject<Type>(objName);
366 return const_cast<IOobject*
>(cfindObject<Type>(objName));
373 return const_cast<IOobject*
>(cfindObject<Type>(objName));
377 template<
class MatchPredicate>
380 const MatchPredicate& matchName
383 return lookupImpl(*
this, matchName);
387 template<
class MatchPredicate>
390 const MatchPredicate& matchClass
397 template<
class MatchPredicate1,
class MatchPredicate2>
400 const MatchPredicate1& matchClass,
401 const MatchPredicate2& matchName
404 return lookupClassImpl(*
this, matchClass, matchName);
415 template<
class Type,
class MatchPredicate>
418 const MatchPredicate& matchName
421 return lookupClassImpl<Type>(*
this, matchName);
425 template<
class MatchPredicate>
429 const MatchPredicate& matchName
432 return classesImpl(*
this, matchName);
436 template<
class MatchPredicate>
439 const MatchPredicate& matchClass
446 template<
class MatchPredicate1,
class MatchPredicate2>
449 const MatchPredicate1& matchClass,
450 const MatchPredicate2& matchName
453 return countImpl(*
this, matchClass, matchName);
464 template<
class Type,
class MatchPredicate>
467 const MatchPredicate& matchName
470 return countTypeImpl<Type>(*
this, matchName);
505 checkObjectOrder(list, syncPar);
511 template<
class Type,
class MatchPredicate>
515 const MatchPredicate& matchName
519 return objectsTypeImpl<Type>(*
this, matchName,
false);
523 template<
class Type,
class MatchPredicate>
527 const MatchPredicate& matchName
531 return objectsTypeImpl<Type>(*
this, matchName,
true);
535 template<
class Type,
class MatchPredicate>
539 const MatchPredicate& matchName,
546 objectsTypeImpl<Type>(*
this, matchName,
true)
549 checkObjectOrder(list, syncPar);
557 template<
class MatchPredicate>
560 const MatchPredicate& matchClass
568 template<
class MatchPredicate>
571 const MatchPredicate& matchClass,
575 return sortedNames(matchClass, syncPar);
579 template<
class MatchPredicate1,
class MatchPredicate2>
582 const MatchPredicate1& matchClass,
583 const MatchPredicate2& matchName
587 return namesImpl(*
this, matchClass, matchName,
false);
591 template<
class MatchPredicate1,
class MatchPredicate2>
594 const MatchPredicate1& matchClass,
595 const MatchPredicate2& matchName,
599 return sortedNames(matchClass, matchName, syncPar);
614 return sortedNames<Type>(syncPar);
618 template<
class Type,
class MatchPredicate>
621 const MatchPredicate& matchName
625 return namesTypeImpl<Type>(*
this, matchName,
false);
629 template<
class Type,
class MatchPredicate>
632 const MatchPredicate& matchName,
636 return sortedNames<Type>(matchName, syncPar);
642 template<
class MatchPredicate>
645 const MatchPredicate& matchClass
652 template<
class MatchPredicate>
655 const MatchPredicate& matchClass,
664 checkNameOrder(objNames, syncPar);
669 template<
class MatchPredicate1,
class MatchPredicate2>
672 const MatchPredicate1& matchClass,
673 const MatchPredicate2& matchName
676 return namesImpl(*
this, matchClass, matchName,
true);
680 template<
class MatchPredicate1,
class MatchPredicate2>
683 const MatchPredicate1& matchClass,
684 const MatchPredicate2& matchName,
688 wordList objNames(namesImpl(*
this, matchClass, matchName,
true));
690 checkNameOrder(objNames, syncPar);
707 checkNameOrder(objNames, syncPar);
712 template<
class Type,
class MatchPredicate>
715 const MatchPredicate& matchName
718 return namesTypeImpl<Type>(*
this, matchName,
true);
722 template<
class Type,
class MatchPredicate>
725 const MatchPredicate& matchName,
729 wordList objNames(namesTypeImpl<Type>(*
this, matchName,
true));
731 checkNameOrder(objNames, syncPar);
738 template<
class UnaryPredicate>
741 const UnaryPredicate& pred,
758 for (iterator iter =
begin(); iter !=
end(); ++iter)
763 (pred(iter.val()->headerClassName()) ? pruning : !pruning)
775 template<
class UnaryPredicate>
778 const UnaryPredicate& pred,
791 for (iterator iter =
begin(); iter !=
end(); ++iter)
796 (pred(iter.key()) ? pruning : !pruning)
811 wordList objNames(namesTypeImpl<Type>(*
this, predicates::always(),
false));
label filterClasses(const UnaryPredicate &pred, const bool pruning=false)
Filter to retain or prune given classes.
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable, so the various sorted methods should be used if traversing in parallel.
const word & name() const noexcept
Return the object name.
IOobjectList lookupClass() const
The list of IOobjects with headerClassName == Type::typeName.
wordList sortedNames() const
The sorted names of the IOobjects.
Ostream & endl(Ostream &os)
Add newline and flush stream.
wordList names() const
The unsorted names of the IOobjects.
IOobjectList lookup(const MatchPredicate &matchName) const
The list of IOobjects that have a matching object name.
label size() const noexcept
The number of elements in table.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
Unary and binary predicates that always return true, useful for templating.
A class for handling words, derived from Foam::string.
void sort(UList< T > &list)
Sort the list.
const IOobject * findObject(const word &objName) const
Return const pointer to the object found by name.
wordList allNames() const
The sorted names of all objects (synchronised across processors)
A HashTable similar to std::unordered_map.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
UPtrList< const IOobject > cobjects() const
The unsorted list of IOobjects with headerClassName == Type::typeName.
int debug
Static debugging option.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
IOobject * getObject(const word &objName) const
Return non-const pointer to the object found by name, using a const-cast to have it behave like a mut...
List< word > wordList
List of word.
const word & headerClassName() const noexcept
Return name of the class name read from header.
bool insert(const word &, IOobject *)=delete
No insert() with raw pointers (potential memory leaks). Use insert() with autoPtr or set() ...
label count() const
The number of objects with headerClassName == Type::typeName.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
label filterObjects(const UnaryPredicate &pred, const bool pruning=false)
Filter to retain or prune given object names.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
constexpr auto begin(C &c) -> decltype(c.begin())
Return iterator to the beginning of the container c.
Defines the attributes of an object for which implicit objectRegistry management is supported...
UPtrList< const IOobject > csorted() const
The sorted list of IOobjects with headerClassName == Type::typeName.
forAllConstIters(mixture.phases(), phase)
bool isHeaderClass() const
Check if headerClassName() equals Type::typeName.
HashTable< wordHashSet > classes() const
A summary hash of classes used and their associated object names.
#define InfoInFunction
Report an information message using Foam::Info.
const IOobject * cfindObject(const word &objName) const
Return const pointer to the object found by name.