Skip to content

Commit d6341d9

Browse files
committed
ST6RI-526 Made SpatialItem::self and localClock referential.
- Edited VectorFunctions slightly. - Corrected KerML library model for FeatureChainExpression, CollectExpression and SelectExpression.
1 parent cb0cd3f commit d6341d9

3 files changed

Lines changed: 16 additions & 15 deletions

File tree

sysml.library/Domain Libraries/Geometry/SpatialItems.sysml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ package SpatialItems {
1717
* A SpatialItem is an Item with a three-dimensional spatial extent that also acts as a SpatialFrame of reference.
1818
*/
1919
item def SpatialItem :> SpatialFrame {
20-
item :>> self : SpatialItem;
20+
ref item :>> self : SpatialItem;
2121

2222
/**
2323
* A local Clock to be used as the corresponding time reference within this SpatialItem.
2424
* By default this is the global defaultClock.
2525
*/
26-
item localClock : Clock[1] default Time::defaultClock;
26+
ref item localClock : Clock[1] default Time::defaultClock;
2727

2828
/**
2929
* The three-dimensional VectorMeasurementReference to be used as the measurement reference for position

sysml.library/Kernel Library/KerML.kerml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ package KerML {
7171
struct LiteralInfinity :> LiteralExpression;
7272
struct NullExpression :> Expression;
7373
struct OperatorExpression :> InvocationExpression;
74-
struct PathStepExpression :> OperatorExpression;
75-
struct PathSelectExpression :> OperatorExpression;
74+
struct FeatureChainExpression :> OperatorExpression;
75+
struct CollectExpression :> OperatorExpression;
76+
struct SelectExpression :> OperatorExpression;
7677

7778
struct Interaction :> Behavior, Association;
7879
struct ItemFlow :> Step, Connector;

sysml.library/Kernel Library/VectorFunctions.kerml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ package VectorFunctions {
7575
* Scalar product of a NumericalVectorValue and a NumericalValue, which has the same value as the scalar product of the
7676
* NumericalValue and the NumericalVectorValue.
7777
*/
78-
abstract function vectorScalarMult specializes DataFunctions::'*' (v: NumericalVectorValue[1], x: NumericalValue[1]): NumericalVectorValue[1] {
78+
abstract function vectorScalarMult specializes DataFunctions::'*' (v: NumericalVectorValue[1], x: NumericalValue[1]) w: NumericalVectorValue[1] {
7979
scalarVectorMult(x, v)
8080
}
8181

8282
/**
8383
* Scalar quotient of a NumericalVectorValue and a NumericalValue, defined as the scalar product of the inverse of the
8484
* NumericalValue and the NumericalVectorValue.
8585
*/
86-
abstract function vectorScalarDiv specializes DataFunctions::'/' (v: NumericalVectorValue[1], x: NumericalValue[1]): NumericalVectorValue[1] {
86+
abstract function vectorScalarDiv specializes DataFunctions::'/' (v: NumericalVectorValue[1], x: NumericalValue[1]) w: NumericalVectorValue[1] {
8787
scalarVectorMult(1.0 / x, v)
8888
}
8989

@@ -117,13 +117,13 @@ package VectorFunctions {
117117
* Construct a CartesianVectorValue whose elements are a non-empty list of Real components.
118118
* The dimension of the NumericalVectorValue is equal to the number of components.
119119
*/
120-
function CartesianVectorOf(components : Real[*]) : CartesianVectorValue {
120+
function CartesianVectorOf(components: Real[*]): CartesianVectorValue {
121121
CartesianVectorValue (
122122
dimension = size(components),
123123
elements = components
124124
)
125125
}
126-
function CartesianThreeVectorOf specializes CartesianVectorOf(components: Real[*]): CartesianThreeVectorValue;
126+
function CartesianThreeVectorOf specializes CartesianVectorOf(components: Real[3]): CartesianThreeVectorValue;
127127

128128
/**
129129
* Cartesian zero vectors of 1, 2 and 3 dimensions.
@@ -144,15 +144,15 @@ package VectorFunctions {
144144
v.elements->forAll{in x; x == 0.0}
145145
}
146146

147-
function 'cartesian+' specializes '+' (v: CartesianVectorValue[1], w: CartesianVectorValue[0..1]): CartesianVectorValue[1] {
147+
function 'cartesian+' specializes '+' (v: CartesianVectorValue[1], w: CartesianVectorValue[0..1]) u: CartesianVectorValue[1] {
148148
inv precondition { w != null implies v.dimension == w.dimension }
149149
if w == null? v
150150
else CartesianVectorOf(
151151
(1..w.dimension)->collect{in i : Positive; v[i] + w[i]}
152152
)
153153
}
154154

155-
function 'cartesian-' specializes '-' (v: CartesianVectorValue[1], w: CartesianVectorValue[0..1]): CartesianVectorValue[1] {
155+
function 'cartesian-' specializes '-' (v: CartesianVectorValue[1], w: CartesianVectorValue[0..1]) u: CartesianVectorValue[1] {
156156
inv precondition { w != null implies v.dimension == w.dimension }
157157
CartesianVectorOf(
158158
if w == null? CartesianVectorOf(v.elements->collect{in x : Real; -x})
@@ -162,25 +162,25 @@ package VectorFunctions {
162162
)
163163
}
164164

165-
function cartesianScalarVectorMult specializes scalarVectorMult (x: Real[1], v: CartesianVectorValue[1]): CartesianVectorValue[1] {
165+
function cartesianScalarVectorMult specializes scalarVectorMult (x: Real[1], v: CartesianVectorValue[1]) w: CartesianVectorValue[1] {
166166
CartesianVectorOf(
167167
v.elements->collect{in y : Real; x * y}
168168
)
169169
}
170-
function cartesianVectorScalarMult specializes vectorScalarMult (v: CartesianVectorValue[1], x: Real[1]): CartesianVectorValue[1] {
170+
function cartesianVectorScalarMult specializes vectorScalarMult (v: CartesianVectorValue[1], x: Real[1]) w: CartesianVectorValue[1] {
171171
cartesianScalarVectorMult(x, v)
172172
}
173173

174-
function cartesianInner specializes inner(v: CartesianVectorValue[1], w : CartesianVectorValue[1]): Real[1]{
174+
function cartesianInner specializes inner(v: CartesianVectorValue[1], w : CartesianVectorValue[1]) x: Real[1]{
175175
inv precondition { v.dimension == w.dimension }
176176
(1..v.dimension)->collect{in i : Positive; v[i] * w[i]}->reduce RealFunctions::'+'
177177
}
178178

179-
function cartesianNorm specializes norm(v: CartesianVectorValue[1]) : NumericalValue[1] {
179+
function cartesianNorm specializes norm(v: CartesianVectorValue[1]) l : NumericalValue[1] {
180180
sqrt(cartesianInner(v, v))
181181
}
182182

183-
function cartesianAngle specializes angle(v: CartesianVectorValue[1], w: CartesianVectorValue[1]): Real[1] {
183+
function cartesianAngle specializes angle(v: CartesianVectorValue[1], w: CartesianVectorValue[1]) theta: Real[1] {
184184
inv precondition { v.dimension == w.dimension }
185185
arccos(cartesianInner(v, w) / (norm(v) * norm(w)))
186186
}

0 commit comments

Comments
 (0)