Skip to content

Commit

Permalink
Add + & - methods between TensorStresses, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
singularitti committed Nov 16, 2021
1 parent 9bb19eb commit f3ded58
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/LinearElasticity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,21 @@ Base.:*(B::Number, A::Union{Stress,Strain,Stiffness,Compliance}) = A * B
Base.:-(A::Union{Stress,Strain,Stiffness,Compliance}) =
constructorof(typeof(A))(Base.broadcast_preserving_zero_d(-, A))

for op in (:+, :-)
for T in (
:TensorStress,
:TensorStrain,
:EngineeringStress,
:EngineeringStrain,
:StiffnessMatrix,
:ComplianceMatrix,
:StiffnessTensor,
:ComplianceTensor,
)
@eval Base.$op(A::$T, B::$T) = $T(Base.broadcast_preserving_zero_d($op, A, B))
end
end

include("conversion.jl")
include("invariants.jl")
include("SymmetryCriteria.jl")
Expand Down

0 comments on commit f3ded58

Please sign in to comment.