summaryrefslogtreecommitdiff
path: root/src/main/MainUtils.c
blob: ac05d1e674b02c0c694280a027a6523a2fbee39a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
 /*@@
   @file      MainUtils.c
   @date      Sep 22 1999
   @author    Thomas Radke, Gabrielle Allen
   @desc 
   Utility Flesh routines
   @enddesc 
   @version $Header$
 @@*/

#include <string.h>

#include "cctk_Flesh.h"
#include "cctk_Misc.h"
#include "cctk_Schedule.h"
#include "cctk_Parameter.h"

static const char *rcsid = "$Header$";

CCTK_FILEVERSION(main_MainUtils_c)

/********************************************************************
 *********************     Local Data Types   ***********************
 ********************************************************************/

/********************************************************************
 ********************* Local Routine Prototypes *********************
 ********************************************************************/
int CCTK_RunTitle(int len, char *title);

/********************************************************************
 ********************* Other Routine Prototypes *********************
 ********************************************************************/

/********************************************************************
 *********************     Local Data   *****************************
 ********************************************************************/

/********************************************************************
 *********************     External Routines   **********************
 ********************************************************************/

 /*@@
   @routine    CCTK_RunTitle
   @date       Sun Sep 17 2000
   @author     Gabrielle Allen
   @desc 
   Returns the simulation description
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 
   @var     len
   @vdesc   The length of the title buffer
   @vtype   int
   @vio     in
   @vcomment 
 
   @endvar 
   @var     title
   @vdesc   The title buffer
   @vtype   char *
   @vio     out
   @vcomment 
 
   @endvar 

   @returntype int
   @returndesc 
   The length of the title
   - if title is NULL
   @endreturndesc
@@*/
int CCTK_RunTitle(int len, char *title)
{
  int retval; 
  int param_type;
  const char *cctk_title;

  cctk_title = (*(const char **)
		CCTK_ParameterGet("cctk_run_title",
				  "Cactus",
				  &param_type));
  
  if (cctk_title)
  {
    if (CCTK_Equals(cctk_title,""))
    {
      strncpy(title,"Cactus Simulation",len-1);
    }
    else
    {
      strncpy(title,cctk_title,len-1);
    }
    retval = strlen(title);
    retval=retval > len ? 0 : retval;
  }
  else
  {
    retval = -1;
  }
  return retval;
}

/********************************************************************
 *********************     Local Routines   *************************
 ********************************************************************/