/** Get a sum of the tags of the contained items. There is no
     *  guarantee that this is unique, but there is a high chance it
     *  is unique and it can be used for debug checks relatively
     *  reliably.
     */
    TaggedObject::Tag GetTagSum() const
    {
      TaggedObject::Tag tag = 0;

      if (IsValid(x())) {
        tag += x()->GetTag();
      }
      if (IsValid(s())) {
        tag += s()->GetTag();
      }
      if (IsValid(y_c())) {
        tag += y_c()->GetTag();
      }
      if (IsValid(y_d())) {
        tag += y_d()->GetTag();
      }
      if (IsValid(z_L())) {
        tag += z_L()->GetTag();
      }
      if (IsValid(z_U())) {
        tag += z_U()->GetTag();
      }
      if (IsValid(v_L())) {
        tag += v_L()->GetTag();
      }
      if (IsValid(v_U())) {
        tag += v_U()->GetTag();
      }

      return tag;
    }
Esempio n. 2
0
  SmartPtr<IteratesVector> IteratesVector::MakeNewContainer() const
  {
    SmartPtr<IteratesVector> ret = MakeNewIteratesVector(false);

    if (IsValid(x())) {
      ret->Set_x(*x());
    }
    if (IsValid(s())) {
      ret->Set_s(*s());
    }
    if (IsValid(y_c())) {
      ret->Set_y_c(*y_c());
    }
    if (IsValid(y_d())) {
      ret->Set_y_d(*y_d());
    }
    if (IsValid(z_L())) {
      ret->Set_z_L(*z_L());
    }
    if (IsValid(z_U())) {
      ret->Set_z_U(*z_U());
    }
    if (IsValid(v_L())) {
      ret->Set_v_L(*v_L());
    }
    if (IsValid(v_U())) {
      ret->Set_v_U(*v_U());
    }

    return ret;

    // We may need a non const version
    //     if (IsCompConst(0)) {
    //       ret->Set_x(*x());
    //     }
    //     else {
    //       ret->Set_x_NonConst(*x_NonConst());
    //     }

    //     if (IsCompConst(1)) {
    //       ret->Set_s(*s());
    //     }
    //     else {
    //       ret->Set_s_NonConst(*s_NonConst());
    //     }

    //     if (IsCompConst(2)) {
    //       ret->Set_y_c(*y_c());
    //     }
    //     else {
    //       ret->Set_y_c_NonConst(*y_c_NonConst());
    //     }

    //     if (IsCompConst(3)) {
    //       ret->Set_y_d(*y_d());
    //     }
    //     else {
    //       ret->Set_y_d_NonConst(*y_d_NonConst());
    //     }

    //     if (IsCompConst(4)) {
    //       ret->Set_z_L(*z_L());
    //     }
    //     else {
    //       ret->Set_z_L_NonConst(*z_L_NonConst());
    //     }

    //     if (IsCompConst(5)) {
    //       ret->Set_z_U(*z_U());
    //     }
    //     else {
    //       ret->Set_z_U_NonConst(*z_U_NonConst());
    //     }

    //     if (IsCompConst(6)) {
    //       ret->Set_v_L(*v_L());
    //     }
    //     else {
    //       ret->Set_v_L_NonConst(*v_L_NonConst());
    //     }

    //     if (IsCompConst(7)) {
    //       ret->Set_v_U(*v_U());
    //     }
    //     else {
    //       ret->Set_v_U_NonConst(*v_U_NonConst());
    //     }

    //    return ret;
  }
Esempio n. 3
0
int main(int argc, char *argv[])
{
    int i;
    NekDouble cr = 0;
    
    if(argc !=3)
    {
        fprintf(stderr,"Usage: ./ExtractCriticalLayer  meshfile fieldfile  \n");
        exit(1);
    }
    
    //------------------------------------------------------------
    // Create Session file. 
    LibUtilities::SessionReaderSharedPtr vSession
        = LibUtilities::SessionReader::CreateInstance(argc, argv);
    //-----------------------------------------------------------
    
    //-------------------------------------------------------------
    // Read in mesh from input file
    SpatialDomains::MeshGraphSharedPtr graphShPt = SpatialDomains::MeshGraph::Read(vSession);
    //------------------------------------------------------------
    
    //-------------------------------------------------------------
    // Define Streak Expansion   
    MultiRegions::ExpListSharedPtr streak;   

    streak = MemoryManager<MultiRegions::ExpList2D>
        ::AllocateSharedPtr(vSession,graphShPt);
    //---------------------------------------------------------------

    //----------------------------------------------
    // Import field file.
    string fieldfile(argv[argc-1]);
    vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
    vector<vector<NekDouble> > fielddata;
    LibUtilities::Import(fieldfile,fielddef,fielddata);
    //----------------------------------------------

    //----------------------------------------------
    // Copy data from field file
    string  streak_field("w");
    for(unsigned int i = 0; i < fielddata.size(); ++i)
    {
        streak->ExtractDataToCoeffs(fielddef [i],
                                    fielddata[i],
                                    streak_field,
                                    streak->UpdateCoeffs());
    }
    //----------------------------------------------
    
    int npts;
    vSession->LoadParameter("NumCriticalLayerPts",npts,30);
    Array<OneD, NekDouble> x_c(npts);
    Array<OneD, NekDouble> y_c(npts);       
    
    NekDouble trans;
    vSession->LoadParameter("WidthOfLayers",trans,0.1);

    Computestreakpositions(streak,x_c, y_c,cr,trans);    

    cout << "# x_c y_c" << endl;
    for(i = 0; i < npts; ++i)
    {
        fprintf(stdout,"%12.10lf %12.10lf \n",x_c[i],y_c[i]);
        //cout << x_c[i] << " " << y_c[i] << endl;
    }
    
}