www.cemf.ir
Field< T, MemorySpace > Class Template Reference
+ Inheritance diagram for Field< T, MemorySpace >:
+ Collaboration diagram for Field< T, MemorySpace >:

Public Types

using VectorType = VectorSingle< T, MemorySpace >
 
using FieldType = Field< T, MemorySpace >
 
using FieldTypeHost = Field< T, HostSpace >
 
using memory_space = typename VectorType::memory_space
 
using execution_space = typename VectorType::execution_space
 
using iterator = typename VectorType::iterator
 
using const_iterator = typename VectorType::const_iterator
 
using reference = typename VectorType::reference
 
using const_reference = typename VectorType::const_reference
 
using value_type = typename VectorType::value_type
 
using pointer = typename VectorType::pointer
 
using const_pointer = typename VectorType::const_pointer
 
- Public Types inherited from VectorSingle< T, void >
using VectorType = VectorSingle< T, void >
 
using VectorTypeHost = VectorSingle< T, HostSpace >
 
using iterator = T *
 
using const_iterator = const T *
 
using reference = T &
 
using const_reference = const T &
 
using value_type = T
 
using pointer = T *
 
using const_pointer = const T *
 
using viewType = ViewType1D< T, void >
 
using device_type = typename viewType::device_type
 
using memory_space = typename viewType::memory_space
 
using execution_space = typename viewType::execution_space
 

Public Member Functions

 TypeInfoTemplateNV111 ("Field", T, VectorType::memoerySpaceName())
 type info More...
 
 Field ()
 construct an empty Filed with default fieldKey More...
 
 Field (const word &name)
 
 Field (const word &name, const word &fieldKey)
 Construct an empty field with name and fieldKey. More...
 
 Field (const word &name, const word &fieldKey, size_t len)
 Construct a field with name and fieldKey and specified len. More...
 
 Field (const word &name, const word &fieldKey, size_t len, const T &val)
 Construct a field with name, fieldKey and set length to len and value to val. More...
 
 Field (const word &name, const word &fieldKey, size_t capacity, size_t len, const T &val)
 
 Field (const word &name, const word &fieldKey, size_t capacity, size_t len, RESERVE)
 Construct a field with name, fieldKey, capacity and len. More...
 
 Field (const word &fieldKey, const Vector< T > &vec)
 Construct a field with fieldKey and Vector vec. More...
 
 Field (const word &name, const word &fieldKey, const Vector< T > &vec)
 Construct a field with name, fieldKey and Vector vec. More...
 
 Field (const word &name, const word &fieldKey, const std::vector< T > &vec)
 Construct a field with name and fieldKey and std::vector. More...
 
 Field (const word &name, const word &fieldKey, const FieldType &src)
 Copy construct with new name and fieldkey. More...
 
 Field (const FieldType &)=default
 Default copy constructor. More...
 
FieldTypeoperator= (const FieldType &rhs)
 Copy assignment, name and fieldKey on the left hand side are preserved. More...
 
 Field (FieldType &&)=default
 Move constructor. More...
 
FieldTypeoperator= (FieldType &&)=default
 Move assignment. More...
 
word fieldKey () const
 return field key More...
 
word name () const
 
void fillField (rangeU32 span, const T &val)
 
void fillField (const T &val)
 
bool read (iIstream &is)
 
bool write (iOstream &os) const
 
bool read (iIstream &is, const IOPattern &iop, bool resume=false)
 
bool write (iOstream &os, const IOPattern &iop) const
 
- Public Member Functions inherited from VectorSingle< T, void >
 TypeInfoTemplateNV111 ("VectorSingle", T, memoerySpaceName())
 Type info. More...
 
 VectorSingle ()
 Empty vector. More...
 
 VectorSingle (const word &name)
 Empty vector with a name (capacity = 2) More...
 
 VectorSingle (const word &name, uint32 n)
 Vector with name and size n. More...
 
 VectorSingle (const word &name, uint32 n, const T &val)
 Vector with name, size and value. More...
 
 VectorSingle (const word &name, uint32 cap, uint32 n, RESERVE)
 Vector with name, size (n) and reserved capacity. More...
 
 VectorSingle (const word &name, const std::vector< T > &src)
 Construct with a name and form std::vector (host memory) More...
 
 VectorSingle (const word &name, const std::vector< T > &src, uint32 cap)
 Construct with a name and form std::vector (host memory) and with a desired capacity. More...
 
 VectorSingle (const VectorSingle &src)
 Copy construct (performs deep copy) More...
 
 VectorSingle (const word &name, const VectorSingle &src)
 Copy construct with a new name (perform deep copy) More...
 
 VectorSingle (const word &name, const ViewType1D< T, void > &src)
 Copy construct with a new name (perform deep copy) More...
 
 VectorSingle (VectorSingle &&)=default
 Move construct. More...
 
