181     if(argc > 6 || argc < 5)
   184             "Usage: ./MoveMesh  meshfile fieldfile  changefile   alpha  cr(optional)\n");
   190             = LibUtilities::SessionReader::CreateInstance(2, argv);
   195         vSession->DefinesSolverInfo(
"INTERFACE")
   196         && vSession->GetSolverInfo(
"INTERFACE")==
"phase" )
   198         cr = boost::lexical_cast<
NekDouble>(argv[argc-1]);
   216     string changefile(argv[argc-2]);
   220     string charalp (argv[argc-1]);
   222     cout<<
"read alpha="<<charalp<<endl;
   226     string fieldfile(argv[argc-3]);
   227     vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
   228     vector<vector<NekDouble> > fielddata;
   237     for(
int i=0; i<fielddata.size(); i++)
   239         streak->ExtractDataToCoeffs(fielddef[i], fielddata[i], fielddef[i]->m_fields[0], streak->UpdateCoeffs());
   241     streak->BwdTrans_IterPerExp(streak->GetCoeffs(), streak->UpdatePhys());
   247     int nIregions, lastIregion=0;
   252     int nbnd= bndConditions.num_elements();
   253     for(
int r=0; r<nbnd; r++)
   255         if(bndConditions[r]->GetUserDefined()==
"CalcBC")
   263     ASSERTL0(nIregions>0,
"there is any boundary region with the tag USERDEFINEDTYPE=""CalcBC"" specified");
   264     cout<<
"nIregions="<<nIregions<<endl;
   269     int nedges = bndfieldx[lastIregion]->GetExpSize();
   270     int nvertl = nedges +1 ;
   286          ( (bndfieldx[lastIregion]->GetExp(0)->as<LocalRegions::SegExp>())
   291     vertex0->GetCoords(x0,y0,z0);
   294         cout<<
"WARNING x0="<<x0<<endl;
   300                   Vids_low, v1, v2 , x_connect ,lastedge, xold_low,yold_low);
   301     ASSERTL0(Vids_low[v2]!=-10, 
"Vids_low[v2] is wrong");
   305     cout<<
"x_conn="<<x_connect<<
"   yt="<<yt<<
"  zt="<<zt<<
" vid="<<Vids_low[v2]<<endl;
   306     vertex->GetCoords(x_connect,yt,zt);
   313                       Vids_low, v1, v2 , x_connect, lastedge, xold_low, yold_low );
   316         vertex->GetCoords(x_connect,yt,zt);
   330          ( (bndfieldx[lastIregion]->GetExp(0)->as<LocalRegions::SegExp>())
   335     vertex0->GetCoords(x0,y0,z0);
   338         cout<<
"WARNING x0="<<x0<<endl;
   346                   Vids_up, v1, v2 , x_connect ,lastedge, xold_up, yold_up);
   348     vertexU->GetCoords(x_connect,yt,zt);
   355                       Vids_up, v1, v2 , x_connect, lastedge, xold_up, yold_up );
   359         vertex->GetCoords(x_connect,yt,zt);
   371         graphShPt->GetVertex(((bndfieldx[lastIregion]->GetExp(0)
   372                 ->as<LocalRegions::SegExp>())->GetGeom1D())->GetVid(0));
   373     vertex0->GetCoords(x0,y0,z0);
   376         cout<<
"WARNING x0="<<x0<<endl;
   385             Vids_c, v1, v2 , x_connect ,lastedge, xold_c, yold_c);
   389     vertexc->GetCoords(x_connect,yt,zt);
   396             Vids_c, v1, v2 , x_connect, lastedge, xold_c, yold_c );
   400          vertex->GetCoords(x_connect,yt,zt);
   409      for(
int r=0; r<nvertl; r++)
   413              Deltaup[r] = yold_up[r] - yold_c[r];
   414              Deltalow[r] = yold_c[r] - yold_low[r];
   415              ASSERTL0(Deltaup[r]>0, 
"distance between upper and layer curve is not positive");
   416              ASSERTL0(Deltalow[r]>0, 
"distance between lower and layer curve is not positive");
   437     if(vSession->DefinesParameter(
"npedge"))
   439           npedge = (int)vSession->GetParameter(
"npedge");
   447     int nq= streak->GetTotPoints();
   450     streak->GetCoords(x,y);
   459                            xold_low, yold_low, xold_c, yold_c, x_c, y_c,cr,
true);
   462     for(
int q=0; q<nvertl; q++)
   464          if(y_c[q] < yold_c[q])
   469          Delta_c[q] = abs(yold_c[q]-y_c[q]);
   472          cout<<x_c[q]<<
"    "<<y_c[q]<<endl;
   477          cout<<
"Warning: the critical layer is stationary"<<endl;
   500     for(
int r=0; r<nedges; r++)
   503          bndSegExp = bndfieldx[lastIregion]->GetExp(r)
   505          Eid = (bndSegExp->GetGeom1D())->GetGlobalID();
   506          id1 = (bndSegExp->GetGeom1D())->GetVid(0);
   507          id2 = (bndSegExp->GetGeom1D())->GetVid(1);
   508          vertex1 = graphShPt->GetVertex(id1);
   509      vertex2 = graphShPt->GetVertex(id2);
   511      vertex2->GetCoords(x2,y2,z2);
   514          cout<<
