cctw  0.2.1
Functions
cctwchunkquick.h File Reference
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
Include dependency graph for cctwchunkquick.h:

Go to the source code of this file.

Functions

static void assignToChunk (CctwIntVector3D &outputChunkSize, int ix, int iy, int iz, double value, CctwChunkedData::MergeDataType *chunk)
 
static CctwChunkedData::MergeDataTypemakeChunk (CctwIntVector3D &outputChunkSize)
 

Function Documentation

static void assignToChunk ( CctwIntVector3D outputChunkSize,
int  ix,
int  iy,
int  iz,
double  value,
CctwChunkedData::MergeDataType chunk 
)
inlinestatic

Definition at line 17 of file cctwchunkquick.h.

References CctwVector3D< T >::y(), and CctwVector3D< T >::z().

Referenced by makeChunk().

20 {
21  int y = outputChunkSize.y();
22  int z = outputChunkSize.z();
23  int index = ix*y*z + iy*z + iz;
24 
25  // printf("assignToChunk: %p(%i,%i,%i)[%i] = %0.3f\n", chunk, ix, iy, iz, index, value);
26  chunk[index] = (CctwChunkedData::MergeDataType) value;
27 }
T z() const
Definition: cctwvector3d.h:19
T y() const
Definition: cctwvector3d.h:18
static CctwChunkedData::MergeDataType* makeChunk ( CctwIntVector3D outputChunkSize)
inlinestatic

Definition at line 30 of file cctwchunkquick.h.

References assignToChunk(), CctwVector3D< T >::x(), CctwVector3D< T >::y(), and CctwVector3D< T >::z().

31 {
32  int x = outputChunkSize.x();
33  int y = outputChunkSize.y();
34  int z = outputChunkSize.z();
35 
36  int length = x*y*z*sizeof(CctwChunkedData::MergeDataType);
37 
38  // printf("makeChunk: %i\n", length);
40  (CctwChunkedData::MergeDataType*) malloc(length);
41  assert(result != NULL);
42  for (int i = 0; i < x; i++)
43  for (int j = 0; j < y; j++)
44  for (int m = 0; m < z; m++)
45  assignToChunk(outputChunkSize, i, j, m, 0, result);
46 
47  // printf("makeChunk: done.\n");
48  return result;
49 }
static void assignToChunk(CctwIntVector3D &outputChunkSize, int ix, int iy, int iz, double value, CctwChunkedData::MergeDataType *chunk)
T x() const
Definition: cctwvector3d.h:17
T z() const
Definition: cctwvector3d.h:19
T y() const
Definition: cctwvector3d.h:18