Skip to content

Commit

Permalink
Detail ordering-dependent behavior in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
loganharbour committed Nov 18, 2021
1 parent b826722 commit 95036d4
Showing 1 changed file with 41 additions and 18 deletions.
59 changes: 41 additions & 18 deletions framework/doc/content/source/meshgenerators/RenameBlockGenerator.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

When using the `RenameBlockGenerator` to change block names, the result is independent of ordering.

The following will change the name for the block "meaningless" to "inside" and will set the name for block "5" to "outside":
The following will change the name for the block `meaningless` to `inside` and will set the name for block `5` to `outside`:

```
[rename]
Expand All @@ -19,43 +19,66 @@ The following will change the name for the block "meaningless" to "inside" and w

## Merging Blocks

When using the `RenameBlockGenerator` to merge blocks, the result is not necessarily independent of ordering.
The `RenameBlockGenerator` can be used to merge blocks together. The result is independent of ordering when [!param](/Mesh/RenameBlockGenerator/new_block) contains only block IDs. When [!param](/Mesh/RenameBlockGenerator/new_block) contains block names, the result is not necessarily independent of ordering.

For example, take the following:
The following will result in the merging of the elements in blocks `1`, `2`, and `3` into block `0`:

```
[merge]
type = RenameBlockGenerator
input = some_mesh
old_block = '0 1 2 3'
new_block = '0_and_1 0_and_1 2_and_3 2_and_3'
old_block = '1 2 3'
new_block = '0 0 0'
[]
```

The above will result in two blocks:
As discussed previously, when providing names in [!param](/Mesh/RenameBlockGenerator/new_block), the result may be ordering-dependent. If a name is provided in [!param](/Mesh/RenameBlockGenerator/new_block) that does not already exist in the mesh, it will take the ID of the first rename.

- Block "0_and_1" with ID "0" that contains the elements from the original blocks "0" and "1".
- Block "2_and_3" with ID "2" that contains the elements from the original blocks "2" and "3".
Take the following examples (assuming that the block `some_block` does not exist yet):

Take the first execution, "0" to "0_and_1". The `RenameBlockGenerator` will use the original block ID, which is "0". The second execution "1" to "0_and_1" will use the new ID associated with "0_and_1", which is "0", and merge "1" into it. The result is similar for the third and fourth executions.
```
[mergename0]
type = RenameBlockGenerator
input = some_mesh
old_block = '0 1'
new_block = 'some_block some_block'
[]
```

!alert! tip title=The use of ID is order independent
The order dependent behavior only exists when the new block provided is a name. Take the following instead:
```
[mergename1]
type = RenameBlockGenerator
input = some_mesh
old_block = '1 0'
new_block = 'some_block some_block'
[]
```

The result of each will be a block named `some_block` that contains elements that were in blocks `0` and `1`. However, because the block `some_block` takes the ID of the first rename execution, the ID of `some_block` will be `0` in the case of the generator `mergename0` and `1` in the case of the generator `mergename1`.

In the case of providing [!param](/Mesh/RenameBlockGenerator/new_block) by ID, the following examples (assuming that the block `2` does not exist yet) will have the same result:

```
[merge]
[mergeblock0]
type = RenameBlockGenerator
input = some_mesh
old_block = '0 1'
new_block = '2 2'
[]
```

```
[mergeblock1]
type = RenameBlockGenerator
input = some_mesh
old_block = '0 1 2 3'
new_block = '0 0 4 4'
old_block = '1 0'
new_block = '2 2'
[]
```

The result is:
That is, a block will be created with the ID `2` that contains the elements previously in blocks `0` and `1`.

- Block "0" that contains the elements from original blocks "0" and "1".
- Block "4" that contains the elements from original blocks "2" and "3".
!alert-end!
In summary, the possibility of ordering-dependent results with the `RenameBlockGenerator` depends on whether or not name(s) are provided in [!param](/Mesh/RenameBlockGenerator/new_block) and said name(s) do not exist yet.

!syntax parameters /Mesh/RenameBlockGenerator

Expand Down

0 comments on commit 95036d4

Please sign in to comment.