예제 #1
0
krb5_error_code KRB5_CALLCONV
krb5_get_profile (krb5_context ctx, profile_t *profile)
{
    return profile_copy (ctx->profile, profile);
}
예제 #2
0
파일: model.c 프로젝트: hoogerheide/garefl
void model_profile(model *m, profile *p)
{
  int layer, repeat_start, R, R_start, R_end, R_count;

  profile_reset(p);

  /* Insert vacuum layers */
  if (!profile_extend(p,1)) return;
  profile_slice(p,10.,m->rho[0],m->mu[0]
#ifdef HAVE_MAGNETIC
		,m->P[0],m->theta[0]
#endif
		);
  add_interface_left(m,p,0,1);
  p->vacuum_offset = profile_depth(p); /* vacuum interface thickness */

  /* initialize R_start, R_end, R_count */
  model_repeat(m,R=0,&R_start,&R_end,&R_count);

  repeat_start = -1;
  for (layer=1; layer<m->n-1; layer++) {
    /* Remember where the repeat section starts */
    if (layer == R_start+1) repeat_start = p->n;

    /* Check if we need to repeat */
    if (layer == R_end) {
      /* The interface between repeats is different from the
       * interface into the first repeat and out of the last
       * repeat. So instead of repeating R1 R2 R3 R4 as in:
       *       Ln|R1 R2 R3 R4|R1 R2 R3 R4|R1 R2 R3 R4|Ln+1
       * we have to repeat R2 R3 R1 as in:
       *       Ln R1*|R2 R3 R4 R1|R2 R3 R4 R1|R2 R3 R4* Ln+1
       * with the last repeat only extending from R_start+1 to
       * R_end-1.
       *
       * At this point we have:
       *       Ln R1*|R2 R3
       * so we need to add R4 and R1 to complete the repeating
       * section, then copy that section R_count-2 times (first
       * repeat is done, last repeat is special), then copy
       * what we have of the last repeat, leaving us at:
       *       Ln R1* R2 R3 R4 R1 R2 R3 R4 R1 R2 R3
       * and layer == R4, so continue as normal. */
      int r, repeat_length, repeat_interface;

      repeat_interface = p->n;

      /* add interface between repeating sections */
      add_layer(m,p,R_end-1,R_end,R_start);
      add_layer(m,p,R_end,R_start,R_start+1);

      /* do bulk repeats of R_start+1 to R_start */
      assert(repeat_start > 0);
      repeat_length = p->n - repeat_start;
      profile_extend(p,R_count*repeat_length); /* make sure there is room */
      for (r=1; r < R_count-1; r++)
	profile_copy(p, repeat_start, repeat_length);

      /* copy layers from R_start to I_start */
      profile_copy(p, repeat_start, repeat_interface-repeat_start);

      /* Look for next repeat */
      model_repeat(m,++R,&R_start,&R_end,&R_count);
      repeat_start = -1;
    }
    add_layer(m,p,layer-1,layer,layer+1);
  }

  /* Insert substrate layers */
  add_interface_right(m,p,layer-1,layer);
  if (!profile_extend(p,1)) return;
  profile_slice(p,10.,m->rho[layer],m->mu[layer]
#ifdef HAVE_MAGNETIC
		,m->P[layer],m->theta[layer]
#endif
		);

  /* Convert polar to cartesian for magnetic layers */
  profile_expth(p);
}