Alsvinn  0.5.3
The fast FVM simulator with UQ support
Classes | Typedefs | Functions
alsfvm::volume Namespace Reference

Classes

class  Volume
 The Volume class represents a volume (a collection of cells with values for each cell (eg. pressure, density, etc) More...
 
class  VolumeFactory
 
class  VolumePair
 Easy reference to the combination of conserved volume and extra volume. More...
 

Typedefs

typedef alsfvm::shared_ptr< VolumeVolumePointer
 

Functions

template<size_t dimension>
void interpolate (memory::View< real > &out, memory::View< const real > &in, size_t x, size_t y, size_t z)
 
template<>
void interpolate< 1 > (memory::View< real > &out, memory::View< const real > &in, size_t x, size_t y, size_t z)
 
template<>
void interpolate< 2 > (memory::View< real > &out, memory::View< const real > &in, size_t x, size_t y, size_t z)
 
template<>
void interpolate< 3 > (memory::View< real > &out, memory::View< const real > &in, size_t x, size_t y, size_t z)
 
template<size_t dimension>
void interpolate (Volume &out, const Volume &in)
 
alsfvm::shared_ptr< VolumemakeConservedVolume (const std::string &platform, const std::string &equation, const ivec3 &innerSize, const int ghostCells)
 Convenience function meant to be used for testing, NOT in production. More...
 
alsfvm::shared_ptr< VolumemakeExtraVolume (const std::string &platform, const std::string &equation, const ivec3 &innerSize, const int ghostCells)
 Convenience function meant to be used for testing, NOT in production. More...
 
template<class Function >
void for_each_cell_index (const Volume &in, const Function &function, ivec3 offsetStart={0, 0, 0}, ivec3 offsetEnd={0, 0, 0})
 
template<size_t direction, bool parallel = false>
void for_each_cell_index_with_neighbours (const Volume &in, const std::function< void(size_t leftIndex, size_t middleIndex, size_t rightIndex)> &function, ivec3 offsetStart={0, 0, 0}, ivec3 offsetEnd={0, 0, 0})
 
void for_each_cell_index_with_neighbours (size_t direction, const Volume &in, const std::function< void(size_t leftIndex, size_t middleIndex, size_t rightIndex)> &function, ivec3 offsetStart={ 0, 0, 0 }, ivec3 offsetEnd={ 0, 0, 0 })
 
template<class VariableStruct >
VariableStruct expandVariableStruct (const std::array< const real *, 0 > &in, size_t index)
 
template<class VariableStruct >
VariableStruct expandVariableStruct (const std::array< const real *, 1 > &in, size_t index)
 
template<class VariableStruct >
VariableStruct expandVariableStruct (const std::array< const real *, 3 > &in, size_t index)
 
template<class VariableStruct >
VariableStruct expandVariableStruct (const std::array< const real *, 2 > &in, size_t index)
 
template<class VariableStruct >
VariableStruct expandVariableStruct (const std::array< const real *, 5 > &in, size_t index)
 
template<class VariableStruct >
VariableStruct expandVariableStruct (const std::array< const real *, 4 > &in, size_t index)
 
template<class VariableStruct >
void saveVariableStruct (const VariableStruct &in, size_t index, std::array< real *, 1 > &out)
 
template<class VariableStruct >
void saveVariableStruct (const VariableStruct &in, size_t index, std::array< real *, 0 > &out)
 
template<class VariableStruct >
void saveVariableStruct (const VariableStruct &in, size_t index, std::array< real *, 4 > &out)
 
template<class VariableStruct >
void saveVariableStruct (const VariableStruct &in, size_t index, std::array< real *, 3 > &out)
 
template<class VariableStruct >
void saveVariableStruct (const VariableStruct &in, size_t index, std::array< real *, 2 > &out)
 
template<class VariableStruct >
void saveVariableStruct (const VariableStruct &in, size_t index, std::array< real *, 5 > &out)
 
template<class VariableStructIn , class VariableStructOut >
void transform_volume (const Volume &in, Volume &out, const std::function< VariableStructOut(const VariableStructIn &)> &function)
 
template<class VariableStruct >
void for_each_cell (const Volume &in, const std::function< void(const VariableStruct &, size_t index)> &function)
 
template<class VariableStructA , class VariableStructB >
void for_each_cell (const Volume &inA, const Volume &inB, const std::function< void(const VariableStructA &, const VariableStructB &, size_t index)> &function)
 
template<class VariableStructA , class VariableStructB >
void fill_volume (Volume &outA, Volume &outB, const grid::Grid &grid, const std::function< void(real x, real y, real z, VariableStructA &outA, VariableStructB &outB) > &fillerFunction)
 
void for_each_midpoint (const Volume &volume, const grid::Grid &grid, const std::function< void(real x, real y, real z, size_t index, size_t i, size_t j, size_t k) > &function)
 
void for_each_midpoint (const Volume &volume, const grid::Grid &grid, const std::function< void(real x, real y, real z, size_t index) > &function)
 
template<class VariableStruct >
void fill_volume (Volume &out, const grid::Grid &grid, const std::function< void(real x, real y, real z, VariableStruct &out) > &fillerFunction)
 
template<size_t direction>
void for_each_internal_volume_index (const Volume &volume, const std::function< void(size_t indexLeft, size_t indexMiddle, size_t indexRight)> &function, size_t ghostLayer)
 
void for_each_internal_volume_index (const Volume &volume, const std::function< void(size_t indexMiddle)> &function)
 
template<size_t direction>
void for_each_internal_volume_index (const Volume &volume, const std::function< void(size_t indexLeft, size_t indexMiddle, size_t indexRight)> &function)
 
void for_each_internal_volume_index (const Volume &volume, size_t direction, const std::function< void(size_t indexLeft, size_t indexMiddle, size_t indexRight)> &function, size_t ghostLayer)
 
void for_each_internal_volume_index (const Volume &volume, size_t direction, const std::function< void(size_t indexLeft, size_t indexMiddle, size_t indexRight)> &function)
 

Typedef Documentation

◆ VolumePointer

typedef alsfvm::shared_ptr<Volume> alsfvm::volume::VolumePointer

Function Documentation

◆ expandVariableStruct() [1/6]

template<class VariableStruct >
VariableStruct alsfvm::volume::expandVariableStruct ( const std::array< const real *, 0 > &  in,
size_t  index 
)
inline

◆ expandVariableStruct() [2/6]

template<class VariableStruct >
VariableStruct alsfvm::volume::expandVariableStruct ( const std::array< const real *, 1 > &  in,
size_t  index 
)
inline

◆ expandVariableStruct() [3/6]

template<class VariableStruct >
VariableStruct alsfvm::volume::expandVariableStruct ( const std::array< const real *, 3 > &  in,
size_t  index 
)
inline

◆ expandVariableStruct() [4/6]

template<class VariableStruct >
VariableStruct alsfvm::volume::expandVariableStruct ( const std::array< const real *, 2 > &  in,
size_t  index 
)
inline

◆ expandVariableStruct() [5/6]

template<class VariableStruct >
VariableStruct alsfvm::volume::expandVariableStruct ( const std::array< const real *, 5 > &  in,
size_t  index 
)
inline

◆ expandVariableStruct() [6/6]

template<class VariableStruct >
VariableStruct alsfvm::volume::expandVariableStruct ( const std::array< const real *, 4 > &  in,
size_t  index 
)
inline

◆ fill_volume() [1/2]

template<class VariableStructA , class VariableStructB >
void alsfvm::volume::fill_volume ( Volume outA,
Volume outB,
const grid::Grid grid,
const std::function< void(real x, real y, real z, VariableStructA &outA, VariableStructB &outB) > &  fillerFunction 
)
inline

Fill the volume based on a filler function (depending on position). Example (making a simple Riemann problem in 2D):

fill_volume<ConservedVariables, ExtraVariables>(conserved, extra, grid,
[](real x, real y, real z, ConservedVariables& outConserved, ExtraVariables& outExtra) {
if ( x < 0.5) {
outConserved.rho = 1.0;
outConserved.m = rvec3(2,1,1);
outConserved.E = 8;
} else {
outConserved.rho = 1.2;
outConserved.m = rvec3(2,1,1);
outConserved.E = 9;
}
outExtra = Equation::calculateExtra(outConserved);
});

◆ fill_volume() [2/2]

template<class VariableStruct >
void alsfvm::volume::fill_volume ( Volume out,
const grid::Grid grid,
const std::function< void(real x, real y, real z, VariableStruct &out) > &  fillerFunction 
)
inline

Fill the volume based on a filler function (depending on position). Example (making a simple Riemann problem in 2D):

fill_volume<ConservedVariables>(conserved, grid,
[](real x, real y, real z, ConservedVariables& outConserved) {
if ( x < 0.5) {
outConserved.rho = 1.0;
outConserved.m = rvec3(2,1,1);
outConserved.E = 8;
} else {
outConserved.rho = 1.2;
outConserved.m = rvec3(2,1,1);
outConserved.E = 9;
}
});

◆ for_each_cell() [1/2]

template<class VariableStruct >
void alsfvm::volume::for_each_cell ( const Volume in,
const std::function< void(const VariableStruct &, size_t index)> &  function 
)
inline

Loops through each cell and calls the function for each cell Example

for_each_cell<euler::ConservedVariables>(conserved, [](const euler::ConservedVariables& in, size_t index) {
// Do something with in or index
});

◆ for_each_cell() [2/2]

template<class VariableStructA , class VariableStructB >
void alsfvm::volume::for_each_cell ( const Volume inA,
const Volume inB,
const std::function< void(const VariableStructA &, const VariableStructB &, size_t index)> &  function 
)
inline

Loops through each cell and calls the function for each cell Example

for_each_cell<euler::ConservedVariables, euler::ExtraVariables>
(conserved, extra, [](const euler::ConservedVariables& inA, const euler::ExtraVariables& inB, size_t index) {
// Do something with inA, inB or index
});

◆ for_each_cell_index()

template<class Function >
void alsfvm::volume::for_each_cell_index ( const Volume in,
const Function &  function,
ivec3  offsetStart = {0, 0, 0},
ivec3  offsetEnd = {0, 0, 0} 
)
inline

Loops through all possible cell indexes in a cache optimal manner. Example:

for_each_cell_index(someVolume, [](size_t index) {
std::cout << "index = " << index;
}):
Parameters
inthe volume to loop over
functionthe function to call
offsetStartthe triple deciding the starting index
offsetEndthe offset for end (must be non-negative!)

◆ for_each_cell_index_with_neighbours() [1/2]

template<size_t direction, bool parallel = false>
void alsfvm::volume::for_each_cell_index_with_neighbours ( const Volume in,
const std::function< void(size_t leftIndex, size_t middleIndex, size_t rightIndex)> &  function,
ivec3  offsetStart = {0, 0, 0},
ivec3  offsetEnd = {0, 0, 0} 
)
inline

Loops through all possible cell indexes in a cache optimal manner.

Parameters
inthe volume to loop over
functionthe function to call
offsetStartthe triple deciding the starting index
offsetEndthe offset for end (must be non-negative!)

◆ for_each_cell_index_with_neighbours() [2/2]

void alsfvm::volume::for_each_cell_index_with_neighbours ( size_t  direction,
const Volume in,
const std::function< void(size_t leftIndex, size_t middleIndex, size_t rightIndex)> &  function,
ivec3  offsetStart = { 0, 0, 0 },
ivec3  offsetEnd = { 0, 0, 0 } 
)
inline

Loops through all possible cell indexes in a cache optimal manner.

Parameters
inthe volume to loop over
functionthe function to call
offsetStartthe triple deciding the starting index
offsetEndthe offset for end (must be non-negative!)
directionthe direction to use
Note
Untemplated version for ease of use, indirectly calls the template version

◆ for_each_internal_volume_index() [1/5]

template<size_t direction>
void alsfvm::volume::for_each_internal_volume_index ( const Volume volume,
const std::function< void(size_t indexLeft, size_t indexMiddle, size_t indexRight)> &  function,
size_t  ghostLayer 
)
inline

Loops through each internal (subject to direction) volume cell, and calls the loop function with additional argument the index of the neighbouring cells.

An internal cell is a cell a cell with index 1<j<n"direction", where j indexes the relevenat direction.

Direction is given as

direction description
0 x direction
1 y direction
2 z direction

Example

for_each_internal_volume_index<0>(volume, [](size_t l, size_t m, size_t r) {
// now l is the left index, m is the middle index and r is the right index
});

◆ for_each_internal_volume_index() [2/5]

void alsfvm::volume::for_each_internal_volume_index ( const Volume volume,
const std::function< void(size_t indexMiddle)> &  function 
)
inline

Loops through each internal (subject to direction) volume cell, and calls the loop function

Example

for_each_internal_volume_indexvolume, [](size_t l, size_t m, size_t r) {
// now l is the left index, m is the middle index and r is the right index
});

