From 6332d1e725f80cb9bfa749e513340b10b5151917 Mon Sep 17 00:00:00 2001 From: Jiaming Guo Date: Thu, 17 Aug 2017 15:26:58 -0500 Subject: [PATCH] fixed warnings --- flow.h | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------ main.cu | 43 +++++++++++++++++++++---------------------- 2 files changed, 81 insertions(+), 82 deletions(-) diff --git a/flow.h b/flow.h index dc7890a..1074d0a 100644 --- a/flow.h +++ b/flow.h @@ -67,7 +67,7 @@ namespace stim { #ifdef __CUDACC__ // for sphere template - __global__ void inside_sphere(const stim::sphere *V, unsigned num, size_t *R, T *S, unsigned char *ptr, int x, int y, int z) { + __global__ void inside_sphere(const stim::sphere *V, size_t num, size_t *R, T *S, unsigned char *ptr, int x, int y, int z) { unsigned ix = blockDim.x * blockIdx.x + threadIdx.x; unsigned iy = blockDim.y * blockIdx.y + threadIdx.y; @@ -97,7 +97,7 @@ namespace stim { // for cone template - __global__ void inside_cone(const stim::cone *E, unsigned num, size_t *R, T *S, unsigned char *ptr, int x, int y, int z) { + __global__ void inside_cone(const stim::cone *E, size_t num, size_t *R, T *S, unsigned char *ptr, int x, int y, int z) { unsigned ix = blockDim.x * blockIdx.x + threadIdx.x; unsigned iy = blockDim.y * blockIdx.y + threadIdx.y; @@ -133,7 +133,7 @@ namespace stim { // for source bus template - __global__ void inside_cuboid(const stim::cuboid *B, unsigned num, size_t *R, T *S, unsigned char *ptr, int x, int y, int z) { + __global__ void inside_cuboid(const stim::cuboid *B, size_t num, size_t *R, T *S, unsigned char *ptr, int x, int y, int z) { unsigned ix = blockDim.x * blockIdx.x + threadIdx.x; unsigned iy = blockDim.y * blockIdx.y + threadIdx.y; @@ -343,7 +343,7 @@ namespace stim { } else if (E[j].v[1] == i) { tmp_e = j; - tmp_v = E[j].size() - 1; + tmp_v = (unsigned)(E[j].size() - 1); } } @@ -418,8 +418,8 @@ namespace stim { unsigned start_vertex = 0; unsigned end_vertex = 0; for (unsigned i = 0; i < num_edge; i++) { - start_vertex = get_start_vertex(i); // get the start vertex index of current edge - end_vertex = get_end_vertex(i); // get the end vertex index of current edge + start_vertex = (unsigned)get_start_vertex(i); // get the start vertex index of current edge + end_vertex = (unsigned)get_end_vertex(i); // get the end vertex index of current edge C[start_vertex][end_vertex] = -((T)stim::PI * std::pow(get_average_r(i), 4)) / (8 * u * get_l(i)); @@ -468,8 +468,8 @@ namespace stim { T end_pressure = 0.0; T deltaP = 0.0; for (unsigned i = 0; i < num_edge; i++) { - start_vertex = get_start_vertex(i); - end_vertex = get_end_vertex(i); + start_vertex = (unsigned)get_start_vertex(i); + end_vertex = (unsigned)get_end_vertex(i); start_pressure = pressure[start_vertex]; // get the start vertex pressure of current edge end_pressure = pressure[end_vertex]; // get the end vertex pressure of current edge deltaP = start_pressure - end_pressure; // deltaP = Pa - Pb @@ -485,8 +485,8 @@ namespace stim { // get the brewer color map based on velocity void get_color_map(T& max_v, T& min_v, std::vector& color, std::vector pendant_vertex) { - unsigned num_edge = Q.size(); - unsigned num_vertex = QQ.size(); + size_t num_edge = Q.size(); + size_t num_vertex = QQ.size(); // find the absolute maximum velocity and minimum velocity std::vector abs_V(num_edge); @@ -534,7 +534,7 @@ namespace stim { while (!flag) { // convert from cartesian length to hilbert length // l -> l * (4 ^ order - 1)/(2 ^ order - 1) - tmp = l * (std::pow(4, o) - 1) / (std::pow(2, o) - 1); + tmp = (T)(l * (std::pow(4, o) - 1) / (std::pow(2, o) - 1)); if (tmp >= d) flag = true; else @@ -813,7 +813,7 @@ namespace stim { glPushMatrix(); glTranslatef(E[i][E[i].size() - 1][0], E[i][E[i].size() - 1][1], E[i][E[i].size() - 1][2]); - glutSolidSphere(get_r(i, E[i].size() - 1) * scale, subdivision, subdivision); + glutSolidSphere(get_r(i, (unsigned)(E[i].size() - 1)) * scale, subdivision, subdivision); glPopMatrix(); } else { @@ -823,7 +823,7 @@ namespace stim { glColor4f(0.7f, 0.7f, 0.7f, 0.7f); // gray color glPushMatrix(); glTranslatef(E[i][E[i].size() - 1][0], E[i][E[i].size() - 1][1], E[i][E[i].size() - 1][2]); - glutSolidSphere(get_r(i, E[i].size() - 1) * scale, subdivision, subdivision); + glutSolidSphere(get_r(i, (unsigned)(E[i].size() - 1)) * scale, subdivision, subdivision); glPopMatrix(); glDisable(GL_BLEND); glEnable(GL_DEPTH_TEST); @@ -929,16 +929,16 @@ namespace stim { std::vector > cp; T radius; - glColor3f(0.0f, 0.0f, 0.0f); // lime color + glColor3f(0.0f, 0.0f, 0.0f); // lime color - unsigned index = E[i].size() / 2 - 1; + size_t index = E[i].size() / 2 - 1; tmp_d = E[i][index + 1] - E[i][index]; - h = tmp_d.len() / 1.5f; // get the height base by factor 3 + h = tmp_d.len() / 3.0f; // get the height base by factor 3 tmp_d = tmp_d.norm(); center = (E[i][index + 1] + E[i][index]) / 2; tmp_c.rotate(tmp_d); - radius = (E[i].r(index + 1) + E[i].r(index)) / 2 * scale; - radius = (h / sqrt(3) < radius) ? h / sqrt(3) : radius; // update radius + radius = (E[i].r((unsigned)(index + 1)) + E[i].r((unsigned)index)) / 2 * scale; + radius = (T)((h / sqrt(3) < radius) ? h / sqrt(3) : radius); // update radius if (v[i] > threshold) head = center + tmp_d * h; else if (v[i] < -threshold) @@ -1247,7 +1247,7 @@ namespace stim { glPushMatrix(); glLoadIdentity(); - glRasterPos2f(X / 2, 5); // hard coded position!!!!! + glRasterPos2f((GLfloat)(X / 2), (GLfloat)5.0f); // hard coded position!!!!! std::stringstream ss_p; ss_p << "Q = "; // Q = * um^3/s ss_p << in; @@ -1404,7 +1404,7 @@ namespace stim { } // draw the bridge as tubes - void tube_bridge(bool &redisplay, T subdivision, T scale = 1.0f, T radius = 5.0f) { + void tube_bridge(bool &redisplay, GLint subdivision, T scale = 1.0f, T radius = 5.0f) { if (redisplay) { glDeleteLists(dlist + 1, 1); @@ -1735,7 +1735,7 @@ namespace stim { // find both input and output vertex stim::triple tmp; - unsigned N = pendant_vertex.size(); // get the number of dangle vertex + size_t N = pendant_vertex.size(); // get the number of dangle vertex unsigned idx = 0; for (unsigned i = 0; i < N; i++) { // for every boundary vertex idx = pendant_vertex[i]; @@ -1835,10 +1835,10 @@ namespace stim { // find the number of U-shape or square-shape structure for extending length of connection // @param t: width = t * radius - int find_number_square(T origin_l, T desire_l, T radius = 5.0f, int times = 10) { + int find_number_square(T origin_l, T desire_l, int times = 10, T radius = 5.0f) { bool done = false; // flag indicates the current number of square shape structure is feasible - int n = origin_l / (times * 4 * radius); // number of square shape structure + int n = (int)(origin_l / (times * 4 * radius)); // number of square shape structure T need_l = desire_l - origin_l; T height; // height of the square shapce structure @@ -1902,16 +1902,16 @@ namespace stim { // check whether it needs 3D square-wave-like connections if (height > threshold) { // enbale 3D connections - height = (desire_l - (1 + 2 * n) * origin_l) / std::pow(2 * n, 2); // compute new height in 3D structure + height = (T)((desire_l - (1 + 2 * n) * origin_l) / std::pow(2 * n, 2)); // compute new height in 3D structure while (height > threshold) { // increase order to decrease height n++; width = (T)(origin_l) / (2 * n); - height = (desire_l - (1 + 2 * n) * origin_l) / std::pow(2 * n, 2); + height = (T)((desire_l - (1 + 2 * n) * origin_l) / std::pow(2 * n, 2)); // check whether it appears overlap, if it appears we choose last time height even if it is larger than threshold if (width < times * radius) { n--; width = (T)(origin_l) / (2 * n); - height = (desire_l - (1 + 2 * n) * origin_l) / std::pow(2 * n, 2); + height = (T)((desire_l - (1 + 2 * n) * origin_l) / std::pow(2 * n, 2)); break; } } @@ -1920,14 +1920,14 @@ namespace stim { while (height < times * radius) { n--; width = (T)(origin_l) / (2 * n); - height = (desire_l - (1 + 2 * n) * origin_l) / std::pow(2 * n, 2); + height = (T)((desire_l - (1 + 2 * n) * origin_l) / std::pow(2 * n, 2)); } // degenerated case, compromise if (n == 0) { n = 1; width = (T)(origin_l) / (2 * n); - height = (desire_l - (1 + 2 * n) * origin_l) / std::pow(2 * n, 2); + height = (T)((desire_l - (1 + 2 * n) * origin_l) / std::pow(2 * n, 2)); } // cube-like structure construction @@ -2028,7 +2028,7 @@ namespace stim { if (height < times * radius) { // if height is too small, decrease n and re-calculate height and width height = times * radius; T need_l = desire_l - origin_l; - n = need_l / (2 * height); + n = (int)(need_l / (2 * height)); if (n == 0) // degenerated case n = 1; height = need_l / (2 * n); @@ -2081,7 +2081,7 @@ namespace stim { } // automatically modify bridge to make it feasible - void modify_synthetic_connection(T viscosity, T rou, bool H, T threshold, T &in, T &out, T ratio = 0.0f, T radius = 5.0f) { + void modify_synthetic_connection(T viscosity, T rou, bool H, T threshold, T &in, T &out, int times = 10, T ratio = 0.0f, T radius = 5.0f) { glDeleteLists(dlist, 1); // delete display list for modify glDeleteLists(dlist + 1, 1); @@ -2167,8 +2167,8 @@ namespace stim { inlet[i].V.push_back(bus_v); } else { - T fragment = (desire_l - origin_l) / ((std::pow(4, order) - 1) / (std::pow(2, order) - 1) - 1); // the length of the opening of cup - T dl = fragment / (std::pow(2, order) - 1); // unit cup length + T fragment = (T)((desire_l - origin_l) / ((std::pow(4, order) - 1) / (std::pow(2, order) - 1) - 1)); // the length of the opening of cup + T dl = (T)(fragment / (std::pow(2, order) - 1)); // unit cup length if (dl > 2 * radius) { // if the radius is feasible if (upper) @@ -2183,7 +2183,7 @@ namespace stim { else { // if the radius is not feasible int count = 1; while (dl <= 2 * radius) { - dl = origin_l / (std::pow(2, order - count) - 1); + dl = (T)(origin_l / (std::pow(2, order - count) - 1)); count++; } count--; @@ -2193,14 +2193,14 @@ namespace stim { else hilbert_curve(i, &tmp_v[0], order - count, dl, 1, invert, UP); - desire_l -= origin_l * ((std::pow(4, order - count) - 1) / (std::pow(2, order - count) - 1)); + desire_l -= (T)(origin_l * ((std::pow(4, order - count) - 1) / (std::pow(2, order - count) - 1))); origin_l = (bus_v - mid_v).len(); desire_l += origin_l; find_hilbert_order(origin_l, desire_l, order); - fragment = (desire_l - origin_l) / ((std::pow(4, order) - 1) / (std::pow(2, order) - 1) - 1); - dl = fragment / (std::pow(2, order) - 1); + fragment = (T)((desire_l - origin_l) / ((std::pow(4, order) - 1) / (std::pow(2, order) - 1) - 1)); + dl = (T)(fragment / (std::pow(2, order) - 1)); if (dl < 2 * radius) std::cout << "infeasible connection between inlets!" << std::endl; @@ -2251,8 +2251,8 @@ namespace stim { outlet[i].V.push_back(bus_v); } else { - T fragment = (desire_l - origin_l) / ((std::pow(4, order) - 1) / (std::pow(2, order) - 1) - 1); // the length of the opening of cup - T dl = fragment / (std::pow(2, order) - 1); // unit cup length + T fragment = (T)((desire_l - origin_l) / ((std::pow(4, order) - 1) / (std::pow(2, order) - 1) - 1)); // the length of the opening of cup + T dl = (T)(fragment / (std::pow(2, order) - 1)); // unit cup length if (dl > 2 * radius) { // if the radius is feasible if (upper) @@ -2267,7 +2267,7 @@ namespace stim { else { // if the radius is not feasible int count = 1; while (dl <= 2 * radius) { - dl = origin_l / (std::pow(2, order - count) - 1); + dl = (T)(origin_l / (std::pow(2, order - count) - 1)); count++; } count--; @@ -2277,14 +2277,14 @@ namespace stim { else hilbert_curve(i, &tmp_v[0], order - count, dl, 0, invert, UP); - desire_l -= origin_l * ((std::pow(4, order - count) - 1) / (std::pow(2, order - count) - 1)); + desire_l -= (T)(origin_l * ((std::pow(4, order - count) - 1) / (std::pow(2, order - count) - 1))); origin_l = (bus_v - mid_v).len(); desire_l += origin_l; find_hilbert_order(origin_l, desire_l, order); - fragment = (desire_l - origin_l) / ((std::pow(4, order) - 1) / (std::pow(2, order) - 1) - 1); - dl = fragment / (std::pow(2, order) - 1); + fragment = (T)((desire_l - origin_l) / ((std::pow(4, order) - 1) / (std::pow(2, order) - 1) - 1)); + dl = (T)(fragment / (std::pow(2, order) - 1)); if (dl < 2 * radius) std::cout << "infeasible connection between outlets!" << std::endl; @@ -2347,7 +2347,7 @@ namespace stim { } inlet[i].l = new_l; - n = find_number_square(origin_l, desire_l); + n = find_number_square(origin_l, desire_l, times); width = (T)origin_l / (2 * n); height = (desire_l - origin_l) / (2 * n); @@ -2396,7 +2396,7 @@ namespace stim { } outlet[i].l = new_l; - n = find_number_square(origin_l, desire_l); + n = find_number_square(origin_l, desire_l, times); width = (T)origin_l / (2 * n); height = (desire_l - origin_l) / (2 * n); @@ -2427,7 +2427,7 @@ namespace stim { // phase 1 check -> direct connection intersection void check_direct_connection() { - unsigned num; + size_t num; // check inlet num = inlet.size(); // get the number of inlets inlet_feasibility.resize(num, true); // initialization @@ -2596,7 +2596,7 @@ namespace stim { } } if (index != UINT_MAX) { - P[inlet[index].v[0]] = Ps - ((T)8 * viscosity * inlet[index].l * inlet[index].Q / (stim::PI * std::pow(radius, 4))); + P[inlet[index].v[0]] = (T)(Ps - (8 * viscosity * inlet[index].l * inlet[index].Q / (stim::PI * std::pow(radius, 4)))); } } @@ -2609,7 +2609,7 @@ namespace stim { } } if (index != UINT_MAX) { - P[outlet[index].v[0]] = Pe + ((T)8 * viscosity * outlet[index].l * outlet[index].Q / (stim::PI * std::pow(radius, 4))); + P[outlet[index].v[0]] = (T)(Pe + (8 * viscosity * outlet[index].l * outlet[index].Q / (stim::PI * std::pow(radius, 4)))); } } @@ -2742,17 +2742,17 @@ namespace stim { if (!prototype) { /// make - size_x = X / dx + 1; // set the size of image - size_y = Y / dy + 1; - size_z = Z / dz + 1; + size_x = (int)(X / dx + 1); // set the size of image + size_y = (int)(Y / dy + 1); + size_z = (int)(Z / dz + 1); /// initialize image stack object I.init(1, size_x, size_y, size_z); I.set_dim(dx, dy, dz); } else { - size_x = I.nx(); - size_y = I.ny(); - size_z = I.nz(); + size_x = (int)I.nx(); + size_y = (int)I.ny(); + size_z = (int)I.nz(); } // because of lack of memory, we have to computer one slice of stack per time @@ -2791,7 +2791,7 @@ namespace stim { // for every slice of image unsigned p = 0; // percentage of progress - for (unsigned i = 0; i < size_z; i++) { + for (int i = 0; i < size_z; i++) { int x = 0 - (int)Xl; // translate whole network(including inlet/outlet) to origin int y = 0 - (int)Yb; @@ -2807,10 +2807,10 @@ namespace stim { cudaDeviceProp prop; cudaGetDeviceProperties(&prop, 0); // get cuda device properties structure - size_t max_thread = sqrt(prop.maxThreadsPerBlock); // get the maximum number of thread per block + size_t max_thread = (size_t)sqrt(prop.maxThreadsPerBlock); // get the maximum number of thread per block - dim3 block(size_x / max_thread + 1, size_y / max_thread + 1); - dim3 thread(max_thread, max_thread); + dim3 block((unsigned)(size_x / max_thread + 1), (unsigned)(size_y / max_thread + 1)); + dim3 thread((unsigned)max_thread, (unsigned)max_thread); inside_sphere << > > (d_V, A.size(), d_R, d_S, d_ptr, x, y, z); cudaDeviceSynchronize(); inside_cone << > > (d_E, B.size(), d_R, d_S, d_ptr, x, y, z); @@ -2825,7 +2825,7 @@ namespace stim { HANDLE_ERROR(cudaFree(d_ptr)); // print progress bar - p = (float)(i + 1) / (float)size_z * 100; + p = (unsigned int)((i + 1) / size_z * 100); rtsProgressBar(p); } @@ -2873,8 +2873,8 @@ namespace stim { // convert from double pointer to single pointer, make it flat T* Aflat = (T*)malloc(order * order * sizeof(T)); - for (unsigned i = 0; i < order; i++) - for (unsigned j = 0; j < order; j++) + for (int i = 0; i < order; i++) + for (int j = 0; j < order; j++) Aflat[i * order + j] = A[i][j]; // create device pointer diff --git a/main.cu b/main.cu index 795c331..79722c0 100644 --- a/main.cu +++ b/main.cu @@ -90,8 +90,7 @@ bool mark_index = true; // flag indicates marking the index near the vertex bool glyph_mode = false; // flag indicates rendering glyph for flow velocity field bool frame_mode = false; // flag indicates rendering filament framing structrues unsigned pressure_index; // the index of vertex that is clicked -unsigned direction_index = -1; // the index of edge that is pointed at -unsigned index_index = -1; // the index of the vertex +unsigned direction_index = UINT_MAX;// the index of edge that is pointed at // build inlet/outlet parameters bool build_inlet_outlet = false; // flag indicates building inlets and outlets @@ -103,7 +102,7 @@ bool render_new_connection = false; // flag indicates rendering new line connect bool redisplay = false; // flag indicates redisplay rendering bool connection_done = false; // flag indicates finishing connections bool render_flow_rate = false; // flag indicates rendering total volume flow rate -unsigned connection_index = -1; // the index of connection that is picked +unsigned connection_index = UINT_MAX;// the index of connection that is picked unsigned port_index = 0; // inlet (0) or outlet (1) stim::vec3 tmp_v1, tmp_v2; // temp vertex int coef; // computational coefficient factor @@ -151,9 +150,9 @@ inline void window_to_world(GLdouble &x, GLdouble &y, GLdouble &z) { // convert current image stack into a binary mask #ifdef __CUDACC__ template -__global__ void binary_transform(unsigned N, T* ptr, F threshold) { +__global__ void binary_transform(size_t N, T* ptr, F threshold) { - unsigned ix = blockDim.x * blockIdx.x + threadIdx.x; + size_t ix = blockDim.x * blockIdx.x + threadIdx.x; if (ix >= N) return; // avoid seg-fault if (ptr[ix] >= threshold) // binary transformation @@ -589,7 +588,7 @@ void glut_passive_motion(int x, int y) { if (mods == GLUT_ACTIVE_SHIFT && picked_connection) { render_new_connection = true; - unsigned i; + size_t i; if (!port_index) { tmp_v1 = stim::vec3(flow.inlet[connection_index].V[1][0], flow.inlet[connection_index].V[1][1] + (float)(picked_y - y), flow.inlet[connection_index].V[1][2]); tmp_v2 = stim::vec3(flow.inlet[connection_index].V[2][0], flow.inlet[connection_index].V[2][1] + (float)(picked_y - y), flow.inlet[connection_index].V[2][2]); @@ -691,7 +690,7 @@ void glut_mouse(int button, int state, int x, int y) { change_fragment = false; render_flow_rate = true; - flow.modify_synthetic_connection(u, rou, hilbert_curve, height_threshold, in, out, fragment_ratio, default_radius); + flow.modify_synthetic_connection(u, rou, hilbert_curve, height_threshold, in, out, 2, fragment_ratio, default_radius); } // move connections along y-axis else if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN && mods == GLUT_ACTIVE_SHIFT && !modified_bridge && !picked_connection) { @@ -720,7 +719,7 @@ void glut_mouse(int button, int state, int x, int y) { else if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN && mods == GLUT_ACTIVE_SHIFT && !modified_bridge && render_new_connection) { float l = 0.0f; std::vector > V; - unsigned i; + size_t i; if (!port_index) { i = flow.inlet[connection_index].V.size(); if (tmp_v2[1] != flow.inlet[connection_index].V[i - 1][1]) { @@ -834,7 +833,7 @@ void glut_wheel(int wheel, int direction, int x, int y) { GLdouble posX, posY, posZ; window_to_world(posX, posY, posZ); // get the world coordinates - if (!to_select_pressure && (simulation || build_inlet_outlet) && !manufacture) { + if (!to_select_pressure && (simulation || build_inlet_outlet)) { // check current pixel position only in simualtion and build_inlet_outlet modes bool flag = flow.epsilon_vertex((float)posX, (float)posY, (float)posZ, eps, scale, pressure_index); if (flag && simulation && !glyph_mode) { float tmp_r; @@ -958,7 +957,7 @@ void glut_keyboard(unsigned char key, int x, int y) { modified_bridge = true; if (hilbert_curve) - flow.modify_synthetic_connection(u, rou, hilbert_curve, height_threshold, in, out, fragment_ratio); + flow.modify_synthetic_connection(u, rou, hilbert_curve, height_threshold, in, out, 2, fragment_ratio); else change_fragment = true; } @@ -1027,7 +1026,7 @@ int main(int argc, char* argv[]) { args.add("maxpress", "maximum allowed pressure in g / units / s^2, default 2 is for blood when units = um", "2", "real value > 0"); args.add("viscosity", "set the viscosity of the fluid (in g / units / s), default .00001 is for blood when units = um", ".00001", "real value > 0"); args.add("rou", "set the desity of the fluid (in g / units^3), default 1.06*10^-12 is for blood when units = um", ".00000000000106", "real value > 0"); - args.add("hilbert", "activate hilbert curves connections", "0", "value 1 for enablement"); + args.add("hilbert", "activate hilbert curves connections"); args.add("stack", "load the image stack"); args.add("stackres", "spacing between pixel samples in each dimension(in units/pixel)", "1 1 1", "real value > 0"); args.add("stackdir", "set the directory of the output image stack", "", "any existing directory (ex. /home/name/network)"); @@ -1068,17 +1067,17 @@ int main(int argc, char* argv[]) { // blood pressure in capillaries range from 15 - 35 torr // 1 torr = 133.3 Pa - max_pressure = args["maxpress"].as_float(); + max_pressure = (float)args["maxpress"].as_float(); // normal blood viscosity range from 4 - 15 mPa·s(cP) // 1 Pa·s = 1 g / mm / s - u = args["viscosity"].as_float(); // g / units / s + u = (float)args["viscosity"].as_float(); // g / units / s // normally the blood density in capillaries: 1060 kg/m^3 = 1.06*10^-12 g/um^3 - rou = args["rou"].as_float(); + rou = (float)args["rou"].as_float(); // check whether to enable hilbert curves or not - hilbert_curve = args["hilbert"].as_int(); + hilbert_curve = args["hilbert"].is_set(); // load image stack if provided if (args["stack"].is_set()) { @@ -1086,14 +1085,14 @@ int main(int argc, char* argv[]) { S.load_images(args["stack"].as_string()); // binary transformation #ifdef __CUDACC__ - unsigned N = S.samples(); // number of pixels loaded + size_t N = S.samples(); // number of pixels loaded unsigned char* d_S; // image stack stored in device unsigned char* h_S = (unsigned char*)malloc(N * sizeof(unsigned char)); // image stack stored in host cudaMalloc((void**)&d_S, N * sizeof(unsigned char)); cudaMemcpy(d_S, S.data(), N * sizeof(unsigned char), cudaMemcpyHostToDevice); - unsigned thread = 1024; - unsigned block = N / thread + 1; + size_t thread = 1024; + size_t block = N / thread + 1; binary_transform <<>> (N, d_S, binary_threshold); // binaryzation cudaMemcpy(h_S, d_S, N * sizeof(unsigned char), cudaMemcpyDeviceToHost); @@ -1103,9 +1102,9 @@ int main(int argc, char* argv[]) { } // get the vexel and image stack size - dx = args["stackres"].as_float(0); - dy = args["stackres"].as_float(1); - dz = args["stackres"].as_float(2); + dx = (float)args["stackres"].as_float(0); + dy = (float)args["stackres"].as_float(1); + dz = (float)args["stackres"].as_float(2); // get the save directory of image stack if (args["stackdir"].is_set()) @@ -1113,7 +1112,7 @@ int main(int argc, char* argv[]) { // get the scale-down factor is provided if (args["scale"].is_set()) - scale = args["scale"].as_float(); + scale = (float)args["scale"].as_float(); // glut main loop bb = flow.boundingbox(); -- libgit2 0.21.4