Skip to content

Commit

Permalink
fix: ✨ adding support factory
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlangrose committed Oct 9, 2023
1 parent 82c0bd5 commit c3ec7a8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions LoopStructural/interpolators/supports/_support_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from LoopStructural.interpolators.supports import support_map, SupportType


class SupportFactory:
@staticmethod
def create_support(support_type, **kwargs):
if support_type is None:
raise ValueError("No support type specified")
if type(support_type) == str:
support_type = SupportType._member_map_[support_type].numerator
return support_map[support_type](**kwargs)

@staticmethod
def from_dict(d):
d = d.copy()
support_type = d.pop("type", None)
if support_type is None:
raise ValueError("No support type specified")
return SupportFactory.create_support(support_type, **d)

# @staticmethod
# def create_3d_structured_grid(origin, maximum, step_vector, nsteps)

0 comments on commit c3ec7a8

Please sign in to comment.