◆ for_each_internal_volume_index() [3/5]

template<size_t direction>
void alsfvm::volume::for_each_internal_volume_index ( const Volume volume,
const std::function< void(size_t indexLeft, size_t indexMiddle, size_t indexRight)> &  function 
)
inline

Loops through each internal (subject to direction) volume cell, and calls the loop function with additional argument the index of the neighbouring cells.

An internal cell is a cell a cell with index 1<j<n"direction", where j indexes the relevenat direction.

Direction is given as

direction description
0 x direction
1 y direction
2 z direction

Example

for_each_internal_volume_index<0>(volume, [](size_t l, size_t m, size_t r) {
// now l is the left index, m is the middle index and r is the right index
});

◆ for_each_internal_volume_index() [4/5]

void alsfvm::volume::for_each_internal_volume_index ( const Volume volume,
size_t  direction,
const std::function< void(size_t indexLeft, size_t indexMiddle, size_t indexRight)> &  function,
size_t  ghostLayer 
)
inline

Works the same way as the templated version, but easier to use in some settings.

◆ for_each_internal_volume_index() [5/5]

void alsfvm::volume::for_each_internal_volume_index ( const Volume volume,
size_t  direction,
const std::function< void(size_t indexLeft, size_t indexMiddle, size_t indexRight)> &  function 
)
inline