"edge="<<r<<
"  x1="<<x1<<
"  y1="<<y1<<
"   x2="<<x2<<
"  y2="<<y2<<endl;
   517          Cpointsx[r] = x1 +(x2-x1)/2;
   520          if( Cpointsx[r]>x2 || Cpointsx[r]< x1)
   522                  Cpointsx[r] = -Cpointsx[r];
   524              for(
int w=0; w< npedge-2; w++)
   527                  Addpointsx[r*(npedge-2) +w] = x1 +((x2-x1)/(npedge - 1))*(w+1);
   528                  if( Addpointsx[r*(npedge-2) +w] > x2 || Addpointsx[r*(npedge-2) +w] < x1)
   530                   Addpointsx[r*(npedge-2) +w] = -Addpointsx[r*(npedge-2) +w];
   533              Addpointsy[r*(npedge-2) +w] = y_c[r] + ((y_c[r+1]-y_c[r])/(x_c[r+1]-x_c[r]))*(Addpointsx[r*(npedge-2) +w]-x1);
   536                           Addpointsx[r*(npedge-2) +w],  Addpointsy[r*(npedge-2) +w], streak, dU,cr);
   549          Cpointsx[r] = x2+ (x1-x2)/2;
   551          if( Cpointsx[r] > x1 || Cpointsx[r] < x2)
   553               Cpointsx[r] = -Cpointsx[r];
   555              for(
int w=0; w< npedge-2; w++)
   557                  Addpointsx[r*(npedge-2) +w] = x2 +((x1-x2)/(npedge - 1))*(w+1);
   558                  if( Addpointsx[r*(npedge-2) +w] > x1 || Addpointsx[r*(npedge-2) +w] < x2)
   560                   Addpointsx[r*(npedge-2) +w] = -Addpointsx[r*(npedge-2) +w];
   564              Addpointsy[r*(npedge-2) +w] = y_c[r+1] + ((y_c[r]-y_c[r+1])/(x_c[r]-x_c[r+1]))*(Addpointsx[r*(npedge-2) +w]-x2);
   568                    Addpointsx[r*(npedge-2) +w], Addpointsy[r*(npedge-2) +w], streak, dU,cr);
   579           ASSERTL0(
false, 
"point not generated");
   598     for(
int a=0; a<nedges; a++)
   601          xcPhys[a*npedge+0] = x_c[a];
   602          ycPhys[a*npedge+0] = y_c[a];
   604          xcPhys[a*npedge+npedge-1] = x_c[a+1];
   605          ycPhys[a*npedge+npedge-1] = y_c[a+1];
   607          for(
int b=0; b<npedge-2; b++)
   609                xcPhys[a*npedge +b+1] = Addpointsx[a*(npedge-2)+b];
   610                ycPhys[a*npedge +b+1] = Addpointsy[a*(npedge-2)+b];
   614 cout<<
"xc,yc before tanevaluate"<<endl;
   615 for(
int v=0; v< xcPhys.num_elements(); v++)
   617 cout<<xcPhys[v]<<
"     "<<ycPhys[v]<<endl;
   630     MappingEVids(xold_up, yold_up, xold_low, yold_low, xold_c, yold_c, Vids_c,
   631                  graphShPt,streak, V1, V2, nlays,  lay_Eids, lay_Vids);
   635 cout<<
