summaryrefslogtreecommitdiff
path: root/src/main/SetParams.c
blob: 297b66d8aced8b008edfa20f3bf7d2cad9dcb092 (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
 /*@@
   @file      SetParams.c
   @date      Tue Jan 12 19:16:38 1999
   @author    Tom Goodale
   @desc 
   
   @enddesc 
 @@*/

#include <stdio.h>

static char *rcsid = "$Id$";

 /*@@
   @routine    CCTK_SetParameter
   @date       Tue Jan 12 19:25:37 1999
   @author     Tom Goodale
   @desc 
   
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 

@@*/
int CCTK_SetParameter(const char *parameter, const char *value)
{
  int retval;
  char thornname[101];
  const char *position;
  int length;
  
  if(CCTK_Equals(parameter, "ActiveThorns"))
  {
    position = value;

    while(*position)
    {
      length=0;

      for(;*position && *position != ' ';position++)
      {
	thornname[length] = *position;
	if(length < 100) length++;
      }

      thornname[length] = '\0';
      CCTK_ActivateThorn(thornname);
      if(position) position++;
    }
      CCTK_ActivateThorn("Cactus");
  }
  else
  {     
    retval = CCTK_BindingsParameterSet(parameter, value);
  }

  if(retval)
  {
    if(retval == -1)
    {
      fprintf(stderr, "Unknown parameter %s\n", parameter);
    }
  }

  return retval;
}