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

#include <stdio.h>

#include "cctk.h"

#include "WarnLevel.h"

static char *rcsid = "$Id$";

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

@@*/
int CCTKi_SetParameter(const char *parameter, const char *value)
{
  int retval;
  char thornname[101];
  const char *position;
  int length;
  int n_errors;

  retval = 0;

  if(CCTK_Equals(parameter, "ActiveThorns"))
  {
    n_errors = 0;
    position = value;

    while(*position)
    {
      length=0;

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

      thornname[length] = '\0';
      n_errors += CCTKi_ActivateThorn(thornname) != 0;
      if(*position) position++;
    }

    if(n_errors)
    {
      CCTK_WARN(0, "Errors while activating thorns\n");
    }
  }
  else
  {     
    retval = CCTKi_BindingsParameterSet(parameter, value);
  }

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

  return retval;
}