"nlays="<<nlays<<endl;
   639     for(
int g=0; g<nlays; g++)
   652     if(vSession->DefinesParameter(
"Delta"))
   654           Delta0 = vSession->GetParameter(
"Delta");
   666     int nVertTot = graphShPt->GetNvertices();
   682     for(
int i=0; i<nVertTot; i++)
   687          vertex->GetCoords(x,y,z);
   697          if(x==0 && y< yold_low[0]
   703          if(x== xold_c[nvertl-1] && y> yold_up[nvertl-1]
   709          if(x==xold_c[nvertl-1] && y<yold_low[nvertl-1]
   715          if(x== 0 && y> yold_up[0]
   721          for(
int j=0; j<nvertl; j++)
   723              if((xold_up[j]==x)&&(yold_up[j]==y))
   727                  ynew[i] = y_c[j] +Delta0;
   731              if((xold_low[j]==x)&&(yold_low[j]==y))
   735                  ynew[i] = y_c[j] -Delta0;
   739              if((xold_c[j]==x)&&(yold_c[j]==y))
   750              for(
int k=0; k<nvertl; k++)
   752                 if(abs(x-xold_up[k]) < diff)
   754                     diff = abs(x-xold_up[k]);
   758              if( y>yold_up[qp_closer] && y< 1)
   766                  ynew[i] = y_c[qp_closer] +(y-yold_c[qp_closer])*
   767                    (1-y_c[qp_closer])/(1-yold_c[qp_closer]);
   773              else if(y<yold_low[qp_closer] && y> -1)
   781                  ynew[i] = y_c[qp_closer] + (y-yold_c[qp_closer] )*
   782                          (-1-y_c[qp_closer])/(-1-yold_c[qp_closer]);
   786              else if ( y>yold_c[qp_closer] && y < yold_up[qp_closer])
   793              else if (y<yold_c[qp_closer] && y > yold_low[qp_closer])
   795                 if(x==0){ cntlow++; }
   800              else if( y==1 || y==-1)
   807              if( (ynew[i]>1 || ynew[i]<-1)
   808                  && ( y>yold_up[qp_closer]  || y<yold_low[qp_closer]) )
   810                 cout<<
"point x="<<xnew[i]<<
"  y="<<y<<
"  closer x="<<xold_up[qp_closer]<<
" ynew="<<ynew[i]<<endl;
   811                 ASSERTL0(
false, 
"shifting out of range");
   821     int nqedge = streak->GetExp(0)->GetNumPoints(0);
   822     int nquad_lay = (nvertl-1)*nqedge;
   827     int np_lay = (nvertl-1)*npedge;
   837     if( move_norm==
true )
   844        Vmath::Vcopy(xcPhys.num_elements(),xcPhys,1,xcPhysMOD,1);
   845        Vmath::Vcopy(xcPhys.num_elements(),ycPhys,1,ycPhysMOD,1);
   849 cout<<
"nquad per edge="<<nqedge<<endl;
   850        for(
int l=0; l<2; l++)
   852            Edge_newcoords[l] = bndfieldx[lastIregion]->GetExp(0)
   877        bndfieldx[lastIregion]->GetCoords(xcQ, ycQ, zcQ);
   886        for(
int l=0; l< xcQ.num_elements(); l++)
   896                           xcQ[l],4,closex,closey  );
   909        Cont_y->FwdTrans_IterPerExp(Cont_y->GetPhys(), coeffsy);
   910        Cont_y->BwdTrans_IterPerExp( coeffsy, Cont_y->UpdatePhys());
   913 cout<<
"xcQ, ycQ"<<endl;
   914 for(
int s=0; s<xcQ.num_elements(); s++)
   916 cout<<xcQ[s]<<
"     "<<ycQ[s]<<endl;
   919        bool evaluatetan=
false;
   923        for(
int k=0; k<nedges; k++)
   928             Edge_newcoords[0]->StdPhysDeriv(xcedgeQ,txedgeQ);
   929             Edge_newcoords[1]->StdPhysDeriv(ycedgeQ,tyedgeQ);
   933             Vmath::Vvtvp(nqedge,tyedgeQ,1,tyedgeQ,1,normsQ,1,normsQ,1);
   948             for(
int u=0; u<nqedge-1; u++)
   950                incratio   = (ycedgeQ[u+1]- ycedgeQ[u])/(xcedgeQ[u+1]- xcedgeQ[u]);
   951 cout<<
"incratio="<<incratio<<endl;
   952                if(abs(incratio)> 4.0 && evaluatetan==false )
   954 cout<<
"wrong="<<wrong<<endl;
   956                     ASSERTL0(wrong<2, 
"number edges to change is too high!!");
   964                 cout<<
"tan bef"<<endl;
   965                 for(
int e=0; e< nqedge; e++)
   967                     cout<<xcedgeQ[e]<<
"     "<<ycedgeQ[e]<<
"      "<<txedgeQ[e]<<endl;
   975                 Vmath::Vcopy(npedge, &xcPhysMOD[k*npedge+0],1,&xPedges[0],1);
   976                  Vmath::Vcopy(npedge, &ycPhysMOD[k*npedge+0],1,&yPedges[0],1);
   978                  PolyFit(polyorder,nqedge, xcedgeQ,ycedgeQ, coeffsinterp, xPedges,yPedges, npedge);
   980                  Vmath::Vcopy(npedge, &xPedges[0],1, &xcPhysMOD[k*npedge+0],1);
   981                  Vmath::Vcopy(npedge, &yPedges[0],1, &ycPhysMOD[k*npedge+0],1);
   988             Vmath::Vcopy(nqedge, &(txedgeQ[0]), 1, &(txQ[nqedge*k]),1);
   989             Vmath::Vcopy(nqedge, &(tyedgeQ[0]), 1, &(tyQ[nqedge*k]),1);
   994        for(
int w=0; w< fz.num_elements(); w++)
   996            txQ[w] = cos(atan(fz[w]));
   997            tyQ[w] = sin(atan(fz[w]));
   998            cout<<xcQ[w]<<
"    "<<ycQ[w]<<
"       "<<fz[w]<<endl;
  1003        Vmath::Vcopy(nquad_lay, txQ,1, Cont_y->UpdatePhys(),1);
  1004        Cont_y->FwdTrans_IterPerExp(Cont_y->GetPhys(), coeffsy);
  1005        Cont_y->BwdTrans_IterPerExp( coeffsy, Cont_y->UpdatePhys());
  1008        Vmath::Vcopy(nquad_lay, tyQ,1, Cont_y->UpdatePhys(),1);
  1009        Cont_y->FwdTrans_IterPerExp(Cont_y->GetPhys(), coeffsy);
  1010        Cont_y->BwdTrans_IterPerExp( coeffsy, Cont_y->UpdatePhys());
  1022         for(
int q=0; q<2; q++)
  1024              edgebef = edgeinterp[q]-1;
  1025              incbefore = (txQ[edgebef*nqedge+nqedge-1]-txQ[edgebef*nqedge])/
  1026                         (xcQ[edgebef*nqedge+nqedge-1]-xcQ[edgebef*nqedge]);
  1027              inc =  (txQ[edgeinterp[q]*nqedge+nqedge-1]-txQ[edgeinterp[q]*nqedge])/
  1028                         (xcQ[edgeinterp[q]*nqedge+nqedge-1]-xcQ[edgeinterp[q]*nqedge]);
  1029              int npoints = 2*nqedge;
  1035              cout<<
"inc="<<inc<<
"    incbef="<<incbefore<<endl;
  1036              if(    (inc/incbefore)>0.           )
  1038                  cout<<
"before!!"<<edgebef<<endl;
  1041                  Vmath::Vcopy(npoints, &xcQ[edgebef*nqedge+0],1,&xQedges[0],1);
  1042                  Vmath::Vcopy(npoints, &ycQ[edgebef*nqedge+0],1,&yQedges[0],1);
  1043                  Vmath::Vcopy(npoints, &txQ[edgebef*nqedge+0],1,&txQedges[0],1);
  1044                  Vmath::Vcopy(npoints, &tyQ[edgebef*nqedge+0],1,&tyQedges[0],1);
  1048                    coeffsinterp, xQedges,txQedges, npoints);
  1051                  Vmath::Vcopy(npoints,&txQedges[0],1, &txQ[edgebef*nqedge+0],1);
  1055                    coeffsinterp, xQedges,tyQedges, npoints);
  1058                  Vmath::Vcopy(npoints,&tyQedges[0],1, &tyQ[edgebef*nqedge+0],1);
  1063                  cout<<
"after!!"<<endl;
  1066                  Vmath::Vcopy(npoints, &xcQ[edgeinterp[q]*nqedge+0],1,&xQedges[0],1);
  1067                  Vmath::Vcopy(npoints, &ycQ[edgeinterp[q]*nqedge+0],1,&yQedges[0],1);
  1068                  Vmath::Vcopy(npoints, &txQ[edgeinterp[q]*nqedge+0],1,&txQedges[0],1);
  1069                  Vmath::Vcopy(npoints, &tyQ[edgeinterp[q]*nqedge+0],1,&tyQedges[0],1);
  1074                    coeffsinterp, xQedges,txQedges, npoints);
  1077                  Vmath::Vcopy(npoints,&txQedges[0],1, &txQ[edgeinterp[q]*nqedge+0],1);
  1081                    coeffsinterp, xQedges,tyQedges, npoints);
  1084                  Vmath::Vcopy(npoints,&tyQedges[0],1, &tyQ[edgeinterp[q]*nqedge+0],1);
  1093         Vmath::Vcopy(nquad_lay, tyQ,1,  Cont_y->UpdatePhys(),1);
  1094         Cont_y->FwdTrans_IterPerExp(Cont_y->GetPhys(), coeffstmp);
  1095         Cont_y->BwdTrans_IterPerExp( coeffstmp, Cont_y->UpdatePhys());
  1098         Vmath::Vcopy(nquad_lay, txQ,1,  Cont_y->UpdatePhys(),1);
  1099         Cont_y->FwdTrans_IterPerExp(Cont_y->GetPhys(), coeffstmp);
  1100         Cont_y->BwdTrans_IterPerExp( coeffstmp, Cont_y->UpdatePhys());
  1103         for(
int k=0; k<nedges; k++)
  1111             Vmath::Vcopy(nqedge, &(txQ[nqedge*k]),1, &(txedgeQ[0]), 1);
  1112             Vmath::Vcopy(nqedge, &(tyQ[nqedge*k]),1, &(tyedgeQ[0]), 1);
  1114             Vmath::Vdiv(nqedge, txedgeQ,1,tyedgeQ,1,tx_tyedgeQ,1);
  1115             Vmath::Vmul(nqedge, tx_tyedgeQ,1,tx_tyedgeQ,1,tx_tyedgeQ,1);
  1121             Vmath::Vcopy(nqedge, &(nxedgeQ[0]),1, &(nxQ[nqedge*k]),1);
  1123             Vmath::Vmul(nqedge, nxedgeQ,1,nxedgeQ,1,nyedgeQ,1);
  1129             Vmath::Vcopy(nqedge, &(nyedgeQ[0]), 1, &(nyQ[nqedge*k]),1);
  1132             cout<<
