[Swift-commit] r5520 - SwiftApps/SciColSim

wilde at ci.uchicago.edu wilde at ci.uchicago.edu
Tue Jan 24 14:42:42 CST 2012


Author: wilde
Date: 2012-01-24 14:42:42 -0600 (Tue, 24 Jan 2012)
New Revision: 5520

Added:
   SwiftApps/SciColSim/TODO
Modified:
   SwiftApps/SciColSim/colortext.swift
   SwiftApps/SciColSim/math.swift
Log:
small changes and experiments in util functions. Added TODO.

Added: SwiftApps/SciColSim/TODO
===================================================================
--- SwiftApps/SciColSim/TODO	                        (rev 0)
+++ SwiftApps/SciColSim/TODO	2012-01-24 20:42:42 UTC (rev 5520)
@@ -0,0 +1,12 @@
+[x] Determine if one evolve() run in the optimizer.cpp code is sufficient. (yes -it does 1 woth reruns = 1
+
+Determine if and how to let the optimizer.cpp code do N reruns and how to set NWorkers accordingly (must evenly divide in current code).
+
+Determine annealing.swift output files needed.
+
+Align Swift and .cp code and do a correctness test.
+
+Do performance tests on Beagle and then other platforms (OSG, TG)
+
+Package code for ExM research.
+

Modified: SwiftApps/SciColSim/colortext.swift
===================================================================
--- SwiftApps/SciColSim/colortext.swift	2012-01-24 20:41:30 UTC (rev 5519)
+++ SwiftApps/SciColSim/colortext.swift	2012-01-24 20:42:42 UTC (rev 5520)
@@ -1,6 +1,16 @@
-global string e33=@arg("e33");
+global string e33; // = @sprintf("\\e") or  @arg("e33");
+
+if( @arg("e33","null") == "null" ) {
+  e33 = @sprintf("\\e");
+}
+else {
+  e33 = @arg("e33");
+}
+
 global string endEscape = "[0m";
 
+// Color codes used in Andrey's cpp optimizer:
+
 global int Black = 0;
 global int Blue = 1;
 global int BlackOnBlue = 2;
@@ -44,6 +54,11 @@
   s = @strcat(e33,colorCode[c],ins,e33,endEscape);
 }
 
+(string s) ncolor(int c, string ins) // Can use this version if \\e handling is available in current Swift
+{
+  s = @sprintf(@strcat("\\e",colorCode[c],ins,"\\e",endEscape));  // sprintf applies \\e escape processing
+}
+
 (string s) OLDcolor(int c, string ins)
 {
     switch(c){

Modified: SwiftApps/SciColSim/math.swift
===================================================================
--- SwiftApps/SciColSim/math.swift	2012-01-24 20:41:30 UTC (rev 5519)
+++ SwiftApps/SciColSim/math.swift	2012-01-24 20:42:42 UTC (rev 5520)
@@ -51,3 +51,26 @@
   result = @java("java.lang.Math","random");
 }
 
+// Functions below are exprimental and do not work
+// FIXME: fix 0.93 problems casting ints as doubles internally.
+//  This breaks the @java interface for Swift ints.
+
+(string result) itos (int i)
+{
+  result = @java("java.lang.Integer","toString",i);
+}
+
+(string result) itos2 (int i)
+{
+  result = @java("java.lang.String","valueOf",i);
+}
+
+(string result) ctos (int i)
+{
+  result = @java("java.lang.Character","valueOf",i);
+}
+
+(string result) format (string f, int c)
+{
+  result = @java("java.lang.String", "format", f, c );
+}




More information about the Swift-commit mailing list