Skip to content

Commit

Permalink
Merge pull request #252 from bhosale2/remove_v0.3_deprecations
Browse files Browse the repository at this point in the history
remove deprecated v0.3 refs
  • Loading branch information
armantekinalp committed May 11, 2023
2 parents fed5ae0 + 552521d commit fe35b9b
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 46 deletions.
2 changes: 0 additions & 2 deletions docs/guide/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ rod1 = CosseratRod.straight_rod(
base_length=0.5, # original length of rod (m)
base_radius=10e-2, # original radius of rod (m)
density=1e3, # density of rod (kg/m^3)
nu=1e-3, # Energy dissipation of rod, internal damping constant, deprecated in v0.3.0
youngs_modulus=1e7, # Elastic Modulus (Pa)
shear_modulus=1e7/(2* (1+0.5)), # Shear Modulus (Pa)
)
Expand All @@ -75,7 +74,6 @@ rod2 = CosseratRod.straight_rod(
base_length=0.5, # original length of rod (m)
base_radius=10e-2, # original radius of rod (m)
density=1e3, # density of rod (kg/m^3)
nu=0.0, # Energy dissipation of rod, internal damping constant, deprecated in v0.3.0
youngs_modulus=1e7, # Elastic Modulus (Pa)
shear_modulus=1e7/(2* (1+0.5)), # Shear Modulus (Pa)
)
Expand Down
8 changes: 0 additions & 8 deletions elastica/_elastica_numba.py

This file was deleted.

6 changes: 0 additions & 6 deletions elastica/_elastica_numpy.py

This file was deleted.

15 changes: 5 additions & 10 deletions elastica/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
_batch_matrix_transpose,
_batch_vec_oneD_vec_cross,
)
import warnings


@njit(cache=True)
Expand Down Expand Up @@ -101,16 +100,12 @@ def node_to_element_mass_or_force(input):


def nodes_to_elements(input):
warnings.warn(
# Change the warning to error on v0.3.1
# Remove the function beyond v0.4.0
"This function is now deprecated (issue #80). Please use "
"elastica.interaction.node_to_element_mass_or_force() "
"instead for node-to-element interpolation of mass/forces. "
"The function will be removed in the future (v0.3.1).",
DeprecationWarning,
# Remove the function beyond v0.4.0
raise NotImplementedError(
"This function is removed in v0.3.1. Please use\n"
"elastica.interaction.node_to_element_mass_or_force()\n"
"instead for node-to-element interpolation of mass/forces."
)
return node_to_element_mass_or_force(input)


@njit(cache=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class InclinedRodRodContact(
inclined_rod_rod_contact_sim = InclinedRodRodContact()

# Simulation parameters
# old damping model (deprecated in v0.3.0) values
# dt = 5e-5
dt = 2.5e-4
final_time = 20
total_steps = int(final_time / dt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class ParallelRodRodContact(
parallel_rod_rod_contact_sim = ParallelRodRodContact()

# Simulation parameters
# old damping model (deprecated in v0.3.0) values
# dt = 5e-5
dt = 5e-4
final_time = 10
total_steps = int(final_time / dt)
Expand Down
26 changes: 10 additions & 16 deletions tests/test_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,24 +377,18 @@ def test_node_to_element_mass_or_force(self, n_elem):
assert_allclose(correct_output, output, atol=Tolerance.atol())
assert_allclose(np.sum(input), np.sum(output), atol=Tolerance.atol())

@pytest.mark.parametrize("n_elem", [2, 3, 5, 10, 20])
def test_deprecated_nodes_to_elements(self, n_elem):
@pytest.mark.parametrize("n_elem", [2, 10])
def test_not_impl_error_for_nodes_to_elements(self, n_elem):
random_vector = np.random.rand(3).reshape(3, 1)
input = np.repeat(random_vector, n_elem + 1, axis=1)
input[..., 0] *= 0.5
input[..., -1] *= 0.5
correct_output = np.repeat(random_vector, n_elem, axis=1)
correct_warning_message = (
"This function is now deprecated (issue #80). Please use "
"elastica.interaction.node_to_element_mass_or_force() "
"instead for node-to-element interpolation of mass/forces. "
"The function will be removed in the future (v0.3.1)."
)
with pytest.warns(DeprecationWarning) as record:
output = nodes_to_elements(input)
assert record[0].message.args[0] == correct_warning_message
assert_allclose(correct_output, output, atol=Tolerance.atol())
assert_allclose(np.sum(input), np.sum(output), atol=Tolerance.atol())
error_message = (
"This function is removed in v0.3.1. Please use\n"
"elastica.interaction.node_to_element_mass_or_force()\n"
"instead for node-to-element interpolation of mass/forces."
)
with pytest.raises(NotImplementedError) as error_info:
nodes_to_elements(input)
assert error_info.value.args[0] == error_message


class TestAnisotropicFriction:
Expand Down

0 comments on commit fe35b9b

Please sign in to comment.