"edge:"<<k<<endl;
  1133             cout<<
"tan/normal"<<endl;
  1134             for(
int r=0; r<nqedge; r++)
  1136                 cout<<xcQ[k*nqedge+r]<<
"     "<<txedgeQ[r]<<
"      "<<tyedgeQ[r]<<
"    "  1137                     <<nxedgeQ[r]<<
"      "<<nyedgeQ[r]<<endl;
  1143         Vmath::Vcopy(nquad_lay, nyQ,1,  Cont_y->UpdatePhys(),1);
  1145        Cont_y->FwdTrans_IterPerExp(Cont_y->GetPhys(), coeffstmp);
  1146        Cont_y->BwdTrans_IterPerExp( coeffstmp, Cont_y->UpdatePhys());
  1150        Vmath::Zero(Cont_y->GetNcoeffs(),Cont_y->UpdateCoeffs(),1);
  1151        Vmath::Vcopy(nquad_lay, nxQ,1,  Cont_y->UpdatePhys(),1);
  1152        Cont_y->FwdTrans_IterPerExp(Cont_y->GetPhys(), coeffstmp);
  1153        Cont_y->BwdTrans_IterPerExp( coeffstmp, Cont_y->UpdatePhys());
  1157        for(
int k=0; k<nedges; k++)
  1163                  nyQ[(k-1)*nqedge+nqedge-1]=
  1168                   nxQ[(k-1)*nqedge+nqedge-1]=
  1177        cout<<
