Skip to content

Commit

Permalink
Merge pull request #196 from Loop3D/2d_3d_support
Browse files Browse the repository at this point in the history
fix: auto select support dimension
  • Loading branch information
lachlangrose authored Jun 4, 2024
2 parents d2e7e95 + 547fea0 commit 078b3e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
15 changes: 10 additions & 5 deletions LoopStructural/interpolators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,16 @@ class InterpolatorType(IntEnum):
}

support_interpolator_map = {
InterpolatorType.FINITE_DIFFERENCE: SupportType.StructuredGrid,
InterpolatorType.DISCRETE_FOLD: SupportType.TetMesh,
InterpolatorType.PIECEWISE_LINEAR: SupportType.TetMesh,
InterpolatorType.PIECEWISE_QUADRATIC: SupportType.P2UnstructuredTetMesh,
InterpolatorType.FINITE_DIFFERENCE: {
2: SupportType.StructuredGrid2D,
3: SupportType.StructuredGrid,
},
InterpolatorType.DISCRETE_FOLD: {3: SupportType.TetMesh, 2: SupportType.P1Unstructured2d},
InterpolatorType.PIECEWISE_LINEAR: {3: SupportType.TetMesh, 2: SupportType.P1Unstructured2d},
InterpolatorType.PIECEWISE_QUADRATIC: {
3: SupportType.P2UnstructuredTetMesh,
2: SupportType.P2Unstructured2d,
},
}


from ._interpolator_factory import InterpolatorFactory
4 changes: 3 additions & 1 deletion LoopStructural/interpolators/_interpolator_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ def create_interpolator(
interpolatortype = interpolator_string_map[interpolatortype]
if support is None:
# raise Exception("Support must be specified")
supporttype = support_interpolator_map[interpolatortype]

supporttype = support_interpolator_map[interpolatortype][boundingbox.dimensions]

support = SupportFactory.create_support_from_bbox(
supporttype,
bounding_box=boundingbox,
Expand Down

0 comments on commit 078b3e5

Please sign in to comment.