MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / set_array_to_adj_list

Function set_array_to_adj_list

src/Connectivity/MeshConnectivity.cpp:17–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15typedef std::vector<IndexSet> SetArray;
16
17void 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
44void MeshConnectivity::initialize(Mesh* mesh) {
45 init_vertex_adjacencies(mesh);

Callers 3

init_face_adjacenciesMethod · 0.85

Calls 3

sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected