Skip to content

Commit

Permalink
Added reverse copy #30 & version bump (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccaprani authored May 3, 2023
1 parent 90224e7 commit 1e41565
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pycba/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
PyCBA - Continuous Beam Analysis in Python
"""

__version__ = "0.1.3"
__version__ = "0.2.0"

from .analysis import *
from .beam import *
Expand Down
16 changes: 13 additions & 3 deletions pycba/vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,28 @@ def __init__(self, axle_spacings: np.ndarray, axle_weights: np.ndarray):
for i, s in enumerate(self.axs):
self.axle_coords[i + 1] = self.axle_coords[i] + s

def reverse(self):
def reverse(self, in_place=True):
"""
Reverses the vehicle; now the `pos` coordinate will refer to the rear axle
as it traverses the bridge in reverse from zero in the global x-coordinate
system.
Parameters
----------
in_place : Bool
Whether or not to reverse the current vehicle (`True` - default),
or return a new copy of this vehicle reversed (`False`).
Returns
-------
None.
None or Vehicle.
"""
self.axle_coords = +self.L - self.axle_coords
if in_place:
self.axle_coords = +self.L - self.axle_coords
else:
return Vehicle(np.copy(self.axs[::-1]), np.copy(self.axw[::-1]))

@classmethod
def from_convoy(cls, vehicles: List[Vehicle], vehicle_spacings: np.ndarray):
Expand Down

0 comments on commit 1e41565

Please sign in to comment.