"nx,yQbefore"<<endl;
  1178        for(
int u=0; u<xcQ.num_elements(); u++)
  1180            cout<<xcQ[u]<<
"      "<<nyQ[u]<<
"     "<<txQ[u]<<endl;
  1186        cout<<
"nx,yQ"<<endl;
  1187        for(
int u=0; u<x_tmpQ.num_elements(); u++)
  1189            cout<<x_tmpQ[u]<<
"      "<<tmpnyQ[u]<<endl;
  1193        for(
int k=0; k<nedges; k++)
  1196            for(
int a=0; a<npedge; a++)
  1200                    nxPhys[k*npedge +a]= nxQ[k*nqedge +0];
  1201                    nyPhys[k*npedge +a]= nyQ[k*nqedge +0];
  1204                else if(a== npedge-1)
  1206                    nxPhys[k*npedge +a]= nxQ[k*nqedge +nqedge-1];
  1207                    nyPhys[k*npedge +a]= nyQ[k*nqedge +nqedge-1];
  1231                    nyPhys[k*npedge +a]=
  1241                    nxPhys[k*npedge +a]= -sqrt(abs(1- nyPhys[k*npedge +a]*nyPhys[k*npedge +a]));
  1257                    nyPhys[(k-1)*npedge+npedge-1]=
  1262                    nxPhys[(k-1)*npedge+npedge-1]=
  1267        cout<<
"xcPhys,,"<<endl;
  1268        for(
int s=0; s<np_lay; s++)
  1271            cout<<xcPhysMOD[s]<<
"     "<<ycPhysMOD[s]<<
"     "<<nxPhys[s]<<
"     "<<nyPhys[s]<<endl;
  1284      for(
int m=0; m<nlays; m++)
  1291               delta[m]  =  -(cntlow+1-m)*Delta0/(cntlow+1);
  1295               delta[m]  = (  m-(cntlow)  )*Delta0/(cntlow+1);
  1302          for(
int h=0; h< nvertl; h++)
  1309              if(move_norm==
false)
  1311                  ynew[lay_Vids[m][h] ]= y_c[h] +delta[m];
  1312                  xnew[lay_Vids[m][h] ]= x_c[h];
  1316                  if(h==0 || h==nvertl-1 )
  1318                      ynew[lay_Vids[m][h] ]= y_c[h] +delta[m];
  1319                      xnew[lay_Vids[m][h] ]= x_c[h];
  1323                      ynew[lay_Vids[m][h] ]= y_c[h] +delta[m]*abs(nyPhys[h*npedge+0]);
  1324                      xnew[lay_Vids[m][h] ]= x_c[h] +delta[m]*abs(nxPhys[h*npedge+0]);
  1327 cout<<
"Vid x="<<xnew[lay_Vids[m][h] ]<<
"   y="<<ynew[lay_Vids[m][h] ]<<endl;
  1332 cout<<
