183 if (argc > 6 || argc < 5)
185 fprintf(stderr,
"Usage: ./MoveMesh meshfile fieldfile changefile "
186 "alpha cr(optional)\n");
193 LibUtilities::SessionReader::CreateInstance(2, argv);
195 SpatialDomains::MeshGraph::Read(vSession);
198 if (argc == 6 && vSession->DefinesSolverInfo(
"INTERFACE") &&
199 vSession->GetSolverInfo(
"INTERFACE") ==
"phase")
201 cr = boost::lexical_cast<NekDouble>(argv[argc - 1]);
209 vSession, graphShPt);
219 string changefile(argv[argc - 2]);
223 string charalp(argv[argc - 1]);
225 cout <<
"read alpha=" << charalp << endl;
229 string fieldfile(argv[argc - 3]);
230 vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
231 vector<vector<NekDouble>> fielddata;
236 vSession, graphShPt,
"w",
true);
240 for (
int i = 0; i < fielddata.size(); i++)
242 streak->ExtractDataToCoeffs(fielddef[i], fielddata[i],
243 fielddef[i]->m_fields[0],
244 streak->UpdateCoeffs());
246 streak->BwdTrans(streak->GetCoeffs(), streak->UpdatePhys());
252 int nIregions, lastIregion = 0;
254 streak->GetBndConditions();
258 int nbnd = bndConditions.size();
259 for (
int r = 0; r < nbnd; r++)
261 if (bndConditions[r]->GetUserDefined() ==
"CalcBC")
270 "there is any boundary region with the tag USERDEFINEDTYPE="
273 cout <<
"nIregions=" << nIregions << endl;
276 streak->GetBndCondExpansions();
279 int nedges = bndfieldx[lastIregion]->GetExpSize();
280 int nvertl = nedges + 1;
294 ((bndfieldx[lastIregion]->GetExp(0)->as<LocalRegions::SegExp>())
297 vertex0->GetCoords(x0, y0, z0);
300 cout <<
"WARNING x0=" << x0 << endl;
305 OrderVertices(nedges, graphShPt, bndfieldx[lastIregion - 1], Vids_low, v1,
306 v2, x_connect, lastedge, xold_low, yold_low);
307 ASSERTL0(Vids_low[v2] != -10,
"Vids_low[v2] is wrong");
309 graphShPt->GetVertex(Vids_low[v2]);
312 cout <<
"x_conn=" << x_connect <<
" yt=" << yt <<
" zt=" << zt
313 <<
" vid=" << Vids_low[v2] << endl;
314 vertex->GetCoords(x_connect, yt, zt);
320 OrderVertices(nedges, graphShPt, bndfieldx[lastIregion - 1], Vids_low,
321 v1, v2, x_connect, lastedge, xold_low, yold_low);
323 graphShPt->GetVertex(Vids_low[v1]);
325 vertex->GetCoords(x_connect, yt, zt);
337 vertex0 = graphShPt->GetVertex(
338 ((bndfieldx[lastIregion]->GetExp(0)->as<LocalRegions::SegExp>())
341 vertex0->GetCoords(x0, y0, z0);
344 cout <<
"WARNING x0=" << x0 << endl;
351 OrderVertices(nedges, graphShPt, bndfieldx[lastIregion - 2], Vids_up, v1,
352 v2, x_connect, lastedge, xold_up, yold_up);
354 graphShPt->GetVertex(Vids_up[v2]);
355 vertexU->GetCoords(x_connect, yt, zt);
361 OrderVertices(nedges, graphShPt, bndfieldx[lastIregion - 2], Vids_up,
362 v1, v2, x_connect, lastedge, xold_up, yold_up);
364 graphShPt->GetVertex(Vids_up[v1]);
367 vertex->GetCoords(x_connect, yt, zt);
379 vertex0 = graphShPt->GetVertex(
380 ((bndfieldx[lastIregion]->GetExp(0)->as<LocalRegions::SegExp>())
383 vertex0->GetCoords(x0, y0, z0);
386 cout <<
"WARNING x0=" << x0 << endl;
394 OrderVertices(nedges, graphShPt, bndfieldx[lastIregion], Vids_c, v1, v2,
395 x_connect, lastedge, xold_c, yold_c);
397 graphShPt->GetVertex(Vids_c[v2]);
400 vertexc->GetCoords(x_connect, yt, zt);
406 OrderVertices(nedges, graphShPt, bndfieldx[lastIregion], Vids_c, v1, v2,
407 x_connect, lastedge, xold_c, yold_c);
409 graphShPt->GetVertex(Vids_c[v1]);
412 vertex->GetCoords(x_connect, yt, zt);
421 for (
int r = 0; r < nvertl; r++)
426 Deltaup[r] = yold_up[r] - yold_c[r];
427 Deltalow[r] = yold_c[r] - yold_low[r];
429 "distance between upper and layer curve is not positive");
431 "distance between lower and layer curve is not positive");
437 bcs.GetBoundaryRegions();
442 vSession, *(bregions.find(lastIregion)->second), graphShPt,
true);
453 if (vSession->DefinesParameter(
"npedge"))
455 npedge = (int)vSession->GetParameter(
"npedge");
464 int nq = streak->GetTotPoints();
467 streak->GetCoords(x, y);
475 xold_c, yold_c, x_c, y_c, cr,
true);
478 for (
int q = 0; q < nvertl; q++)
480 if (y_c[q] < yold_c[q])
485 Delta_c[q] =
abs(yold_c[q] - y_c[q]);
488 cout << x_c[q] <<
" " << y_c[q] << endl;
493 cout <<
"Warning: the critical layer is stationary" << endl;
514 for (
int r = 0; r < nedges; r++)
519 Eid = (bndSegExp->GetGeom1D())->GetGlobalID();
520 id1 = (bndSegExp->GetGeom1D())->GetVid(0);
521 id2 = (bndSegExp->GetGeom1D())->GetVid(1);
522 vertex1 = graphShPt->GetVertex(id1);
523 vertex2 = graphShPt->GetVertex(id2);
525 vertex2->GetCoords(x2, y2, z2);
528 cout <<
"edge=" << r <<
" x1=" << x1 <<
" y1=" << y1 <<
" x2=" << x2
529 <<
" y2=" << y2 << endl;
532 Cpointsx[r] = x1 + (x2 - x1) / 2;
536 if (Cpointsx[r] > x2 || Cpointsx[r] < x1)
538 Cpointsx[r] = -Cpointsx[r];
540 for (
int w = 0; w < npedge - 2; w++)
543 Addpointsx[r * (npedge - 2) + w] =
544 x1 + ((x2 - x1) / (npedge - 1)) * (w + 1);
545 if (Addpointsx[r * (npedge - 2) + w] > x2 ||
546 Addpointsx[r * (npedge - 2) + w] < x1)
548 Addpointsx[r * (npedge - 2) + w] =
549 -Addpointsx[r * (npedge - 2) + w];
552 Addpointsy[r * (npedge - 2) + w] =
553 y_c[r] + ((y_c[r + 1] - y_c[r]) / (x_c[r + 1] - x_c[r])) *
554 (Addpointsx[r * (npedge - 2) + w] - x1);
558 Addpointsy[r * (npedge - 2) + w],
559 Addpointsx[r * (npedge - 2) + w],
560 Addpointsy[r * (npedge - 2) + w],
574 Cpointsx[r] = x2 + (x1 - x2) / 2;
576 if (Cpointsx[r] > x1 || Cpointsx[r] < x2)
578 Cpointsx[r] = -Cpointsx[r];
580 for (
int w = 0; w < npedge - 2; w++)
582 Addpointsx[r * (npedge - 2) + w] =
583 x2 + ((x1 - x2) / (npedge - 1)) * (w + 1);
584 if (Addpointsx[r * (npedge - 2) + w] > x1 ||
585 Addpointsx[r * (npedge - 2) + w] < x2)
587 Addpointsx[r * (npedge - 2) + w] =
588 -Addpointsx[r * (npedge - 2) + w];
592 Addpointsy[r * (npedge - 2) + w] =
594 ((y_c[r] - y_c[r + 1]) / (x_c[r] - x_c[r + 1])) *
595 (Addpointsx[r * (npedge - 2) + w] - x2);
600 Addpointsy[r * (npedge - 2) + w],
601 Addpointsx[r * (npedge - 2) + w],
602 Addpointsy[r * (npedge - 2) + w],
615 ASSERTL0(
false,
"point not generated");
633 for (
int a = 0; a < nedges; a++)
636 xcPhys[a * npedge + 0] = x_c[a];
637 ycPhys[a * npedge + 0] = y_c[a];
639 xcPhys[a * npedge + npedge - 1] = x_c[a + 1];
640 ycPhys[a * npedge + npedge - 1] = y_c[a + 1];
642 for (
int b = 0; b < npedge - 2; b++)
644 xcPhys[a * npedge + b + 1] = Addpointsx[a * (npedge - 2) + b];
645 ycPhys[a * npedge + b + 1] = Addpointsy[a * (npedge - 2) + b];
649 cout <<
"xc,yc before tanevaluate" << endl;
650 for (
int v = 0; v < xcPhys.size(); v++)
652 cout << xcPhys[v] <<
" " << ycPhys[v] << endl;
665 MappingEVids(xold_up, yold_up, xold_low, yold_low, xold_c, yold_c, Vids_c,
666 graphShPt, streak, V1, V2, nlays, lay_Eids, lay_Vids);
668 cout <<
"nlays=" << nlays << endl;
672 for (
int g = 0; g < nlays; g++)
683 if (vSession->DefinesParameter(
"Delta"))
685 Delta0 = vSession->GetParameter(
"Delta");
697 int nVertTot = graphShPt->GetNvertices();
713 for (
int i = 0; i < nVertTot; i++)
715 bool mvpoint =
false;
718 vertex->GetCoords(x, y, z);
727 if (x == 0 && y < yold_low[0] && y > bleft)
732 if (x == xold_c[nvertl - 1] && y > yold_up[nvertl - 1] && y < tright)
737 if (x == xold_c[nvertl - 1] && y < yold_low[nvertl - 1] && y > bright)
742 if (x == 0 && y > yold_up[0] && y < tleft)
747 for (
int j = 0; j < nvertl; j++)
749 if ((xold_up[j] == x) && (yold_up[j] == y))
753 ynew[i] = y_c[j] + Delta0;
757 if ((xold_low[j] == x) && (yold_low[j] == y))
761 ynew[i] = y_c[j] - Delta0;
765 if ((xold_c[j] == x) && (yold_c[j] == y))
771 if (mvpoint ==
false)
776 for (
int k = 0; k < nvertl; k++)
778 if (
abs(x - xold_up[k]) < diff)
780 diff =
abs(x - xold_up[k]);
784 if (y > yold_up[qp_closer] && y < 1)
794 ynew[i] = y_c[qp_closer] + (y - yold_c[qp_closer]) *
795 (1 - y_c[qp_closer]) /
796 (1 - yold_c[qp_closer]);
799 else if (y < yold_low[qp_closer] && y > -1)
809 ynew[i] = y_c[qp_closer] + (y - yold_c[qp_closer]) *
810 (-1 - y_c[qp_closer]) /
811 (-1 - yold_c[qp_closer]);
814 else if (y > yold_c[qp_closer] && y < yold_up[qp_closer])
824 else if (y < yold_c[qp_closer] && y > yold_low[qp_closer])
834 else if (y == 1 || y == -1)
842 if ((ynew[i] > 1 || ynew[i] < -1) &&
843 (y > yold_up[qp_closer] || y < yold_low[qp_closer]))
845 cout <<
"point x=" << xnew[i] <<
" y=" << y
846 <<
" closer x=" << xold_up[qp_closer]
847 <<
" ynew=" << ynew[i] << endl;
848 ASSERTL0(
false,
"shifting out of range");
853 int nqedge = streak->GetExp(0)->GetNumPoints(0);
854 int nquad_lay = (nvertl - 1) * nqedge;
857 bool curv_lay =
true;
858 bool move_norm =
true;
859 int np_lay = (nvertl - 1) * npedge;
869 if (move_norm ==
true)
881 cout <<
"nquad per edge=" << nqedge << endl;
882 for (
int l = 0; l < 2; l++)
884 Edge_newcoords[l] = bndfieldx[lastIregion]
908 bndfieldx[lastIregion]->GetCoords(xcQ, ycQ, zcQ);
917 for (
int l = 0; l < xcQ.size(); l++)
931 Vmath::Vcopy(nquad_lay, ycQ, 1, Cont_y->UpdatePhys(), 1);
934 Cont_y->FwdTransLocalElmt(Cont_y->GetPhys(), coeffsy);
935 Cont_y->BwdTrans(coeffsy, Cont_y->UpdatePhys());
938 cout <<
"xcQ, ycQ" << endl;
939 for (
int s = 0; s < xcQ.size(); s++)
941 cout << xcQ[s] <<
" " << ycQ[s] << endl;
944 bool evaluatetan =
false;
948 for (
int k = 0; k < nedges; k++)
950 Vmath::Vcopy(nqedge, &xcQ[k * nqedge], 1, &xcedgeQ[0], 1);
951 Vmath::Vcopy(nqedge, &ycQ[k * nqedge], 1, &ycedgeQ[0], 1);
953 Edge_newcoords[0]->StdPhysDeriv(xcedgeQ, txedgeQ);
954 Edge_newcoords[1]->StdPhysDeriv(ycedgeQ, tyedgeQ);
956 Vmath::Vmul(nqedge, txedgeQ, 1, txedgeQ, 1, normsQ, 1);
958 Vmath::Vvtvp(nqedge, tyedgeQ, 1, tyedgeQ, 1, normsQ, 1, normsQ, 1);
963 Vmath::Vmul(nqedge, txedgeQ, 1, normsQ, 1, txedgeQ, 1);
964 Vmath::Vmul(nqedge, tyedgeQ, 1, normsQ, 1, tyedgeQ, 1);
969 for (
int u = 0; u < nqedge - 1; u++)
971 incratio = (ycedgeQ[u + 1] - ycedgeQ[u]) /
972 (xcedgeQ[u + 1] - xcedgeQ[u]);
973 cout <<
"incratio=" << incratio << endl;
974 if (
abs(incratio) > 4.0 && evaluatetan ==
false)
976 cout <<
"wrong=" << wrong << endl;
978 ASSERTL0(wrong < 2,
"number edges to change is too high!!");
979 edgeinterp[wrong] = k;
986 cout <<
"tan bef" << endl;
987 for (
int e = 0; e < nqedge; e++)
989 cout << xcedgeQ[e] <<
" " << ycedgeQ[e] <<
" "
990 << txedgeQ[e] << endl;
998 Vmath::Vcopy(npedge, &xcPhysMOD[k * npedge + 0], 1, &xPedges[0],
1000 Vmath::Vcopy(npedge, &ycPhysMOD[k * npedge + 0], 1, &yPedges[0],
1003 PolyFit(polyorder, nqedge, xcedgeQ, ycedgeQ, coeffsinterp,
1004 xPedges, yPedges, npedge);
1006 Vmath::Vcopy(npedge, &xPedges[0], 1, &xcPhysMOD[k * npedge + 0],
1008 Vmath::Vcopy(npedge, &yPedges[0], 1, &ycPhysMOD[k * npedge + 0],
1015 Vmath::Vcopy(nqedge, &(txedgeQ[0]), 1, &(txQ[nqedge * k]), 1);
1016 Vmath::Vcopy(nqedge, &(tyedgeQ[0]), 1, &(tyQ[nqedge * k]), 1);
1021 for (
int w = 0; w < fz.size(); w++)
1023 txQ[w] = cos(atan(fz[w]));
1024 tyQ[w] = sin(atan(fz[w]));
1025 cout << xcQ[w] <<
" " << ycQ[w] <<
" " << fz[w] << endl;
1030 Vmath::Vcopy(nquad_lay, txQ, 1, Cont_y->UpdatePhys(), 1);
1031 Cont_y->FwdTransLocalElmt(Cont_y->GetPhys(), coeffsy);
1032 Cont_y->BwdTrans(coeffsy, Cont_y->UpdatePhys());
1035 Vmath::Vcopy(nquad_lay, tyQ, 1, Cont_y->UpdatePhys(), 1);
1036 Cont_y->FwdTransLocalElmt(Cont_y->GetPhys(), coeffsy);
1037 Cont_y->BwdTrans(coeffsy, Cont_y->UpdatePhys());
1048 for (
int q = 0; q < 2; q++)
1050 edgebef = edgeinterp[q] - 1;
1052 (txQ[edgebef * nqedge + nqedge - 1] - txQ[edgebef * nqedge]) /
1053 (xcQ[edgebef * nqedge + nqedge - 1] - xcQ[edgebef * nqedge]);
1054 inc = (txQ[edgeinterp[q] * nqedge + nqedge - 1] -
1055 txQ[edgeinterp[q] * nqedge]) /
1056 (xcQ[edgeinterp[q] * nqedge + nqedge - 1] -
1057 xcQ[edgeinterp[q] * nqedge]);
1058 int npoints = 2 * nqedge;
1064 cout <<
"inc=" << inc <<
" incbef=" << incbefore << endl;
1065 if ((inc / incbefore) > 0.)
1067 cout <<
"before!!" << edgebef << endl;
1079 PolyFit(polyorder, npoints, xQedges, txQedges, coeffsinterp,
1080 xQedges, txQedges, npoints);
1084 &txQ[edgebef * nqedge + 0], 1);
1086 PolyFit(polyorder, npoints, xQedges, tyQedges, coeffsinterp,
1087 xQedges, tyQedges, npoints);
1091 &tyQ[edgebef * nqedge + 0], 1);
1095 cout <<
"after!!" << endl;
1098 Vmath::Vcopy(npoints, &xcQ[edgeinterp[q] * nqedge + 0], 1,
1100 Vmath::Vcopy(npoints, &ycQ[edgeinterp[q] * nqedge + 0], 1,
1102 Vmath::Vcopy(npoints, &txQ[edgeinterp[q] * nqedge + 0], 1,
1104 Vmath::Vcopy(npoints, &tyQ[edgeinterp[q] * nqedge + 0], 1,
1107 PolyFit(polyorder, npoints, xQedges, txQedges, coeffsinterp,
1108 xQedges, txQedges, npoints);
1112 &txQ[edgeinterp[q] * nqedge + 0], 1);
1114 PolyFit(polyorder, npoints, xQedges, tyQedges, coeffsinterp,
1115 xQedges, tyQedges, npoints);
1119 &tyQ[edgeinterp[q] * nqedge + 0], 1);
1124 Vmath::Vcopy(nquad_lay, tyQ, 1, Cont_y->UpdatePhys(), 1);
1125 Cont_y->FwdTransLocalElmt(Cont_y->GetPhys(), coeffstmp);
1126 Cont_y->BwdTrans(coeffstmp, Cont_y->UpdatePhys());
1129 Vmath::Vcopy(nquad_lay, txQ, 1, Cont_y->UpdatePhys(), 1);
1130 Cont_y->FwdTransLocalElmt(Cont_y->GetPhys(), coeffstmp);
1131 Cont_y->BwdTrans(coeffstmp, Cont_y->UpdatePhys());
1134 for (
int k = 0; k < nedges; k++)
1141 Vmath::Vcopy(nqedge, &(txQ[nqedge * k]), 1, &(txedgeQ[0]), 1);
1142 Vmath::Vcopy(nqedge, &(tyQ[nqedge * k]), 1, &(tyedgeQ[0]), 1);
1144 Vmath::Vdiv(nqedge, txedgeQ, 1, tyedgeQ, 1, tx_tyedgeQ, 1);
1145 Vmath::Vmul(nqedge, tx_tyedgeQ, 1, tx_tyedgeQ, 1, tx_tyedgeQ, 1);
1146 Vmath::Sadd(nqedge, 1.0, tx_tyedgeQ, 1, nxedgeQ, 1);
1150 Vmath::Smul(nqedge, -1.0, nxedgeQ, 1, nxedgeQ, 1);
1151 Vmath::Vcopy(nqedge, &(nxedgeQ[0]), 1, &(nxQ[nqedge * k]), 1);
1153 Vmath::Vmul(nqedge, nxedgeQ, 1, nxedgeQ, 1, nyedgeQ, 1);
1154 Vmath::Smul(nqedge, -1.0, nyedgeQ, 1, nyedgeQ, 1);
1158 Vmath::Smul(nqedge, -1.0, nyedgeQ, 1, nyedgeQ, 1);
1159 Vmath::Vcopy(nqedge, &(nyedgeQ[0]), 1, &(nyQ[nqedge * k]), 1);
1161 cout <<
"edge:" << k << endl;
1162 cout <<
"tan/normal" << endl;
1163 for (
int r = 0; r < nqedge; r++)
1165 cout << xcQ[k * nqedge + r] <<
" " << txedgeQ[r] <<
" "
1166 << tyedgeQ[r] <<
" " << nxedgeQ[r] <<
" "
1167 << nyedgeQ[r] << endl;
1173 Vmath::Vcopy(nquad_lay, nyQ, 1, Cont_y->UpdatePhys(), 1);
1175 Cont_y->FwdTransLocalElmt(Cont_y->GetPhys(), coeffstmp);
1176 Cont_y->BwdTrans(coeffstmp, Cont_y->UpdatePhys());
1180 Vmath::Zero(Cont_y->GetNcoeffs(), Cont_y->UpdateCoeffs(), 1);
1181 Vmath::Vcopy(nquad_lay, nxQ, 1, Cont_y->UpdatePhys(), 1);
1182 Cont_y->FwdTransLocalElmt(Cont_y->GetPhys(), coeffstmp);
1183 Cont_y->BwdTrans(coeffstmp, Cont_y->UpdatePhys());
1187 for (
int k = 0; k < nedges; k++)
1193 nyQ[(k - 1) * nqedge + nqedge - 1] = nyQ[k * nqedge + 0];
1197 nxQ[(k - 1) * nqedge + nqedge - 1] = nxQ[k * nqedge + 0];
1205 cout <<
"nx,yQbefore" << endl;
1206 for (
int u = 0; u < xcQ.size(); u++)
1208 cout << xcQ[u] <<
" " << nyQ[u] <<
" " << txQ[u] << endl;
1214 cout <<
"nx,yQ" << endl;
1215 for (
int u = 0; u < x_tmpQ.size(); u++)
1217 cout << x_tmpQ[u] <<
" " << tmpnyQ[u] << endl;
1221 for (
int k = 0; k < nedges; k++)
1224 for (
int a = 0; a < npedge; a++)
1228 nxPhys[k * npedge + a] = nxQ[k * nqedge + 0];
1229 nyPhys[k * npedge + a] = nyQ[k * nqedge + 0];
1231 else if (a == npedge - 1)
1233 nxPhys[k * npedge + a] = nxQ[k * nqedge + nqedge - 1];
1234 nyPhys[k * npedge + a] = nyQ[k * nqedge + nqedge - 1];
1249 Addpointsx[k * (npedge - 2) + a - 1], x_tmpQ);
1259 Addpointsx[k * (npedge - 2) + a - 1], 4, Pxinterp,
1270 nxPhys[k * npedge + a] = -
sqrt(
abs(
1271 1 - nyPhys[k * npedge + a] * nyPhys[k * npedge + a]));
1286 nyPhys[(k - 1) * npedge + npedge - 1] =
1287 nyPhys[k * npedge + 0];
1291 nxPhys[(k - 1) * npedge + npedge - 1] =
1292 nxPhys[k * npedge + 0];
1296 cout <<
"xcPhys,," << endl;
1297 for (
int s = 0; s < np_lay; s++)
1300 cout << xcPhysMOD[s] <<
" " << ycPhysMOD[s] <<
" "
1301 << nxPhys[s] <<
" " << nyPhys[s] << endl;
1313 for (
int m = 0; m < nlays; m++)
1320 delta[m] = -(cntlow + 1 - m) * Delta0 / (cntlow + 1);
1324 delta[m] = (m - (cntlow)) * Delta0 / (cntlow + 1);
1330 for (
int h = 0; h < nvertl; h++)
1338 if (move_norm ==
false)
1340 ynew[lay_Vids[m][h]] = y_c[h] + delta[m];
1341 xnew[lay_Vids[m][h]] = x_c[h];
1345 if (h == 0 || h == nvertl - 1)
1347 ynew[lay_Vids[m][h]] = y_c[h] + delta[m];
1348 xnew[lay_Vids[m][h]] = x_c[h];
1352 ynew[lay_Vids[m][h]] =
1353 y_c[h] + delta[m] *
abs(nyPhys[h * npedge + 0]);
1354 xnew[lay_Vids[m][h]] =
1355 x_c[h] + delta[m] *
abs(nxPhys[h * npedge + 0]);
1358 cout <<
"Vid x=" << xnew[lay_Vids[m][h]]
1359 <<
" y=" << ynew[lay_Vids[m][h]] << endl;
1364 cout <<
"edge==" << h << endl;
1368 nyPhys[(h - 1) * npedge + npedge - 1],
1371 nxPhys[(h - 1) * npedge + npedge - 1],
1374 if (move_norm ==
false)
1377 layers_y[m][h * npedge + 0] = y_c[h] + delta[m];
1378 layers_x[m][h * npedge + 0] = xnew[lay_Vids[m][h]];
1380 layers_y[m][h * npedge + npedge - 1] =
1381 y_c[h + 1] + delta[m];
1382 layers_x[m][h * npedge + npedge - 1] =
1383 xnew[lay_Vids[m][h + 1]];
1385 for (
int d = 0; d < npedge - 2; d++)
1387 layers_y[m][h * npedge + d + 1] =
1388 ycPhysMOD[h * npedge + d + 1] + delta[m];
1390 layers_x[m][h * npedge + d + 1] =
1391 xcPhysMOD[h * npedge + d + 1];
1400 tmpy_lay[h * npedge + 0] = y_c[h] + delta[m];
1401 tmpx_lay[h * npedge + 0] = xnew[lay_Vids[m][h]];
1403 tmpy_lay[h * npedge + npedge - 1] =
1405 delta[m] *
abs(nyPhys[h * npedge + npedge - 1]);
1406 tmpx_lay[h * npedge + npedge - 1] =
1408 delta[m] *
abs(nxPhys[h * npedge + npedge - 1]);
1410 else if (h == nedges - 1)
1413 tmpy_lay[h * npedge + 0] =
1414 y_c[h] + delta[m] *
abs(nyPhys[h * npedge + 0]);
1415 tmpx_lay[h * npedge + 0] =
1416 x_c[h] + delta[m] *
abs(nxPhys[h * npedge + 0]);
1418 tmpy_lay[h * npedge + npedge - 1] =
1419 y_c[h + 1] + delta[m];
1420 tmpx_lay[h * npedge + npedge - 1] =
1421 xnew[lay_Vids[m][h + 1]];
1426 tmpy_lay[h * npedge + 0] =
1427 y_c[h] + delta[m] *
abs(nyPhys[h * npedge + 0]);
1428 tmpx_lay[h * npedge + 0] =
1429 x_c[h] + delta[m] *
abs(nxPhys[h * npedge + 0]);
1431 tmpy_lay[h * npedge + npedge - 1] =
1433 delta[m] *
abs(nyPhys[h * npedge + npedge - 1]);
1434 tmpx_lay[h * npedge + npedge - 1] =
1436 delta[m] *
abs(nxPhys[h * npedge + npedge - 1]);
1440 for (
int d = 0; d < npedge - 2; d++)
1443 tmpy_lay[h * npedge + d + 1] =
1444 ycPhysMOD[h * npedge + d + 1] +
1445 delta[m] *
abs(nyPhys[h * npedge + d + 1]);
1448 tmpx_lay[h * npedge + d + 1] =
1449 xcPhysMOD[h * npedge + d + 1] +
1450 delta[m] *
abs(nxPhys[h * npedge + d + 1]);
1468 for (
int s = 0; s < np_lay; s++)
1470 cout << tmpx_lay[s] <<
" " << tmpy_lay[s] << endl;
1473 cout <<
"fisrt interp" << endl;
1474 for (
int s = 0; s < np_lay; s++)
1476 cout << tmpx_lay[s] <<
" " << tmpy_lay[s] << endl;
1488 NekDouble boundright = xcPhysMOD[np_lay - 1];
1489 bool outboundleft =
false;
1490 bool outboundright =
false;
1491 if (tmpx_lay[1] < boundleft)
1493 outboundleft =
true;
1495 if (tmpx_lay[np_lay - 2] > boundright)
1497 outboundright =
true;
1505 for (
int r = 0; r < nedges; r++)
1508 if (tmpx_lay[r * npedge + npedge - 1] < boundleft &&
1509 outboundleft ==
true)
1511 vertout[outvert] = r;
1517 if (tmpx_lay[(r + 1) * npedge + npedge - 1] > boundleft)
1519 for (
int s = 0; s < npedge - 2; s++)
1521 if (tmpx_lay[(r + 1) * npedge + s + 1] <
1531 if (tmpx_lay[r * npedge + 0] > boundright &&
1532 outboundright ==
true)
1534 vertout[outvert] = r;
1540 if (tmpx_lay[(r - 1) * npedge + 0] < boundright)
1542 for (
int s = 0; s < npedge - 2; s++)
1544 if (tmpx_lay[(r - 1) * npedge + s + 1] >
1556 outcount = outvert * npedge + 1 + outmiddle;
1558 int replacepointsfromindex = 0;
1559 for (
int c = 0; c < nedges; c++)
1562 if (xcPhysMOD[c * npedge + npedge - 1] <=
1563 tmpx_lay[c * (npedge - (npedge - 2)) + 2] &&
1564 outboundright ==
true)
1566 replacepointsfromindex = c * (npedge - (npedge - 2)) + 2;
1571 if (xcPhysMOD[(nedges - 1 - c) * npedge + 0] >=
1572 tmpx_lay[np_lay - 1 -
1573 (c * (npedge - (npedge - 2)) + 2)] &&
1574 outboundleft ==
true)
1576 replacepointsfromindex =
1577 np_lay - 1 - (c * (npedge - (npedge - 2)) + 2);
1593 if (outboundright ==
true)
1595 pstart = replacepointsfromindex;
1596 shift = np_lay - outcount;
1598 (xcPhysMOD[np_lay - outcount] - xcPhysMOD[pstart]) /
1600 outcount = outcount - 1;
1601 ASSERTL0(tmpx_lay[np_lay - outcount] >
1602 xcPhysMOD[(nedges - 1) * npedge + 0],
1603 "no middle points in the last edge");
1608 pstart = outcount - 1;
1609 increment = (xcPhysMOD[replacepointsfromindex] -
1610 xcPhysMOD[pstart]) /
1613 xcPhysMOD[0 * npedge + npedge - 1],
1614 "no middle points in the first edge");
1631 NekDouble xctmp, ycinterp, nxinterp, nyinterp;
1633 for (
int v = 0; v < outcount; v++)
1635 xctmp = xcPhysMOD[pstart] + (v + 1) * increment;
1649 nxinterp =
sqrt(
abs(1 - nyinterp * nyinterp));
1657 replace_x[v] = xctmp + delta[m] *
abs(nxinterp);
1658 replace_y[v] = ycinterp + delta[m] *
abs(nyinterp);
1659 tmpx_lay[v + shift] = replace_x[v];
1660 tmpy_lay[v + shift] = replace_y[v];
1680 int closepoints = 4;
1686 int pointscount = 0;
1687 for (
int q = 0; q < np_lay; q++)
1689 for (
int e = 0; e < nedges; e++)
1691 if (tmpx_lay[q] <= x_c[e + 1] && tmpx_lay[q] >= x_c[e])
1695 if (q == e * npedge + npedge - 1 && pointscount != npedge)
1700 else if (q == e * npedge + npedge - 1)
1721 lay_Vids[m], layers_x[m], layers_y[m], xnew,
1801 if (curv_lay ==
true)
1810 int npoints = npedge;
1813 for (
int f = 0; f < nedges; f++)
1824 PolyFit(polyorder, npoints, xPedges, yPedges, coeffsinterp,
1825 xPedges, yPedges, npoints);
1829 &layers_y[m][(f)*npedge + 0], 1);
1832 layers_y[m][f * npedge + 0] = ynew[lay_Vids[m][f]];
1833 layers_y[m][f * npedge + npedge - 1] = ynew[lay_Vids[m][f + 1]];
1836 cout <<
" xlay ylay lay:" << m << endl;
1837 for (
int l = 0; l < np_lay; l++)
1840 cout << std::setprecision(8) << layers_x[m][l] <<
" "
1841 << layers_y[m][l] << endl;
1877 cout <<
"lay=" << m << endl;
1880 " different layer ymin val");
1883 " different layer ymax val");
1886 " different layer xmin val");
1889 " different layer xmax val");
1899 npedge, graphShPt, xold_c, yold_c, xold_low, yold_low, xold_up,
1900 yold_up, layers_x[0], layers_y[0], layers_x[nlays - 1],
1901 layers_y[nlays - 1], nxPhys, nyPhys, xnew, ynew);
1982 Down, Up, xnew, ynew, layers_x, layers_y);
1992 cout << std::setprecision(8) <<
"xmin=" <<
Vmath::Vmin(nVertTot, xnew, 1)
1995 " different xmin val");
1997 " different ymin val");
1999 " different xmax val");
2001 " different ymax val");
2006 charalp, layers_x, layers_y, lay_Eids, curv_lay);
void GenerateMapEidsv1v2(MultiRegions::ExpListSharedPtr field, Array< OneD, int > &V1, Array< OneD, int > &V2)
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 EvaluateTangent(int npoints, Array< OneD, NekDouble > xcQedge, Array< OneD, NekDouble > coeffsinterp, Array< OneD, NekDouble > &txQedge, Array< OneD, NekDouble > &tyQedge)
NekDouble LagrangeInterpolant(NekDouble x, int npts, Array< OneD, NekDouble > xpts, Array< OneD, NekDouble > funcvals)
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)
void Cutrepetitions(int nedges, Array< OneD, NekDouble > inarray, Array< OneD, NekDouble > &outarray)
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 CheckSingularQuads(MultiRegions::ExpListSharedPtr Exp, Array< OneD, int > V1, Array< OneD, int > V2, Array< OneD, NekDouble > &xnew, Array< OneD, NekDouble > &ynew)
void Orderfunctionx(Array< OneD, NekDouble > inarray_x, Array< OneD, NekDouble > inarray_y, Array< OneD, NekDouble > &outarray_x, Array< OneD, NekDouble > &outarray_y)
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)
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)
void GenerateAddPointsNewtonIt(NekDouble xi, NekDouble yi, NekDouble &xout, NekDouble &yout, MultiRegions::ExpListSharedPtr function, Array< OneD, NekDouble > derfunction, NekDouble cr)
void GenerateNeighbourArrays(int index, int neighpoints, Array< OneD, NekDouble > xArray, Array< OneD, NekDouble > yArray, Array< OneD, NekDouble > &Neighbour_x, Array< OneD, NekDouble > &Neighbour_y)
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)
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 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)
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
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 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...
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< SegExp > SegExpSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::shared_ptr< ContField > ContFieldSharedPtr
std::map< int, BoundaryRegionShPtr > BoundaryRegionCollection
std::shared_ptr< BoundaryConditions > BoundaryConditionsSharedPtr
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::shared_ptr< PointGeom > PointGeomSharedPtr
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
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.
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
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 Zero(int n, T *x, const int incx)
Zero vector.
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
scalarT< T > sqrt(scalarT< T > in)