Skip to content

Commit 7601100

Browse files
committed
IOSS: Catalyst
Fixed Catalyst tests for element blocks when writing connectivity_raw. Original code was scrambling the connectivity in this case and causing test failures with recent changes to io_shell --compare.
1 parent 4a10484 commit 7601100

3 files changed

Lines changed: 18 additions & 43 deletions

File tree

packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMesh.C

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -236,30 +236,6 @@ namespace Iocatalyst {
236236
return conn;
237237
}
238238

239-
BlockMesh::BlockConn BlockMesh::getPartitionBlockConnectivityPointIDs(ID blockID) const
240-
{
241-
BlockConn conn;
242-
Extent bounds = {extents.i + BLOCK_OFFSET, extents.j + BLOCK_OFFSET, extents.k + BLOCK_OFFSET};
243-
Extent e = getCoordsForID(blockID, bounds);
244-
e.i -= partitionStart.i;
245-
e.j -= partitionStart.j;
246-
e.k -= partitionStart.k;
247-
248-
bounds = {partitionExtents.i + BLOCK_OFFSET, partitionExtents.j + BLOCK_OFFSET,
249-
partitionExtents.k + BLOCK_OFFSET};
250-
251-
conn[0] = getIDfromCoords({e.i, e.j, e.k}, bounds);
252-
conn[1] = getIDfromCoords({e.i + 1, e.j, e.k}, bounds);
253-
conn[2] = getIDfromCoords({e.i + 1, e.j + 1, e.k}, bounds);
254-
conn[3] = getIDfromCoords({e.i, e.j + 1, e.k}, bounds);
255-
conn[4] = getIDfromCoords({e.i, e.j, e.k + 1}, bounds);
256-
conn[5] = getIDfromCoords({e.i + 1, e.j, e.k + 1}, bounds);
257-
conn[6] = getIDfromCoords({e.i + 1, e.j + 1, e.k + 1}, bounds);
258-
conn[7] = getIDfromCoords({e.i, e.j + 1, e.k + 1}, bounds);
259-
260-
return conn;
261-
}
262-
263239
BlockMesh::ID BlockMesh::getGlobalIDForBlockID(ID blockID)
264240
{
265241
auto coords = getCoordsForID(blockID, getExtents());

packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMesh.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ namespace Iocatalyst {
6868
int getNumPartitionBlocks() const;
6969
IDList getPartitionBlockIDs() const;
7070
BlockConn getBlockConnectivityPointIDs(ID blockID) const;
71-
BlockConn getPartitionBlockConnectivityPointIDs(ID blockID) const;
7271
static Extent getGlobalBlockExtents() { return {I_GLOBAL, J_GLOBAL, K_GLOBAL}; };
7372
ID getGlobalIDForBlockID(ID blockID);
7473

packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMeshSet.C

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <catalyst/Iocatalyst_DatabaseIO.h>
1717
#include <catalyst_tests/Iocatalyst_BlockMeshSet.h>
1818
#include <unordered_set>
19+
#include <algorithm>
1920

2021
namespace Iocatalyst {
2122

@@ -337,27 +338,26 @@ namespace Iocatalyst {
337338
BlockMesh::IDList globalElemIds;
338339
BlockMesh::IDList ids = bm.getPartitionBlockIDs();
339340

340-
if (iop.writeConnectivityRaw) {
341-
for (int i = 0; i < ids.size(); i++) {
342-
BlockMesh::BlockConn conn = bm.getPartitionBlockConnectivityPointIDs(ids[i]);
343-
globalElemIds.push_back(bm.getGlobalIDForBlockID(ids[i]));
344-
for (int j = 0; j < conn.size(); j++) {
345-
connectivity[(i * 8) + j] = conn[j];
346-
}
341+
for (int i = 0; i < ids.size(); i++) {
342+
BlockMesh::BlockConn conn = bm.getBlockConnectivityPointIDs(ids[i]);
343+
globalElemIds.push_back(bm.getGlobalIDForBlockID(ids[i]));
344+
for (int j = 0; j < conn.size(); j++) {
345+
connectivity[(i * 8) + j] = bm.getGlobalIDForPointID(conn[j]);
347346
}
348-
elemBlock->put_field_data("connectivity_raw", connectivity);
349-
}
350-
else {
351-
for (int i = 0; i < ids.size(); i++) {
352-
BlockMesh::BlockConn conn = bm.getBlockConnectivityPointIDs(ids[i]);
353-
globalElemIds.push_back(bm.getGlobalIDForBlockID(ids[i]));
354-
for (int j = 0; j < conn.size(); j++) {
355-
connectivity[(i * 8) + j] = bm.getGlobalIDForPointID(conn[j]);
356-
}
357-
}
358-
elemBlock->put_field_data("connectivity", connectivity);
359347
}
360348

349+
std::string conn_name = "connectivity";
350+
if (iop.writeConnectivityRaw) {
351+
conn_name = "connectivity_raw";
352+
for (int i = 0; i < connectivity.size(); i++) {
353+
auto it = std::find(globalPointIds.begin(), globalPointIds.end(), connectivity[i]);
354+
if (it != globalPointIds.end()) {
355+
int index = std::distance(globalPointIds.begin(), it);
356+
connectivity[i] = index + 1;
357+
}
358+
}
359+
}
360+
elemBlock->put_field_data(conn_name, connectivity);
361361
elemBlock->put_field_data("ids", globalElemIds);
362362
}
363363
}

0 commit comments

Comments
 (0)