-
Notifications
You must be signed in to change notification settings - Fork 25
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
TXTExport
refactoring
#883
Merged
KulaginVladimir
merged 8 commits into
festim-dev:main
from
KulaginVladimir:TXTExport_refactoring
Dec 21, 2024
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0e3004d
added a write_at_last parameter
KulaginVladimir 35dc3a7
filter duplicates depending on chemical_pot flag
KulaginVladimir 72648b2
refactor filtering
KulaginVladimir 7ca7997
test is_last
KulaginVladimir 4903d7e
fix typo
KulaginVladimir 9ef34ad
added docstrings
KulaginVladimir f639d2a
added filter flag
KulaginVladimir 468611d
suggestions from review
KulaginVladimir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -111,33 +111,45 @@ def test_sorted_by_x(self, my_export, function, mesh): | |||||||
assert (np.diff(my_export.data[:, 0]) >= 0).all() | ||||||||
|
||||||||
@pytest.mark.parametrize( | ||||||||
"materials,project_to_DG,export_len", | ||||||||
"materials,project_to_DG,filter,export_len", | ||||||||
[ | ||||||||
(None, False, 11), | ||||||||
(None, False, False, 11), | ||||||||
( | ||||||||
[ | ||||||||
Material(id=1, D_0=1, E_D=0, S_0=1, E_S=0, borders=[0, 0.5]), | ||||||||
Material(id=2, D_0=2, E_D=0, S_0=2, E_S=0, borders=[0.5, 1]), | ||||||||
], | ||||||||
True, | ||||||||
True, | ||||||||
12, # + 1 duplicate near the interface | ||||||||
), | ||||||||
( | ||||||||
[ | ||||||||
Material(id=1, D_0=1, E_D=0, S_0=1, E_S=0, borders=[0, 0.5]), | ||||||||
Material(id=2, D_0=2, E_D=0, S_0=2, E_S=0, borders=[0.5, 1]), | ||||||||
], | ||||||||
True, | ||||||||
False, | ||||||||
20, # 2 * (len_vertices - 1) | ||||||||
), | ||||||||
], | ||||||||
) | ||||||||
def test_duplicates( | ||||||||
self, materials, project_to_DG, export_len, my_export, function, mesh | ||||||||
self, materials, project_to_DG, filter, export_len, my_export, function, mesh | ||||||||
): | ||||||||
""" | ||||||||
Checks that the exported data does not contain duplicates | ||||||||
except those near interfaces | ||||||||
""" | ||||||||
current_time = 1 | ||||||||
my_export.function = function | ||||||||
my_export.filter = filter | ||||||||
my_export.initialise(mesh, project_to_DG, materials) | ||||||||
my_export.write( | ||||||||
current_time=current_time, | ||||||||
final_time=None, | ||||||||
) | ||||||||
print(my_export._unique_indices) | ||||||||
assert len(my_export.data) == export_len | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of a print you can do the following:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't know about such a functionality, but I forgot to delete this print-statement |
||||||||
|
||||||||
|
||||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.