VectorSingleoperator= (const VectorSingle &rhs)
 Copy assignment (perform deep copy from rhs to *this) More...
 
VectorSingleoperator= (VectorSingle &&)=default
 Move assignment. More...
 
 ~VectorSingle ()
 Descructor This may not destroy the underlying memory, sice view is shared_ptr and maybe referenced by another object too
More...
 
INLINE_FUNCTION_H uniquePtr< VectorSingleclone () const
 Clone as a uniquePtr (perform deep copy) More...
 
INLINE_FUNCTION_H VectorTypeVectorField ()
 Return *this. More...
 
const INLINE_FUNCTION_H VectorTypeVectorField () const
 Return *this. More...
 
INLINE_FUNCTION_H auto & deviceViewAll ()
 Device view range [0,capcity) More...
 
const INLINE_FUNCTION_H auto & deviceViewAll () const
 Device view range [0,capcity) More...
 
INLINE_FUNCTION_H auto deviceView () const
 Device view range [0, size) More...
 
INLINE_FUNCTION_H auto hostViewAll () const
 Return a view accessible on Host in range [0,capacity) More...
 
INLINE_FUNCTION_H auto hostView () const
 Return a view accessible on Host in range [0,size) More...
 
INLINE_FUNCTION_H word name () const
 Name of the vector. More...
 
INLINE_FUNCTION_H uint32 size () const
 Size of the vector. More...
 
INLINE_FUNCTION_H uint32 capacity () const
 
INLINE_FUNCTION_H bool empty () const
 If vector is empty. More...
 
INLINE_FUNCTION_H void reserve (uint32 cap)
 Reserve capacity for vector Preserve the content. More...
 
INLINE_FUNCTION_H void reallocate (uint32 cap)
 Reallocate memory to new cap and set size to 0. More...
 
INLINE_FUNCTION_H void reallocate (uint32 cap, uint32 newSize)
 Reallocate memory to new cap and set size to newSize. More...
 
INLINE_FUNCTION_H void resize (uint32 n)
 Resize the vector and preserve the content. More...
 
INLINE_FUNCTION_H void resize (uint32 n, const T &val)
 Resize the vector and assign the value to it. More...
 
INLINE_FUNCTION_H void clear ()
 Clear the vector, but keep the allocated memory unchanged. More...
 
INLINE_FUNCTION_H void fill (const T &val)
 Fill the range [0,size) with val. More...
 
INLINE_FUNCTION_H void fill (rangeU32 r, const T &val)
 
INLINE_FUNCTION_H void assign (size_t n, const T &val)
 Change size of the vector and assign val to vector and. More...
 
INLINE_FUNCTION_H void assign (const std::vector< T > &src, uint32 cap)
 Assign source vector with specified capacity. More...
 
INLINE_FUNCTION_H void assign (const std::vector< T > &src)
 Assign source vector. More...
 
INLINE_FUNCTION_H void assign (const VectorType &src, bool srcCapacity=true)
 
INLINE_FUNCTION_H void assignFromHost (const VectorTypeHost &src)
 Assign source vector from host side. More...
 
INLINE_FUNCTION_H void assignFromDevice (const VectorSingle< T, MSpace > &src, bool srcCapacity=true)
 
INLINE_FUNCTION_H void append (const ViewType1D< T, void > &appVec)
 
INLINE_FUNCTION_H void append (const std::vector< T > &appVec)
 
INLINE_FUNCTION_H void append (const VectorType &appVec)
 
INLINE_FUNCTION_H auto getSpan ()
 
INLINE_FUNCTION_H auto getSpan () const
 
INLINE_FUNCTION_H bool insertSetElement (const uint32IndexContainer &indices, const T &val)
 