◆ for_each_midpoint() [1/2]

void alsfvm::volume::for_each_midpoint ( const Volume volume,
const grid::Grid grid,
const std::function< void(real x, real y, real z, size_t index, size_t i, size_t j, size_t k) > &  function 
)
inline

Loops through each cell midpoint, and call function with the coordinates and the corresponding index in the volume.

◆ for_each_midpoint() [2/2]

void alsfvm::volume::for_each_midpoint ( const Volume volume,
const grid::Grid grid,
const std::function< void(real x, real y, real z, size_t index) > &  function 
)
inline

Loops through each cell midpoint, and call function with the coordinates and the corresponding index in the volume.

Note
This just passes through to the other function taking a bigger lambda signature.

◆ interpolate() [1/2]

template<size_t dimension>
void alsfvm::volume::interpolate ( memory::View< real > &  out,
memory::View< const real > &  in,
size_t  x,
size_t  y,
size_t  z 
)

◆ interpolate() [2/2]

template<size_t dimension>
void alsfvm::volume::interpolate ( Volume out,
const Volume in 
)
inline

◆ interpolate< 1 >()

template<>
void alsfvm::volume::interpolate< 1 > ( memory::View< real > &  out,
memory::View< const real > &  in,
size_t  x,
size_t  y,
size_t  z 
)

