[cig-commits] r4457 - in cs/benchmark/trunk/benchmark: .
short/examples
baagaard at geodynamics.org
baagaard at geodynamics.org
Thu Aug 31 11:21:46 PDT 2006
Author: baagaard
Date: 2006-08-31 11:21:45 -0700 (Thu, 31 Aug 2006)
New Revision: 4457
Modified:
cs/benchmark/trunk/benchmark/CompareApp.py
cs/benchmark/trunk/benchmark/short/examples/compare_solns.py
Log:
Created callback for CompareApp::main instead of forcing user to add own code after calling run().
Modified: cs/benchmark/trunk/benchmark/CompareApp.py
===================================================================
--- cs/benchmark/trunk/benchmark/CompareApp.py 2006-08-31 14:56:29 UTC (rev 4456)
+++ cs/benchmark/trunk/benchmark/CompareApp.py 2006-08-31 18:21:45 UTC (rev 4457)
@@ -53,6 +53,7 @@
Constructor.
"""
Script.__init__(self, name)
+ self.mainfn = None
return
@@ -60,11 +61,11 @@
"""
Entry point for application.
- Don't know what user wants to do, so leave this empty and let
- them do whatever they want by adding stuff to a driver after a
- call to run(). By calling run(), Pythia handles ingestion of
- all of the parameters.
+ Call user provided 'main' if provided.
"""
+
+ if not self.mainfn is None:
+ self.mainfn(self)
return
Modified: cs/benchmark/trunk/benchmark/short/examples/compare_solns.py
===================================================================
--- cs/benchmark/trunk/benchmark/short/examples/compare_solns.py 2006-08-31 14:56:29 UTC (rev 4456)
+++ cs/benchmark/trunk/benchmark/short/examples/compare_solns.py 2006-08-31 18:21:45 UTC (rev 4457)
@@ -18,11 +18,11 @@
field = "displacements"
# ----------------------------------------------------------------------
-if __name__ == "__main__":
- from benchmark.CompareApp import CompareApp
- app = CompareApp()
- app.run()
-
+def local_main(app):
+ """
+ Local replacement for application 'main'.
+ """
+
projection = app.projection
projection.open()
@@ -72,4 +72,13 @@
# ----------------------------------------
projection.close()
+ return
+
+# ----------------------------------------------------------------------
+if __name__ == "__main__":
+ from benchmark.CompareApp import CompareApp
+ app = CompareApp()
+ app.mainfn = local_main
+ app.run()
+
# End of file
More information about the cig-commits
mailing list