INLINE_FUNCTION_H bool insertSetElement (const uint32IndexContainer &indices, const std::vector< T > &vals)
 
INLINE_FUNCTION_H bool insertSetElement (const uint32IndexContainer &indices, const ViewType1D< T, memory_space > vals)
 
INLINE_FUNCTION_H bool reorderItems (const uint32IndexContainer &indices)
 
INLINE_FUNCTION_H std::enable_if_t< isHostAccessible_ &&Enable, void > push_back (const T &val)
 push a new element at the end (host call only) resize if necessary and works on host accessible vector. More...
 
INLINE_FUNCTION_H pointer data ()
 
INLINE_FUNCTION_H const_pointer data () const
 
INLINE_FUNCTION_H std::enable_if_t< isHostAccessible_ &&Enable, iteratorbegin ()
 Return begin iterator. It works when devices is host accessible. More...
 
INLINE_FUNCTION_H std::enable_if_t< isHostAccessible_ &&Enable, const_iteratorbegin () const
 Return begin iterator. it works when host is accessible. More...
 
INLINE_FUNCTION_H std::enable_if_t< isHostAccessible_ &&Enable, iteratorend ()
 Return end iterator. it works when host is accessible. More...
 
INLINE_FUNCTION_H std::enable_if_t< isHostAccessible_ &&Enable, const_iteratorend () const
 Return end iterator. it works when host is accessible. More...
 
INLINE_FUNCTION_H std::enable_if_t< isHostAccessible_ &&Enable, referenceoperator[] (size_t i)
 Return reference to element i. it works when host is accessible. More...
 
INLINE_FUNCTION_H std::enable_if_t< isHostAccessible_ &&Enable, const_referenceoperator[] (size_t i) const
 Return reference to element i. it works when host is accessible. More...
 
FUNCTION_H bool read (iIstream &is)
 Read vector from stream. More...
 
FUNCTION_H bool read (iIstream &is, const IOPattern &iop)
 Read vector from stream. More...
 
FUNCTION_H bool write (iOstream &os, const IOPattern &iop) const
 Write the vector to os. More...
 
FUNCTION_H bool write (iOstream &os) const
 
FUNCTION_H bool write (iOstream &os, const IOPattern &iop, const HostMask &mask) const
 

Private Attributes

const word fieldKey_ = FKey
 

Static Private Attributes

static const word FKey = "value"
 

Additional Inherited Members

- Static Public Member Functions inherited from VectorSingle< T, void >
static constexpr const char * memoerySpaceName ()
 Name of the memory space. More...
 

Detailed Description

template<class T, class MemorySpace = void>
class pFlow::Field< T, MemorySpace >

Definition at line 36 of file Field.hpp.

Member Typedef Documentation

◆ VectorType

using VectorType = VectorSingle<T,MemorySpace>

Definition at line 42 of file Field.hpp.

◆ FieldType

using FieldType = Field<T, MemorySpace>

Definition at line 44 of file Field.hpp.

◆ FieldTypeHost

Definition at line 46 of file Field.hpp.

◆ memory_space

Definition at line 48 of file Field.hpp.

◆ execution_space

Definition at line 50 of file Field.hpp.

◆ iterator

using iterator = typename VectorType::iterator

Definition at line 52 of file Field.hpp.

◆ const_iterator

Definition at line 54 of file Field.hpp.

◆ reference

using reference = typename VectorType::reference

Definition at line 56 of file Field.hpp.

◆ const_reference

Definition at line 58 of file Field.hpp.

◆ value_type

Definition at line 60 of file Field.hpp.

◆ pointer

using pointer = typename VectorType::pointer

Definition at line 62 of file Field.hpp.

◆ const_pointer

Definition at line 64 of file Field.hpp.

Constructor & Destructor Documentation

◆ Field() [1/13]

Field ( )
inline

construct an empty Filed with default fieldKey

Definition at line 81 of file Field.hpp.

◆ Field() [2/13]

Field ( const word name)
inline

Definition at line 86 of file Field.hpp.

◆ Field() [3/13]

Field ( const word name,
const word fieldKey 
)
inline

Construct an empty field with name and fieldKey.

Definition at line 92 of file Field.hpp.

