예제 #1
0
/* check if this variable can be output (static conditions) */
static int CheckOutputVar (int vindex)
{
  int retval;
  int grouptype;
  char *fullname;


  /* check the variable type */
  grouptype = CCTK_GroupTypeFromVarI (vindex);
  retval = grouptype != CCTK_GF && grouptype != CCTK_ARRAY;
  if (retval)
  {
    fullname = CCTK_FullName (vindex);
    CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
                "CheckOutputVar: No IOASCII 1D output for '%s' (not a grid "
                "function or an array)", fullname);
    free (fullname);
  }

  return (retval);
}
예제 #2
0
/*@@
   @routine    IOBasic_TriggerScalarOutput
   @date       Sat March 6 1999
   @author     Gabrielle Allen
   @desc
               Triggers the output of a variable using IOBasic's Scalar
               output method
   @enddesc

   @var        GH
   @vdesc      Pointer to CCTK GH
   @vtype      const cGH *
   @vio        in
   @endvar
   @var        vindex
   @vdesc      index of variable to output
   @vtype      int
   @vio        in
   @endvar

   @returntype int
   @returndesc
               return code of @seeroutine IOBasic_WriteScalarGS or
               @seeroutine IOBasic_WriteScalarGA
   @endreturndesc
@@*/
int IOBasic_TriggerScalarOutput (const cGH *GH, int vindex)
{
  int retval;
  const char *name;
  iobasicGH *myGH;


  /* Get the GH extension for IOBasic */
  myGH = (iobasicGH *) CCTK_GHExtension (GH, "IOBasic");

  name = CCTK_VarName (vindex);

#ifdef IOBASIC_DEBUG
  printf ("\nIn IOBasic_TriggerScalarOutput\n---------------------\n");
  printf ("  Index = %d\n", vindex);
  printf ("  Variable = -%s-\n", name);
#endif

  /* Do the Scalar output */
  if (CCTK_GroupTypeFromVarI (vindex) == CCTK_SCALAR)
  {
    retval = IOBasic_WriteScalarGS (GH, vindex, name);
  }
  else
  {
    retval = IOBasic_WriteScalarGA (GH, vindex, name);
  }

  if (retval == 0)
  {
    /* Register variable as having Scalar output this iteration */
    myGH->outScalar_last [vindex] = GH->cctk_iteration;
  }

  return (retval);
}