Skip to content

Commit 40053e5

Browse files
authored
Merge pull request #2097 from glotzerlab/speedup_mesh_read
Speeding up mesh construction
2 parents 29a8913 + 489b5e5 commit 40053e5

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

CHANGELOG.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ Change Log
77
5.3.1 (not yet released)
88
^^^^^^^^^^^^^^^^^^^^^^^^
99

10-
5.3.0 (2025-06-26)
11-
^^^^^^^^^^^^^^^^^^
12-
1310
*Fixed*
1411

1512
* Ensure that GPU devices have full unified memory capabilities
@@ -18,6 +15,11 @@ Change Log
1815
(`#2089 <https://github.com/glotzerlab/hoomd-blue/pull/2089>`__).
1916
* Install cuh headers
2017
(`#2091 <https://github.com/glotzerlab/hoomd-blue/pull/2091>`__).
18+
* Reduce the time needed to generate mesh bonds
19+
(`#2097 <https://github.com/glotzerlab/hoomd-blue/pull/2097>`__).
20+
21+
5.3.0 (2025-06-26)
22+
^^^^^^^^^^^^^^^^^^
2123

2224
*Added*
2325

hoomd/MeshGroupData.cc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ void MeshGroupData<group_size, Group, name, snap>::initializeFromTriangleSnapsho
125125

126126
if (group_size == 4)
127127
{
128+
unsigned int bond_idx = 0;
128129
for (unsigned group_idx = 0; group_idx < snapshot.groups.size(); group_idx++)
129130
{
130131
std::vector<unsigned int> triag_tag(3);
@@ -169,20 +170,27 @@ void MeshGroupData<group_size, Group, name, snap>::initializeFromTriangleSnapsho
169170
if (bonds[j].tag[0] == all_helper[i].tag[0]
170171
&& bonds[j].tag[1] == all_helper[i].tag[1])
171172
{
172-
// all_helper[i].tag[3] = group_idx;
173-
all_helper[i].tag[3] = bonds[j].tag[2];
173+
unsigned int find_idx = all_helper[i].tag[2];
174+
all_groups[find_idx].tag[3] = bonds[j].tag[2];
175+
176+
all_helper.erase(all_helper.begin() + i);
177+
i -= 1;
174178
bonds.erase(bonds.begin() + j);
175179
break;
176180
}
177181
}
178182
}
179183
for (unsigned int i = 0; i < bonds.size(); ++i)
180184
{
185+
all_groups.push_back(bonds[i]);
181186
all_helper.push_back(bonds[i]);
187+
long unsigned int all_helper_size = all_helper.size() - 1;
188+
all_helper[all_helper_size].tag[2] = bond_idx;
189+
bond_idx++;
190+
182191
all_types.push_back(snapshot.type_id[group_idx]);
183192
}
184193
}
185-
all_groups = all_helper;
186194
}
187195
else // this part will be important later for dynamical bonding
188196
{

0 commit comments

Comments
 (0)