FreeFOAM The Cross-Platform CFD Toolkit
SubField< Type > Class Template Reference

SubField is a Field obtained as a section of another Field. More...

#include <OpenFOAM/SubField.H>


Detailed Description

template<class Type>
class Foam::SubField< Type >

SubField is a Field obtained as a section of another Field.

Thus it is itself unallocated so that no storage is allocated or deallocated during its use. To achieve this behaviour, SubField is derived from a SubList rather than a List.

Source files

Definition at line 59 of file SubField.H.

+ Inheritance diagram for SubField< Type >:
+ Collaboration diagram for SubField< Type >:

List of all members.

Public Types

typedef pTraits< Type >::cmptType cmptType
 Component type.

Public Member Functions

 SubField (const SubList< Type > &)
 Construct from a SubList.
 SubField (const UList< Type > &)
 Construct from a UList<Type>, using the entire size.
 SubField (const UList< Type > &list, const label subSize)
 Construct from a UList<Type> with a given size.
 SubField (const UList< Type > &list, const label subSize, const label startIndex)
 Construct from a UList<Type> with a given size and start index.
 SubField (const SubField< Type > &)
 Construct as copy.
tmp< Field< cmptType > > component (const direction) const
 Return a component field of the field.
tmp< Field< Type > > T () const
 Return the field transpose (only defined for second rank tensors)
void operator= (const SubField< Type > &)
 Assignment via UList operator. Takes linear time.
 operator const Field< Type > & () const
 Allow cast to a const Field<Type>&.
- Public Member Functions inherited from refCount
 refCount ()
 Construct null with zero count.
int count () const
 Return the reference count.
bool okToDelete () const
 Return true if the reference count is zero.
void resetRefCount ()
 Reset the reference count to zero.
void operator++ ()
 Increment the reference count.
void operator++ (int)
 Increment the reference count.
void operator-- ()
 Decrement the reference count.
void operator-- (int)
 Decrement the reference count.
- Public Member Functions inherited from SubList< Type >
 SubList (const UList< Type > &list, const label subSize)
 Construct from UList and sub-list size.
 SubList (const UList< Type > &list, const label subSize, const label startIndex)
 Construct from UList, sub-list size and start index.
 operator const Foam::List< Type > & () const
 Allow cast to a const List<T>&.
void operator= (const Type &)
 Assignment of all entries to the given value.
- Public Member Functions inherited from UList< Type >
 UList ()
 Null constructor.
 UList (Type *__restrict__ v, label size)
 Construct from components.
label fcIndex (const label i) const
 Return the forward circular index, i.e. the next index.
label rcIndex (const label i) const
 Return the reverse circular index, i.e. the previous index.
label byteSize () const
 Return the binary size in number of characters of the UList.
const Type * cdata () const
 Return a const pointer to the first data element,.
Type * data ()
 Return a pointer to the first data element,.
void checkStart (const label start) const
 Check start is within valid range (0 ... size-1).
void checkSize (const label size) const
 Check size is within valid range (0 ... size).
void checkIndex (const label i) const
 Check index i is within valid range (0 ... size-1).
void writeEntry (Ostream &) const
 Write the UList as a dictionary entry.
void writeEntry (const word &keyword, Ostream &) const
 Write the UList as a dictionary entry with keyword.
void assign (const UList< Type > &)
 Assign elements to those from UList.
Type & operator[] (const label)
 Return element of UList.
const Type & operator[] (const label) const
 Return element of constant UList.
iterator begin ()
 Return an iterator to begin traversing the UList.
const_iterator begin () const
 Return const_iterator to begin traversing the constant UList.
iterator end ()
 Return an iterator to end traversing the UList.
const_iterator end () const
 Return const_iterator to end traversing the constant UList.
const_iterator cbegin () const
 Return const_iterator to begin traversing the constant UList.
const_iterator cend () const
 Return const_iterator to end traversing the constant UList.
reverse_iterator rbegin ()
 Return reverse_iterator to begin reverse traversing the UList.
const_reverse_iterator rbegin () const
 Return const_reverse_iterator to begin reverse traversing the UList.
reverse_iterator rend ()
 Return reverse_iterator to end reverse traversing the UList.
const_reverse_iterator rend () const
 Return const_reverse_iterator to end reverse traversing the UList.
const_reverse_iterator crbegin () const
 Return const_reverse_iterator to begin reverse traversing the UList.
const_reverse_iterator crend () const
 Return const_reverse_iterator to end reverse traversing the UList.
label size () const
 Return the number of elements in the UList.
label max_size () const
 Return size of the largest possible UList.
bool empty () const
 Return true if the UList is empty (ie, size() is zero).
void swap (UList< Type > &)
 Swap two ULists of the same type in constant time.
bool operator== (const UList< Type > &) const
 Equality operation on ULists of the same type.
bool operator!= (const UList< Type > &) const
 The opposite of the equality operation. Takes linear time.
bool operator< (const UList< Type > &) const
 Compare two ULists lexicographically. Takes linear time.
bool operator> (const UList< Type > &) const
 Compare two ULists lexicographically. Takes linear time.
bool operator<= (const UList< Type > &) const
 Return true if !(a > b). Takes linear time.
bool operator>= (const UList< Type > &) const
 Return true if !(a < b). Takes linear time.

Static Public Member Functions

static const SubField< Type > & null ()
 Return a null SubField.

Member Typedef Documentation

typedef pTraits<Type>::cmptType cmptType

Component type.

Reimplemented in SubDimensionedField< Type, GeoMesh >.

Definition at line 68 of file SubField.H.


Constructor & Destructor Documentation

SubField ( const SubList< Type > &  list)
inline

Construct from a SubList.

Definition at line 30 of file SubFieldI.H.

SubField ( const UList< Type > &  list)
inlineexplicit

Construct from a UList<Type>, using the entire size.

Definition at line 40 of file SubFieldI.H.

SubField ( const UList< Type > &  list,
const label  subSize 
)
inline

Construct from a UList<Type> with a given size.

Definition at line 50 of file SubFieldI.H.

SubField ( const UList< Type > &  list,
const label  subSize,
const label  startIndex 
)
inline

Construct from a UList<Type> with a given size and start index.

Definition at line 61 of file SubFieldI.H.

SubField ( const SubField< Type > &  sfield)
inline

Construct as copy.

Definition at line 73 of file SubFieldI.H.


Member Function Documentation

const Foam::SubField< Type > & null ( )
inlinestatic

Return a null SubField.

Reimplemented from SubList< Type >.

Reimplemented in SubDimensionedField< Type, GeoMesh >.

Definition at line 85 of file SubFieldI.H.

Foam::tmp< Foam::Field< typename Foam::SubField< Type >::cmptType > > component ( const direction  d) const
inline

Return a component field of the field.

Reimplemented in SubDimensionedField< Type, GeoMesh >.

Definition at line 94 of file SubFieldI.H.

Foam::tmp< Foam::Field< Type > > T ( ) const
inline

Return the field transpose (only defined for second rank tensors)

Reimplemented in SubDimensionedField< Type, GeoMesh >.

Definition at line 103 of file SubFieldI.H.

void operator= ( const SubField< Type > &  rhs)
inline

Assignment via UList operator. Takes linear time.

Definition at line 112 of file SubFieldI.H.

Referenced by SubDimensionedField< Type, GeoMesh >::operator=().

operator const Field< Type > & ( ) const
inline

Allow cast to a const Field<Type>&.


The documentation for this class was generated from the following files: