当前位置: 首页>>代码示例>>C++>>正文


C++ NODE::Getno方法代码示例

本文整理汇总了C++中NODE::Getno方法的典型用法代码示例。如果您正苦于以下问题:C++ NODE::Getno方法的具体用法?C++ NODE::Getno怎么用?C++ NODE::Getno使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NODE的用法示例。


在下文中一共展示了NODE::Getno方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sqrt

void EQS_KD2D::Validate( PROJECT* project, int np, NODE** node,
                         int ne, NODE** cent, ELEM** elem )
{
  // -------------------------------------------------------------------------------------
  // Check K and D for minmum flow velocity (Reynolds number) in surrounding nodes

  // define the limit of Re, where K and D will be set to their minimum
  double minRe = 10.0;

  // for each node: determine the maximum Reynolds number from surrounding nodes
  double* maxRe = (double*) MEMORY::memo.Array_nd( np );

  for( int n=0; n<np; n++ )
  {
    NODE* nd = node[n];
    int   no = nd->Getno();

    double U = nd->v.U;
    double V = nd->v.V;
    double H = nd->v.S - nd->z;

    maxRe[no] = 4.0 * H * sqrt( U*U + V*V ) / project->vk;

    // check also surrounding nodes, if Reynolds number is too small at node ndi
    if( maxRe[no] < minRe )
    {
      for( int j=0; j<nd->noel; j++ )
      {
        ELEM* el = nd->el[j];

        for( int k=0; k<el->Getncn(); k++ )
        {
          NODE* ndk = el->Getnode(k);

          double U  = ndk->v.U;
          double V  = ndk->v.V;
          double H  = ndk->v.S - ndk->z;
          double Re = H * 4.0 * sqrt( U*U + V*V ) / project->vk;

          if( Re > maxRe[no] )
          {
            maxRe[no] = Re;
            if( maxRe[no] > minRe )  break;
          }
        }

        if( maxRe[no] > minRe )  break;
      }
    }
  }

# ifdef _MPI_
  project->subdom.Mpi_max( maxRe );
# endif

  for( int n=0; n<np; n++ )
  {
    NODE* nd = node[n];
    int   no = nd->Getno();

    // set the turbulence at nodes with very small Reynolds numbers to the minimum
    if( maxRe[no] < minRe )
    {
      nd->v.K = project->minK;
      nd->v.D = project->minD;
    }
  }

  MEMORY::memo.Detach( maxRe );


  if( quarterShape )
  {
    for( int e=0; e<ne; e++ )
    {
      ELEM* el = elem[e];
      if( isFS( el->flag, ELEM::kRegion)  &&  el->Getncn() == 4 )
      {
        int   no = el->Getno();

        NODE* nd = cent[no];

        double U = nd->v.U;
        double V = nd->v.V;
        double H = nd->v.S - nd->z;

        double c_maxRe = 4.0 * H * sqrt( U*U + V*V ) / project->vk;

        // check also surrounding nodes, if Reynolds number is too small at node ndi
        if( c_maxRe < minRe )
        {
          for( int k=0; k<el->Getncn(); k++ )
          {
            NODE* ndk = el->Getnode(k);

            double U  = ndk->v.U;
            double V  = ndk->v.V;
            double H  = ndk->v.S - ndk->z;
            double Re = H * 4.0 * sqrt( U*U + V*V ) / project->vk;

//.........这里部分代码省略.........
开发者ID:markuszi,项目名称:Rismo2D,代码行数:101,代码来源:EqsKD2D.cpp

示例2:

double* MODEL::Rot2D()
{
  int np = region->Getnp();
  int ne = region->Getne();


  // -------------------------------------------------------------------------------------
  // allocate memory for rotation of flow field
  // -------------------------------------------------------------------------------------

  double* rot = (double*) MEMORY::memo.Array_nd( np );
  double* wgt = (double*) MEMORY::memo.Array_nd( np );

  for( int n=0; n<np; n++ )  rot[n] = wgt[n] = 0.0;


  // -------------------------------------------------------------------------------------
  // loop on elements
  // -------------------------------------------------------------------------------------

  for( int e=0; e<ne; e++ )
  {
    ELEM* elem = region->Getelem(e);

    SHAPE* shape = elem->GetQShape();

    int ngp = shape->ngp;          // number of GAUSS points
    int nnd = shape->nnd;          // number of corner nodes


    // -----------------------------------------------------------------------------------
    // compute coordinates relative to first node

    double x[kMaxNodes2D], y[kMaxNodes2D];

    x[0] = elem->nd[0]->x;
    y[0] = elem->nd[0]->y;

    for( int i=1; i<nnd; i++ )
    {
      x[i] = elem->nd[i]->x - *x;
      y[i] = elem->nd[i]->y - *y;
    }
    x[0] = y[0] = 0.0;


    // -----------------------------------------------------------------------------------
    // use GAUSS point integration to solve momentum and continuity

    for( int g=0; g<ngp; g++ )
    {
      // form JACOBIAN transformation matrix ---------------------------------------------

      double  trafo[2][2];

      double* dfdxPtr = shape->dfdx[g];
      double* dfdyPtr = shape->dfdy[g];

      double detj   = shape->jacobi2D( nnd, dfdxPtr, dfdyPtr, x, y, trafo );
      double weight = detj * shape->weight[g];

      // compute values of shape functions at GP g ---------------------------------------

      double* n = shape->f[g];

      double dndx[kMaxNodes2D], dndy[kMaxNodes2D];

      for( int i=0; i<nnd; i++ )
      {
        dndx[i] = trafo[0][0] * dfdxPtr[i] + trafo[0][1] * dfdyPtr[i];
        dndy[i] = trafo[1][0] * dfdxPtr[i] + trafo[1][1] * dfdyPtr[i];
      }

      // compute flow parameters and their derivatives -----------------------------------

      double dUdy = 0.0;
      double dVdx = 0.0;

      for( int i=0; i<nnd; i++ )
      {
        NODE* node = elem->nd[i];

        dUdy += dndy[i] * node->v.U;
        dVdx += dndx[i] * node->v.V;
      }

      // compute rotation ----------------------------------------------------------------

      double f = weight * ( dVdx - dUdy );

      for( int i=0; i<nnd; i++ )
      {
        NODE* nd = elem->nd[i];
        int   no = nd->Getno();

        rot[no] += f;
        wgt[no] += weight;
      }
    }
  }
//.........这里部分代码省略.........
开发者ID:pm-schroeder,项目名称:Rismo2D,代码行数:101,代码来源:Rot2D.cpp

示例3: MPI_Comm_Dry


//.........这里部分代码省略.........
          NODE* nd = inface[s].node[n];

          inface[s].send[3*n]   = nd->v.U;
          inface[s].send[3*n+1] = nd->v.V;
          inface[s].send[3*n+2] = nd->v.S;
        }
      }
    }

    for( int s=0; s<subdom->npr; s++ )
    {
      int npinf = inface[s].np;

      if( npinf > 0 )
      {
        MPI_Sendrecv( inface[s].send, 3*npinf, MPI_DOUBLE, s, 1,
                      inface[s].recv, 3*npinf, MPI_DOUBLE, s, 1,
                      MPI_COMM_WORLD, &status );

        for( int n=0; n<npinf; n++ )
        {
          NODE* nd = inface[s].node[n];
          SUB* sub = nd->sub;

          while( sub )
          {
            if( sub->no == s )
            {
              if( !sub->dry )
              {
                nd->v.U += inface[s].recv[3*n];
                nd->v.V += inface[s].recv[3*n+1];
                nd->v.S += inface[s].recv[3*n+2];
                cnt[nd->Getno()]++;
              }
            }
            sub = sub->next;
          }
        }
      }
    }

    for( int n=0; n<rgnp; n++ )
    {
      if( cnt[n] > 1 )
      {
        NODE* nd = region->Getnode(n);

        nd->v.U /= cnt[n];
        nd->v.V /= cnt[n];
        nd->v.S /= cnt[n];
      }
    }

    MEMORY::memo.Detach( cnt );
  }

# ifdef kDebug_2
  {
    char text[200];

    sprintf( text, "### DEBUGGING: List of dry interface nodes...\n\n" );
    REPORT::rpt.Output( text, 1 );

    for( int s=0; s<subdom->npr; s++ )
    {
开发者ID:markuszi,项目名称:Rismo2D,代码行数:67,代码来源:DoDryRew.cpp

示例4:

void EQS_D2D::Validate( int np, NODE** node, PROJECT* project )
{
//  for( int iter=0; iter<1000; iter++ )
//  {
//    int further = false;
//
//    for( int i=0; i<np; i++ )
//    {
//      NODE* nd = node[i];
//
//      if( isFS(nd->flag, NODE::kDry) )  continue;
//
//      double U  = nd->v.U;
//      double V  = nd->v.V;
//      double Us = sqrt( nd->cf * (U*U + V*V) );
//
//      double H  = nd->v.S - nd->z;
//      if( H <= 0.0 ) H = project->hmin;
//
//      if( nd->v.D <= 0.0 )
//      {
//        further = true;
//
//        int noel = nd->noel;
//
//        double Dave = 0.0;
//        int    cntD = 0;
//
//        for( int j=0; j<noel; j++ )
//        {
//          ELEM* el = nd->el[j];
//
//          for( int k=0; k<el->getnnd(); k++ )
//          {
//            double D = el->nd[k]->v.D;
//            if( D > 0.0 )
//            {
//              Dave += D;
//              cntD++;
//            }
//          }
//        }
//
//        // ***PENDING*** MPI broadcasting of averaged values ...
//
//        if( cntD > 0 )
//        {
//          nd->v.D = Dave / cntD;
//        }
//      }
//    }
//
//    if( !further )  break;
//  }


  // -------------------------------------------------------------------------------------

  for( int i=0; i<np; i++ )
  {
    NODE* nd = node[i];
    int   no = nd->Getno();

    if( isFS(nd->flag, NODE::kDry) )  continue;

    if( nd->v.D < project->minD )
    {
      nd->v.K = project->minK;
      nd->v.D = project->minD;
    }
  }
}
开发者ID:markuszi,项目名称:Rismo2D,代码行数:72,代码来源:EqsD2D.cpp

示例5: removeFront

int REORDER::removeFront( ELEM *el, REOFRONT **frnt, int num )
{
   int i, ncn;

   ncn = el->Getncn();

   el->mark = false;

   for( i=0; i<ncn; i++ )
   {
      NODE *nd;
      REOFRONT *fr, *fr_prev;

      nd = el->nd[i];

      fr      = *frnt;
      fr_prev = NULL;

      while( fr )
      {
         if( fr->node == nd )  break;

         fr_prev = fr;
         fr      = fr->next;
      }

      // wenn der Knoten in der Liste steht ...

      if( fr )
      {
         fr->miss++;

         if( fr->miss == nd->noel )
         {
            // Knoten war mit dem Element 'el' neu hinzugekommen
            // und kann nun wieder entfernt werden
            num--;

            if( fr_prev )
               fr_prev->next = fr->next;
            else
               *frnt = fr->next;
         }
      }

      // ... andernfalls wird er nun wieder aktiv

      else
      {
         if( nd->noel > 1 )
         {
            fr = &frontPtr[nd->Getno()];

            if( fr_prev )
               fr_prev->next = fr;
            else
               *frnt = fr;

            fr->next = NULL;
            fr->miss = 1;
            num++;
         }
      }
   }

   return num;
}
开发者ID:markuszi,项目名称:Rismo2D,代码行数:67,代码来源:Reorder.cpp

示例6: updateFront

int REORDER::updateFront( ELEM *el, REOFRONT **frnt, int num, int histflg )
{
   int i, ncn;

   ncn = el->Getncn();

   el->mark = true;

   for( i=0; i<ncn; i++ )
   {
      NODE *nd;
      REOFRONT *fr, *fr_prev;

      nd = el->nd[i];

      fr      = *frnt;
      fr_prev = NULL;

      while( fr )
      {
         if( fr->node == nd )  break;

         fr_prev = fr;
         fr      = fr->next;
      }


      // wenn der Knoten bereits in der Liste steht ...

      if ( fr )
      {
         fr->miss--;

         if ( !fr->miss )
         {
            // Knoten ist mit dem Element 'el' komplett und
            // wird aus der Liste aktiver Knoten entfernt

            num--;
            if (histflg)
               fr->hist = 0;

            if (fr_prev)
               fr_prev->next = fr->next;
            else
               *frnt = fr->next;
         }
      }


      // ... andernfalls wird er an die Liste angehaengt

      else
      {
         if( nd->noel > 1)
         {
            fr = &frontPtr[nd->Getno()];

            if( fr_prev )
               fr_prev->next = fr;
            else
               *frnt = fr;

            fr->next = NULL;
            fr->miss = nd->noel - 1;

            if( histflg )
               fr->hist = hist_cnt++;

            num++;
         }
      }
   }

   return (num);
}
开发者ID:markuszi,项目名称:Rismo2D,代码行数:76,代码来源:Reorder.cpp


注:本文中的NODE::Getno方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。