cctw
0.2.1
Main Page
Namespaces
Classes
Files
File List
File Members
cctw-code
cctwlib
cctwchunkquick.h
Go to the documentation of this file.
1
2
/*
3
* cctwchunkquick.h
4
*
5
* Created on: May 12, 2014
6
* Author: wozniak
7
*/
8
9
#ifndef CCTWCHUNKQUICK_H
10
#define CCTWCHUNKQUICK_H
11
12
#include <assert.h>
13
#include <stdlib.h>
14
#include <stdio.h>
15
16
static
inline
void
17
assignToChunk
(
CctwIntVector3D
&outputChunkSize,
18
int
ix,
int
iy,
int
iz,
double
value,
19
CctwChunkedData::MergeDataType
* chunk)
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
}
28
29
static
inline
CctwChunkedData::MergeDataType
*
30
makeChunk
(
CctwIntVector3D
&outputChunkSize)
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);
39
CctwChunkedData::MergeDataType
*result =
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
}
50
51
#endif
makeChunk
static CctwChunkedData::MergeDataType * makeChunk(CctwIntVector3D &outputChunkSize)
Definition:
cctwchunkquick.h:30
assignToChunk
static void assignToChunk(CctwIntVector3D &outputChunkSize, int ix, int iy, int iz, double value, CctwChunkedData::MergeDataType *chunk)
Definition:
cctwchunkquick.h:17
CctwVector3D::x
T x() const
Definition:
cctwvector3d.h:17
CctwVector3D
Definition:
cctwvector3d.h:9
CctwChunkedData::MergeDataType
float MergeDataType
Definition:
cctwchunkeddata.h:32
CctwVector3D::z
T z() const
Definition:
cctwvector3d.h:19
CctwVector3D::y
T y() const
Definition:
cctwvector3d.h:18
Generated on Thu Mar 17 2016 15:17:35 for cctw by
1.8.10