Commit e8c9a82ba15e3f8c8d27f9f64d59075a45e1f9a0
1 parent
6e9cf1ac
fixed GCC errors and warnings associated with NetMets
Showing
2 changed files
with
16 additions
and
15 deletions
Show diff stats
stim/biomodels/network.h
... | ... | @@ -35,7 +35,7 @@ class network{ |
35 | 35 | // default constructor |
36 | 36 | edge() : cylinder<T>() |
37 | 37 | { |
38 | - v[1] = -1; v[0] = -1; | |
38 | + v[1] = (unsigned)(-1); v[0] = (unsigned)(-1); | |
39 | 39 | } |
40 | 40 | /// Constructor - creates an edge from a list of points by calling the stim::fiber constructor |
41 | 41 | |
... | ... | @@ -421,7 +421,7 @@ public: |
421 | 421 | R = (*this); //initialize the result with the current network |
422 | 422 | |
423 | 423 | //generate a KD-tree for network A |
424 | - float metric = 0.0; // initialize metric to be returned after comparing the networks | |
424 | + //float metric = 0.0; // initialize metric to be returned after comparing the networks | |
425 | 425 | stim::cuda_kdtree<T, 3> kdt; // initialize a pointer to a kd tree |
426 | 426 | size_t MaxTreeLevels = 3; // max tree level |
427 | 427 | |
... | ... | @@ -447,8 +447,8 @@ public: |
447 | 447 | |
448 | 448 | stim::vec3<T> p0, p1; |
449 | 449 | float m1; |
450 | - float M = 0; //stores the total metric value | |
451 | - float L = 0; //stores the total network length | |
450 | + //float M = 0; //stores the total metric value | |
451 | + //float L = 0; //stores the total network length | |
452 | 452 | float* queryPt = new float[3]; |
453 | 453 | for(unsigned e = 0; e < R.E.size(); e++){ //for each edge in A |
454 | 454 | R.E[e].add_mag(0); //add a new magnitude for the metric |
... | ... | @@ -488,7 +488,7 @@ public: |
488 | 488 | void load_txt(std::string filename) |
489 | 489 | { |
490 | 490 | std::vector <std::string> file_contents; |
491 | - std::ifstream file(filename); | |
491 | + std::ifstream file(filename.c_str()); | |
492 | 492 | std::string line; |
493 | 493 | std::vector<unsigned> id2vert; //this list stores the vertex ID associated with each network vertex |
494 | 494 | //for each line in the text file, store them as strings in file_contents |
... | ... | @@ -553,8 +553,8 @@ public: |
553 | 553 | void |
554 | 554 | to_txt(std::string filename) |
555 | 555 | { |
556 | - std::ofstream ofs(filename, std::ofstream::out | std::ofstream::app); | |
557 | - int num; | |
556 | + std::ofstream ofs(filename.c_str(), std::ofstream::out | std::ofstream::app); | |
557 | + //int num; | |
558 | 558 | ofs << (E.size()).str() << "\n"; |
559 | 559 | for(unsigned int i = 0; i < E.size(); i++) |
560 | 560 | { |
... | ... | @@ -567,7 +567,8 @@ public: |
567 | 567 | { |
568 | 568 | std::string str; |
569 | 569 | str = V[i].str(); |
570 | - removeCharsFromString(str, "[],"); | |
570 | + char temp[4] = "[],"; | |
571 | + removeCharsFromString(str, temp); | |
571 | 572 | ofs << str << "\n"; |
572 | 573 | } |
573 | 574 | ofs.close(); | ... | ... |
stim/structures/kdtree.cuh
... | ... | @@ -52,7 +52,7 @@ namespace stim { |
52 | 52 | int current_axis; // current judging axis |
53 | 53 | int cmps; // count how many time of comparisons (just for cpu-kdtree) |
54 | 54 | int n_id; // store the total number of nodes |
55 | - std::vector <kdtree::point<T, D>> *tmp_points; // transfer or temp points | |
55 | + std::vector < typename kdtree::point<T, D> > *tmp_points; // transfer or temp points | |
56 | 56 | kdtree::kdnode<T> *root; // root node |
57 | 57 | static cpu_kdtree<T, D> *cur_tree_ptr; |
58 | 58 | public: |
... | ... | @@ -78,7 +78,7 @@ namespace stim { |
78 | 78 | } |
79 | 79 | root = NULL; |
80 | 80 | } |
81 | - void Create(std::vector <kdtree::point<T, D>> &reference_points, size_t max_levels) { | |
81 | + void Create(std::vector < typename kdtree::point<T, D> > &reference_points, size_t max_levels) { | |
82 | 82 | tmp_points = &reference_points; |
83 | 83 | root = new kdtree::kdnode<T>(); // initializing the root node |
84 | 84 | root->idx = n_id++; // the index of root is 0 |
... | ... | @@ -119,11 +119,11 @@ namespace stim { |
119 | 119 | } |
120 | 120 | } |
121 | 121 | static bool SortPoints(const size_t a, const size_t b) { // create functor for std::sort |
122 | - std::vector <kdtree::point<T, D>> &pts = *cur_tree_ptr->tmp_points; // put cur_tree_ptr to current input points' pointer | |
122 | + std::vector < typename kdtree::point<T, D> > &pts = *cur_tree_ptr->tmp_points; // put cur_tree_ptr to current input points' pointer | |
123 | 123 | return pts[a].dim[cur_tree_ptr->current_axis] < pts[b].dim[cur_tree_ptr->current_axis]; |
124 | 124 | } |
125 | 125 | void Split(kdtree::kdnode<T> *cur, kdtree::kdnode<T> *left, kdtree::kdnode<T> *right) { |
126 | - std::vector <kdtree::point<T, D>> &pts = *tmp_points; | |
126 | + std::vector < typename kdtree::point<T, D> > &pts = *tmp_points; | |
127 | 127 | current_axis = cur->level % D; // indicate the judicative dimension or axis |
128 | 128 | std::sort(cur->indices.begin(), cur->indices.end(), SortPoints); // using SortPoints as comparison function to sort the data |
129 | 129 | 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 { |
317 | 317 | std::cout<<"The max_tree_levels should be smaller!"<<std::endl; |
318 | 318 | exit(1); |
319 | 319 | } |
320 | - std::vector <kdtree::point<T, D>> reference_points(reference_count); // restore the reference points in particular way | |
320 | + std::vector < typename kdtree::point<T, D> > reference_points(reference_count); // restore the reference points in particular way | |
321 | 321 | for (size_t j = 0; j < reference_count; j++) |
322 | 322 | for (size_t i = 0; i < dim_count; i++) |
323 | 323 | reference_points[j].dim[i] = h_reference_points[j * dim_count + i]; |
... | ... | @@ -331,7 +331,7 @@ namespace stim { |
331 | 331 | HANDLE_ERROR(cudaMalloc((void**)&d_index, sizeof(size_t) * d_reference_count)); |
332 | 332 | HANDLE_ERROR(cudaMalloc((void**)&d_reference_points, sizeof(kdtree::point<T, D>) * d_reference_count)); |
333 | 333 | |
334 | - std::vector <cuda_kdnode<T>> tmp_nodes(num_nodes); | |
334 | + std::vector < cuda_kdnode<T> > tmp_nodes(num_nodes); | |
335 | 335 | std::vector <size_t> indices(d_reference_count); |
336 | 336 | std::vector <kdtree::kdnode<T>*> next_nodes; |
337 | 337 | size_t cur_pos = 0; |
... | ... | @@ -372,7 +372,7 @@ namespace stim { |
372 | 372 | HANDLE_ERROR(cudaMemcpy(d_reference_points, &reference_points[0], sizeof(kdtree::point<T, D>) * reference_points.size(), cudaMemcpyHostToDevice)); |
373 | 373 | } |
374 | 374 | void Search(T *h_query_points, size_t query_count, size_t dim_count, T *dists, size_t *indices) { |
375 | - std::vector <kdtree::point<T, D>> query_points(query_count); | |
375 | + std::vector < typename kdtree::point<T, D> > query_points(query_count); | |
376 | 376 | for (size_t j = 0; j < query_count; j++) |
377 | 377 | for (size_t i = 0; i < dim_count; i++) |
378 | 378 | query_points[j].dim[i] = h_query_points[j * dim_count + i]; | ... | ... |