aboutsummaryrefslogtreecommitdiff
path: root/src/Content.c
diff options
context:
space:
mode:
authorgoodale <goodale@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2000-09-20 20:36:02 +0000
committergoodale <goodale@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2000-09-20 20:36:02 +0000
commit07b6471179a5937d345bbabd23a2b2dd4ef6da0c (patch)
treeb84ace296537223aff7c7cfa4e56b3d4878ae8a5 /src/Content.c
parenta6c41c514585e34820beaa0161e74cb95b51bf8f (diff)
Updated control page to allow single stepping and running until a
condition is true. Also made some formatting fixes so works properly under lynx, and added some explanatory text. Tom git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@70 1faa4e14-9dd3-4be0-9f0e-ffe519881164
Diffstat (limited to 'src/Content.c')
-rw-r--r--src/Content.c206
1 files changed, 187 insertions, 19 deletions
diff --git a/src/Content.c b/src/Content.c
index 8ee3a8a..e9378fe 100644
--- a/src/Content.c
+++ b/src/Content.c
@@ -1071,6 +1071,8 @@ static int ControlPage(cGH *cctkGH, httpRequest *request, void *data)
/* Start the page */
strcpy(message, "<HTML><HEAD><TITLE>Cactus Control and Status Page</TITLE>\n");
+
+ HTTP_Write(request, message, strlen(message));
HTTP_ContentHeader(0,4098,message);
strcat(message, "<center><h1>Control and Status Page</h1></center>");
@@ -1086,23 +1088,39 @@ static int ControlPage(cGH *cctkGH, httpRequest *request, void *data)
strcpy(message,
"<CENTER>\n"
- "<FORM action=\"/control.html\" method=\"GET\">\n"
+ "<FORM action=\"/control.html\" method=\"GET\">\n");
+
+ HTTP_Write(request, message, strlen(message));
+
+ strcpy(message,
+ "<H4> Run Control </H4>\n"
+ "<p> Select if the run should be paused, running normally, or terminated."
+ " You may also single step to the next iteration.</p>");
+
+ HTTP_Write(request, message, strlen(message));
+
+ strcpy(message,
"<TABLE BORDER= 0 CELLSPACING=5 CELLPADDING=5>\n"
"<TR>\n");
+
HTTP_Write(request, message, strlen(message));
sprintf(message,
- "<TD align=left valign=center><INPUT type=\"radio\" name=\"runstate\" %s value=\"PAUSE\"> PAUSE<BR></TD>\n",
+ "<TD align=left valign=center><INPUT type=\"radio\" name=\"runstate\" %s value=\"PAUSE\"> PAUSE</TD>\n",
pause ? "checked" : "");
HTTP_Write(request, message, strlen(message));
sprintf(message,
- "<TD align=left valign=center><INPUT type=\"radio\" name=\"runstate\" %s value=\"RUN\"> RUN<BR></TD>\n",
+ "<TD align=left valign=center><INPUT type=\"radio\" name=\"runstate\" %s value=\"RUN\"> RUN</TD>\n",
pause ? "" : "checked");
HTTP_Write(request, message, strlen(message));
strcpy(message,
- "<TD align=left valign=center><INPUT type=\"radio\" name=\"runstate\" value=\"TERMINATE\"> TERMINATE<BR></TD>\n");
+ "<TD align=left valign=center><INPUT type=\"radio\" name=\"runstate\" value=\"TERMINATE\"> TERMINATE</TD>\n");
+ HTTP_Write(request, message, strlen(message));
+
+ strcpy(message,
+ "<TD align=left valign=center><INPUT type=\"submit\" name=\"step\" value=\"STEP\"></TD>\n");
HTTP_Write(request, message, strlen(message));
strcpy(message,
@@ -1110,7 +1128,42 @@ static int ControlPage(cGH *cctkGH, httpRequest *request, void *data)
"<TABLE>\n"
"<TR><TD><INPUT type=\"submit\" value=\"OK\"></TD><TD> <INPUT type=\"reset\"></TD>\n"
"</TR>\n"
- "</TABLE>\n"
+ "</TABLE>\n");
+
+ HTTP_Write(request, message, strlen(message));
+
+ strcpy(message,
+ "<H4> Run Until </H4>\n"
+ "<p> The following parameters allow you to select an iteration number"
+ " or physical time at which the code will pause.\n"
+ " You may also choose to pause if a particular expression made up"
+ " of grid scalars, simulation time and iteration is true. \n"
+ " Note that even if 'run' is selected above, the settings here have"
+ " precedence. </p>");
+
+ HTTP_Write(request, message, strlen(message));
+
+ strcpy(message,
+ "<TABLE>\n");
+
+ sprintf(message,"%s<TR><TD>Iteration</TD>"
+ "<TD><INPUT type=\"text\" value=\"%d\" name=\"iteration\"></TD>"
+ "<TD><INPUT type=\"checkbox\" value=\"yes\" %s name=\"until_it_active\"></TD>\n"
+ "</TR>\n", message, until_it, until_it_active ? "checked" : "");
+ sprintf(message,"%s<TR><TD>Time</TD>"
+ "<TD><INPUT type=\"text\" value=\"%f\" name=\"time\"></TD>"
+ "<TD><INPUT type=\"checkbox\" value=\"yes\" %s name=\"until_time_active\"></TD>\n"
+ "</TR>\n", message, until_time, until_time_active ? "checked" : "");
+ sprintf(message,"%s<TR><TD>Expression</TD>"
+ "<TD><INPUT type=\"text\" value=\"%s\" name=\"expression\"></TD>"
+ "<TD><INPUT type=\"checkbox\" value=\"yes\" %s name=\"until_expression_active\"></TD>\n"
+ "</TR>\n", message, until_expression, until_expression_active ? "checked" : "");
+
+ strcat(message,"</TABLE>\n");
+
+ HTTP_Write(request, message, strlen(message));
+
+ strcpy(message,
"</FORM>\n"
"</CENTER>\n");
@@ -1167,26 +1220,141 @@ static int ControlPage(cGH *cctkGH, httpRequest *request, void *data)
@@*/
static int ControlSet(cGH *cctkGH, httpRequest *request)
{
+ DECLARE_CCTK_PARAMETERS
char message[4098];
- const char *runstate;
+ const char *value;
- runstate = HTTP_ArgumentValue(request,"runstate");
+ /* What is the runstate ? */
+ value = HTTP_ArgumentValue(request,"runstate");
- switch(*runstate)
+ if(value)
{
- case 'T' : HTTP_SteerQueue(CCTK_THORNSTRING, "terminate", "yes");
- ControlTerminationPage(cctkGH, request);
- break;
- case 'P' : HTTP_SteerQueue(CCTK_THORNSTRING, "pause", "yes");
- break;
- case 'R' : HTTP_SteerQueue(CCTK_THORNSTRING, "pause", "no");
- break;
- default :
- fprintf(stderr, "Unknown runstate '%s'\n", runstate);
+ switch(*value)
+ {
+ case 'T' : HTTP_SteerQueue(CCTK_THORNSTRING, "terminate", "yes");
+ ControlTerminationPage(cctkGH, request);
+ break;
+ case 'P' : HTTP_SteerQueue(CCTK_THORNSTRING, "pause", "yes");
+ break;
+ case 'R' : HTTP_SteerQueue(CCTK_THORNSTRING, "pause", "no");
+ break;
+ default :
+ fprintf(stderr, "Unknown runstate '%s'\n", value);
+ }
}
+
+ /* Is single stepping switched on ? */
+ value = HTTP_ArgumentValue(request,"step");
- /* Now redirect the browser to the normal page */
- /* Status message */
+ if(value)
+ {
+ HTTP_SteerQueue(CCTK_THORNSTRING, "single_step", "yes");
+ }
+
+ /****************************************************************************
+ *************** Is running until an iteration switched on ? ****************
+ */
+ value = HTTP_ArgumentValue(request,"until_it_active");
+
+ if(value)
+ {
+ /* Value exists, so must be yes */
+ if(!until_it_active)
+ {
+ HTTP_SteerQueue(CCTK_THORNSTRING, "until_it_active", "yes");
+ }
+ }
+ else
+ {
+ /* Value doesn't exist, so must be no */
+ if(until_it_active)
+ {
+ HTTP_SteerQueue(CCTK_THORNSTRING, "until_it_active", "no");
+ }
+ }
+
+ /* Now look at the value and steer it if it's changed */
+ value = HTTP_ArgumentValue(request,"iteration");
+
+ if(value)
+ {
+ if(atoi(value) != until_it)
+ {
+ HTTP_SteerQueue(CCTK_THORNSTRING, "until_it", value);
+ }
+ }
+
+ /****************************************************************************
+ *************** Is running until a particular time switched on ? ***********
+ */
+ value = HTTP_ArgumentValue(request,"until_time_active");
+
+ if(value)
+ {
+ /* Value exists, so must be yes */
+ if(!until_time_active)
+ {
+ HTTP_SteerQueue(CCTK_THORNSTRING, "until_time_active", "yes");
+ }
+ }
+ else
+ {
+ /* Value doesn't exist, so must be no */
+ if(until_time_active)
+ {
+ HTTP_SteerQueue(CCTK_THORNSTRING, "until_time_active", "no");
+ }
+ }
+
+ /* Now look at the value and steer it if it's changed */
+ value = HTTP_ArgumentValue(request,"time");
+
+ if(value)
+ {
+ if(atof(value) != until_time)
+ {
+ HTTP_SteerQueue(CCTK_THORNSTRING, "until_time", value);
+ }
+ }
+
+ /****************************************************************************
+ *************** Is running until an expression is true switched on ? *******
+ */
+ value = HTTP_ArgumentValue(request,"until_expression_active");
+
+ if(value)
+ {
+ /* Value exists, so must be yes */
+ if(!until_expression_active)
+ {
+ HTTP_SteerQueue(CCTK_THORNSTRING, "until_expression_active", "yes");
+ }
+ }
+ else
+ {
+ /* Value doesn't exist, so must be no */
+ if(until_expression_active)
+ {
+ HTTP_SteerQueue(CCTK_THORNSTRING, "until_expression_active", "no");
+ }
+ }
+
+ /* Now look at the value and steer it if it's changed */
+ value = HTTP_ArgumentValue(request,"expression");
+
+ if(value)
+ {
+ if(!CCTK_Equals(value,until_expression))
+ {
+ HTTP_SteerQueue(CCTK_THORNSTRING, "until_expression", value);
+ }
+ }
+
+ /****************************************************************************
+ **************** Now redirect the browser to the normal page ***************
+ */
+
+ /* Status message */
if(request->http_major_version < 1 ||
(request->http_major_version == 1 && request->http_minor_version < 1))
{