Example #1
0
def calc_surface_area():
    global area_sum
    global actualarea
    global voxelarea

    d = 0
    area_sum = 0.0
    for i in range(nx):
        for j in range(ny):
            for k in range(nz):
                if side_exposed[i, j, k] != 0:
                    for m in range(2, 26):
                        if voxel_db[d, m].mat != 0:
                            area_sum = area_sum + dict_surf_area.func(
                                voxel_db[d, m].pos, voxel_db, d, nx, ny, dx,
                                voxel_db[d, m].mat)
                d = d + 1

    voxelarea = float(0)
    for i in range(nx):
        for j in range(ny):
            for k in range(nz):
                if voxel[i, j, k] == 1:
                    voxelarea = side_exposed[i, j, k] + voxelarea
    actualarea = float(4 * math.pi * (((a * b)**1.6 + (a * c)**1.6 +
                                       (b * c)**1.6) / 3.0)**(1 / 1.6))
    voxelarea = voxelarea * dx * dx
Example #2
0
if (visualization == 1):
    v.visualize(voxel_db, side_exposed, nx, ny, nz, cx, cy, cz)

# Calculate the surface area
if (surfaceareacalc == 1):

    d = 0
    areasum1 = 0.0
    for k in range(nz):
        for j in range(ny):
            for i in range(nx):
                if (side_exposed[i, j, k] != 0):
                    for m in range(2, 26):
                        if (voxel_db[d, m].mat != 0):
                            areasum1 = areasum1 + dicsurfarea.func(
                                voxel_db[d, m].pos, voxel_db, d, nx, ny, nz,
                                dx, voxel_db[d, m].mat)
                d = d + 1
    print("Tetra Area = ", areasum1)

    voxelarea = 0
    for k in range(nz):
        for j in range(ny):
            for i in range(nx):
                if (voxel[i, j, k] == 1):
                    voxelarea = side_exposed[i, j, k] + voxelarea
    actualarea = 4 * mt.pi * (((a * b)**1.6 + (a * c)**1.6 +
                               (b * c)**1.6) / 3.0)**(1 / 1.6)
    print("Actual Area = ", actualarea)
    voxelarea = voxelarea * dx * dx
    print("voxel area = ", voxelarea)