-
Notifications
You must be signed in to change notification settings - Fork 15
Enhancement: Field data export #17
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
Conversation
…ove ref to non-existing routine (64bit)
- removes EOL'ed python versions - switches Travis's base image to the latest (ubuntu bionic)
Thank you for the contribution @MuellerSeb ! I'm having a little trouble discovering the functional changes in between the formatting ones. Can you help me with that? I've also update the CI setup in #18 just now, if you rebase on master now, travis can work again. |
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.
Here I pointed out the substantial changes. Most of them are related to field data.
|
||
point_data = {"test_pd": np.array([1, 2, 3, 4, 5, 6])} | ||
cell_data = {"test_cd": np.array([1, 2, 3])} | ||
field_data = {"test_fd": np.array([1.0, 2.0])} |
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.
Here I added field data to the grid.
cell_types=ctype, | ||
cellData=cell_data, | ||
pointData=point_data, | ||
fieldData=field_data, |
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.
This field data can now simply be added to the call of the export functions.
# Helper functions | ||
# ================================= | ||
def _addDataToFile(vtkFile, cellData, pointData): | ||
def _addDataToFile(vtkFile, cellData, pointData, fieldData=None): |
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.
Here you can now pass field data to create a corresponding section.
def _appendDataToFile(vtkFile, cellData, pointData): | ||
# Field data | ||
# https://www.visitusers.org/index.php?title=Time_and_Cycle_in_VTK_files#XML_VTK_files | ||
if fieldData: |
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.
Field data has no attributes, so just a section is created.
vtkFile.closeData("Field") | ||
|
||
|
||
def _appendDataToFile(vtkFile, cellData, pointData, fieldData=None): |
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.
Here we can now create DataSets for field data.
cell_types, | ||
cellData=None, | ||
pointData=None, | ||
fieldData=None, |
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.
Added fieldData
keyword to unstructuredGridToVTK
npilars=16, | ||
cellData=None, | ||
pointData=None, | ||
fieldData=None, |
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.
Added fieldData
keyword to cylinderToVTK
The default is False. | ||
""" | ||
|
||
def __init__(self, filepath, ftype): |
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.
removed the unused largeFile
keyword.
VtkFile | ||
This VtkFile to allow chained calls. | ||
""" | ||
self.xml.openElement(nodeType + "Data") |
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.
This creates the FieldData element, when nodeType="Field"
if self.largeFile == False: | ||
writeBlockSize(self.xml.stream, block_size) | ||
else: | ||
writeBlockSize64Bit(self.xml.stream, block_size) |
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.
This routine did not exists.
…ove ref to non-existing routine (64bit)
I did a review, pointing out the essential changes. I also rebased and travis succeeded. |
Great! Thanks. Those changes look good to me. While I do not mind the style changes personally, lets see if @somada141 or @xylar have strong opinions. |
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.
I like the updated formatting. It might be hard to merge changes from Paulo Herrera's version but I don't think we expect much from there.
Cool. Is @somada141 still active on GitHub? |
Indeed. There hasn't been anything in over a year. We can always just run black on the remote too before a hypothetical merge though.
Let's wait till monday with the merge in either way. |
Thank you again @MuellerSeb, I'll try to prepare a new release today. |
@renefritze : maybe we could address #19 first, before releasing a new version. |
This PR adresses #15. In addition I made some corrections in the code:
writeBlockSize64Bit
largeFile
attribute formVtkFile
val != None
toval is not None