◆ interpolate< 2 >()

template<>
void alsfvm::volume::interpolate< 2 > ( memory::View< real > &  out,
memory::View< const real > &  in,
size_t  x,
size_t  y,
size_t  z 
)

◆ interpolate< 3 >()

template<>
void alsfvm::volume::interpolate< 3 > ( memory::View< real > &  out,
memory::View< const real > &  in,
size_t  x,
size_t  y,
size_t  z 
)

◆ makeConservedVolume()

alsfvm::shared_ptr<Volume> alsfvm::volume::makeConservedVolume ( const std::string &  platform,
const std::string &  equation,
const ivec3 innerSize,
const int  ghostCells 
)
inline

Convenience function meant to be used for testing, NOT in production.

◆ makeExtraVolume()

alsfvm::shared_ptr<Volume> alsfvm::volume::makeExtraVolume ( const std::string &  platform,
const std::string &  equation,
const ivec3 innerSize,
const int  ghostCells 
)
inline

Convenience function meant to be used for testing, NOT in production.

◆ saveVariableStruct() [1/6]

template<class VariableStruct >
void alsfvm::volume::saveVariableStruct ( const VariableStruct &  in,
size_t  index,
std::array< real *, 1 > &  out 
)
inline

◆ saveVariableStruct() [2/6]

template<class VariableStruct >
void alsfvm::volume::saveVariableStruct ( const VariableStruct &  in,
size_t  index,
std::array< real *, 0 > &  out 
)
inline

◆ saveVariableStruct() [3/6]

template<class VariableStruct >
void alsfvm::volume::saveVariableStruct ( const VariableStruct &  in,
size_t  index,
std::array< real *, 4 > &  out 
)
inline

◆ saveVariableStruct() [4/6]

template<class VariableStruct >
void alsfvm::volume::saveVariableStruct ( const VariableStruct &  in,
size_t  index,
std::array< real *, 3 > &  out 
)
inline

◆ saveVariableStruct() [5/6]

template<class VariableStruct >
void alsfvm::volume::saveVariableStruct ( const VariableStruct &  in,
size_t  index,
std::array< real *, 2 > &  out 
)
inline

◆ saveVariableStruct() [6/6]

template<class VariableStruct >
void alsfvm::volume::saveVariableStruct ( const VariableStruct &  in,
size_t  index,
std::array< real *, 5 > &  out 
)
inline

◆ transform_volume()

template<class VariableStructIn , class VariableStructOut >
void alsfvm::volume::transform_volume ( const Volume in,
Volume out,
const std::function< VariableStructOut(const VariableStructIn &)> &  function 
)
inline

Loops through each cell in the index and calls function function on each value of each cell Example usage

transform_volume<euler::ConservedVariables, euler::ExtraVariables>(conserved, extra,
[] (const euler::ConservedVariables& in) {
return euler::Euler::computeExtra(in);
});