"edge=="<<h<<endl;
  1335                  ASSERTL0( nyPhys[h*npedge+0]==nyPhys[(h-1)*npedge+npedge-1],
" normaly wrong");
  1336                  ASSERTL0( nxPhys[h*npedge+0]==nxPhys[(h-1)*npedge+npedge-1],
" normalx wrong");
  1339                  if(move_norm==
false)
  1342                      layers_y[m][h*npedge +0] = y_c[h] +delta[m];
  1343                      layers_x[m][h*npedge +0] = xnew[lay_Vids[m][h] ];
  1345                      layers_y[m][h*npedge +npedge-1] = y_c[h+1] +delta[m];
  1346                      layers_x[m][h*npedge +npedge-1] = xnew[lay_Vids[m][h+1] ];
  1348                      for(
int d=0; d< npedge-2; d++)
  1350                          layers_y[m][h*npedge +d+1]=  ycPhysMOD[h*npedge +d+1] +delta[m];
  1352                          layers_x[m][h*npedge +d+1]=  xcPhysMOD[h*npedge +d+1];
  1361                          tmpy_lay[h*npedge +0] = y_c[h] +delta[m];
  1362                          tmpx_lay[h*npedge +0] = xnew[lay_Vids[m][h] ];
  1364                          tmpy_lay[h*npedge +npedge-1] =
  1365                                         y_c[h+1] +delta[m]*abs(nyPhys[h*npedge +npedge-1]);
  1366                          tmpx_lay[h*npedge +npedge-1] =
  1367                                         x_c[h+1] +delta[m]*abs(nxPhys[h*npedge +npedge-1]);
  1369                      else if(h==nedges-1)
  1372                          tmpy_lay[h*npedge +0] =
  1373                                         y_c[h] +delta[m]*abs(nyPhys[h*npedge +0]);
  1374                          tmpx_lay[h*npedge +0] =
  1375                                         x_c[h] +delta[m]*abs(nxPhys[h*npedge +0]);
  1377                          tmpy_lay[h*npedge +npedge-1] = y_c[h+1] +delta[m];
  1378                          tmpx_lay[h*npedge +npedge-1] = xnew[lay_Vids[m][h+1] ];
  1383                          tmpy_lay[h*npedge +0] =
  1384                                         y_c[h] +delta[m]*abs(nyPhys[h*npedge +0]);
  1385                          tmpx_lay[h*npedge +0] =
  1386                                         x_c[h] +delta[m]*abs(nxPhys[h*npedge +0]);
  1388                          tmpy_lay[h*npedge +npedge-1] =
  1389                                         y_c[h+1] +delta[m]*abs(nyPhys[h*npedge +npedge-1]);
  1390                          tmpx_lay[h*npedge +npedge-1] =
  1391                                         x_c[h+1] +delta[m]*abs(nxPhys[h*npedge +npedge-1]);
  1395                      for(
int d=0; d< npedge-2; d++)
  1398                          tmpy_lay[h*npedge +d+1] = ycPhysMOD[h*npedge +d+1] +
  1399                                   delta[m]*abs(nyPhys[h*npedge +d+1]);
  1402                          tmpx_lay[h*npedge +d+1]=  xcPhysMOD[h*npedge +d+1] +
  1403                                   delta[m]*abs(nxPhys[h*npedge +d+1]);
  1420          for(
int s=0; s<np_lay; s++)
  1422              cout<<tmpx_lay[s]<<
"     "<<tmpy_lay[s]<<endl;
  1425          cout<<
"fisrt interp"<<endl;
  1426          for(
int s=0; s<np_lay; s++)
  1428              cout<<tmpx_lay[s]<<
"     "<<tmpy_lay[s]<<endl;
  1440          NekDouble boundright = xcPhysMOD[np_lay-1];
  1441          bool outboundleft= 
false;
  1442          bool outboundright=
false;
  1443          if(tmpx_lay[1]< boundleft )
  1445               outboundleft = 
true;
  1447          if(tmpx_lay[np_lay-2] > boundright )
  1449               outboundright = 
true;
  1457          for(
int r=0; r< nedges; r++)
  1460              if(tmpx_lay[r*npedge + npedge-1]< boundleft && outboundleft==
true )
  1468                      if( tmpx_lay[(r+1)*npedge + npedge-1]> boundleft )
  1470                          for(
int s=0; s<npedge-2; s++)
  1472                              if(tmpx_lay[(r+1)*npedge + s+1]<  boundleft)
  1482              if(tmpx_lay[r*npedge + 0]> boundright && outboundright==
true )
  1490                      if( tmpx_lay[(r-1)*npedge + 0]< boundright )
  1492                          for(
int s=0; s<npedge-2; s++)
  1494                              if(tmpx_lay[(r-1)*npedge + s+1]>  boundright)
  1506          outcount = outvert*npedge+1+ outmiddle;
  1508          int replacepointsfromindex=0;
  1509          for(
int c=0; c<nedges; c++)
  1512              if(xcPhysMOD[c*npedge+npedge-1] <= tmpx_lay[c*(npedge-(npedge-2)) +2] && outboundright==
true)
  1514                  replacepointsfromindex =   c*(npedge-(npedge-2))+2;
  1519              if(xcPhysMOD[(nedges-1 -c)*npedge+0] >= tmpx_lay[np_lay-1 -(c*(npedge-(npedge-2)) +2)] && outboundleft==
true)
  1521                  replacepointsfromindex =   np_lay-1 -(c*(npedge-(npedge-2)) +2);
  1537              if( outboundright==
true)
  1539                  pstart = replacepointsfromindex;
  1540                  shift = np_lay-outcount;
  1541                  increment =  (xcPhysMOD[np_lay-outcount]-xcPhysMOD[pstart])/(outcount+1);
  1542                  outcount = outcount-1;
  1543                  ASSERTL0(tmpx_lay[np_lay-outcount]>xcPhysMOD[(nedges-1)*npedge+0], 
"no middle points in the last edge");
  1549                  increment = (xcPhysMOD[replacepointsfromindex]-xcPhysMOD[pstart])/(outcount+1);
  1550                  ASSERTL0(tmpx_lay[pstart]<xcPhysMOD[0*npedge +npedge-1], 
"no middle points in the first edge");
  1567              NekDouble xctmp,ycinterp,nxinterp,nyinterp;
  1569              for(
int v=0; v<outcount;v++)
  1571                  xctmp = xcPhysMOD[pstart]+(v+1)*increment;
  1584                                          xctmp,4,closex,closeny  );
  1587                  nxinterp = sqrt(abs(1-nyinterp*nyinterp));
  1594                  replace_x[v] = xctmp +delta[m]*abs(nxinterp);
  1595                  replace_y[v] = ycinterp +delta[m]*abs(nyinterp);
  1596                  tmpx_lay[ v+shift ] = replace_x[v];
  1597                  tmpy_lay[ v+shift ] = replace_y[v];
  1618          int closepoints = 4;
  1625          for(
int q=0; q<np_lay; q++)
  1627              for(
int e=0; e<nedges; e++)
  1629                  if(tmpx_lay[q]<= x_c[e+1]  && tmpx_lay[q]>= x_c[e])
  1633                  if(q == e*npedge +npedge-1 && pointscount!=npedge )
  1638                  else if(q == e*npedge +npedge-1)
  1658                            lay_Vids[m], layers_x[m], layers_y[m],xnew,ynew);
  1741          int npoints = npedge;
  1744          for(
int f=0; f<nedges; f++)
  1750              Vmath::Vcopy(npoints, &layers_x[m][(f)*npedge+0],1,&xPedges[0],1);
  1751              Vmath::Vcopy(npoints, &layers_y[m][(f)*npedge+0],1,&yPedges[0],1);
  1755                      coeffsinterp, xPedges,yPedges, npoints);
  1758              Vmath::Vcopy(npoints,&yPedges[0],1, &layers_y[m][(f)*npedge+0],1);
  1761              layers_y[m][f*npedge+0]= ynew[lay_Vids[m][f]];
  1762              layers_y[m][f*npedge+npedge-1]= ynew[lay_Vids[m][f+1]];
  1765          cout<<
