Alsvinn
0.5.3
The fast FVM simulator with UQ support
|
#include <alsfvm/memory/Memory.hpp>
Public Member Functions | |
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 std::shared_ptr< Memory< T > > | makeInstance () const =0 |
Clones the memory area, but does not copy the content More... | |
virtual void | copyFrom (const Memory< T > &other)=0 |
Copies the contents of the other memory area into this one. More... | |
virtual size_t | getExtentXInBytes () const |
virtual size_t | getExtentYInBytes () const |
virtual bool | isOnHost () const =0 |
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) |
virtual T * | getPointer ()=0 |
virtual const T * | getPointer () const =0 |
virtual void | copyToHost (T *bufferPointer, size_t bufferLength) const =0 |
virtual void | copyFromHost (const T *bufferPointer, size_t bufferLength)=0 |
virtual void | operator+= (const Memory< T > &other)=0 |
virtual void | operator*= (const Memory< T > &other)=0 |
virtual void | operator-= (const Memory< T > &other)=0 |
virtual void | operator/= (const Memory< T > &other)=0 |
virtual void | operator+= (real scalar)=0 |
virtual void | operator*= (real scalar)=0 |
virtual void | operator-= (real scalar)=0 |
virtual void | operator/= (real scalar)=0 |
virtual void | makeZero ()=0 |
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)=0 |
copyInternalCells copies the internal cells into the memory area This is ideal for removing ghost cells before outputing the solution. More... | |
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... | |
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)=0 |
virtual void | addPower (const Memory< T > &other, double power)=0 |
virtual void | addPower (const Memory< T > &other, double power, double factor)=0 |
virtual void | subtractPower (const Memory< T > &other, double power)=0 |
virtual std::shared_ptr< Memory< T > > | getHostMemory ()=0 |
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 =0 |
virtual real | getTotalVariation (int p, const ivec3 &start, const ivec3 &end) const =0 |
virtual real | getTotalVariation (int direction, int p, const ivec3 &start, const ivec3 &end) const =0 |
![]() | |
MemoryBase () | |
virtual | ~MemoryBase () |
Protected Attributes | |
const size_t | nx |
const size_t | ny |
const size_t | nz |
Class to hold data. Do note that this is an abstract interface, look at the other concrete implementations to use this.
alsfvm::memory::Memory< T >::Memory | ( | size_t | nx, |
size_t | ny, | ||
size_t | nz | ||
) |
Memory constructs new memory.
nx | the number of cells in x direction |
ny | the number of cells in y direction |
nz | the number of cells in z direction |
|
inlinevirtual |
|
pure virtual |
Adds the memory with coefficients to this memory area Here we compute the sum
where is the volume being operated on.
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
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 |
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
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 |
factor | the factor to multiply |
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
Copies the contents of the other memory area into this one.
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
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) |
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
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
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
Copies the memory to the given buffer
bufferPointer | the buffer to write to |
bufferLength | the size of the buffer (in number of T's) |
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
inline |
|
inline |
|
virtual |
|
virtual |
|
pure virtual |
Copies the data to host if it is on GPU, otherwise makes a copy.
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
Copies the data to host if it is on GPU, otherwise makes a copy Const version
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
Gets the pointer to the data (need not be on the host!)
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
Gets the pointer to the data (need not be on the host!)
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
pure virtual |
Computes the total variation, given here as
p | the exponent p |
start | the index to start at (inclusive) |
end | the maximum index (exclusive) |
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
$
p | the exponent p |
direction | the direction (between 0 and 2 inclusive) |
start | the index to start at (inclusive) |
end | the maximum index (exclusive) |
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
View< T > alsfvm::memory::Memory< T >::getView | ( | ) |
getView gets the view to the memory
View< const T > alsfvm::memory::Memory< T >::getView | ( | ) | const |
getView gets the view to the memory (const version)
|
pure virtual |
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.
Implemented in alsfvm::cuda::CudaMemory< T >, and alsfvm::memory::HostMemory< T >.
|
pure virtual |
Clones the memory area, but does not copy the content
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
makeZero sets every element to zero (0)
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
inline |
|
inline |
|
pure virtual |
Mutliplies the other memory area to this one
other | the memory area to multiply from |
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
Multiplies the scalar to each component
scalar | the scalar to multiply |
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
Adds the other memory area to this one
other | the memory area to add from |
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
Adds the scalar to each component
scalar | the scalar to add |
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
Subtracts the other memory area to this one
other | the memory area to subtract from |
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
Subtracts the scalar from each component
scalar | the scalar to subtract |
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
Divides the other memory area to this one
other | the memory area to divide from |
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
pure virtual |
Divides the each component by the scalar
scalar | the scalar to divide |
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
inline |
|
inline |
|
pure virtual |
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 |
Implemented in alsfvm::memory::HostMemory< T >, and alsfvm::cuda::CudaMemory< T >.
|
protected |
|
protected |
|
protected |