tAdded missing wmode write in single precision - sphere - GPU-based 3D discrete… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 49277e1ca814ee2535c3e7eb96ddc972b010dd57 | |
parent 6810a726d594e10b7fed5301c841e07303c0241d | |
Author: Anders Damsgaard <[email protected]> | |
Date: Thu, 6 Sep 2012 13:09:45 +0200 | |
Added missing wmode write in single precision | |
Diffstat: | |
M python/sphere.py | 9 +++++++-- | |
M src/file_io.cpp | 5 +++++ | |
2 files changed, 12 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/python/sphere.py b/python/sphere.py | |
t@@ -781,7 +781,7 @@ class Spherebin: | |
def porosity(self, lower_corner, | |
upper_corner, | |
grid = numpy.array([10,10,10], int), | |
- precisionfactor = 10): | |
+ precisionfactor = 10, verbose = False): | |
""" Calculate the porosity inside each grid cell. | |
Specify the lower and upper corners of the volume to evaluate. | |
A good starting point for the grid vector is self.num. | |
t@@ -811,6 +811,9 @@ class Spherebin: | |
# Volume of fine grid vells | |
Vc_fine = csl_fine[0] * csl_fine[1] * csl_fine[2] | |
+ if (verbose == True): | |
+ print("Iterating over fine grid cells") | |
+ | |
# Iterate over fine grid cells | |
for ix in range(grid[0]*precisionfactor): | |
for iy in range(grid[1]*precisionfactor): | |
t@@ -835,6 +838,9 @@ class Spherebin: | |
fine_grid[ix,iy,iz] = False | |
+ if (verbose == True): | |
+ print("Interpolating fine grid to normal grid") | |
+ | |
# Interpolate fine grid to coarse grid by looping | |
# over the fine grid, and subtracting the fine cell volume | |
# if it is marked as inside a particle | |
t@@ -850,7 +856,6 @@ class Spherebin: | |
return porosity_grid | |
- | |
def render(binary, | |
out = '~/img_out/rt-out', | |
graphicsformat = 'jpg', | |
diff --git a/src/file_io.cpp b/src/file_io.cpp | |
t@@ -277,6 +277,11 @@ int fwritebin(char *target, | |
// Walls | |
fwrite(¶ms->nw, sizeof(params->nw), 1, fp); // No. of walls | |
for (j=0; j<params->nw; ++j) { | |
+ | |
+ // Wall mode | |
+ d = (double)params->wmode[j]; | |
+ fwrite(&d, sizeof(d), 1, fp); | |
+ | |
// Wall normal | |
d = (double)host_w_nx[j].x; | |
fwrite(&d, sizeof(d), 1, fp); |