diff --git a/stim/biomodels/network.h b/stim/biomodels/network.h index 300b7e1..84fb949 100644 --- a/stim/biomodels/network.h +++ b/stim/biomodels/network.h @@ -35,7 +35,7 @@ class network{ // default constructor edge() : cylinder() { - v[1] = -1; v[0] = -1; + v[1] = (unsigned)(-1); v[0] = (unsigned)(-1); } /// Constructor - creates an edge from a list of points by calling the stim::fiber constructor @@ -421,7 +421,7 @@ public: R = (*this); //initialize the result with the current network //generate a KD-tree for network A - float metric = 0.0; // initialize metric to be returned after comparing the networks + //float metric = 0.0; // initialize metric to be returned after comparing the networks stim::cuda_kdtree kdt; // initialize a pointer to a kd tree size_t MaxTreeLevels = 3; // max tree level @@ -447,8 +447,8 @@ public: stim::vec3 p0, p1; float m1; - float M = 0; //stores the total metric value - float L = 0; //stores the total network length + //float M = 0; //stores the total metric value + //float L = 0; //stores the total network length float* queryPt = new float[3]; for(unsigned e = 0; e < R.E.size(); e++){ //for each edge in A R.E[e].add_mag(0); //add a new magnitude for the metric @@ -488,7 +488,7 @@ public: void load_txt(std::string filename) { std::vector file_contents; - std::ifstream file(filename); + std::ifstream file(filename.c_str()); std::string line; std::vector id2vert; //this list stores the vertex ID associated with each network vertex //for each line in the text file, store them as strings in file_contents @@ -553,8 +553,8 @@ public: void to_txt(std::string filename) { - std::ofstream ofs(filename, std::ofstream::out | std::ofstream::app); - int num; + std::ofstream ofs(filename.c_str(), std::ofstream::out | std::ofstream::app); + //int num; ofs << (E.size()).str() << "\n"; for(unsigned int i = 0; i < E.size(); i++) { @@ -567,7 +567,8 @@ public: { std::string str; str = V[i].str(); - removeCharsFromString(str, "[],"); + char temp[4] = "[],"; + removeCharsFromString(str, temp); ofs << str << "\n"; } ofs.close(); diff --git a/stim/structures/kdtree.cuh b/stim/structures/kdtree.cuh index 15f458a..f85dc23 100644 --- a/stim/structures/kdtree.cuh +++ b/stim/structures/kdtree.cuh @@ -52,7 +52,7 @@ namespace stim { int current_axis; // current judging axis int cmps; // count how many time of comparisons (just for cpu-kdtree) int n_id; // store the total number of nodes - std::vector > *tmp_points; // transfer or temp points + std::vector < typename kdtree::point > *tmp_points; // transfer or temp points kdtree::kdnode *root; // root node static cpu_kdtree *cur_tree_ptr; public: @@ -78,7 +78,7 @@ namespace stim { } root = NULL; } - void Create(std::vector > &reference_points, size_t max_levels) { + void Create(std::vector < typename kdtree::point > &reference_points, size_t max_levels) { tmp_points = &reference_points; root = new kdtree::kdnode(); // initializing the root node root->idx = n_id++; // the index of root is 0 @@ -119,11 +119,11 @@ namespace stim { } } static bool SortPoints(const size_t a, const size_t b) { // create functor for std::sort - std::vector > &pts = *cur_tree_ptr->tmp_points; // put cur_tree_ptr to current input points' pointer + std::vector < typename kdtree::point > &pts = *cur_tree_ptr->tmp_points; // put cur_tree_ptr to current input points' pointer return pts[a].dim[cur_tree_ptr->current_axis] < pts[b].dim[cur_tree_ptr->current_axis]; } void Split(kdtree::kdnode *cur, kdtree::kdnode *left, kdtree::kdnode *right) { - std::vector > &pts = *tmp_points; + std::vector < typename kdtree::point > &pts = *tmp_points; current_axis = cur->level % D; // indicate the judicative dimension or axis std::sort(cur->indices.begin(), cur->indices.end(), SortPoints); // using SortPoints as comparison function to sort the data size_t mid_value = cur->indices[cur->indices.size() / 2]; // odd in the mid_value, even take the floor @@ -317,7 +317,7 @@ namespace stim { std::cout<<"The max_tree_levels should be smaller!"<> reference_points(reference_count); // restore the reference points in particular way + std::vector < typename kdtree::point > reference_points(reference_count); // restore the reference points in particular way for (size_t j = 0; j < reference_count; j++) for (size_t i = 0; i < dim_count; i++) reference_points[j].dim[i] = h_reference_points[j * dim_count + i]; @@ -331,7 +331,7 @@ namespace stim { HANDLE_ERROR(cudaMalloc((void**)&d_index, sizeof(size_t) * d_reference_count)); HANDLE_ERROR(cudaMalloc((void**)&d_reference_points, sizeof(kdtree::point) * d_reference_count)); - std::vector > tmp_nodes(num_nodes); + std::vector < cuda_kdnode > tmp_nodes(num_nodes); std::vector indices(d_reference_count); std::vector *> next_nodes; size_t cur_pos = 0; @@ -372,7 +372,7 @@ namespace stim { HANDLE_ERROR(cudaMemcpy(d_reference_points, &reference_points[0], sizeof(kdtree::point) * reference_points.size(), cudaMemcpyHostToDevice)); } void Search(T *h_query_points, size_t query_count, size_t dim_count, T *dists, size_t *indices) { - std::vector > query_points(query_count); + std::vector < typename kdtree::point > query_points(query_count); for (size_t j = 0; j < query_count; j++) for (size_t i = 0; i < dim_count; i++) query_points[j].dim[i] = h_query_points[j * dim_count + i]; -- libgit2 0.21.4