-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGetDistance.mod
More file actions
13 lines (13 loc) · 1 KB
/
Copy pathGetDistance.mod
File metadata and controls
13 lines (13 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
@#define Indices1 = [ IndicesArray[ ((Point1-1)*SpatialDimensions+1):(Point1*SpatialDimensions) ] ]
@#define Indices2 = [ IndicesArray[ ((Point2-1)*SpatialDimensions+1):(Point2*SpatialDimensions) ] ]
@#define Distance = "( 0 "
@#for Dimension in 1 : SpatialDimensions
@#if SpatialShape[1] == "P"
@#define DistanceTemp = "abs( " + Numbers[Indices1[Dimension]] + "/" + Numbers[SpatialPointsPerDimension] + " - " + Numbers[Indices2[Dimension]] + "/" + Numbers[SpatialPointsPerDimension] + " )"
@#define Distance = Distance + " + " + DistanceTemp + " ^ ( " + SpatialNorm + " )"
@#else
@#define DistanceTemp = "abs( " + Numbers[Indices1[Dimension]] + "/" + Numbers[SpatialPointsPerDimension+1] + " - " + Numbers[Indices2[Dimension]] + "/" + Numbers[SpatialPointsPerDimension+1] + " )"
@#define Distance = Distance + " + min( " + DistanceTemp + " , 1 - " + DistanceTemp + " ) ^ ( " + SpatialNorm + " )"
@#endif
@#endfor
@#define Distance = Distance + " ) ^ ( 1 / ( " + SpatialNorm + " ) )"