Esempio n. 1
0
static int apply_line_modifier (Model_t *m, Model_Info_Type *info, DB_line_t *line, double *emis) /*{{{*/
{
   Plasma_State_Type lm_state;

   lm_state.temperature = m->temperature;
   lm_state.ndensity = m->density;

   SLang_start_arg_list ();
   SLang_push_array (info->line_emis_modifier_params, 0);
   SLang_push_int (line->indx);
   if (-1 == SLang_push_cstruct ((VOID_STAR)&lm_state, Plasma_State_Layout))
     return -1;
   SLang_push_double (*emis);
   if (info->line_emis_modifier_args != NULL)
     isis_push_args (info->line_emis_modifier_args);

   if (info->line_emis_modifier_qualifiers == NULL)
     {
        SLang_end_arg_list ();

        if (-1 == SLexecute_function (info->line_emis_modifier))
          return -1;
     }
   else
     {
        if ((-1 == SLang_push_function (info->line_emis_modifier))
            || (-1 == SLang_push_struct (info->line_emis_modifier_qualifiers)))
          return -1;

        SLang_end_arg_list ();

        if (-1 == SLang_execute_function ("_isis->do_eval_with_qualifiers"))
          return -1;
     }

   if (-1 == SLang_pop_double (emis))
     return -1;

   return 0;
}
Esempio n. 2
0
static void get_qualifiers_intrin (void)
{
   SLang_Struct_Type *q;
   if (0 == _pSLang_get_qualifiers (&q))
     (void) SLang_push_struct (q);
}
Esempio n. 3
0
static int call_ionpop_modifier (Model_t *m, Model_Info_Type *info, float *ionpop_new) /*{{{*/
{
   Plasma_State_Type s;
   SLang_Array_Type *sl_ionpop = NULL;
   int Z, q, status = -1;
   int n = ISIS_MAX_PROTON_NUMBER;

   s.temperature = m->temperature;
   s.ndensity = m->density;

   /* Float_Type[n,n] = ionpop_modifier (params, state, last_ionpop, [,args]) */
   SLang_start_arg_list ();
   SLang_push_array (info->ionpop_params, 0);
   if (-1 == SLang_push_cstruct ((VOID_STAR)&s, Plasma_State_Layout))
     {
        SLang_end_arg_list ();
        return -1;
     }
   SLang_push_array (m->last_ionpop, 0);
   if (info->ionpop_args != NULL)
     isis_push_args (info->ionpop_args);

   if (info->ionpop_qualifiers == NULL)
     {
        SLang_end_arg_list ();

        if (-1 == SLexecute_function (info->ionpop_modifier))
          return -1;
     }
   else
     {
        if ((-1 == SLang_push_function (info->ionpop_modifier))
            || (-1 == SLang_push_struct (info->ionpop_qualifiers)))
          return -1;

        SLang_end_arg_list ();

        if (-1 == SLang_execute_function ("_isis->do_eval_with_qualifiers"))
          return -1;
     }

   if (-1 == SLang_pop_array_of_type (&sl_ionpop, SLANG_FLOAT_TYPE))
     return -1;

   if ((sl_ionpop == NULL)
       || (sl_ionpop->num_dims != 2)
       || ((sl_ionpop->dims[0] != n+1) || (sl_ionpop->dims[1] != n+1)))
     {
        isis_vmesg (FAIL, I_ERROR, __FILE__, __LINE__,
                    "ionpop_modifier: invalid return value, expecting: Float_Type[n,n] with n=%d", n+1);
        goto return_status;
     }

   for (Z = 1; Z <= n; Z++)
     {
        for (q = 0; q <= Z; q++)
          {
             int i[2];
             i[0] = Z;  i[1] = q;
             if (-1 == SLang_get_array_element (sl_ionpop, i, &ionpop_new[Z*(n+1)+q]))
               goto return_status;
          }
     }

   SLang_free_array (m->last_ionpop);
   m->last_ionpop = sl_ionpop;

   status = 0;
return_status:
   if (status != 0)
     {
       SLang_free_array (sl_ionpop);
     }

   return status;
}