-
Couldn't load subscription status.
- Fork 0
refactor: Move GeosBlockExtractor from geos-posp to geos-mesh #142
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
base: main
Are you sure you want to change the base?
refactor: Move GeosBlockExtractor from geos-posp to geos-mesh #142
Conversation
Update to the last version of the main
Update to the last version of the main
Update to the last version of the main
Update to the last version of the main
| .. Note:: | ||
| The volume domain is automatically extracted, by defaults the fault and well domain are empty multiBlockDataSet. | ||
| CellElementRegion is automatically extracted, by defaults SurfaceElementRegion and SurfaceElementRegion are empty multiBlockDataSet. |
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.
| CellElementRegion is automatically extracted, by defaults SurfaceElementRegion and SurfaceElementRegion are empty multiBlockDataSet. | |
| CellElementRegion is automatically extracted, by defaults SurfaceElementRegion and WellElementRegion are empty multiBlockDataSet. |
| __doc__ = """ | ||
| GeosBlockExtractor is a vtk filter that allows to extract from an output Geos multiBlockDataSet | ||
| all the blocks in a multiBlockDataSet of a Geos domain with its index. | ||
| GeosBlockExtractor is a vtk filter that allows to extract blocks from the ElementRegions from a GEOS output multiBlockDataset mesh. |
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.
| GeosBlockExtractor is a vtk filter that allows to extract blocks from the ElementRegions from a GEOS output multiBlockDataset mesh. | |
| GeosBlockExtractor is a vtk filter that allows to extract the ElementRegions blocks from a GEOS output multiBlockDataset mesh. |
| The three ElementRegions are: | ||
| 0: CellElementRegion, | ||
| 1: SurfaceElementRegion, | ||
| 2: WellElementRegion, |
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.
Maybe a mix of the previous and the current doc, something like this ?
| The three ElementRegions are: | |
| 0: CellElementRegion, | |
| 1: SurfaceElementRegion, | |
| 2: WellElementRegion, | |
| The three ElementRegions are: | |
| 0: Volumes ( labeled `CellElementRegion` in the mesh ) | |
| 1: Faults ( labeled `SurfaceElementRegion` ) | |
| 2: Wells ( labeled `WellElementRegion` ) |
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.
An enum for that would make it clearer
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 use the one already existing
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.
Please add an Enum and the outer-most property
Checks from the setters could be a plus. ➕ if not too heavy
| The three ElementRegions are: | ||
| 0: CellElementRegion, | ||
| 1: SurfaceElementRegion, | ||
| 2: WellElementRegion, |
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.
An enum for that would make it clearer
| """Extract ElementRegions block from a GEOS output multiBlockDataset mesh.""" | ||
| super().__init__() | ||
|
|
||
| self.geosElementRegionsName: dict[ int, str ] = { |
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 I think is an enum and eventhough should be class var and not instance var :)
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.
It is indeed an enum and it is already defined in GeosOutputsConstants. I don't need to rewrite it.
| elif elementRegionId == 2: | ||
| self.well = multiBlockDataSet | ||
|
|
||
| extractedElementRegions: ExtractedElementRegionsMesh |
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.
should it be accessible outside of the class ? If not then decorate it with @property
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.
It needs to be accessible outside of the class to get the result of the extraction
| "The logger already has an handler, to use yours set the argument 'speHandler' to True during the filter initialization." | ||
| ) | ||
|
|
||
| def applyFilter( self: Self ) -> bool: |
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.
If returned value is not used then maybe drop it, else maybe raise an error with diagnostic
| _surface: vtkMultiBlockDataSet = vtkMultiBlockDataSet() | ||
| _well: vtkMultiBlockDataSet = vtkMultiBlockDataSet() | ||
|
|
||
| @property |
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.
Can the setters actually check that the elements from the multiblock passed in arg are of the right type ? something following this logic
cell_type = cell.GetCellType()
# Use vtkCellTypes to get dimension
dimension = vtk.vtkCellTypes.GetDimension(cell_type)
if dimension == 3:
print("This is a volume cell.")
elif dimension == 2:
print("This is a surface cell.")
elif dimension == 1:
print("This is a line cell.")
else:
print("Unknown or unsupported cell typ
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.
Good idear. I have implemented a new function to get the dimension of the cells of the mesh and I test this dimension in the setters. It also test taht the mesh is a vtm
| """ | ||
| return self.geosElementRegionsName[ elementRegionId ] | ||
|
|
||
| def AddGeosElementRegionsBlockIndex( self, elementRegionId: int ) -> 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.
| def AddGeosElementRegionsBlockIndex( self, elementRegionId: int ) -> None: | |
| def AddGeosElementRegionsBlockIndex( self: Self, elementRegionId: int ) -> None: |
In the context of the code refactoring, this pr aims to:
Note: A future pr will clean all the test mesh