" xlay    ylay lay:"<<m<<endl;
  1766          for(
int l=0; l<np_lay; l++)
  1769              cout<<std::setprecision(8)<<layers_x[m][l]<<
"    "<<layers_y[m][l]<<endl;
  1803          cout<<
"lay="<<m<<endl;
  1805                   "  different layer ymin val");
  1807              "  different layer ymax val");
  1809              "  different layer xmin val");
  1811              "  different layer xmax val");
  1821                                layers_x[0], layers_y[0], layers_x[nlays-1], layers_y[nlays-1],nxPhys, nyPhys,xnew, ynew);
  1903                              lay_Vids, x_c, y_c, Down, Up, xnew, ynew, layers_x, layers_y);
  1914 cout<<std::setprecision(8)<<
"xmin="<<
Vmath::Vmin(nVertTot, xnew,1)<<endl;
  1916              "  different xmin val");
  1918              "  different ymin val");
  1920              "  different xmax val");
  1922              "  different ymax val");
  1928     Replacevertices(changefile, xnew , ynew, xcPhys, ycPhys, Eids, npedge, charalp, layers_x,layers_y, lay_Eids, curv_lay);
 void PolyFit(int polyorder, int npoints, Array< OneD, NekDouble > xin, Array< OneD, NekDouble > fin, Array< OneD, NekDouble > &coeffsinterp, Array< OneD, NekDouble > &xout, Array< OneD, NekDouble > &fout, int npout)
 
#define ASSERTL0(condition, msg)
 
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
 
std::shared_ptr< ContField1D > ContField1DSharedPtr
 
void OrderVertices(int nedges, SpatialDomains::MeshGraphSharedPtr graphShPt, MultiRegions::ExpListSharedPtr &bndfield, Array< OneD, int > &Vids, int v1, int v2, NekDouble x_connect, int &lastedge, Array< OneD, NekDouble > &x, Array< OneD, NekDouble > &y)
 
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object. 
 
void GenerateMapEidsv1v2(MultiRegions::ExpListSharedPtr field, Array< OneD, int > &V1, Array< OneD, int > &V2)
 
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x) 
 
void MoveOutsidePointsNnormpos(int npedge, SpatialDomains::MeshGraphSharedPtr mesh, Array< OneD, NekDouble > xcold, Array< OneD, NekDouble > ycold, Array< OneD, NekDouble > xolddown, Array< OneD, NekDouble > yolddown, Array< OneD, NekDouble > xoldup, Array< OneD, NekDouble > yoldup, Array< OneD, NekDouble > xlaydown, Array< OneD, NekDouble > ylaydown, Array< OneD, NekDouble > xlayup, Array< OneD, NekDouble > ylayup, Array< OneD, NekDouble > nxPhys, Array< OneD, NekDouble > nyPhys, Array< OneD, NekDouble > &xnew, Array< OneD, NekDouble > &ynew)
 
void GenerateAddPointsNewtonIt(NekDouble xi, NekDouble yi, NekDouble &xout, NekDouble &yout, MultiRegions::ExpListSharedPtr function, Array< OneD, NekDouble > derfunction, NekDouble cr)
 
