Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

MuellerSeb
Copy link
Collaborator

This PR adresses #15. In addition I made some corrections in the code:

  • reformatted with black
  • removed call to non-existing writeBlockSize64Bit
  • removed largeFile attribute form VtkFile
  • rewrote doc string in numpydoc style
  • converted None comparisons from val != None to val is not None

- removes EOL'ed python versions
 - switches Travis's base image to the latest (ubuntu bionic)
@renefritze
Copy link
Contributor

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.

Copy link
Collaborator Author

@MuellerSeb MuellerSeb left a 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])}
Copy link
Collaborator Author

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,
Copy link
Collaborator Author

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):
Copy link
Collaborator Author

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:
Copy link
Collaborator Author

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):
Copy link
Collaborator Author

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,
Copy link
Collaborator Author

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,
Copy link
Collaborator Author

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):
Copy link
Collaborator Author

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")
Copy link
Collaborator Author

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)
Copy link
Collaborator Author

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.

@MuellerSeb
Copy link
Collaborator Author

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.

I did a review, pointing out the essential changes.

I also rebased and travis succeeded.

@renefritze
Copy link
Contributor

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.

Copy link
Collaborator

@xylar xylar left a 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.

@MuellerSeb
Copy link
Collaborator Author

Cool. Is @somada141 still active on GitHub?

@renefritze
Copy link
Contributor

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.

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.

Cool. Is @somada141 still active on GitHub?

Let's wait till monday with the merge in either way.

@renefritze renefritze merged commit 488306a into pyscience-projects:master Apr 27, 2020
@renefritze
Copy link
Contributor

Thank you again @MuellerSeb, I'll try to prepare a new release today.

@MuellerSeb
Copy link
Collaborator Author

@renefritze : maybe we could address #19 first, before releasing a new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants