[Yt-svn] commit/yt: MatthewTurk: Marching cubes appear to mostly be working, although visualizing them is
Bitbucket
commits-noreply at bitbucket.org
Mon May 16 14:36:59 PDT 2011
1 new changeset in yt:
http://bitbucket.org/yt_analysis/yt/changeset/b31b2146cca5/
changeset: r4258:b31b2146cca5
branch: yt
user: MatthewTurk
date: 2011-05-16 23:34:59
summary: Marching cubes appear to mostly be working, although visualizing them is
currently challenging. I have loaded them into partiview and they look
alright, but proper verification is still pending.
affected #: 3 files (630 bytes)
--- a/yt/utilities/_amr_utils/FixedInterpolator.c Mon May 16 16:28:35 2011 -0400
+++ b/yt/utilities/_amr_utils/FixedInterpolator.c Mon May 16 17:34:59 2011 -0400
@@ -82,17 +82,39 @@
gridval[7] = OINDEX(0,1,1);
}
-npy_float64 vertex_interp(npy_float64 v1, npy_float64 v2, npy_float64 isovalue,
- npy_float64 vl[3], npy_float64 dds[3],
- npy_float64 x, npy_float64 y, npy_float64 z)
+void vertex_interp(npy_float64 v1, npy_float64 v2, npy_float64 isovalue,
+ npy_float64 vl[3], npy_float64 dds[3],
+ npy_float64 x, npy_float64 y, npy_float64 z,
+ int x0, int y0, int z0, int direction)
{
/*if (fabs(isovalue - v1) < 0.000001) return 0.0;
if (fabs(isovalue - v2) < 0.000001) return 1.0;
if (fabs(v1 - v2) < 0.000001) return 0.0;*/
npy_float64 mu = (isovalue - v1) / (v2 - v1);
- vl[0] = x + mu * dds[0];
- vl[1] = y + mu * dds[1];
- vl[2] = z + mu * dds[2];
+ vl[0] = x; vl[1] = y; vl[2] = z;
+ if (x0 == 1) vl[0] += dds[0];
+ if (y0 == 1) vl[1] += dds[1];
+ if (z0 == 1) vl[2] += dds[2];
+ switch (direction) {
+ case -1:
+ vl[0] -= (1.0 - mu) * dds[0];
+ break;
+ case 1:
+ vl[0] += mu * dds[0];
+ break;
+ case -2:
+ vl[1] -= (1.0 - mu) * dds[1];
+ break;
+ case 2:
+ vl[1] += mu * dds[1];
+ break;
+ case -3:
+ vl[2] -= (1.0 - mu) * dds[2];
+ break;
+ case 3:
+ vl[2] += mu * dds[2];
+ break;
+ }
}
npy_float64 trilinear_interpolate(int ds[3], int ci[3], npy_float64 dp[3],
--- a/yt/utilities/_amr_utils/FixedInterpolator.h Mon May 16 16:28:35 2011 -0400
+++ b/yt/utilities/_amr_utils/FixedInterpolator.h Mon May 16 17:34:59 2011 -0400
@@ -44,6 +44,7 @@
npy_float64 eval_gradient(int ds[3], int ci[3], npy_float64 dp[3],
npy_float64 *data, npy_float64 *grad);
-npy_float64 vertex_interp(npy_float64 v1, npy_float64 v2, npy_float64 isovalue,
- npy_float64 vl[3], npy_float64 dds[3],
- npy_float64 x, npy_float64 y, npy_float64 z);
+void vertex_interp(npy_float64 v1, npy_float64 v2, npy_float64 isovalue,
+ npy_float64 vl[3], npy_float64 dds[3],
+ npy_float64 x, npy_float64 y, npy_float64 z,
+ int x0, int y0, int z0, int direction);
--- a/yt/utilities/_amr_utils/VolumeIntegrator.pyx Mon May 16 16:28:35 2011 -0400
+++ b/yt/utilities/_amr_utils/VolumeIntegrator.pyx Mon May 16 17:34:59 2011 -0400
@@ -116,9 +116,10 @@
np.float64_t eval_gradient(int *ds, int *ci, np.float64_t *dp,
np.float64_t *data, np.float64_t *grad)
void offset_fill(int *ds, np.float64_t *data, np.float64_t *gridval)
- np.float64_t vertex_interp(np.float64_t v1, np.float64_t v2, np.float64_t isovalue,
- np.float64_t vl[3], np.float64_t dds[3],
- np.float64_t x, np.float64_t y, np.float64_t z)
+ void vertex_interp(np.float64_t v1, np.float64_t v2, np.float64_t isovalue,
+ np.float64_t vl[3], np.float64_t dds[3],
+ np.float64_t x, np.float64_t y, np.float64_t z,
+ int x0, int y0, int z0, int direction)
#cdef extern int *edge_table
#cdef extern int **tri_table
@@ -1172,41 +1173,41 @@
#print cubeindex
if edge_table[cubeindex] == 0: continue
if (edge_table[cubeindex] & 1): # 0,0,0 with 1,0,0
- mu = vertex_interp(gv[0], gv[1], isovalue, vertlist[0],
- self.dds, x, y, z)
+ vertex_interp(gv[0], gv[1], isovalue, vertlist[0],
+ self.dds, x, y, z, 0,0,0,1)
if (edge_table[cubeindex] & 2): # 1,0,0 with 1,1,0
- mu = vertex_interp(gv[1], gv[2], isovalue, vertlist[1],
- self.dds, x, y, z)
+ vertex_interp(gv[1], gv[2], isovalue, vertlist[1],
+ self.dds, x, y, z, 1,0,0,2)
if (edge_table[cubeindex] & 4): # 1,1,0 with 0,1,0
- mu = vertex_interp(gv[2], gv[3], isovalue, vertlist[2],
- self.dds, x, y, z)
+ vertex_interp(gv[2], gv[3], isovalue, vertlist[2],
+ self.dds, x, y, z, 1,0,0,-1)
if (edge_table[cubeindex] & 8): # 0,1,0 with 0,0,0
- mu = vertex_interp(gv[3], gv[0], isovalue, vertlist[3],
- self.dds, x, y, z)
+ vertex_interp(gv[3], gv[0], isovalue, vertlist[3],
+ self.dds, x, y, z, 0,1,0,-2)
if (edge_table[cubeindex] & 16): # 0,0,1 with 1,0,1
- mu = vertex_interp(gv[4], gv[5], isovalue, vertlist[4],
- self.dds, x, y, z)
+ vertex_interp(gv[4], gv[5], isovalue, vertlist[4],
+ self.dds, x, y, z, 0,0,1,1)
if (edge_table[cubeindex] & 32): # 1,0,1 with 1,1,1
- mu = vertex_interp(gv[5], gv[6], isovalue, vertlist[5],
- self.dds, x, y, z)
+ vertex_interp(gv[5], gv[6], isovalue, vertlist[5],
+ self.dds, x, y, z, 1,0,1,2)
if (edge_table[cubeindex] & 64): # 1,1,1 with 0,1,1
- mu = vertex_interp(gv[6], gv[7], isovalue, vertlist[6],
- self.dds, x, y, z)
+ vertex_interp(gv[6], gv[7], isovalue, vertlist[6],
+ self.dds, x, y, z, 1,1,1,-1)
if (edge_table[cubeindex] & 128): # 0,1,1 with 0,0,1
- mu = vertex_interp(gv[7], gv[4], isovalue, vertlist[7],
- self.dds, x, y, z)
+ vertex_interp(gv[7], gv[4], isovalue, vertlist[7],
+ self.dds, x, y, z, 0,1,1,-2)
if (edge_table[cubeindex] & 256): # 0,0,0 with 0,0,1
- mu = vertex_interp(gv[0], gv[4], isovalue, vertlist[8],
- self.dds, x, y, z)
+ vertex_interp(gv[0], gv[4], isovalue, vertlist[8],
+ self.dds, x, y, z, 0,0,0,3)
if (edge_table[cubeindex] & 512): # 1,0,0 with 1,0,1
- mu = vertex_interp(gv[1], gv[5], isovalue, vertlist[9],
- self.dds, x, y, z)
+ vertex_interp(gv[1], gv[5], isovalue, vertlist[9],
+ self.dds, x, y, z, 1,0,0,3)
if (edge_table[cubeindex] & 1024): # 1,1,0 with 1,1,1
- mu = vertex_interp(gv[2], gv[6], isovalue, vertlist[10],
- self.dds, x, y, z)
+ vertex_interp(gv[2], gv[6], isovalue, vertlist[10],
+ self.dds, x, y, z, 1,1,0,3)
if (edge_table[cubeindex] & 2048): # 0,1,0 with 0,1,1
- mu = vertex_interp(gv[3], gv[7], isovalue, vertlist[11],
- self.dds, x, y, z)
+ vertex_interp(gv[3], gv[7], isovalue, vertlist[11],
+ self.dds, x, y, z, 0,1,0,3)
n = 0
while 1:
current = AddTriangle(current,
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list