void Import(const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, FieldMetaDataMap &fieldinfomap, const Array< OneD, int > &ElementIDs)
This function allows for data to be imported from an FLD file when a session and/or communicator is n...
 
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max. 
 
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
 
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min. 
 
std::shared_ptr< BoundaryConditions > BoundaryConditionsSharedPtr
 
void MoveLayerNnormpos(int nvertl, int npedge, Array< OneD, NekDouble > xcPhys, Array< OneD, NekDouble > tmpx_lay, Array< OneD, NekDouble > tmpy_lay, Array< OneD, int > Vids, Array< OneD, NekDouble > &xlay, Array< OneD, NekDouble > &ylay, Array< OneD, NekDouble > &xnew, Array< OneD, NekDouble > &ynew)
 
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y 
 
void Sdiv(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha/y. 
 
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y. 
 
void MappingEVids(Array< OneD, NekDouble > xoldup, Array< OneD, NekDouble > yoldup, Array< OneD, NekDouble > xolddown, Array< OneD, NekDouble > yolddown, Array< OneD, NekDouble > xcold, Array< OneD, NekDouble > ycold, Array< OneD, int > Vids_c, SpatialDomains::MeshGraphSharedPtr mesh, MultiRegions::ExpListSharedPtr streak, Array< OneD, int > V1, Array< OneD, int > V2, int &nlays, Array< OneD, Array< OneD, int > > &Eids_lay, Array< OneD, Array< OneD, int > > &Vids_lay)
 
void GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2=NullNekDouble1DArray, Array< OneD, NekDouble > &coords_3=NullNekDouble1DArray)
this function returns the physical coordinates of the quadrature points of the expansion ...
 
void Cutrepetitions(int nedges, Array< OneD, NekDouble > inarray, Array< OneD, NekDouble > &outarray)
 
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y. 
 
NekDouble LagrangeInterpolant(NekDouble x, int npts, Array< OneD, NekDouble > xpts, Array< OneD, NekDouble > funcvals)
 
void CheckSingularQuads(MultiRegions::ExpListSharedPtr Exp, Array< OneD, int > V1, Array< OneD, int > V2, Array< OneD, NekDouble > &xnew, Array< OneD, NekDouble > &ynew)
 
void EvaluateTangent(int npoints, Array< OneD, NekDouble > xcQedge, Array< OneD, NekDouble > coeffsinterp, Array< OneD, NekDouble > &txQedge, Array< OneD, NekDouble > &tyQedge)
 
std::map< int, BoundaryRegionShPtr > BoundaryRegionCollection
 
void Computestreakpositions(int nvertl, MultiRegions::ExpListSharedPtr streak, Array< OneD, NekDouble > xold_up, Array< OneD, NekDouble > yold_up, Array< OneD, NekDouble > xold_low, Array< OneD, NekDouble > yold_low, Array< OneD, NekDouble > xold_c, Array< OneD, NekDouble > yold_c, Array< OneD, NekDouble > &xc, Array< OneD, NekDouble > &yc, NekDouble cr, bool verts)
 
std::shared_ptr< PointGeom > PointGeomSharedPtr
 
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha + x. 
 
void Orderfunctionx(Array< OneD, NekDouble > inarray_x, Array< OneD, NekDouble > inarray_y, Array< OneD, NekDouble > &outarray_x, Array< OneD, NekDouble > &outarray_y)
 
std::shared_ptr< SegExp > SegExpSharedPtr
 
int DetermineclosePointxindex(NekDouble x, Array< OneD, NekDouble > xArray)
 
void MoveLayersvertically(int nlays, int nvertl, int cntlow, int cntup, Array< OneD, Array< OneD, int > > lay_Vids, Array< OneD, NekDouble > xc, Array< OneD, NekDouble > yc, Array< OneD, int > Down, Array< OneD, int > Up, Array< OneD, NekDouble > &xnew, Array< OneD, NekDouble > &ynew, Array< OneD, Array< OneD, NekDouble > > &layers_x, Array< OneD, Array< OneD, NekDouble > > &layers_y)
 
void Zero(int n, T *x, const int incx)
Zero vector. 
 
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
 
void Replacevertices(string filename, Array< OneD, NekDouble > newx, Array< OneD, NekDouble > newy, Array< OneD, NekDouble > xcPhys, Array< OneD, NekDouble > ycPhys, Array< OneD, int >Eids, int Npoints, string s_alp, Array< OneD, Array< OneD, NekDouble > > x_lay, Array< OneD, Array< OneD, NekDouble > > y_lay, Array< OneD, Array< OneD, int > >lay_eids, bool curv_lay)
 
std::shared_ptr< ExpList1D > ExpList1DSharedPtr
Shared pointer to an ExpList1D object. 
 
std::shared_ptr< SessionReader > SessionReaderSharedPtr
 
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y. 
 
void GenerateNeighbourArrays(int index, int neighpoints, Array< OneD, NekDouble > xArray, Array< OneD, NekDouble > yArray, Array< OneD, NekDouble > &Neighbour_x, Array< OneD, NekDouble > &Neighbour_y)