Skip to content

Commit

Permalink
Merge pull request #248 from bhosale2/240_refactor_ring_rod_factory
Browse files Browse the repository at this point in the history
(#240) refactor ring rod factory
  • Loading branch information
armantekinalp committed May 11, 2023
2 parents 3521ce1 + 0b013ac commit 6350ec6
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 324 deletions.
18 changes: 10 additions & 8 deletions elastica/rod/cosserat_rod.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
_batch_matvec,
)
from elastica._rotations import _inv_rotate
from elastica.rod.factory_function import allocate, allocate_ring_rod
from elastica.rod.factory_function import allocate
from elastica.rod.knot_theory import KnotTheory
from elastica._calculus import (
quadrature_kernel_for_block_structure,
Expand Down Expand Up @@ -302,6 +302,8 @@ def straight_rod(
"For reference see the class elastica.dissipation.AnalyticalLinearDamper(),\n"
"and for usage check examples/axial_stretching.py"
)
# Straight rod is not ring rod set flag to false
ring_rod_flag = False
(
n_elements,
position,
Expand Down Expand Up @@ -337,17 +339,16 @@ def straight_rod(
internal_couple,
) = allocate(
n_elements,
start,
direction,
normal,
base_length,
base_radius,
density,
youngs_modulus,
rod_origin_position=start,
ring_rod_flag=ring_rod_flag,
**kwargs,
)
# Straight rod is not ring rod set flag to false
ring_rod_flag = False

return cls(
n_elements,
Expand Down Expand Up @@ -448,6 +449,8 @@ def ring_rod(
"For reference see the class elastica.dissipation.AnalyticalLinearDamper(),\n"
"and for usage check examples/axial_stretching.py"
)
# Straight rod is not ring rod set flag to false
ring_rod_flag = True
(
n_elements,
position,
Expand Down Expand Up @@ -481,19 +484,18 @@ def ring_rod(
rest_kappa,
internal_stress,
internal_couple,
) = allocate_ring_rod(
) = allocate(
n_elements,
ring_center_position,
direction,
normal,
base_length,
base_radius,
density,
youngs_modulus,
rod_origin_position=ring_center_position,
ring_rod_flag=ring_rod_flag,
**kwargs,
)
# Straight rod is not ring rod set flag to false
ring_rod_flag = True

return cls(
n_elements,
Expand Down

0 comments on commit 6350ec6

Please sign in to comment.