| 15 | typedef std::vector<IndexSet> SetArray; |
| 16 | |
| 17 | void set_array_to_adj_list( |
| 18 | SetArray& set_array, |
| 19 | VectorI& adjacency, |
| 20 | VectorI& adjacency_idx) { |
| 21 | |
| 22 | size_t num_elements = set_array.size(); |
| 23 | size_t total_adjacency = 0; |
| 24 | for (size_t i=0; i<num_elements; i++) { |
| 25 | total_adjacency += set_array[i].size(); |
| 26 | } |
| 27 | |
| 28 | adjacency.resize(total_adjacency); |
| 29 | adjacency_idx.resize(num_elements + 1); |
| 30 | |
| 31 | size_t count = 0; |
| 32 | for (size_t i=0; i<num_elements; i++) { |
| 33 | adjacency_idx[i] = count; |
| 34 | IndexSet& neighbors = set_array[i]; |
| 35 | for (IndexSet::const_iterator itr = neighbors.begin(); |
| 36 | itr != neighbors.end(); itr++) { |
| 37 | adjacency[count] = *itr; |
| 38 | count++; |
| 39 | } |
| 40 | } |
| 41 | adjacency_idx[num_elements] = count; |
| 42 | } |
| 43 | |
| 44 | void MeshConnectivity::initialize(Mesh* mesh) { |
| 45 | init_vertex_adjacencies(mesh); |
no test coverage detected