Skip to content

Commit

Permalink
[Parameters] Implemented VertexGroupSupportParameter.index()
Browse files Browse the repository at this point in the history
  • Loading branch information
arpastrana committed Sep 20, 2024
1 parent 00acba6 commit 91acf77
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added `VertexSupportParameter.index()`. This change might appear redundant, but it was necessary to deal with the method resolution order of the parent classes of `VertexSupportParameter`.
- Added `VertexGroupSupportParameter.index()` for similar reasons as the listed above.

### Changed

- `VertexGroupSupportParameter` inherits from `VertexGroupParameter` instead of `NodeGroupParameter`. This was a bug.

### Removed


Expand Down
14 changes: 10 additions & 4 deletions src/jax_fdm/parameters/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,31 +407,37 @@ def __init__(self, *args, **kwargs):
# ==========================================================================


class VertexGroupSupportParameter(NodeGroupParameter):
class VertexGroupSupportParameter(VertexGroupParameter):
"""
Parametrize a group of support nodes.
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def index(self, model, structure):
"""
Get the indices of the keys of the parametrized vertices of the structure of a model.
"""
return [structure.support_index[key] for key in self.key]


class VertexGroupSupportXParameter(VertexGroupParameter, VertexSupportXParameter):
class VertexGroupSupportXParameter(VertexGroupSupportParameter, VertexSupportXParameter):
"""
Parametrize wiht a single value the X coordinate of a group of support nodes.
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)


class VertexGroupSupportYParameter(VertexGroupParameter, VertexSupportYParameter):
class VertexGroupSupportYParameter(VertexGroupSupportParameter, VertexSupportYParameter):
"""
Parametrize wiht a single value the Y coordinate of a group of support nodes.
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)


class VertexGroupSupportZParameter(VertexGroupParameter, VertexSupportZParameter):
class VertexGroupSupportZParameter(VertexGroupSupportParameter, VertexSupportZParameter):
"""
Parametrize wiht a single value the Z coordinate of a group of support nodes.
"""
Expand Down

0 comments on commit 91acf77

Please sign in to comment.