Class overview¶
Simulation¶
- template <class realNeq, ConservationLaw CL>
- class
Simulation: class containing simulation.
This is the basic class needed to run an Astrix simulation.
Public Functions
-
template astrix::Simulation< realNeq, CL >::Simulation(int _verboseLevel, int _debugLevel, char * fileName, Device * _device, int restartNumber)
Constructor for Simulation object.
Define Arrays, create Mesh and setup simulation.
- Parameters
_verboseLevel
-How much information to output to stdout in Astrix.
_debugLevel
-Level of extra checks for correct mesh.
*fileName
-Input file name
*device
-Device to be used for computation.
restartNumber
-Number of saved file to restore from
-
template astrix::Simulation< realNeq, CL >::~Simulation()
Destructor, releases all dynamically allocated memory.
-
template void astrix::Simulation< realNeq, CL >::Run(real maxWallClockHours)
Run simulation.
Run simulation, possibly restarting from saved state, for a maximum amount of wall clock hours.
- Parameters
maxWallClockHours
-Maximum amount of wall clock hours to run for.
-
SimulationParameter¶
- class
Class containing parameters for the Simulation.
Various parameters governing the Simulation are read from an input file and stored in this class
Public Functions
-
astrix::SimulationParameter::
SimulationParameter
()¶ Constructor, set all data to invalid values.
-
astrix::SimulationParameter::
~SimulationParameter
()¶ Destructor.
-
void
astrix::SimulationParameter::
ReadFromFile
(const char *fileName, ConservationLaw CL)¶ Read in data from file.
Read in data from input file. File is read line by line; input parameters can appear in any order but all must be present. An exception is thrown if any parameter is missing or has an invalid value.
- Parameters
*fileName
-Pointer to input file name
Public Members
-
ProblemDefinition
astrix::SimulationParameter::
problemDef
¶ Problem specification (see Common/definitions.h)
Converted to int using definitions in definitions.h.
-
int
astrix::SimulationParameter::
nSpaceDim
¶ Number of space dimensions (fixed to 2)
-
IntegrationScheme
astrix::SimulationParameter::
intScheme
¶ Integration scheme (see Common/definitions.h)
Converted to int using definitions in definitions.h.
-
int
astrix::SimulationParameter::
integrationOrder
¶ Order of accuracy in time (1 or 2)
-
int
astrix::SimulationParameter::
massMatrix
¶ Mass matrix formulation to use (1, 2, 3 or 4)
-
int
astrix::SimulationParameter::
selectiveLumpFlag
¶ Flag whether to use selective lumping.
-
real
astrix::SimulationParameter::
CFLnumber
¶ Courant number.
-
int
astrix::SimulationParameter::
preferMinMaxBlend
¶ Preference for using minimum/maximum value of blend parameter.
-
real
astrix::SimulationParameter::
specificHeatRatio
¶ Ratio of specific heats.
-
real
astrix::SimulationParameter::
maxSimulationTime
¶ Maximum simulation time.
-
real
astrix::SimulationParameter::
saveIntervalTime
¶ Time between 2D saves.
-
real
astrix::SimulationParameter::
saveIntervalTimeFine
¶ Time between 0D saves.
-
int
astrix::SimulationParameter::
writeVTK
¶ Flag whether do output VTK files.
-
Device¶
- class
Simple class containing information about device.
This class is used to hold some very basic information about the machine the simulation is run on: whether we want to use any CUDA capable device, and how many CUDA-capable devices there are in total.
Public Functions
-
astrix::Device::
Device
(int _cudaFlag)¶ Constructor.
Construct Device object. Count number of CUDA-capable devices and display capabilities on screen. By default, device 0 is used.
- Parameters
_cudaFlag
-Flag whether to run on CUDA device. If set to zero, still count CUDA devices but do not use them to for computation.
-
astrix::Device::
~Device
()¶ Destructor.
Free Device object. If using CUDA, reset device for clean exit.
-
int
astrix::Device::
GetDeviceCount
()¶ Return number of CUDA devices.
-
int
astrix::Device::
GetCudaFlag
()¶ Return flag whether using CUDA.
-
Mesh¶
- class
Class containing functions acting on the whole mesh.
A Mesh object can be thought of representing the Delaunay mesh on which the computations are performed.
Public Functions
-
astrix::Mesh::
Mesh
(int meshVerboseLevel, int meshDebugLevel, int meshCudaFlag, const char *fileName, Device *device, int restartNumber)¶ Constructor.
Create Mesh with parameters specified in file fileName.
- Parameters
meshVerboseLevel
-Level of output to stdout
meshDebugLevel
-Level of debugging in Mesh construction and maintenance
meshCudaFlag
-Flag whether to use CUDA device
*fileName
-Input file name
*device
-Pointer to Device class containing information about any CUDA device present
restartNumber
-Number of save file to restore from
-
astrix::Mesh::
~Mesh
()¶ Destructor; releases memory.
- template <class realNeq, ConservationLaw CL>
-
template int astrix::Mesh::ImproveQuality< real4, CL_CART_EULER >(Array < realNeq > * vertexState, real specificHeatRatio, int nTimeStep)
Refine mesh.
Refine Delaunay mesh, depending on the state vector (i.e. density, momentum, etc). If *vertexState != 0, we first calculate an estimate of the discretization error and flag triangles to be refined; otherwise, all triangles can be refined, necessary for example when building the mesh for the first time. It returns the number of vertices added.
- Parameters
*vertexState
-Pointer to state vector at vertices
specificHeatRatio
-Ratio of specific heats
nTimeStep
-Number of time steps taken so far. Used in combination with nStepSkipRefine to possibly avoid refining every timestep
- template <class realNeq, ConservationLaw CL>
-
template int astrix::Mesh::RemoveVertices< real4, CL_CART_EULER >(Array < realNeq > * vertexState, real specificHeatRatio, int nTimeStep)
Coarsen mesh.
Coarsen mesh. First calculate an estimate of the discretization error and flag triangles that can be coarsened. Then remove as many vertices as possible from mesh.
- Parameters
*vertexState
-Pointer to state vector at vertices
specificHeatRatio
-Ratio of specific heats
nTimeStep
-Number of time steps taken so far. Used in combination with nStepSkipCoarsen to possibly avoid coarsening every timestep
-
void
astrix::Mesh::
Save
(int nSave)¶ Save mesh to disk.
Save vertexCoordinates in a vertex file, triangleVertices and triangleEdges in a triangle file, and edgeTriangles in an edge file.
- Parameters
nSave
-Number of save, used to generate file names
-
void
astrix::Mesh::
ReadFromDisk
(int nSave)¶ Read previously created mesh from disk.
Read mesh from disk as it was saved under number nSave. In addition, calculate triangle normals, vertex areas and find boundary vertices.
- Parameters
nSave
-Number of save to restore
-
int
astrix::Mesh::
GetNVertex
()¶ Return number of vertices.
-
int
astrix::Mesh::
GetNTriangle
()¶ Return number of triangles.
-
int
astrix::Mesh::
GetNEdge
()¶ Return number of edges.
-
int
astrix::Mesh::
IsAdaptive
()¶ Return if mesh is adaptive.
-
real
astrix::Mesh::
GetPx
()¶ Return size of domain in x.
-
real
astrix::Mesh::
GetPy
()¶ Return size of domain in y.
-
real
astrix::Mesh::
GetMinX
()¶ Return minimum x.
-
real
astrix::Mesh::
GetMaxX
()¶ Return maximum x.
-
real
astrix::Mesh::
GetMinY
()¶ Return minimum y.
-
real
astrix::Mesh::
GetMaxY
()¶ Return maximum y.
-
real
astrix::Mesh::
GetTotalArea
()¶ Return total vertex area.
-
const real2 *
astrix::Mesh::
VertexCoordinatesData
()¶ Return pointer to vertex coordinates data.
-
const int *
astrix::Mesh::
VertexBoundaryFlagData
()¶ Return pointer to vertex boundary flag data.
-
const real *
astrix::Mesh::
VertexAreaData
()¶ Return pointer to vertex area data.
-
const int3 *
astrix::Mesh::
TriangleVerticesData
()¶ Return pointer to triangle vertices data.
-
const int3 *
astrix::Mesh::
TriangleEdgesData
()¶ Return pointer to triangle edges data.
-
const real2 *
astrix::Mesh::
TriangleEdgeNormalsData
(int dim)¶ Return pointer to triangle edge normals data.
-
const real3 *
astrix::Mesh::
TriangleEdgeLengthData
()¶ Return triangle edge length data.
-
const int2 *
astrix::Mesh::
EdgeTrianglesData
()¶ Return edge triangles data.
-
void
astrix::Mesh::
Transform
()¶ Transform all Arrays.
-
MeshParameter¶
- class
Class containing parameters for the Mesh.
Various parameters governing the resolution and quality of the Mesh are read from an input file and stored in this class
Public Functions
-
astrix::MeshParameter::
MeshParameter
()¶ Constructor, set all data to invalid values.
-
astrix::MeshParameter::
~MeshParameter
()¶ Destructor.
-
void
astrix::MeshParameter::
ReadFromFile
(const char *fileName)¶ Read in data from file.
Read in data from input file. File is read line by line; input parameters can appear in any order but all must be present. An exception is thrown if any parameter is missing or has an invalid value.
- Parameters
*fileName
-Pointer to input file name
Public Members
-
ProblemDefinition
astrix::MeshParameter::
problemDef
¶ Definition of test problem.
-
int
astrix::MeshParameter::
equivalentPointsX
¶ Approximate number of vertices in x direction.
-
real
astrix::MeshParameter::
qualityBound
¶ Quality bound on triangles; must be >= 1.
-
int
astrix::MeshParameter::
periodicFlagX
¶ Flag to create periodic domain in x.
-
int
astrix::MeshParameter::
periodicFlagY
¶ Flag to create periodic domain in y.
-
real
astrix::MeshParameter::
minx
¶ Position of left x boundary.
-
real
astrix::MeshParameter::
maxx
¶ Position of right x boundary.
-
real
astrix::MeshParameter::
miny
¶ Position of left y boundary.
-
real
astrix::MeshParameter::
maxy
¶ Position of right y boundary.
-
int
astrix::MeshParameter::
structuredFlag
¶ Flag whether using structured mesh.
-
int
astrix::MeshParameter::
adaptiveMeshFlag
¶ Flag whether mesh is adaptive.
-
int
astrix::MeshParameter::
maxRefineFactor
¶ Maximum factor to increase resolution over base resolution if adaptive mesh is used.
-
int
astrix::MeshParameter::
nStepSkipRefine
¶ Number of time steps without checking if refinement is needed.
-
int
astrix::MeshParameter::
nStepSkipCoarsen
¶ Number of time steps without checking if coarsening is needed.
-
real
astrix::MeshParameter::
baseResolution
¶ Triangle size for initial Mesh (derived from equivalentPointsX)
-
real
astrix::MeshParameter::
maxResolution
¶ Triangle size for adaptive mesh (derived from baseResolution and maxRefineFactor)
-
Connectivity¶
- class
Class containing Mesh data structure.
Class containing coordinates and connectivity of Mesh; data needed by all Mesh-related classes. The class is essentially data-only, plus a few functions to move data between host and device. All data members are public, which can be unsafe. It is assumed that at the end of any function modifying the Mesh, the Connectivity represents a valid triangulation (not necessarily Delaunay), and that the sizes of the Arrays are properly set, i.e. the size of vertexCoordinates is the number of vertices, the size of both triangleVertices and triangleEdges equals the number of triangles, and the size of edgeTriangles equals the number of edges.
Public Functions
-
astrix::Connectivity::
Connectivity
(int _cudaFlag)¶ Constructor.
Constructor for Connectivity class. Memory is allocated in large chunks to minimise any further calls to cudaMalloc when improving the Mesh.
- Parameters
_cudaFlag
-Flag whether Arrays reside on host (0) or device (1)
-
astrix::Connectivity::
~Connectivity
()¶ Destructor; releases memory.
-
void
astrix::Connectivity::
Transform
()¶ Transform from device to host or vice versa.
Move whole class to device or host, depending on current value of cudaFlag
-
void
astrix::Connectivity::
CopyToHost
()¶ Copy data to host.
Copy all data currently residing on device to host. Unlike during a transform, cudaFlag is not changed
-
void
astrix::Connectivity::
CopyToDevice
()¶ Copy data to device.
Copy all data currently residing on the host to the device. Unlike during a transform, cudaFlag is not changed
-
void
astrix::Connectivity::
CheckEdgeTriangles
()¶ Check if the neighbouring triangles of every edge e do have e as an edge. This is done on the host
-
void
astrix::Connectivity::
CalcVertexArea
(real Px, real Py)¶ Calculate area associated with vertices (Voronoi cells)
Every triangle contributes one third of its area to the area of the Voronoi cell associated with its vertices. Atomically add this contribution to vertexArea
Public Members
-
Delaunay¶
- class
Class for turning Mesh into Delaunay mesh.
The public function of this class turns the Mesh into a Delaunay mesh by edge flipping.
Public Functions
-
astrix::Delaunay::
Delaunay
(int _cudaFlag, int _debugLevel)¶ Constructor.
Constructor for Delaunay class.
- Parameters
_cudaFlag
-Flag indicating whether to use device (1) or host (0)
_debugLevel
-Level of extra checks to do
-
astrix::Delaunay::
~Delaunay
()¶ Destructor; releases memory.
- template <class realNeq, ConservationLaw CL>
-
template void astrix::Delaunay::MakeDelaunay< real4, CL_CART_EULER >(Connectivity *const connectivity, Array < realNeq > *const vertexState, const Predicates * predicates, const MeshParameter * meshParameter, const int maxCycle, Array < int > *const edgeNeedsChecking, const int nEdgeCheck, const int flopFlag)
-
Transform triangulated Mesh into Delaunay Mesh. This is achieved by flipping edges that do not have the Delaunay property. First, we make a list of edges that are not Delaunay, then we select those that can be flipped in parallel, we adjust the state vector in order to conserve mass, momentum and energy, and finally we flip the edges. A repair step ensures all edges have the correct neighbouring triangles. This is repeated until all edges are Delaunay.
- Parameters
*connectivity
-Pointer to basic Mesh data
*vertexState
-Pointer to state vector
*predicates
-Pointer to Predicates object, used to check Delaunay property without roundoff error
*meshParameter
-Pointer to Mesh parameters
maxCycle
-Maximum number of cycles. If <= 0, cycle until all edges are Delaunay
-
Refine¶
- class
Public Functions
-
astrix::Refine::
Refine
(int _cudaFlag, int _debugLevel, int _verboseLevel)¶ Constructor.
Constructor for Refine class.
- Parameters
_cudaFlag
-Flag indicating whether to use device (1) or host (0)
_debugLevel
-Level of extra checks to do
_verboseLevel
-Level of output to stdout
-
astrix::Refine::
~Refine
()¶ Destructor; releases memory.
- template <class realNeq, ConservationLaw CL>
-
template int astrix::Refine::ImproveQuality< real4, CL_CART_EULER >(Connectivity *const connectivity, const MeshParameter * meshParameter, const Predicates * predicates, Morton *const morton, Delaunay *const delaunay, Array < realNeq > *const vertexState, const real specificHeatRatio, Array < int > *const triangleWantRefine)
Add vertices to Mesh until quality constraints met.
Function to improve quality of Mesh by adding new vertices, until the requirements as specified in MeshParameter are met. Returns the number of vertices that were added.
- Parameters
*connectivity
-Pointer to basic Mesh data: vertices, triangles, edges
*meshParameter
-Pointer to Mesh parameters, read from input file
*predicates
-Exact geometric predicates
*morton
-Pointer to Morton object, used for sorting to improve data locality
*delaunay
-Pointer to Delaunay object, used to maintain Delaunay triangulation
*vertexState
-Pointer to state at vertices. If refining at t > 0, we need to interpolate the state at new vertices. Otherwise, this pointer needs to be 0 and will be ignored.
specificHeatRatio
-Ratio of specific heats. Needed when interpolating the state.
*triangleWantRefine
-Pointer to flags if triangle needs to be refined based on current state. Only used when t > 0; otherwise it needs to be 0.
-
int
astrix::Refine::
AddVertices
(Connectivity *const connectivity, const MeshParameter *meshParameter, const Predicates *predicates, Delaunay *const delaunay, Array<real2> *const vertexBoundaryCoordinates, Array<int> *const vertexOrder)¶ Add list of vertices to Mesh.
Add a list of vertices to the Mesh. Used in cases where vertex locations are known in advance, i.e. when inserting boundaries. Can only be used at t = 0, so no interpolation of the state is necessary.
- Parameters
*connectivity
-Pointer to basic Mesh data: vertices, triangles, edges
*meshParameter
-Pointer to Mesh parameters, read from input file
*predicates
-Exact geometric predicates
*delaunay
-Pointer to Delaunay object, used to maintain Delaunay triangulation
*vertexBoundaryCoordinates
-Pointer to coordinates of vertices to be added
*vertexOrder
-Output: the order in which vertices were inserted.
-
Morton¶
- class
Class containing functions for Morton ordering.
A Morton object can be used to reorder vertices, triangles and edges to improve data locality.
Public Functions
-
astrix::Morton::
Morton
(int _cudaFlag)¶ Constructor.
Constructor for Morton object. Allocates Arrays of standard size.
- Parameters
_cudaFlag
-Flag whether to use device (1) or host (0) to compute
-
astrix::Morton::
~Morton
()¶ Destructor; releases memory.
- template <class realNeq, ConservationLaw CL>
-
template void astrix::Morton::Order< real4, CL_CART_EULER >(Connectivity *const connectivity, Array < int > *const triangleWantRefine, Array < realNeq > *const vertexState)
Reorder Arrays for maximum locality.
Sort vertices, edges and triangles according to their Morton value to improve data locality. We first compute the Morton values for the vertex coordinates and use those to sort vertices, triangles and edges.
- Parameters
*connectivity
-Pointer to basic Mesh data
*triangleWantRefine
-Pointer to flags whether triangles need to be refined
*vertexState
-Pointer to state vector
-
Predicates¶
- class
Class for exact geometric predicates.
Creating and updating Delaunay triangulations requires exact evaluation of certain geometric tests, in particular whether a point d lies inside or outside the circle through three other points a, b and c, and whether three points a, b and c are orientated in anti-clockwise direction or not. This class uses the algorithms by Shewchuck (1997).
Public Functions
-
astrix::Predicates::
Predicates
(Device *device)¶ Constructor.
Construct Predicates object and compute parameter vector on host and device.
- Parameters
*device
-Pointer to Device object.
-
astrix::Predicates::
~Predicates
()¶ Destructor.
-
real
astrix::Predicates::
incircle
(real ax, real ay, real bx, real by, real cx, real cy, real dx, real dy, const real *const pParam)¶
const Test whether point d lies in circle formed by a, b and c.
Test whether point (dx, dy) lies inside a circle defined by points (ax, ay), (bx, by) and (cx, cy). Return value > 0 if d lies inside circle, < 0 if outside circle, and = 0 if exactly on circle.
- Parameters
ax
-x coordinate of point a
ay
-y coordinate of point a
bx
-x coordinate of point b
by
-y coordinate of point b
cx
-x coordinate of point c
cy
-y coordinate of point c
dx
-x coordinate of point d
dy
-y coordinate of point d
*pParam
-pointer to parameter vector
-
real
astrix::Predicates::
orient2d
(real ax, real ay, real bx, real by, real cx, real cy, const real *const pParam)¶
const Test whether points a, b and c lie in counterclockwise orientation.
Test whether points (ax, ay), (bx, by) and (cx, cy) are orientated in counterclockwise direction. Return value > 0 if a, b, c occur in counterclockwise order, < 0 if in clockwise order, and = 0 if points are collinear.
- Parameters
ax
-x coordinate of point a
ay
-y coordinate of point a
bx
-x coordinate of point b
by
-y coordinate of point b
cx
-x coordinate of point c
cy
-y coordinate of point c
*pParam
-pointer to parameter vector
-
real *
astrix::Predicates::
GetParamPointer
(int cudaFlag)¶
const Get pointer to parameter vector.
Return pointer to parameter vector, either device pointer (if cudaFlag = 1) or host pointer (if cudaFlag = 0). Note that both exist unless there is no CUDA capable device.
- Parameters
cudaFlag
-Flag whether to return device pointer (= 1) or host pointer (= 0).
-
Array¶
- template <class T>
- class
Basic vector-like class used in Astrix.
An Array object can be thought of as a vector that can either live on the host or on the device.
Public Functions
-
template astrix::Array< T >::Array()
Basic constructor for 1D Array on host.
Construct 1D array on host of size dynArrayStep.
-
template astrix::Array< T >::Array(unsigned int _nDims, int _cudaFlag)
Constructor for multidimensional Array, possibly on device.
Construct Array of dimensions _nDims, on device if _cudaFlag = 1, of size dynArrayStep.
- Parameters
_nDims
-Number of dimensions
_cudaFlag
-Create Array on host (=0) or on device (=1)
-
template astrix::Array< T >::Array(unsigned int _nDims, int _cudaFlag, unsigned int _size)
Constructor for multidimensional Array of specified size, possibly on device.
Construct Array of dimensions _nDims, on device if _cudaFlag = 1, of size _size.
- Parameters
_nDims
-Number of dimensions
_cudaFlag
-Create Array on host (=0) or on device (=1)
_size
-Size of every dimension
-
template astrix::Array< T >::Array(unsigned int _nDims, int _cudaFlag, unsigned int _size, int _dynArrayStep)
Constructor for multidimensional Array of specified size and dynArrayStep, possibly on device.
Construct Array of dimensions _nDims, on device if _cudaFlag = 1, of size _size, with dynamical size increase step _dynArrayStep.
- Parameters
_nDims
-Number of dimensions
_cudaFlag
-Create Array on host (=0) or on device (=1)
_size
-Size of every dimension
_dynArrayStep
-Increase physical size of array in these steps
-
template astrix::Array< T >::~Array()
Destructor, releases allocated memory.
Destroy Array object, releasing both host and device memory
-
template void astrix::Array< T >::TransformToDevice()
Transform from host vector to device vector.
-
template void astrix::Array< T >::TransformToHost()
Transform from device vector to host vector.
-
template<>
intastrix::Array<T>::
GetCudaFlag
()¶
const Return whether data currently resides on host or device.
-
template unsigned int astrix::Array< T >::GetSize()
const Return size of array.
-
template unsigned int astrix::Array< T >::GetRealSize()
const Return realSize of array.
-
template unsigned int astrix::Array< T >::GetDimension()
const Return number of dimensions.
-
template void astrix::Array< T >::SetSize(unsigned int _size)
Set size of Array, either on host or device depending on cudaFlag.
-
template<>
voidastrix::Array<T>::
SetToValue
(T value, unsigned int startIndex, unsigned int endIndex)¶ Set Array entries from startIndex to endIndex to value.
-
template void astrix::Array< T >::SetToSeries()
Set a[0] = 0, a[1] = 1, etc.
-
template void astrix::Array< T >::SetToSeries(unsigned int startIndex, unsigned int endIndex)
Set a[i] = i for all i from startIndex to endIndex.
-
template void astrix::Array< T >::SetEqual(const Array * B)
Set all entries equal to those in Array *B.
-
template void astrix::Array< T >::SetEqual(const Array * B, unsigned int N, unsigned int M)
Set all entries of dimension N of Array equal to dimension M of Array B.
-
template void astrix::Array< T >::SetEqual(const Array * B, int startPosition)
Set all entries starting from startPosition equal to those of Array *B, i.e. a[startPosition] = b[0] etc.
-
template void astrix::Array< T >::Reindex(unsigned int * reindex)
Reindex array: a[i] = a[reindex[i]].
-
template void astrix::Array< T >::Reindex(unsigned int * reindex, unsigned int N)
Reindex array: a[i] = a[reindex[i]] for the first N elements.
-
template<>
voidastrix::Array<T>::
InverseReindex
(unsigned int *reindex, int maxValue, bool ignoreValue)¶ Inverse reindex array: a[i] = reindex[a[i]].
Set a[i] = reindex[a[i]]. If a[i] = -1, leave it at -1. If a[i] >= maxValue, subtract maxValue n times until a[i] < maxValue, and set a[i] = a[reindex[a[i]-n*maxValue]] + n*maxValue
-
template void astrix::Array< T >::Compact(int nKeep, Array < int > * keepFlag, Array < int > * keepFlagScan)
Compact; keep only entries where keepFlag == 1.
-
template void astrix::Array< T >::CopyToDevice()
Copy data from host to device.
-
template void astrix::Array< T >::CopyToHost()
Copy data from device to host.
-
template<>
voidastrix::Array<T>::
SetSingleValue
(T value, int position)¶ Set a[position] = value.
-
template<>
voidastrix::Array<T>::
SetSingleValue
(T value, int position, unsigned int N)¶ Set a[position] = value for dimension N.
-
template<>
voidastrix::Array<T>::
GetSingleValue
(T *value, int position)¶ Real a[position] into *value.
-
template<>
voidastrix::Array<T>::
GetSingleValue
(T *value, int position, unsigned int N)¶ Read a[position] for dimension N into *value.
-
template void astrix::Array< T >::AddValue(T value, unsigned int startIndex, unsigned int endIndex)
Add value to all entries from startIndex to endIndex.
-
template void astrix::Array< T >::Sort(Array < T > * arrayB)
Sort array, together with arrayB.
- template <class S>
-
template<>
voidastrix::Array<T>::
SortByKey
(Array<S> *indexArray)¶ Create index array for sorting.
- template <class S>
-
template<>
voidastrix::Array<T>::
SortByKey
(Array<S> *indexArray, unsigned int N)¶ Create index array for sorting dimension N.
-
template<>
Tastrix::Array<T>::
ExclusiveScan
(Array<T> *result)¶ Perform exclusive scan.
-
template<>
Tastrix::Array<T>::
ExclusiveScan
(Array<T> *result, unsigned int N)¶ Perform exclusive scan on dimension N.
-
template void astrix::Array< T >::Gather(Array < T > * in, Array < int > * map, int maxIndex)
Set out[i] = in[map[i]].
-
template void astrix::Array< T >::GatherIf(Array < T > * in, Array < int > * map, int value, int maxIndex)
If map[i] != value then out[i] = in[map[i]].
-
template void astrix::Array< T >::Scatter(Array < T > * in, Array < int > * map, int maxIndex)
Set out[map[i]] = in[i].
- template <class S>
-
template void astrix::Array< T >::ScatterSeries(Array < S > * map, unsigned int maxIndex)
Set out[map[i]] = i.
-
template void astrix::Array< T >::SetToRandom()
Set to random values using rand()
-
template void astrix::Array< T >::SetToDiff(Array < T > * A, Array < T > * B)
Set a[i] = a[i] - b[i].
-
template int astrix::Array< T >::Minimum()
Return minimum of array.
-
template double astrix::Array< T >::Minimum(int N)
Return minimum of dimension N of array.
-
template int astrix::Array< T >::Maximum()
Return maximum of array.
-
template double astrix::Array< T >::Maximum(int N)
Return maximum of dimension N of array.
-
template unsigned int astrix::Array< T >::Sum()
Return sum of elements.
-
template void astrix::Array< T >::Invert()
Swap values 0 and 1.
-
template void astrix::Array< T >::Concat(Array < T > * A)
Join with Array A.
-
template int astrix::Array< T >::RemoveEvery(int start, int step)
Remove every entry start+i*step, compact array.
- template <class S>
-
template<>
intastrix::Array<T>::
RemoveEvery
(int start, int step, Array<S> *A)¶ Remove every entry start+i*step, compact array and inverse reindex A.
-
template void astrix::Array< T >::ScatterUnique(Array < int > * A, Array < int > * B, int maxIndex, int ignoreValue, T value)
At a unique entry of A, i, (ignoring ignoreValue) set hostVec[B[i]] = value.
-
template void astrix::Array< T >::Shuffle()
Shuffle array (non-random!)
-
template<>
T *astrix::Array<T>::
GetHostPointer
()¶
const Return pointer to host memory.
-
template<>
T *astrix::Array<T>::
GetHostPointer
(unsigned int _dim)¶
const Return pointer to host memory for dimension _dim.
-
template<>
T *astrix::Array<T>::
GetDevicePointer
()¶
const Return pointer to device memory.
-
template<>
T *astrix::Array<T>::
GetDevicePointer
(unsigned int _dim)¶
const Return pointer to device memory for dimension _dim.
-
template<>
T *astrix::Array<T>::
GetPointer
()¶
const Return pointer to either host or device memory, depending on cudaFlag.
-
template<>
T *astrix::Array<T>::
GetPointer
(unsigned int _dim)¶
const Return pointer to either host or device memory for dimension _dim.
-