File: TestNarrowTimes.mesa
Last Edited by: Stolfi, April 17, 1984 8:28:53 pm PST
Tests the time taken by Narrows.
DIRECTORY
Buttons USING [ButtonProc, Create],
MessageWindow USING [Append],
ViewerClasses USING [Viewer];
TestNarrowTimes: CEDAR MONITOR
IMPORTS Buttons, MessageWindow = 
BEGIN

Constr: TYPE = REF ConstrRec; -- to some kind of constraint record

ConstrKind: TYPE = {hor, ver, para, perp, cong, at, ccw}; -- kind of constraint

ConstrRec: TYPE = RECORD

[link: Constr,
constr: SELECT kind: ConstrKind FROM

hor =>  -- Constrains (i,j) to be horizontal
[i, j: Point ← NIL],
ver =>  -- Constrains (i,j) to be vertical
[i, j: Point ← NIL],
para => -- Constrains (i,j), (k,l) to be parallel
[i, j, k, l: Point ← NIL],
perp => -- Constrains (i,j), (k,l) to be perpendicular (relative to the given frame)
[i, j, k, l: Point ← NIL],
cong => -- Constrains segments (i,j), (k,l) to be congruent (relative to the given frame)
[i, j, k, l: Point ← NIL],
at => -- Constrains p to have coordinates (x,y) (relative to the given frame)
[p: Point ← NIL,
x, y: REAL ← 0],
ccw =>  -- Constrains (i,j,k) to be counterclockwise (rel to frame)
[i, j, k: Point ← NIL],
ENDCASE];

Point: TYPE = REF PointRec;

PointRec: TYPE = RECORD

[x, y: REAL ← 0, -- coordinates of point.
-- The following stuff is used only by JunoOldSolver:
tempfixed: BOOLFALSE, -- (set by caller) TRUE = don't solve for this point.
xheader, yheader: INTEGER ← 0, -- indices of x and y in array
oldx, oldy: REAL ← 0, -- values of x, y in previous iteration.
-- The following stuff is used only by JunoTop, JunoImage:
frozen: BOOLFALSE, -- p was frozen by user.
visible: BOOLFALSE, -- false for control points of strings
wn: INTEGER ← 0, -- winding number; used only in TrackLoop
copy: Point ← NIL, -- used by CopyCmd.
name: REFNIL -- used when building procedures
];
FoolAny: PROC [list: LIST OF REF ANY] RETURNS [LIST OF REF ANY] = {
RETURN[list]
};
FoolPoint: PROC [list: LIST OF Point] RETURNS [LIST OF Point] = {
RETURN[list]
};
LotsaNarrows: PROC [list: LIST OF REF ANY] = {
MessageWindow.Append["Lotsa started...."];
THROUGH [1..100] DO
NARROW[list.first, Point].wn ← 0;
THROUGH [1..30000] DO
NARROW[FoolAny[list].first, Point].wn ← NARROW[list.first, Point].wn+1;
ENDLOOP;
ENDLOOP;
MessageWindow.Append["done. "]
};
NoNarrows: PROC [list: LIST OF Point] = {
MessageWindow.Append["Notsa started...."];
THROUGH [1..100] DO
list.first.wn ← 0;
THROUGH [1..30000] DO
FoolPoint[list].first.wn ← list.first.wn+1;
ENDLOOP;
ENDLOOP;
MessageWindow.Append["done. "]
};
WithButtonProc: ENTRY Buttons.ButtonProc = {
[parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL]
r: REF ANYNEW[PointRec];
LotsaNarrows[LIST[r]]
};
WithoutButtonProc: ENTRY Buttons.ButtonProc = {
[parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL]
r: Point ← NEW[PointRec];
NoNarrows[LIST[r]]
};
[] ← Buttons.Create[
info: [
name: "with",
parent: NIL],
proc: WithButtonProc,
documentation: "Tests Time with Lotsa NARROWS."];
[] ← Buttons.Create[
info: [
name: "without",
parent: NIL],
proc: WithoutButtonProc,
documentation: "Tests time without the No NARROWS."];
END.
CHANGE LOG
Created by Stolfi on April 17, 1984 7:58:04 pm PST