Skip to content

Commit acaf219

Browse files
committed
Merge branch 'master' of https://github.com/sandialabs/seacas
2 parents 90d4cf1 + 034a59c commit acaf219

File tree

6 files changed

+35
-24
lines changed

6 files changed

+35
-24
lines changed

packages/seacas/libraries/ioss/src/Ioss_Decomposition.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,9 @@ namespace Ioss {
323323
}
324324
if (props.exists("DECOMP_OMITTED_BLOCK_NAMES")) {
325325
auto name_string = props.get("DECOMP_OMITTED_BLOCK_NAMES").get_string();
326-
auto names = Ioss::tokenize(name_string, ",");
326+
auto names = Ioss::tokenize(name_string, ",");
327327
for (const auto &name : names) {
328-
m_omittedBlockNames.push_back(name);
328+
m_omittedBlockNames.push_back(name);
329329
}
330330
}
331331
if (props.exists("PARMETIS_COMMON_NODE_COUNT") &&

packages/seacas/libraries/ioss/src/Ioss_Decomposition.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,8 @@ namespace Ioss {
818818
// The global element at index 'I' (0-based) is on block B in the
819819
// file decomposition.
820820
// if m_fileBlockIndex[B] <= I && m_fileBlockIndex[B+1] < I
821-
std::vector<size_t> m_fileBlockIndex;
822-
std::vector<int64_t> m_omittedBlocks;
821+
std::vector<size_t> m_fileBlockIndex;
822+
std::vector<int64_t> m_omittedBlocks;
823823
std::vector<std::string> m_omittedBlockNames;
824824

825825
private:

packages/seacas/libraries/ioss/src/Ioss_Doxygen.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ LOAD_BALANCE_THRESHOLD | {real} [1.4] | CGNS-Structured only -- Load imbalance p
6767
DECOMPOSITION_EXTRA | {name},{multiplier} | Specify the name of the element map or variable used if the decomposition method is `map` or `variable`. If it contains a comma, the value following the comma is used to scale (divide) the values in the map/variable. If it is 'auto', then all values will be scaled by `max_value/processorCount`
6868
DECOMP_OMITTED_BLOCK_IDS | {id_list} | A integer vector containing the
6969
element block ids that should be ignored during the parallel decomposition. The blocks will still appear in the decomposition, but will not affect the load balance. If specified via `IOSS_PROPERTIES` can be a comma-separated string of ids.
70+
DECOMP_OMITTED_BLOCK_NAMES | {name_list} | A comma-separated list of block names that should be ignored during the parallel decomposition. The blocks will still appear in the decomposition, but will not affect the load balance.
7071
7172
### Valid values for Decomposition Method
7273

packages/seacas/libraries/ioss/src/exodus/Ioex_DecompositionData.C

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -525,35 +525,43 @@ namespace Ioex {
525525
return;
526526
}
527527

528+
size_t block_count = el_blocks.size();
528529
std::vector<INT> ids(block_count);
529530
ex_get_ids(filePtr, EX_ELEM_BLOCK, Data(ids));
530531

531532
if (!decomposition.m_omittedBlockNames.empty()) {
532533
// Need to determine the id of each block name in the list...
533534
// Probably easiest to go through each id and get its name and
534535
// see if it exists in `m_omittedBlockNames`
535-
int max_name_length = ex_inquire_int(exoid, EX_INQ_DB_MAX_USED_NAME_LENGTH);
536-
size_t num_found = 0;
536+
int max_name_length = ex_inquire_int(filePtr, EX_INQ_DB_MAX_USED_NAME_LENGTH);
537+
max_name_length = std::max(max_name_length, 32);
538+
size_t num_found = 0;
537539
for (INT id : ids) {
538-
bool db_has_name = false;
539-
name = Ioex::Utils::get_entity_name(filePtr, EX_ELEM_BLOCK, id, "block", max_name_length, false, db_has_name);
540-
if (db_has_name) {
541-
bool found = std::find(decomposition.m_omittedBlockNames.begin(), decomposition.m_omittedBlockNames.end(),
542-
name) != decomposition.m_omittedBlockNames.end();
543-
if (found) {
544-
fmt::print(stderr, "Found name {} with id {}\n", name, id);
545-
decomposition.m_omittedBlocks.push_back(id);
546-
num_found++;
547-
if (num_found == decomposition.m_omittedBlockNames.size()) {
548-
break;
549-
}
550-
}
551-
}
540+
std::vector<char> buffer(max_name_length + 1);
541+
buffer[0] = '\0';
542+
ex_get_name(filePtr, EX_ELEM_BLOCK, id, Data(buffer));
543+
if (buffer[0] != '\0') {
544+
std::string name(Data(buffer));
545+
bool found = std::find(decomposition.m_omittedBlockNames.begin(),
546+
decomposition.m_omittedBlockNames.end(),
547+
name) != decomposition.m_omittedBlockNames.end();
548+
if (found) {
549+
#if IOSS_DEBUG_OUTPUT
550+
if (m_processor == 0) {
551+
fmt::print(stderr, "Found name {} with id {}\n", name, id);
552+
}
553+
#endif
554+
decomposition.m_omittedBlocks.push_back(id);
555+
num_found++;
556+
if (num_found == decomposition.m_omittedBlockNames.size()) {
557+
break;
558+
}
559+
}
560+
}
552561
}
553562
}
554563

555564
m_decomposition.show_progress(__func__);
556-
size_t block_count = el_blocks.size();
557565
if (decomposition.m_fileBlockIndex.size() != block_count + 1) {
558566
std::ostringstream errmsg;
559567
fmt::print(errmsg, "ERROR: The `generate_adjacency` function was not called prior to calling "

packages/seacas/libraries/ioss/src/main/io_shell.C

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,10 +782,12 @@ namespace {
782782
}
783783

784784
if (!interFace.decomp_omitted_block_ids.empty()) {
785-
properties.add(Ioss::Property("DECOMP_OMITTED_BLOCK_IDS", interFace.decomp_omitted_block_ids));
785+
properties.add(
786+
Ioss::Property("DECOMP_OMITTED_BLOCK_IDS", interFace.decomp_omitted_block_ids));
786787
}
787788
if (!interFace.decomp_omitted_block_names.empty()) {
788-
properties.add(Ioss::Property("DECOMP_OMITTED_BLOCK_NAMES", interFace.decomp_omitted_block_names));
789+
properties.add(
790+
Ioss::Property("DECOMP_OMITTED_BLOCK_NAMES", interFace.decomp_omitted_block_names));
789791
}
790792
if (interFace.retain_empty_blocks) {
791793
properties.add(Ioss::Property("RETAIN_EMPTY_BLOCKS", "YES"));

packages/seacas/libraries/ioss/src/main/shell_interface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ namespace IOShell {
7575
//! still appear in the decomposed files, but will not affect the
7676
//! balance. Only active element blocks will be load-balanced.
7777
std::vector<int> decomp_omitted_block_ids{};
78-
std::string decomp_omitted_block_names{};
78+
std::string decomp_omitted_block_names{};
7979

8080
//! If non-zero, then put `split_times` timesteps in each file. Then close file and start new
8181
//! file.

0 commit comments

Comments
 (0)