-
Couldn't load subscription status.
- Fork 0
feat: adding SISO decorator #151
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
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.
Thanks for your work. It seems good to me but check PVMeshQualityEnhanced and the output of Filter.
geos-pv/src/geos/pv/plugins/PVCreateConstantAttributePerRegion.py
Outdated
Show resolved
Hide resolved
| Returns: | ||
| int: 1 if calculation successfully ended, 0 otherwise. | ||
| inputMesh : a mesh to transform |
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.
| inputMesh : a mesh to transform | |
| inputMesh : A mesh to transform. |
| Returns: | ||
| int: 1 if calculation successfully ended, 0 otherwise. | ||
| inputMesh : a mesh to transform | ||
| outputMesh : a mesh transformed |
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.
| outputMesh : a mesh transformed | |
| outputMesh : A mesh transformed. |
| Returns: | ||
| vtkPointSet: output mesh | ||
| inputMesh(vtkPointSet): input mesh | ||
| outputMesh: output 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.
| outputMesh: output mesh | |
| outputMesh: Output mesh. |
geos-pv/src/geos/pv/utils/details.py
Outdated
| """Pre-init the filter with the Base algo and I/O single type (usually vtkMultiBlockDataSet). | ||
| Args: | ||
| ar : fowarded arguments |
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.
| ar : fowarded arguments | |
| ar : Fowarded arguments. |
geos-pv/src/geos/pv/utils/details.py
Outdated
| Args: | ||
| ar : fowarded arguments | ||
| kw : forwarded keywords args |
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.
| kw : forwarded keywords args | |
| kw : Forwarded keywords args. |
geos-pv/src/geos/pv/utils/details.py
Outdated
| """Define filter here. | ||
| Args: | ||
| inputMesh : a mesh to transform |
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.
| inputMesh : a mesh to transform | |
| inputMesh : A mesh to transform. |
geos-pv/src/geos/pv/utils/details.py
Outdated
| Args: | ||
| inputMesh : a mesh to transform | ||
| outputMesh : a mesh transformed |
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.
| outputMesh : a mesh transformed | |
| outputMesh : A mesh transformed. |
geos-pv/src/geos/pv/utils/details.py
Outdated
| update_paths() | ||
|
|
||
| __doc__ = """ | ||
| Set of decorators that allows quicker generation of MultiBlockDataSet to MultiBlockDataSet filters |
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 documentation does not take into account that we allow for multiple types of inputs U, we are not limited to MultiBlockDataSet.
geos-pv/src/geos/pv/utils/details.py
Outdated
| # from functools import wraps | ||
| # from dataclasses import dataclass |
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.
Remove unused imports
geos-pv/src/geos/pv/utils/details.py
Outdated
| # Enum for filter categories | ||
| class FilterCategory( str, Enum ): | ||
| GEOS_UTILS = '4- Geos Utils' | ||
| GEOS_MESH = '1- Geos Mesh' | ||
| GEOS_PROP = '0- Geos Pre-processing' | ||
| GEOS_GEOMECHANICS = '2- Geos Geomechanics' | ||
| GEOS_PV = '3- Geos PV' | ||
| GEOS_QC = '5- Geos QC' | ||
| # Add more as needed |
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.
2 things:
- The class should be defined after the doc
- Reorder from 0 to 5
geos-pv/src/geos/pv/utils/details.py
Outdated
| def SISOFilter( category: FilterCategory, decorated_label: str, | ||
| decorated_type: Union[str,list] ) -> Callable[ [ Type[ T ] ], Type[ T ] ]: |
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 SISOFilter( category: FilterCategory, decorated_label: str, | |
| decorated_type: Union[str,list] ) -> Callable[ [ Type[ T ] ], Type[ T ] ]: | |
| def SISOFilter( category: FilterCategory, decoratedLabel: str, | |
| decoratedType: Union[str,list] ) -> Callable[ [ Type[ T ] ], Type[ T ] ]: |
And change that everywhere else
geos-pv/src/geos/pv/utils/details.py
Outdated
| decorated_type: Union[str,list] ) -> Callable[ [ Type[ T ] ], Type[ T ] ]: | ||
| """Decorate single input single output filter.""" | ||
|
|
||
| def decorated_class( cls: Type[ T ] ) -> Type[ T ]: |
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 decorated_class( cls: Type[ T ] ) -> Type[ T ]: | |
| def decoratedClass( cls: Type[ T ] ) -> Type[ T ]: |
geos-pv/src/geos/pv/utils/details.py
Outdated
|
|
||
| def SISOFilter( category: FilterCategory, decorated_label: str, | ||
| decorated_type: Union[str,list] ) -> Callable[ [ Type[ T ] ], Type[ T ] ]: | ||
| """Decorate single input single output filter.""" |
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.
| """Decorate single input single output filter.""" | |
| """Decorate Single Input Single Output (SISO) filter.""" |
geos-pv/src/geos/pv/utils/details.py
Outdated
|
|
||
| def decorated_class( cls: Type[ T ] ) -> Type[ T ]: | ||
| """Outer wrapper function. All is in the WrappingClass below.""" | ||
| original_init = cls.__init__ |
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.
| original_init = cls.__init__ | |
| originalInit = cls.__init__ |
geos-pv/src/geos/pv/utils/details.py
Outdated
| return 1 | ||
|
|
||
| # Copy all methods and attributes from cls, including decorator metadata | ||
| for attr_name in dir(cls): |
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.
| for attr_name in dir(cls): | |
| for attrName in dir(cls): |
geos-pv/src/geos/pv/utils/details.py
Outdated
| @@ -0,0 +1,191 @@ | |||
| # SPDX-License-Identifier: Apache-2.0 | |||
| # SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies. | |||
| # SPDX-FileContributor: Martin Lemay, Romain Baville | |||
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.
| # SPDX-FileContributor: Martin Lemay, Romain Baville | |
| # SPDX-FileContributor: Martin Lemay, Romain Baville, Jacques Franc |
…t. Can still crash in some cases and will need separate PR to deal with it.
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 seems good to me, thank for your job.
As the pr #140 as been merged, the plugin PVGeomechanicsCalculator may also be refactor in this pr if you have the time. If not, I will do it after the merge.
| Args: | ||
| inputMesh : a dummy mesh to transform | ||
| outputMesh : a dummy mesh transformed | ||
| inputMesh : A dummy mesh to transform |
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.
| inputMesh : A dummy mesh to transform | |
| inputMesh : A dummy mesh to transform. |
| inputMesh : a dummy mesh to transform | ||
| outputMesh : a dummy mesh transformed | ||
| inputMesh : A dummy mesh to transform | ||
| outputMesh : A dummy mesh transformed |
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.
| outputMesh : A dummy mesh transformed | |
| outputMesh : A dummy mesh transformed. |
I don't think they can enter the protocol as they are heterogeneous in types (2 types in input a single type output) |
Among factorization effort, declaring more fit-for-use decorator that can minimize code duplication and boilerplate code. Here is a PR used in the case of Single Input Single Output PV Plugins that wrap a VTK plugin.
PVFillPartialArray