-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Introduced functions 'get_field' and 'field_data' in order to be able to read FieldData from VTK files. * Introduced suggested changes in pull request * Indented docstring * Export the `get_field_data` function * Add test for field data * Update docstring references on `get_field_data` * Ignore non DataArray elements Co-authored-by: Hendrik Ranocha <[email protected]> * Format field data test * Add field data support to documentation * format --------- Co-authored-by: andresegido <[email protected]> Co-authored-by: Hendrik Ranocha <[email protected]>
- Loading branch information
1 parent
67571e9
commit 45b6452
Showing
5 changed files
with
70 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Create some cells | ||
points = rand(3, 5) | ||
cells = [ | ||
MeshCell(VTKCellTypes.VTK_TRIANGLE, [1, 4, 2]), | ||
MeshCell(VTKCellTypes.VTK_QUAD, [2, 4, 3, 5]), | ||
] | ||
|
||
scalar = 5.0 | ||
vector = [1.0, 2.0, 3.0] | ||
|
||
path = joinpath(TEST_EXAMPLES_DIR, "fields") | ||
|
||
vtk_grid(path, points, cells, append = false) do vtk | ||
vtk["scalar"] = scalar | ||
return vtk["vector"] = vector | ||
end | ||
|
||
vtk_read = VTKFile(path * ".vtu") | ||
fielddata = get_field_data(vtk_read) | ||
|
||
@test only(get_data(fielddata["scalar"])) == scalar | ||
|
||
@test get_data(fielddata["vector"]) == vector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters