Alsvinn
0.5.3
The fast FVM simulator with UQ support
|
The Volume class represents a volume (a collection of cells with values for each cell (eg. pressure, density, etc) More...
#include <alsfvm/volume/Volume.hpp>
Public Member Functions | |
Volume (const std::vector< std::string > &variableNames, alsfvm::shared_ptr< memory::MemoryFactory > memoryFactory, size_t nx, size_t ny, size_t nz, size_t numberOfGhostCells=0) | |
Volume creates a new volume object. More... | |
Volume (Volume &volume, const std::vector< size_t > &components, const std::vector< std::string > &variableNames) | |
virtual | ~Volume () |
virtual size_t | getNumberOfVariables () const |
getNumberOfVariables gets the number of variables used More... | |
virtual ivec3 | getSize () const |
Returns the size in each dimension. More... | |
virtual ivec3 | getInnerSize () const |
Gets the size without ghost cells in each dimension. More... | |
virtual ivec3 | getNumberOfGhostCells () const |
Returns the number of ghostcells in each dimension. More... | |
virtual alsfvm::shared_ptr< memory::Memory< real > > & | getScalarMemoryArea (size_t index) |
getScalarMemoryArea gets the scalar memory area (real) More... | |
virtual alsfvm::shared_ptr< const memory::Memory< real > > | getScalarMemoryArea (size_t index) const |
getScalarMemoryArea gets the scalar memory area (real) More... | |
virtual alsfvm::shared_ptr< memory::Memory< real > > & | getScalarMemoryArea (const std::string &name) |
getScalarMemoryArea gets the scalar memory area (real) More... | |
virtual alsfvm::shared_ptr< const memory::Memory< real > > | getScalarMemoryArea (const std::string &name) const |
getScalarMemoryArea gets the scalar memory area (real) More... | |
virtual alsfvm::shared_ptr< const memory::Memory< real > > | operator[] (size_t index) const |
gets the scalar memory area (real) More... | |
virtual alsfvm::shared_ptr< memory::Memory< real > > | operator[] (size_t index) |
gets the scalar memory area (real) More... | |
virtual const memory::Memory< real > & | operator[] (const std::string &name) const |
gets the scalar memory area (real) More... | |
virtual memory::Memory< real > & | operator[] (const std::string &name) |
gets the scalar memory area (real) More... | |
virtual size_t | getIndexFromName (const std::string &name) const |
getIndexFromName returns the given index from the name More... | |
virtual std::string | getName (size_t index) const |
virtual Volume & | operator+= (const Volume &other) |
virtual Volume & | operator*= (real scalar) |
virtual size_t | getNumberOfXCells () const |
virtual size_t | getNumberOfYCells () const |
virtual size_t | getNumberOfZCells () const |
virtual void | makeZero () |
makeZero sets every element of the volume to zero (0). More... | |
virtual size_t | getNumberOfXGhostCells () const |
virtual size_t | getNumberOfYGhostCells () const |
virtual size_t | getNumberOfZGhostCells () const |
virtual size_t | getTotalNumberOfXCells () const |
virtual size_t | getTotalNumberOfYCells () const |
virtual size_t | getTotalNumberOfZCells () const |
virtual void | copyInternalCells (size_t memoryAreaIndex, real *output, size_t outputSize) const |
virtual void | copyTo (volume::Volume &other) const |
virtual void | setVolume (const volume::Volume &other) |
setVolume sets the contents of this volume to the contenst of the other volume More... | |
virtual size_t | getDimensions () const |
Gets the number of space dimensions. More... | |
void | addLinearCombination (real a1, real a2, const Volume &v2, real a3, const Volume &v3, real a4, const Volume &v4, real a5, const Volume &v5) |
virtual ivec3 | getTotalDimensions () const |
virtual void | addPower (const Volume &other, real power) |
virtual void | addPower (const Volume &other, real power, real factor) |
virtual void | subtractPower (const Volume &other, real power) |
std::shared_ptr< volume::Volume > | makeInstance () const |
Makes a volume with the same memory areas and the same sizes. More... | |
std::shared_ptr< volume::Volume > | makeInstance (size_t nx, size_t ny, size_t nz, const std::string &platform="default") const |
std::shared_ptr< volume::Volume > | getCopyOnCPU () |
bool | hasVariable (const std::string &variableName) const |
Returns true if the volume has the given variable, false otherwise. More... | |
The Volume class represents a volume (a collection of cells with values for each cell (eg. pressure, density, etc)
alsfvm::volume::Volume::Volume | ( | const std::vector< std::string > & | variableNames, |
alsfvm::shared_ptr< memory::MemoryFactory > | memoryFactory, | ||
size_t | nx, | ||
size_t | ny, | ||
size_t | nz, | ||
size_t | numberOfGhostCells = 0 |
||
) |
Volume creates a new volume object.
variableNames | a list of the used variable names. Typically this can be "rho", "m", "u", etc. |
memoryFactory | the memory factory to use to create new memory areas. |
nx | the number of cells in x diretion |
ny | the number of cells in y diretion |
nz | the number of cells in z diretion |
numberOfGhostCells | the number of ghost cells |
alsfvm::volume::Volume::Volume | ( | Volume & | volume, |
const std::vector< size_t > & | components, | ||
const std::vector< std::string > & | variableNames | ||
) |
Make a volume as a view of another volume.
volume | the volume to make a view of |
components | the components to use |
variableNames | the variableNames to use |
|
virtual |
void alsfvm::volume::Volume::addLinearCombination | ( | real | a1, |
real | a2, | ||
const Volume & | v2, | ||
real | a3, | ||
const Volume & | v3, | ||
real | a4, | ||
const Volume & | v4, | ||
real | a5, | ||
const Volume & | v5 | ||
) |
Adds the volumes with coefficients to this volume Here we compute the sum
where is the volume being operated on.
Adds a power of the other volume to this volume, ie
other | the other volume to the the power of |
power | the power to use |
Adds a power of the other volume to this volume, ie
other | the other volume to the the power of |
power | the power to use |
|
virtual |
Copies the contents of the given memory area into the buffer output.
This is ideal for removing the ghost cells before output.
|
virtual |
Copies the whole volume to the other volume
std::shared_ptr< Volume > alsfvm::volume::Volume::getCopyOnCPU | ( | ) |
If the volume is on the CPU, returns a pointer to the current volume, otherwise, make a new cpu copy, copy data from gpu, and then return
|
virtual |
Gets the number of space dimensions.
|
virtual |
getIndexFromName returns the given index from the name
name | the name of the variable |
|
virtual |
Gets the size without ghost cells in each dimension.
|
virtual |
Gets the variable name associated to the given index
index | the index of the variable name |
|
virtual |
Returns the number of ghostcells in each dimension.
|
virtual |
getNumberOfVariables gets the number of variables used
|
virtual |
|
virtual |
Gets the number of ghost cells in x direction
|
virtual |
|
virtual |
Gets the number of ghost cells in y direction
|
virtual |
|
virtual |
Gets the number of ghost cells in z direction
|
virtual |
getScalarMemoryArea gets the scalar memory area (real)
index | the index of the variable. Use getIndexFromName to get the index. |
|
virtual |
getScalarMemoryArea gets the scalar memory area (real)
index | the index of the variable. Use getIndexFromName to get the index. |
|
virtual |
getScalarMemoryArea gets the scalar memory area (real)
name | the name of the variable |
|
virtual |
getScalarMemoryArea gets the scalar memory area (real)
name | the name of the variable |
|
virtual |
Returns the size in each dimension.
|
virtual |
Gets the total size in each dimension. Equivalent to calling
|
virtual |
Returns the total number of cells in x direction, including ghost cells
|
virtual |
Returns the total number of cells in y direction, including ghost cells
|
virtual |
Returns the total number of cells in z direction, including ghost cells
bool alsfvm::volume::Volume::hasVariable | ( | const std::string & | variableName | ) | const |
Returns true if the volume has the given variable, false otherwise.
std::shared_ptr< Volume > alsfvm::volume::Volume::makeInstance | ( | ) | const |
Makes a volume with the same memory areas and the same sizes.
std::shared_ptr< Volume > alsfvm::volume::Volume::makeInstance | ( | size_t | nx, |
size_t | ny, | ||
size_t | nz, | ||
const std::string & | platform = "default" |
||
) | const |
Makes a new volume with the same names for the memory areas, but with the newly given sizes.
|
virtual |
makeZero sets every element of the volume to zero (0).
Multiplies each component of the volume by the scalar
Adds each component of the other volume to this volume
|
virtual |
gets the scalar memory area (real)
index | the index of the variable |
|
virtual |
gets the scalar memory area (real)
index | the index of the variable |
|
virtual |
gets the scalar memory area (real)
name | the name of the variable |
|
virtual |
gets the scalar memory area (real)
name | the name of the variable |
|
virtual |
setVolume sets the contents of this volume to the contenst of the other volume
other | the other volume to read from |
Subtracts a power of the other volume to this volume, ie
other | the other volume to the the power of |
power | the power to use |