◆ Field() [4/13]

Field ( const word name,
const word fieldKey,
size_t  len 
)
inline

Construct a field with name and fieldKey and specified len.

Definition at line 99 of file Field.hpp.

◆ Field() [5/13]

Field ( const word name,
const word fieldKey,
size_t  len,
const T &  val 
)
inline

Construct a field with name, fieldKey and set length to len and value to val.

Definition at line 108 of file Field.hpp.

◆ Field() [6/13]

Field ( const word name,
const word fieldKey,
size_t  capacity,
size_t  len,
const T &  val 
)
inline

Definition at line 114 of file Field.hpp.

◆ Field() [7/13]

Field ( const word name,
const word fieldKey,
size_t  capacity,
size_t  len,
RESERVE   
)
inline

Construct a field with name, fieldKey, capacity and len.

Definition at line 123 of file Field.hpp.

◆ Field() [8/13]

Field ( const word fieldKey,
const Vector< T > &  vec 
)
inline

Construct a field with fieldKey and Vector vec.

Definition at line 130 of file Field.hpp.

◆ Field() [9/13]

Field ( const word name,
const word fieldKey,
const Vector< T > &  vec 
)
inline

Construct a field with name, fieldKey and Vector vec.

Definition at line 137 of file Field.hpp.

◆ Field() [10/13]

Field ( const word name,
const word fieldKey,
const std::vector< T > &  vec 
)
inline

Construct a field with name and fieldKey and std::vector.

Definition at line 144 of file Field.hpp.

◆ Field() [11/13]

Field ( const word name,
const word fieldKey,
const FieldType src 
)
inline

Copy construct with new name and fieldkey.

Definition at line 151 of file Field.hpp.

◆ Field() [12/13]

Field ( const FieldType )
default

Default copy constructor.

◆ Field() [13/13]

Field ( FieldType &&  )
default

Move constructor.

Member Function Documentation

◆ TypeInfoTemplateNV111()

TypeInfoTemplateNV111 ( "Field< T, MemorySpace >"  ,
,
VectorType::memoerySpaceName()   
)

type info

◆ operator=() [1/2]

FieldType& operator= ( const FieldType rhs)
inline

Copy assignment, name and fieldKey on the left hand side are preserved.

Definition at line 161 of file Field.hpp.

◆ operator=() [2/2]

FieldType& operator= ( FieldType &&  )
default

Move assignment.

◆ fieldKey()

word fieldKey ( ) const
inline

return field key

Definition at line 177 of file Field.hpp.

Referenced by internalField< realx3, void >::fieldKey().

+ Here is the caller graph for this function:

◆ name()

word name ( ) const
inline

Definition at line 182 of file Field.hpp.

Referenced by triSurface::append(), and internalField< realx3, void >::name().

+ Here is the caller graph for this function:

◆ fillField() [1/2]

void fillField ( rangeU32  span,
const T &  val 
)
inline

Definition at line 188 of file Field.hpp.

Referenced by triSurfaceField< uint32 >::fill(), and internalField< realx3, void >::fillInternal().

+ Here is the caller graph for this function:

◆ fillField() [2/2]

void fillField ( const T &  val)
inline

Definition at line 193 of file Field.hpp.

◆ read() [1/2]

bool read ( iIstream is)

Definition at line 23 of file Field.cpp.

Referenced by pFlow::operator>>(), and pointField< pFlow::VectorSingle, pFlow::AB3History >::readPointField().

+ Here is the caller graph for this function:

◆ write() [1/2]

bool write ( iOstream os) const

Definition at line 95 of file Field.cpp.

Referenced by pFlow::operator<<().

+ Here is the caller graph for this function:

◆ read() [2/2]

bool read ( iIstream is,
const IOPattern iop,
bool  resume = false 
)

Definition at line 54 of file Field.cpp.

◆ write() [2/2]

bool write ( iOstream os,
const IOPattern iop 
) const

Definition at line 116 of file Field.cpp.

Member Data Documentation

◆ FKey

const word FKey = "value"
inlinestaticprivate

Definition at line 69 of file Field.hpp.

◆ fieldKey_

const word fieldKey_ = FKey
private

Definition at line 71 of file Field.hpp.

Referenced by Field< uint32x3 >::fieldKey().


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