Subversion Repositories gelsvn

Rev

Rev 657 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 657 Rev 662
Line 49... Line 49...
49
    private:
49
    private:
50
        iterator begin_;
50
        iterator begin_;
51
        iterator end_;
51
        iterator end_;
52
    };
52
    };
53
 
53
    
54
    typedef std::vector<std::vector<VertexID>> VertexIDBatches;
-
 
55
    
-
 
56
 
-
 
57
    
-
 
58
    void for_each_vertex(Manifold& m, function<void(VertexID)> f) { for(auto v : m.vertices()) f(v); }
54
    void for_each_vertex(Manifold& m, function<void(VertexID)> f) { for(auto v : m.vertices()) f(v); }
59
    void for_each_face(Manifold& m, function<void(FaceID)> f) { for(auto p : m.faces()) f(p); }
55
    void for_each_face(Manifold& m, function<void(FaceID)> f) { for(auto p : m.faces()) f(p); }
60
    void for_each_halfedge(Manifold& m, function<void(HalfEdgeID)> f) { for(auto h : m.halfedges()) f(h); }
56
    void for_each_halfedge(Manifold& m, function<void(HalfEdgeID)> f) { for(auto h : m.halfedges()) f(h); }
61
 
57
 
62
    
58
    
Line 208... Line 204...
208
        }
204
        }
209
        
205
        
210
    }
206
    }
211
    
207
    
212
    
208
    
-
 
209
    typedef std::vector<std::vector<VertexID>> VertexIDBatches;
-
 
210
 
213
//    template<typename  T>
211
//    template<typename  T>
214
//    void for_each_vertex_parallel(int no_threads, const VertexIDBatches& batches, const T& f) {
212
//    void for_each_vertex_parallel(int no_threads, const VertexIDBatches& batches, const T& f) {
215
//        vector<future<void>> f_vec(no_threads);
213
//        vector<future<void>> f_vec(no_threads);
216
//        for(auto t : range(0, no_threads))
214
//        for(auto t : range(0, no_threads))
217
//            f_vec[t] = async(launch::async, f, ref(batches[t]));
215
//            f_vec[t] = async(launch::async, f, ref(batches[t]));
218
//    }
216
//    }
-
 
217
    
-
 
218
    
219
    template<typename  T>
219
    template<typename  T>
220
    void for_each_vertex_parallel(int no_threads, const VertexIDBatches& batches, const T& f) {
220
    void for_each_vertex_parallel(int no_threads, const VertexIDBatches& batches, const T& f) {
221
        vector<thread> t_vec(no_threads);
221
        vector<thread> t_vec(no_threads);
222
        for(auto t : range(0, no_threads))
222
        for(auto t : range(0, no_threads))
223
            t_vec[t] = thread(f, ref(batches[t]));
223
            t_vec[t] = thread(f, ref(batches[t]));