@@ -2,7 +2,7 @@ using Tensorial: fromvoigt, ⊡, ⋅
2
2
3
3
import Tensorial: contraction, double_contraction
4
4
5
- export to_tensor, to_voigt, isequivalent, ⩵
5
+ export to_tensor, to_voigt, ⩵ , ⩶
6
6
7
7
TensorStress (σ:: EngineeringStress ) = TensorStress (σ[1 ], σ[6 ], σ[5 ], σ[2 ], σ[4 ], σ[3 ])
8
8
@@ -105,16 +105,34 @@ contraction(s::ComplianceTensor, σ::TensorStress, ::Val{2}) = TensorStrain(s.da
105
105
@inline double_contraction (s:: ComplianceTensor , σ:: TensorStress ) = contraction (s, σ, Val (2 ))
106
106
107
107
# See https://discourse.julialang.org/t/how-to-compare-two-vectors-whose-elements-are-equal-but-their-types-are-not-the-same/94309/6
108
+ for T in (
109
+ :EngineeringStrain ,
110
+ :EngineeringStress ,
111
+ :TensorStrain ,
112
+ :TensorStress ,
113
+ :StiffnessMatrix ,
114
+ :StiffnessTensor ,
115
+ :ComplianceMatrix ,
116
+ :ComplianceTensor ,
117
+ )
118
+ @eval begin
119
+ ⩵ (s:: $T , t:: $T ) = s == t
120
+ ⩵ (s, t:: $T ) = s isa $ T && s == t
121
+ ⩵ (s:: $T , t) = t ⩵ s
122
+ ⩶ (s, t:: $T ) = s === t
123
+ ⩶ (s:: $T , t) = t ⩶ s
124
+ end
125
+ end
108
126
for (S, T) in (
109
- (:EngineeringStress , :EngineeringStrain ),
110
- (:TensorStress , :TensorStrain ),
111
- (:StiffnessTensor , :ComplianceTensor ),
112
- (:StiffnessMatrix , :ComplianceMatrix ),
127
+ (:EngineeringStress , :TensorStress ),
128
+ (:EngineeringStrain , :TensorStrain ),
129
+ (:StiffnessMatrix , :StiffnessTensor ),
130
+ (:ComplianceMatrix , :ComplianceTensor ),
113
131
)
114
132
@eval begin
115
- isequivalent (s:: $S , t:: $T ) = false
116
- isequivalent (t:: $T , s:: $S ) = isequivalent (s, t)
133
+ ⩵ (s:: $S , t:: $T ) = to_voigt (t) ⩵ s
134
+ ⩵ (t:: $T , s:: $S ) = s ⩵ t
135
+ ⩶ (s:: $S , t:: $T ) = to_voigt (t) ⩶ s
136
+ ⩶ (t:: $T , s:: $S ) = s ⩶ t
117
137
end
118
138
end
119
- isequivalent (x, y) = x == y # Fallback
120
- const ⩵ = isequivalent
0 commit comments