Ejemplo n.º 1
0
 Ord Hermes1DFunction<Scalar>::value(Ord x) const
 {
   if (this->is_const)
     return Ord(0);
   else
   {
     throw Hermes::Exceptions::MethodNotOverridenException("Hermes1DFunction<Scalar>::value");
     return Ord(99);
   }
 };
Ejemplo n.º 2
0
 Ord Hermes3DFunction<Scalar>::derivative_z(Ord x, Ord y, Ord z) const
 {
   if (this->is_const)
     return Ord(0);
   else
   {
     throw Hermes::Exceptions::MethodNotOverridenException("Hermes3DFunction<Scalar>::derivative_z");
     return Ord(99);
   }
 };
Ejemplo n.º 3
0
int CTranscription::TengHash(unsigned char c)
{
   size_t n;

   for(unsigned int i=0;i<equivs.count();i++)
   {
     n=equivs[i].find(c);
     if(n != std::string::npos)
       return Ord(equivs[i][0]);
   }
   return Ord(c);
}
Ejemplo n.º 4
0
bool TIniFile::ReadBool(const wxString &Section, const wxString &Ident,
  bool Default)
{
	bool result;
	result = ReadInteger(Section, Ident, Ord(Default)) != 0;
	return result;
}
Ejemplo n.º 5
0
Ord CustomWeakForm::CustomVectorFormSurface::ord(int n, double *wt, Func<Ord> *u_ext[], Func<Ord> *v, Geom<Ord> *e, Func<Ord> **ext) const
{
  Ord result = Ord(0);
  for (int i = 0; i < n; i++)
    result += -wt[i] * v->val[i];
  return result;
}
Ejemplo n.º 6
0
Ord CustomWeakFormHeatRK::CustomFormResidualVol::ord(int n, double *wt, Func<Ord> *u_ext[], Func<Ord> *v, 
                                                     Geom<Ord> *e, ExtData<Ord> *ext) const 
{
  Func<Ord>* u_prev_newton = u_ext[0];
  // Return the polynomial order of the gradient increased by five to account for lambda(x, y).
  return (u_prev_newton->dx[0] * v->dx[0] + u_prev_newton->dy[0] * v->dy[0]) * Ord(5);
}
Ejemplo n.º 7
0
Ord CustomWeakForm::JacobianFormSurf_0_0::ord(int n, double *wt, Func<Ord> *u_ext[], 
                                     Func<Ord> *vj, Func<Ord> *vi, Geom<Ord> *e, ExtData<Ord> *ext) const
{
  Ord result = Ord(0);
  for (int i = 0; i < n; i++)
    result += wt[i] * (kappa * vj->val[i] * vi->val[i]);
  return result;
}
Ejemplo n.º 8
0
Ord CustomWeakForm::ResidualFormSurf_0::ord(int n, double *wt, Func<Ord> *u_ext[], 
                                 Func<Ord> *vi, Geom<Ord> *e, ExtData<Ord> *ext) const
{
  Ord result = Ord(0);
  Func<Ord>* t_prev_newton = u_ext[0];
  for (int i = 0; i < n; i++)
    result += wt[i] * (kappa * t_prev_newton->val[i] * vi->val[i]);
  return result;
}
Ejemplo n.º 9
0
Ord CustomWeakForm::JacobianFormVol_0_1::ord(int n, double *wt, Func<Ord> *u_ext[], 
                                Func<Ord> *vj, Func<Ord> *vi, Geom<Ord> *e, ExtData<Ord> *ext) const
{
  Ord result = Ord(0);
  Func<Ord>* domegady = ext->fn[0];
  for (int i = 0; i < n; i++)
    result += wt[i] * (- domegady->val[i] * vj->val[i] * vi->val[i] );
  return result;
}
Ejemplo n.º 10
0
Ord CustomWeakForm::JacobianFormVol_1_0::ord(int n, double *wt, Func<Ord> *u_ext[], 
                                Func<Ord> *vj, Func<Ord> *vi, Geom<Ord> *e, Func<Ord> **ext) const
{
  Ord result = Ord(0);
  Func<Ord>* domegadt = ext[0];
  for (int i = 0; i < n; i++)
    result += wt[i] * ( domegadt->val[i] * vj->val[i] * vi->val[i] );
  return result;
}
Ejemplo n.º 11
0
Ord WeakFormNSSimpleLinearization::VectorFormVolVel::ord(int n, double *wt, Func<Ord> *u_ext[], Func<Ord> *v, Geom<Ord> *e, ExtData<Ord> *ext) const
{
    Ord result = Ord(0);
    if(!Stokes) {
        Func<Ord>* vel_prev_time = ext->fn[0]; // this form is used with both velocity components
        result = int_u_v<Ord, Ord>(n, wt, vel_prev_time, v) / time_step;
    }
    return result;
}
Ejemplo n.º 12
0
Ord DefaultResidualMagnetostatics::ord(int n, double *wt, Func<Ord> *u_ext[], Func<Ord> *v,
                                       Geom<Ord> *e, ExtData<Ord> *ext) const {
    Ord planar_part = 0;
    for (int i = 0; i < n; i++) {
        Ord B_i = sqrt(sqr(u_ext[0]->dx[i]) + sqr(u_ext[0]->dy[i]));
        planar_part += wt[i] * const_coeff*spline_coeff->get_value(B_i) *
                       (u_ext[0]->dx[i] * v->dx[i] + u_ext[0]->dy[i] * v->dy[i]);
    }
    return planar_part * Ord(order_increase);
}
Ejemplo n.º 13
0
Ord CustomWeakFormPicard::CustomResidual::ord(int n, double *wt, Func<Ord> *u_ext[], Func<Ord> *v, 
                                              Geom<Ord> *e, Func<Ord> **ext) const 
{
  Ord result = Ord(0);
  for (int i = 0; i < n; i++) 
  {
    result += wt[i] * f->value(e->x[i], e->y[i]) * v->val[i];
  }
  return result;
}
Ejemplo n.º 14
0
Ord WeakFormNSNewton::VectorFormNS_2::ord(int n, double *wt, Func<Ord> *u_ext[], Func<Ord> *v, Geom<Ord> *e, Func<Ord>* *ext) const 
{
  Ord result = Ord(0);
  Func<Ord>* xvel_prev_newton = u_ext[0];  
  Func<Ord>* yvel_prev_newton = u_ext[1];  

  for (int i = 0; i < n; i++)
    result += wt[i] * (xvel_prev_newton->dx[i] * v->val[i] + yvel_prev_newton->dy[i] * v->val[i]);
  return result;
}
Ejemplo n.º 15
0
Ord CustomWeakForm::CustomFormAdvection::ord(int n, double *wt, Func<Ord> *u_ext[], Func<Ord> *u, Func<Ord> *v,
  Geom<Ord> *e, Func<Ord> **ext) const
{
  Ord result = Ord(0);
  for (int i = 0; i < n; i++) 
  {
    result += wt[i] * (ext[0]->dx[i] * u->dx[i] + ext[0]->dy[i] * u->dy[i]) * v->val[i];
  }
  return result;
}
Ejemplo n.º 16
0
Archivo: init.c Proyecto: jfmc/yap-6.3
static int
OpDec(int p, const char *type, Atom a, Term m)
{
  int             i;
  AtomEntry      *ae = RepAtom(a);
  OpEntry        *info;

  if (m == TermProlog)
    m = PROLOG_MODULE;
  else if (m == USER_MODULE)
    m = PROLOG_MODULE;
  for (i = 1; i <= 7; ++i)
    if (strcmp(type, optypes[i]) == 0)
      break;
  if (i > 7) {
    Yap_Error(DOMAIN_ERROR_OPERATOR_SPECIFIER,MkAtomTerm(Yap_LookupAtom(type)),"op/3");
    return(FALSE);
  }
  if (p) {
    if (i == 1 || i == 2 || i == 4)
      p |= DcrlpFlag;
    if (i == 1 || i == 3 || i == 6)
      p |= DcrrpFlag;
  }
  WRITE_LOCK(ae->ARWLock);
  info = Yap_GetOpPropForAModuleHavingALock(ae, m);
  if (EndOfPAEntr(info)) {
    info = (OpEntry *) Yap_AllocAtomSpace(sizeof(OpEntry));
    info->KindOfPE = Ord(OpProperty);
    info->OpModule = m;
    info->OpName = a;
    //LOCK(OpListLock);
    info->OpNext = OpList;
    OpList = info;
    //UNLOCK(OpListLock);
    AddPropToAtom(ae, (PropEntry *)info);
    INIT_RWLOCK(info->OpRWLock);
    WRITE_LOCK(info->OpRWLock);
    WRITE_UNLOCK(ae->ARWLock);
    info->Prefix = info->Infix = info->Posfix = 0;
  } else {
    WRITE_LOCK(info->OpRWLock);
    WRITE_UNLOCK(ae->ARWLock);
  }
  if (i <= 3) {
    GET_LD
    if (truePrologFlag(PLFLAG_ISO) &&
	info->Posfix != 0) /* there is a posfix operator */ {
      /* ISO dictates */
      WRITE_UNLOCK(info->OpRWLock);
      Yap_Error(PERMISSION_ERROR_CREATE_OPERATOR,MkAtomTerm(a),"op/3");
      return FALSE;
    }
    info->Infix = p;
  } else if (i <= 5) {
Ejemplo n.º 17
0
Ord WeakFormNSNewton::BilinearFormNonsymVel_1_0::ord(int n, double *wt, Func<Ord> *u_ext[], Func<Ord> *u, Func<Ord> *v, Geom<Ord> *e,
        ExtData<Ord> *ext) const
{
    Ord result = Ord(0);
    if(!Stokes) {
        Func<Ord>* yvel_prev_newton = u_ext[0];
        for (int i = 0; i < n; i++)
            result += wt[i] * (u->val[i] * v->val[i] * yvel_prev_newton->dx[i]);
    }
    return result;
}
Ejemplo n.º 18
0
Ord CustomWeakForm::JacobianFormVol_1_1::ord(int n, double *wt, Func<Ord> *u_ext[], 
                                Func<Ord> *vj, Func<Ord> *vi, Geom<Ord> *e, Func<Ord> **ext) const
{
  Ord result = Ord(0);
  Func<Ord>* domegady = ext[1];
  for (int i = 0; i < n; i++)
    result += wt[i] * (  1.5 * vj->val[i] * vi->val[i] / tau
                      +  (vj->dx[i] * vi->dx[i] + vj->dy[i] * vi->dy[i]) / Le
                      + domegady->val[i] * vj->val[i] * vi->val[i] );
  return result;
}
Ejemplo n.º 19
0
Ord CustomWeakFormPicard::CustomJacobian::ord(int n, double *wt, Func<Ord> *u_ext[], 
                                              Func<Ord> *u, Func<Ord> *v,
                                              Geom<Ord> *e, Func<Ord> **ext) const 
{
  Ord result = Ord(0);
  for (int i = 0; i < n; i++) 
  {
    result += wt[i] * lambda->value(u_ext[0]->val[i]) * (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i]);
  }
  return result;
}
Ejemplo n.º 20
0
Ord WeakFormNSSimpleLinearization::BilinearFormNonsymVel::ord(int n, double *wt, Func<Ord> *u_ext[], Func<Ord> *u, Func<Ord> *v, Geom<Ord> *e,
        ExtData<Ord> *ext) const
{
    Ord result = Ord(0);
    if(!Stokes) {
        Func<Ord>* xvel_prev_time = ext->fn[0];
        Func<Ord>* yvel_prev_time = ext->fn[1];
        result = int_w_nabla_u_v<Ord, Ord>(n, wt, xvel_prev_time, yvel_prev_time, u, v);
    }
    return result;
}
Ejemplo n.º 21
0
Ord WeakFormNSNewton::BilinearFormNonsymVel_0_1::ord(int n, double *wt, Func<Ord> *u_ext[], Func<Ord> *u, Func<Ord> *v, GeomVol<Ord> *e,
  Func<Ord>* *ext) const
{
  Ord result = Ord(0);
  if (!Stokes)
  {
    Func<Ord>* xvel_prev_newton = u_ext[0];
    for (int i = 0; i < n; i++)
      result += wt[i] * u->val[i] * xvel_prev_newton->dy[i] * v->val[i];
  }
  return result;
}
Ejemplo n.º 22
0
Archivo: 81.c Proyecto: zyxstar/md_note
void Distribute(SLList *L,int i,ArrType f,ArrType e)    /*Distribute() function */
{  int j,p;
   for(j=0;j<RD;j++)
      f[j]=0;
   for(p=L->r[0].next;p;p=L->r[p].next)
   {  j=Ord(L->r[p].keys[i]);                              /*call Ord() */
      if(!f[j])
         f[j]=p;
      else
         L->r[e[j]].next=p;
      e[j]=p;
   }/*end of for */
}/*end of Distrubute() function */
Ejemplo n.º 23
0
Archivo: code65.c Proyecto: begoon/asl
END

/*---------------------------------------------------------------------------*/

static void ChkZero(char *Asc, Byte *erg)
{
  if ((strlen(Asc) > 1) && ((*Asc == '<') || (*Asc == '>')))
  {
    *erg = Ord(*Asc == '<') + 1;
    strmov(Asc, Asc + 1);
  }
  else
    *erg = 0;
}
Ejemplo n.º 24
0
Ord ErrorForm::ord(int n, double *wt, Func<Ord> *u_ext[],
                   Func<Ord> *u, Func<Ord> *v, Geom<Ord> *e,
                   ExtData<Ord> *ext) const
{
  switch (projNormType)
  {
    case HERMES_L2_NORM:
      return l2_error_form_axisym<Ord, Ord>(n, wt, u_ext, u, v, e, ext);
    case HERMES_H1_NORM:
      return h1_error_form_axisym<Ord, Ord>(n, wt, u_ext, u, v, e, ext);
    default:
      error("Only the H1 and L2 norms are currently implemented.");
      return Ord();
  }
}
Ejemplo n.º 25
0
Ord CustomResidual2::ord(int n, double *wt, Func<Ord> *u_ext[], Func<Ord> *v,
                                 Geom<Ord> *e, ExtData<Ord> *ext) const 
{
   Ord result = Ord(0);
   for (int i = 0; i < n; i++) 
   {
     result += wt[i] * (    d_v*d_v * (u_ext[1]->dx[i]*v->dx[i] + u_ext[1]->dy[i]*v->dy[i]) 
                          - u_ext[0]->val[i]*v->val[i] 
                          + u_ext[1]->val[i]*v->val[i]
                          - g2->value(e->x[i], e->y[i])*v->val[i]
                        );
   }

  return result;
} 
Ejemplo n.º 26
0
Ord CustomWeakForm::ResidualFormVol_0::ord(int n, double *wt, Func<Ord> *u_ext[], 
                            Func<Ord> *vi, Geom<Ord> *e, Func<Ord> **ext) const
{
  Ord result = Ord(0);
  Func<Ord>* titer = u_ext[0];
  Func<Ord>* t_prev_time_1 = ext[2];
  Func<Ord>* t_prev_time_2 = ext[3];
  Func<Ord>* omega = ext[6];
  for (int i = 0; i < n; i++)
    result += wt[i] * ( (3.0 * titer->val[i] - 4.0 * t_prev_time_1->val[i] 
                         + t_prev_time_2->val[i]) * vi->val[i] / (2.0 * tau) +
                        (titer->dx[i] * vi->dx[i] + titer->dy[i] * vi->dy[i]) -
                        omega->val[i] * vi->val[i]);
  return result;
}
Ejemplo n.º 27
0
Ord CustomWeakForm::ResidualFormVol_1::ord(int n, double *wt, Func<Ord> *u_ext[], 
                            Func<Ord> *vi, Geom<Ord> *e, ExtData<Ord> *ext) const
{
  Ord result = Ord(0);
  Func<Ord>* c_prev_newton = u_ext[1];
  Func<Ord>* c_prev_time_1 = ext->fn[0];
  Func<Ord>* c_prev_time_2 = ext->fn[1];
  Func<Ord>* omega = ext->fn[2];
  for (int i = 0; i < n; i++)
		result += wt[i] * ( (3.0 * c_prev_newton->val[i] - 4.0 * c_prev_time_1->val[i] + c_prev_time_2->val[i])
                         * vi->val[i] / (2.0 * tau) +
                        (c_prev_newton->dx[i] * vi->dx[i] + c_prev_newton->dy[i] * vi->dy[i]) / Le +
                        omega->val[i] * vi->val[i]);
  return result;
}
Ejemplo n.º 28
0
Ord WeakFormNSNewton::VectorFormNS_1::ord(int n, double *wt, Func<Ord> *u_ext[], Func<Ord> *v, Geom<Ord> *e, Func<Ord>* *ext) const 
{
  Ord result = Ord(0);  
  Func<Ord>* yvel_prev_time = ext[0];
  Func<Ord>* xvel_prev_newton = u_ext[0];  
  Func<Ord>* yvel_prev_newton = u_ext[1];  
  Func<Ord>* p_prev_newton = u_ext[2];
  for (int i = 0; i < n; i++)
    result += wt[i] * ((xvel_prev_newton->dx[i] * v->dx[i] + xvel_prev_newton->dy[i] * v->dy[i]) / Reynolds 
                       - (p_prev_newton->val[i] * v->dx[i]));
  if(!Stokes)
    for (int i = 0; i < n; i++)
      result += wt[i] * (((yvel_prev_newton->val[i] - yvel_prev_time->val[i]) * v->val[i] / time_step )
                         + ((xvel_prev_newton->val[i] * xvel_prev_newton->dx[i] 
                         + yvel_prev_newton->val[i] * xvel_prev_newton->dy[i]) * v->val[i]));
  return result;
}
Ejemplo n.º 29
0
Ord DefaultJacobianMagnetostatics::ord(int n, double *wt, Func<Ord> *u_ext[], Func<Ord> *u, Func<Ord> *v,
                                       Geom<Ord> *e, ExtData<Ord> *ext) const {
    Ord planar_part = 0;
    for (int i = 0; i < n; i++) {
        Ord B_i = sqrt(sqr(u_ext[0]->dx[i]) + sqr(u_ext[0]->dy[i]));
        planar_part += wt[i] * const_coeff*spline_coeff->get_derivative(B_i) / B_i
                       * (u_ext[0]->dx[i] * u->dx[i] + u_ext[0]->dy[i] * u->dy[i])
                       * (u_ext[0]->dx[i] * v->dx[i] + u_ext[0]->dy[i] * v->dy[i]);
        planar_part += wt[i] * const_coeff*spline_coeff->get_value(B_i)
                       * (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i]);
    }

    // This increase is for the axisymmetric part. We are not letting the
    // Ord class do it since it would automatically choose the highest order
    // due to the nonpolynomial 1/r term.
    return planar_part * Ord(order_increase);
}
Ejemplo n.º 30
0
Geom<Ord> init_geom(int marker) {
	_F_

	Geom<Ord> e;
	e.marker = marker;

	static Ord x[] = { Ord(1) };
	static Ord y[] = { Ord(1) };
	static Ord z[] = { Ord(1) };

	static Ord nx[] = { Ord(1) };
	static Ord ny[] = { Ord(1) };
	static Ord nz[] = { Ord(1) };

	static Ord tx[] = { Ord(1) };
	static Ord ty[] = { Ord(1) };
	static Ord tz[] = { Ord(1) };

	e.x = x; e.y = y; e.z = z;
	e.nx = nx; e.ny = ny; e.nz = nz;
	e.tx = tx; e.ty = ty; e.tz = tz;
	return e;
}