Alsvinn
0.5.3
The fast FVM simulator with UQ support
|
#include <alsfvm/memory/HostMemory.hpp>
Public Member Functions | |
HostMemory (size_t nx, size_t ny=1, size_t nz=1) | |
virtual std::shared_ptr< Memory< T > > | makeInstance () const override |
Clones the memory area, but does not copy the content More... | |
virtual bool | isOnHost () const override |
virtual void | copyFrom (const Memory< T > &other) override |
Copies the contents of the other memory area into this one. More... | |
virtual T * | getPointer () override |
virtual const T * | getPointer () const override |
virtual void | copyToHost (T *bufferPointer, size_t bufferLength) const override |
virtual void | copyFromHost (const T *bufferPointer, size_t bufferLength) override |
virtual void | operator+= (const Memory< T > &other) override |
virtual void | operator*= (const Memory< T > &other) override |
virtual void | operator-= (const Memory< T > &other) override |
virtual void | operator/= (const Memory< T > &other) override |
virtual void | operator+= (real scalar) override |
virtual void | operator*= (real scalar) override |
virtual void | operator-= (real scalar) override |
virtual void | operator/= (real scalar) override |
T & | at (size_t x, size_t y=0, size_t z=0) |
at returns the data at the given index More... | |
const T & | at (size_t x, size_t y=0, size_t z=0) const |
at returns the data at the given index More... | |
virtual void | makeZero () override |
makeZero sets every element to zero (0) More... | |
virtual void | copyInternalCells (size_t startX, size_t endX, size_t startY, size_t endY, size_t startZ, size_t endZ, T *output, size_t outputSize) override |
copyInternalCells copies the internal cells into the memory area This is ideal for removing ghost cells before outputing the solution. More... | |
virtual void | addLinearCombination (T a1, T a2, const Memory< T > &v2, T a3, const Memory< T > &v3, T a4, const Memory< T > &v4, T a5, const Memory< T > &v5) override |
virtual void | addPower (const Memory< T > &other, double power) override |
virtual void | addPower (const Memory< T > &other, double power, double factor) override |
virtual void | subtractPower (const Memory< T > &other, double power) override |
virtual std::shared_ptr< Memory< T > > | getHostMemory () override |
Copies the data to host if it is on GPU, otherwise makes a copy. More... | |
virtual const std::shared_ptr< const Memory< T > > | getHostMemory () const override |
virtual real | getTotalVariation (int p, const ivec3 &start, const ivec3 &end) const override |
virtual real | getTotalVariation (int direction, int p, const ivec3 &start, const ivec3 &end) const override |
![]() | |
Memory (size_t nx, size_t ny, size_t nz) | |
Memory constructs new memory. More... | |
virtual | ~Memory () |
virtual size_t | getSize () const |
virtual size_t | getSizeX () const |
virtual size_t | getSizeY () const |
virtual size_t | getSizeZ () const |
virtual size_t | getExtentXInBytes () const |
virtual size_t | getExtentYInBytes () const |
T * | data () |
const T * | data () const |
T & | operator[] (size_t i) |
T | operator[] (size_t i) const |
T | operator() (int x, int y, int z) const |
T & | operator() (int x, int y, int z) |
View< T > | getView () |
getView gets the view to the memory More... | |
View< const T > | getView () const |
getView gets the view to the memory (const version) More... | |
![]() | |
MemoryBase () | |
virtual | ~MemoryBase () |
Additional Inherited Members | |
![]() | |
const size_t | nx |
const size_t | ny |
const size_t | nz |
alsfvm::memory::HostMemory< T >::HostMemory | ( | size_t | nx, |
size_t | ny = 1 , |
||
size_t | nz = 1 |
||
) |
nx | the size of the memory area in X (number of T) |
ny | the size of the memory area in Y (number of T) |
nz | the size of the memory area in Z (number of T) |
|
overridevirtual |
Adds the memory with coefficients to this memory area Here we compute the sum
where is the volume being operated on.
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Adds a power of the other memory area to this memory area, ie
other | the other memory area to the the power of |
power | the power to use |
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Adds a power of the other memory area to this memory area, ie
other | the other memory area to the the power of |
power | the power to use |
Implements alsfvm::memory::Memory< T >.
T & alsfvm::memory::HostMemory< T >::at | ( | size_t | x, |
size_t | y = 0 , |
||
size_t | z = 0 |
||
) |
at returns the data at the given index
x | the x index |
y | the y index |
z | the z index |
const T & alsfvm::memory::HostMemory< T >::at | ( | size_t | x, |
size_t | y = 0 , |
||
size_t | z = 0 |
||
) | const |
at returns the data at the given index
x | the x index |
y | the y index |
z | the z index |
|
overridevirtual |
Copies the contents of the other memory area into this one.
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Copies the memory from the buffer (assumed to be on Host/CPU)
bufferPointer | the buffer to write to |
bufferLength | the size of the buffer (in number of T's) |
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
copyInternalCells copies the internal cells into the memory area This is ideal for removing ghost cells before outputing the solution.
startX | start index (inclusive) for x direction |
endX | end index (exclusive) for x direction |
startY | start index (inclusive) for y direction |
endY | end index (exclusive) for y direction |
startZ | start index (inclusive) for z direction |
endZ | end index (exclusive) for z direction |
output | the output buffer |
outputSize | must be at least the size of the written memory |
This is essentially equivalent to doing
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Copies the memory to the given buffer
bufferPointer | the buffer to write to |
bufferLength | the size of the buffer (in number of T's) |
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Copies the data to host if it is on GPU, otherwise makes a copy.
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Copies the data to host if it is on GPU, otherwise makes a copy Const version
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Gets the pointer to the data (need not be on the host!)
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Gets the pointer to the data (need not be on the host!)
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Computes the total variation, given here as
p | the exponent p |
start | the index to start at (inclusive) |
end | the maximum index (exclusive) |
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
$
p | the exponent p |
direction | the direction (between 0 and 2 inclusive) |
start | the index to start at (inclusive) |
end | the maximum index (exclusive) |
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Checks if the memory area is on the host (CPU) or on some device, if the latter, one needs to copy to host before reading it.
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Clones the memory area, but does not copy the content
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
makeZero sets every element to zero (0)
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Mutliplies the other memory area to this one
other | the memory area to multiply from |
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Multiplies the scalar to each component
scalar | the scalar to multiply |
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Adds the other memory area to this one
other | the memory area to add from |
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Adds the scalar to each component
scalar | the scalar to add |
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Subtracts the other memory area to this one
other | the memory area to subtract from |
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Subtracts the scalar from each component
scalar | the scalar to subtract |
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Divides the other memory area to this one
other | the memory area to divide from |
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Divides the each component by the scalar
scalar | the scalar to divide |
Implements alsfvm::memory::Memory< T >.
|
overridevirtual |
Subtracts a power of the other memory area to this memory area, ie
other | the other memory area to the the power of |
power | the power to use |
Implements alsfvm::memory::Memory< T >.