New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug in RenameBlockGenerator #17710
Comments
Already Fixed this bug in |
Are you creating temporary blocks when a from block exists in the to blocks? That's how it should be done here; we just did the same with RenameBoundaryGenerator. |
@loganharbour This is the code section of replacing the block id in for (const auto & elem : mesh->active_element_ptr_range())
for (unsigned i = 0; i < _old_block_id.size(); ++i)
if (elem->subdomain_id() == _old_block_id[i])
elem->subdomain_id() = _new_block_id[i]; I think break should be inserted as: for (const auto & elem : mesh->active_element_ptr_range())
for (unsigned i = 0; i < _old_block_id.size(); ++i)
if (elem->subdomain_id() == _old_block_id[i])
{
elem->subdomain_id() = _new_block_id[i];
break;
} Otherwise, block 1 is replaced to 3 first then, replaced again to 1 due to new_block_id setting. |
I'm afraid that won't work in the case of when boundary names are input. We need to keep track of the underlying ID, and then create temp blocks. For example: We have the following blocks
And the user wants this
What we would do is first notice that 0 exists within the new IDs, so we would create a temp '3'. Then, we would do This makes it independent of ordering. In addition, I'd like to simplify the parameters and only have a single parameter old_block and new_block. I did the same for RenameBoundaryGenerator. I can actually take a look at this right now, I suspect it's a little more work than you expected. Let me know. |
Now I see your point. For avoiding the issue, it would be better to define a temporary block id rather than doing the way I did. Good to know. Thank you! |
I just rewrote RenameBoundaryGenerator for this similar behavior, and I'm in a good place to rework RenameBlockGenerator in the same sense. We'd also like to remove the |
I think your modification would work for my cases - providing both Names an IDs at the same time. Thank you for very quick response! |
- Remove _id and _name params to the single old_block and new_block params - Allow merging that is independent of ordering refs idaholab#17710
@yjung-anl, see #17711 for the new capability |
- Remove _id and _name params to the single old_block and new_block params - Allow merging that is independent of ordering refs idaholab#17710
I checked your updates. It looks good to me! |
- Remove _id and _name params to the single old_block and new_block params - Allow merging that is independent of ordering refs idaholab#17710
- Remove _id and _name params to the single old_block and new_block params - Allow merging that is independent of ordering refs idaholab#17710
- Remove _id and _name params to the single old_block and new_block params - Allow merging that is independent of ordering refs idaholab#17710
- Remove _id and _name params to the single old_block and new_block params - Allow merging that is independent of ordering refs idaholab#17710
Bug Description
Found that the block id is not properly re-assigned for certain cases. The following is the case having this issue. The resulting block_id of "RenameBlockGenerator" is "1 2 1" not "3 2 1" as shown in below figures.
Before applying
RenameBlockGenerator
(Block: 1 2 3 from center to outer)After applying
RenameBlockGenerator
(Block: 1 2 1 from center to outer)Steps to Reproduce
It can be reproduced for the input case attached above.
Impact
Fix bug in RenameBlockGenerator
The text was updated successfully, but these errors were encountered: