35#ifndef Foam_directFieldMapper_H
36#define Foam_directFieldMapper_H
46template<
class FieldMapperType>
class DirectFieldMapper;
58template<
class FieldMapperType>
61 public FieldMapperType
75 static bool hasUnmappedEntry(
const labelUList& directAddr)
77 for (
const label val : directAddr)
79 if (val < 0)
return true;
98 const bool checkUnmapped =
true
102 directAddressing_(directAddr),
103 hasUnmapped_(checkUnmapped && hasUnmappedEntry(directAddr))
116 return notNull(directAddressing_);
120 virtual label
size()
const
122 return directAddressing_.
size();
126 virtual bool direct()
const
146 return directAddressing_;
A templated direct mapper for the given FieldMapper type.
virtual bool hasDirectAddressing() const
True if directAddressing is not the null object (unallocated)
virtual label size() const
The mapper size is given by the size of the direct addressing.
FieldMapperType mapper_type
The base mapper type.
virtual bool hasUnmapped() const
Any unmapped values?
virtual const labelUList & directAddressing() const
Return the direct addressing values.
virtual ~DirectFieldMapper()=default
Destructor.
virtual bool & hasUnmapped()
Allow modification.
virtual bool direct() const
It is a direct mapper.
DirectFieldMapper(const labelUList &directAddr, const bool checkUnmapped=true)
Construct given addressing, check for unmapped (negative) values.
void size(const label n)
Older name for setAddressableSize.
DirectFieldMapper< FieldMapper > directFieldMapper
A FieldMapper with direct mapping.
bool notNull(const T *ptr)
True if ptr is not a pointer (of type T) to the nullObject.