NeoN
A framework for CFD software
|
A class to contain the data and executors for a field and define some basic operations. More...
#include <vector.hpp>
Public Types | |
using | VectorValueType = ValueType |
Public Member Functions | |
Vector (const Executor &exec, localIdx size) | |
Create an uninitialized Vector with a given size on an executor. | |
Vector (const Executor &exec, const ValueType *in, localIdx size, Executor hostExec=SerialExecutor()) | |
Create a Vector with a given size from existing memory on an executor. | |
Vector (const Executor &exec, localIdx size, ValueType value) | |
Create a Vector with a given size on an executor and uniform value. | |
Vector (const Executor &exec, std::vector< ValueType > in) | |
Create a Vector from a given vector of values on an executor. | |
Vector (const Executor &exec, const Vector< ValueType > &in) | |
Create a Vector as a copy of a Vector on a specified executor. | |
Vector (const Vector< ValueType > &rhs) | |
Copy constructor, creates a new field with the same size and data as the parsed field. | |
Vector (Vector< ValueType > &&rhs) noexcept | |
Move constructor, moves the data from the parsed field to the new field. | |
~Vector () | |
Destroy the Vector object. | |
template<typename func > | |
void | apply (func f) |
applies a functor, transformation, to the field | |
Vector< ValueType > | copyToExecutor (Executor dstExec) const |
Copies the data to a new field on a specific executor. | |
Vector< ValueType > | copyToHost () const |
Returns a copy of the field back to the host. | |
void | copyToHost (Vector< ValueType > &result) |
Copies the data (from anywhere) to a parsed host field. | |
ValueType & | operator[] (const localIdx i)=delete |
const ValueType & | operator[] (const localIdx i) const =delete |
void | operator= (const ValueType &rhs) |
Assignment operator, Sets the field values to that of the passed value. | |
void | operator= (const Vector< ValueType > &rhs) |
Assignment operator, Sets the field values to that of the parsed field. | |
Vector< ValueType > & | operator+= (const Vector< ValueType > &rhs) |
Arithmetic add operator, addition of a second field. | |
Vector< ValueType > & | operator-= (const Vector< ValueType > &rhs) |
Arithmetic subtraction operator, subtraction by a second field. | |
Vector< ValueType > | operator* (const Vector< ValueType > &rhs) |
Arithmetic multiply operator, multiply by a second field. | |
Vector< ValueType > | operator* (const scalar rhs) |
Arithmetic multiply operator, multiplies every cell in the field by a scalar. | |
Vector< ValueType > & | operator*= (const Vector< ValueType > &rhs) |
Assignment multiply operator, multiplies this field by another field element-wise. | |
Vector< ValueType > & | operator*= (const scalar rhs) |
Assignment multiply operator, multiplies every cell in the field by a scalar. | |
void | resize (const localIdx size) |
Resizes the field to a new size. | |
ValueType * | data () |
Direct access to the underlying field data. | |
const ValueType * | data () const |
Direct access to the underlying field data. | |
const Executor & | exec () const |
Gets the executor associated with the field. | |
localIdx | size () const |
Gets the size of the field. | |
label | ssize () const |
Gets the size of the field. | |
bool | empty () const |
Checks if the field is empty. | |
View< ValueType > | view () &&=delete |
View< const ValueType > | view () const &&=delete |
View< ValueType > | view () & |
Gets the field as a view. | |
View< const ValueType > | view () const & |
Gets the field as a view. | |
View< ValueType > | view (std::pair< localIdx, localIdx > range) &&=delete |
View< const ValueType > | view (std::pair< localIdx, localIdx > range) const &&=delete |
View< ValueType > | view (std::pair< localIdx, localIdx > range) & |
Gets a sub view of the field as a view. | |
View< const ValueType > | view (std::pair< localIdx, localIdx > range) const & |
Gets a sub view of the field as a view. | |
std::pair< localIdx, localIdx > | range () const |
Gets the range of the field. | |
A class to contain the data and executors for a field and define some basic operations.
Definition at line 27 of file vector.hpp.
using NeoN::Vector< ValueType >::VectorValueType = ValueType |
Definition at line 32 of file vector.hpp.
NeoN::Vector< ValueType >::Vector | ( | const Executor & | exec, |
localIdx | size | ||
) |
Create an uninitialized Vector with a given size on an executor.
exec | Executor associated to the field |
size | size of the field |
NeoN::Vector< ValueType >::Vector | ( | const Executor & | exec, |
const ValueType * | in, | ||
localIdx | size, | ||
Executor | hostExec = SerialExecutor() |
||
) |
Create a Vector with a given size from existing memory on an executor.
exec | Executor associated to the field |
in | Pointer to existing data |
size | size of the field |
hostExec | Executor where the original data is located |
NeoN::Vector< ValueType >::Vector | ( | const Executor & | exec, |
localIdx | size, | ||
ValueType | value | ||
) |
Create a Vector with a given size on an executor and uniform value.
exec | Executor associated to the field |
size | size of the field |
value | the default value |
NeoN::Vector< ValueType >::Vector | ( | const Executor & | exec, |
std::vector< ValueType > | in | ||
) |
Create a Vector from a given vector of values on an executor.
exec | Executor associated to the field |
in | a vector of elements to copy over |
NeoN::Vector< ValueType >::Vector | ( | const Executor & | exec, |
const Vector< ValueType > & | in | ||
) |
NeoN::Vector< ValueType >::Vector | ( | const Vector< ValueType > & | rhs | ) |
Copy constructor, creates a new field with the same size and data as the parsed field.
rhs | The field to copy from. |
|
noexcept |
Move constructor, moves the data from the parsed field to the new field.
rhs | The field to move from. |
NeoN::Vector< ValueType >::~Vector | ( | ) |
Destroy the Vector object.
|
inline |
applies a functor, transformation, to the field
f | The functor to map over the field. |
Definition at line 100 of file vector.hpp.
Vector< ValueType > NeoN::Vector< ValueType >::copyToExecutor | ( | Executor | dstExec | ) | const |
Copies the data to a new field on a specific executor.
dstExec | The executor on which the data should be copied. |
Vector< ValueType > NeoN::Vector< ValueType >::copyToHost | ( | ) | const |
Returns a copy of the field back to the host.
void NeoN::Vector< ValueType >::copyToHost | ( | Vector< ValueType > & | result | ) |
Copies the data (from anywhere) to a parsed host field.
result | The field into which the data must be copied. Must be sized. |
|
inline |
Direct access to the underlying field data.
Definition at line 215 of file vector.hpp.
|
inline |
Direct access to the underlying field data.
Definition at line 221 of file vector.hpp.
|
inline |
Checks if the field is empty.
Definition at line 245 of file vector.hpp.
|
inline |
Gets the executor associated with the field.
Definition at line 227 of file vector.hpp.
Vector< ValueType > NeoN::Vector< ValueType >::operator* | ( | const scalar | rhs | ) |
Arithmetic multiply operator, multiplies every cell in the field by a scalar.
rhs | The scalar to multiply with the field. |
Vector< ValueType > NeoN::Vector< ValueType >::operator* | ( | const Vector< ValueType > & | rhs | ) |
Arithmetic multiply operator, multiply by a second field.
rhs | The field to subtract from this field. |
Vector< ValueType > & NeoN::Vector< ValueType >::operator*= | ( | const scalar | rhs | ) |
Assignment multiply operator, multiplies every cell in the field by a scalar.
rhs | The scalar to multiply with the field. |
Vector< ValueType > & NeoN::Vector< ValueType >::operator*= | ( | const Vector< ValueType > & | rhs | ) |
Assignment multiply operator, multiplies this field by another field element-wise.
rhs | The field to multiply with this field. |
Vector< ValueType > & NeoN::Vector< ValueType >::operator+= | ( | const Vector< ValueType > & | rhs | ) |
Arithmetic add operator, addition of a second field.
rhs | The field to add with this field. |
Vector< ValueType > & NeoN::Vector< ValueType >::operator-= | ( | const Vector< ValueType > & | rhs | ) |
Arithmetic subtraction operator, subtraction by a second field.
rhs | The field to subtract from this field. |
void NeoN::Vector< ValueType >::operator= | ( | const ValueType & | rhs | ) |
Assignment operator, Sets the field values to that of the passed value.
rhs | The value to set the field to. |
void NeoN::Vector< ValueType >::operator= | ( | const Vector< ValueType > & | rhs | ) |
Assignment operator, Sets the field values to that of the parsed field.
rhs | The field to copy from. |
|
delete |
|
delete |
|
inline |
Gets the range of the field.
Definition at line 303 of file vector.hpp.
void NeoN::Vector< ValueType >::resize | ( | const localIdx | size | ) |
Resizes the field to a new size.
size | The new size to set the field to. |
|
inline |
Gets the size of the field.
Definition at line 233 of file vector.hpp.
|
inline |
Gets the size of the field.
Definition at line 239 of file vector.hpp.
|
inline |
|
delete |
|
inline |
|
delete |
|
inline |
Gets a sub view of the field as a view.
Definition at line 281 of file vector.hpp.
|
delete |
|
inline |
Gets a sub view of the field as a view.
Definition at line 292 of file vector.hpp.
|
delete |