Nektar++
MoveMeshToCriticalLayer.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: MoveMeshToCriticalLayer.cpp
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: MoveMesh to critical layer
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #include <cstdio>
36 #include <cstdlib>
37 #include <iomanip>
38 
40 #include <MultiRegions/ExpList.h>
42 #include <tinyxml.h>
43 
44 using namespace std;
45 using namespace Nektar;
46 
48 
50 {
54  eNoSolve
55 };
56 
57 struct MoveVerts
58 {
59  vector<NekDouble> kspring;
60  vector<int> springVid;
62 };
63 
64 void GetInterfaceVerts(const int compositeID,
66  vector<int> &InterfaceVerts);
67 
70  string &fieldfile, Array<OneD, NekDouble> &xc,
72 
73 void GetNewVertexLocation(TiXmlElement *doc,
75  vector<int> &InterfaceVerts,
76  Array<OneD, NekDouble> &xstreak,
77  Array<OneD, NekDouble> &ystreak,
79  Array<OneD, NekDouble> &verty, int maxiter);
80 
81 void TurnOffEdges(TiXmlElement *doc, SpatialDomains::SegGeomMap &meshedges,
82  Array<OneD, MoveVerts> &verts);
83 
84 void RedefineVertices(TiXmlElement *doc, Array<OneD, NekDouble> &dvertx,
85  Array<OneD, NekDouble> &dverty);
86 
88  Array<OneD, NekDouble> &dvertx,
89  Array<OneD, NekDouble> &dverty);
90 
91 int main(int argc, char *argv[])
92 {
93  if (argc != 4)
94  {
95  fprintf(
96  stderr,
97  "Usage: ./MoveMeshToCriticalLayer meshfile streakfile outfile\n");
98  exit(1);
99  }
100 
101  //------------------------------------------------------------
102  // Create Session file by reading only first meshfile
103  //-----------------------------------------------------------
105  LibUtilities::SessionReader::CreateInstance(2, argv);
107  SpatialDomains::MeshGraph::Read(vSession);
108 
109  //-------------------------------------------------------------
110  // Read in mesh from input file
111  //------------------------------------------------------------
112  TiXmlDocument &meshdoc = vSession->GetDocument();
113  TiXmlHandle docHandle(&meshdoc);
114  TiXmlElement *doc = docHandle.FirstChildElement("NEKTAR")
115  .FirstChildElement("GEOMETRY")
116  .Element();
117 
118  //------------------------------------------------------------
119  // Get list of vertices along interface
120  //------------------------------------------------------------
121  vector<int> InterfaceVerts;
122  GetInterfaceVerts(300, mesh, InterfaceVerts);
123 
124  //------------------------------------------------------------
125  // Determine location of new interface vertices
126  //------------------------------------------------------------
127  Array<OneD, NekDouble> xstreak(50), ystreak(50);
128  string fieldfile(argv[argc - 2]);
129  GetStreakLocation(vSession, mesh, fieldfile, xstreak, ystreak);
130 
131  //------------------------------------------------------------
132  // Move internal mesh using critical layer info and under string analogy
133  //------------------------------------------------------------
134  Array<OneD, NekDouble> dvertx(mesh->GetNvertices(), 0.0),
135  dverty(mesh->GetNvertices(), 0.0);
136  int maxiter;
137  vSession->LoadParameter("MoveMeshMaxIterations", maxiter, 100);
138 
139  GetNewVertexLocation(doc, mesh, InterfaceVerts, xstreak, ystreak, dvertx,
140  dverty, maxiter);
141 
142  //------------------------------------------------------------
143  // Enforce rotational symmetry on mesh
144  //------------------------------------------------------------
145  if (vSession->DefinesSolverInfo("EnforceRotationalSymmetry"))
146  {
147  EnforceRotationalSymmetry(mesh, dvertx, dverty);
148  }
149 
150  //------------------------------------------------------------
151  // Redfine vertices in doc
152  //------------------------------------------------------------
153  RedefineVertices(doc, dvertx, dverty);
154 
155  //------------------------------------------------------------
156  // Write out moved mesh file
157  //------------------------------------------------------------
158  std::string outfile(argv[argc - 1]);
159  meshdoc.SaveFile(outfile);
160 }
161 
162 void GetInterfaceVerts(const int compositeID,
164  vector<int> &InterfaceVerts)
165 {
167  composite = mesh->GetComposite(compositeID);
168  int compsize = composite->m_geomVec.size();
169  map<int, int> vertmap;
170 
171  for (int i = 0; i < compsize; ++i)
172  {
173  if (vertmap.count(composite->m_geomVec[i]->GetVid(0)) == 0)
174  {
175  InterfaceVerts.push_back(composite->m_geomVec[i]->GetVid(0));
176  vertmap[composite->m_geomVec[i]->GetVid(0)] = 1;
177  }
178 
179  if (vertmap.count(composite->m_geomVec[i]->GetVid(1)) == 0)
180  {
181  InterfaceVerts.push_back(composite->m_geomVec[i]->GetVid(1));
182  vertmap[composite->m_geomVec[i]->GetVid(1)] = 1;
183  }
184  }
185 }
186 
189  string &fieldfile, Array<OneD, NekDouble> &xc,
191 {
192  //-------------------------------------------------------------
193  // Define Streak Expansion
195 
196  streak =
198  //---------------------------------------------------------------
199 
200  //----------------------------------------------
201  // Import field file.
202  vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
203  vector<vector<NekDouble>> fielddata;
204  LibUtilities::Import(fieldfile, fielddef, fielddata);
205  //----------------------------------------------
206 
207  //----------------------------------------------
208  // Copy data from field file
209  string streak_field("w");
210  for (unsigned int i = 0; i < fielddata.size(); ++i)
211  {
212  streak->ExtractDataToCoeffs(fielddef[i], fielddata[i], streak_field,
213  streak->UpdateCoeffs());
214  }
215  //----------------------------------------------
216 
217  NekDouble cr = 0.0;
218 
219  cerr << "Extracting Critical Layer ";
220  Computestreakpositions(streak, xc, yc, cr);
221 }
222 
223 void GetNewVertexLocation(TiXmlElement *doc,
225  vector<int> &InterfaceVerts,
226  Array<OneD, NekDouble> &xstreak,
227  Array<OneD, NekDouble> &ystreak,
228  Array<OneD, NekDouble> &dvertx,
229  Array<OneD, NekDouble> &dverty, int maxiter)
230 {
231  int i, j, k;
232  int nverts = mesh->GetNvertices();
233 
234  SpatialDomains::SegGeomMap meshedges = mesh->GetAllSegGeoms();
235 
236  Array<OneD, MoveVerts> Verts(nverts);
237 
238  // loop mesh edges and fill in verts info
241 
242  int vid0, vid1;
243  NekDouble kspring;
244  NekDouble x, y, x1, y1, z1, x2, y2, z2;
245 
246  // Setup intiial spring and verts
247  for (auto &segIter : meshedges)
248  {
249  vid0 = (segIter.second)->GetVid(0);
250  vid1 = (segIter.second)->GetVid(1);
251 
252  v0 = (segIter.second)->GetVertex(0);
253  v1 = (segIter.second)->GetVertex(1);
254 
255  kspring = 1.0 / v0->dist(*v1);
256 
257  Verts[vid0].kspring.push_back(kspring);
258  Verts[vid0].springVid.push_back(vid1);
259  Verts[vid1].kspring.push_back(kspring);
260  Verts[vid1].springVid.push_back(vid0);
261  }
262 
263  // Scale spring by total around vertex and turn on all vertices.
264  for (i = 0; i < nverts; ++i)
265  {
266  NekDouble invktot = 0.0;
267  for (j = 0; j < Verts[i].kspring.size(); ++j)
268  {
269  invktot += Verts[i].kspring[j];
270  }
271  invktot = 1.0 / invktot;
272  for (j = 0; j < Verts[i].kspring.size(); ++j)
273  {
274  Verts[i].kspring[j] *= invktot;
275  }
276 
277  Verts[i].solve = eSolveXY;
278  }
279 
280  // Turn off all edges defined by composite lists of correct dimension
281  TurnOffEdges(doc, meshedges, Verts);
282 
283  NekDouble z, h0, h1, h2;
284  // Set interface vertices to lie on critical layer
285  for (i = 0; i < InterfaceVerts.size(); ++i)
286  {
287  Verts[InterfaceVerts[i]].solve = eNoSolve;
288  mesh->GetVertex(InterfaceVerts[i])->GetCoords(x, y, z);
289 
290  for (j = 0; j < xstreak.size() - 1; ++j)
291  {
292  if ((x >= xstreak[j]) && (x <= xstreak[j + 1]))
293  {
294  break;
295  }
296  }
297 
298  ASSERTL0(j != xstreak.size(),
299  "Did not find x location along critical layer");
300 
301  k = (j == 0) ? 1 : j; // offset index at beginning
302 
303  // quadraticalling interpolate points
304  h0 =
305  (x - xstreak[k]) * (x - xstreak[k + 1]) /
306  ((xstreak[k - 1] - xstreak[k]) * (xstreak[k - 1] - xstreak[k + 1]));
307  h1 = (x - xstreak[k - 1]) * (x - xstreak[k + 1]) /
308  ((xstreak[k] - xstreak[k - 1]) * (xstreak[k] - xstreak[k + 1]));
309  h2 =
310  (x - xstreak[k - 1]) * (x - xstreak[k]) /
311  ((xstreak[k + 1] - xstreak[k - 1]) * (xstreak[k + 1] - xstreak[k]));
312 
313  dvertx[InterfaceVerts[i]] =
314  (xstreak[k - 1] * h0 + xstreak[k] * h1 + xstreak[k + 1] * h2) - x;
315  dverty[InterfaceVerts[i]] =
316  (ystreak[k - 1] * h0 + ystreak[k] * h1 + ystreak[k + 1] * h2) - y;
317  }
318 
319  // shift quads in critical layer to move more or less rigidly
320  SpatialDomains::QuadGeomMap quadgeom = mesh->GetAllQuadGeoms();
321  for (auto &quadIter : quadgeom)
322  {
323  for (i = 0; i < 4; ++i)
324  {
325  vid0 = (quadIter.second)->GetVid(i);
326 
327  switch (Verts[vid0].solve)
328  {
329  case eSolveXY:
330  {
331  mesh->GetVertex(vid0)->GetCoords(x, y, z);
332 
333  // find nearest interface vert
334  mesh->GetVertex(InterfaceVerts[0])->GetCoords(x1, y1, z1);
335  for (j = 0; j < InterfaceVerts.size() - 1; ++j)
336  {
337  mesh->GetVertex(InterfaceVerts[j + 1])
338  ->GetCoords(x2, y2, z2);
339  if ((x >= x1) && (x < x2))
340  {
341  break;
342  }
343  x1 = x2;
344  y1 = y2;
345  }
346 
347  // currently just shift vert as average of two sides
348  dvertx[vid0] =
349  (x2 - x) / (x2 - x1) * dvertx[InterfaceVerts[j]] +
350  (x - x1) / (x2 - x1) * dvertx[InterfaceVerts[j + 1]];
351  dverty[vid0] =
352  (x2 - x) / (x2 - x1) * dverty[InterfaceVerts[j]] +
353  (x - x1) / (x2 - x1) * dverty[InterfaceVerts[j + 1]];
354  }
355  break;
356  case eSolveY:
357  {
358  mesh->GetVertex(vid0)->GetCoords(x, y, z);
359  mesh->GetVertex(InterfaceVerts[0])->GetCoords(x1, y1, z1);
360 
361  if (fabs(x - x1) < 1e-6)
362  {
363  dverty[vid0] = dverty[InterfaceVerts[0]];
364  }
365  else
366  {
367  dverty[vid0] =
368  dverty[InterfaceVerts[InterfaceVerts.size() - 1]];
369  }
370  }
371  break;
372  default:
373  break;
374  }
375  Verts[vid0].solve = eNoSolve;
376  }
377  }
378 
379  // Iterate internal vertices
380  bool ContinueToIterate = true;
381  int cnt = 0;
382  int nsum = 0;
383  NekDouble dsum, dx, dy, sum, prev_sum = 0.0;
384  NekDouble tol = 1e-3, fac;
385  int blend = 50;
386 
387  while (ContinueToIterate)
388  {
389 
390  sum = 0.0;
391  nsum = 0;
392 
393  // use a ramping function to help move interior slowly
394  fac = (cnt < blend) ? 1.0 / (blend + 1.0) * (cnt + 1) : 1.0;
395 
396  for (i = 0; i < nverts; ++i)
397  {
398  if (Verts[i].solve != eNoSolve)
399  {
400  dx = dy = 0.0;
401 
402  if ((Verts[i].solve == eSolveX) || (Verts[i].solve == eSolveXY))
403  {
404  for (j = 0; j < Verts[i].kspring.size(); ++j)
405  {
406  dx += fac * Verts[i].kspring[j] *
407  dvertx[Verts[i].springVid[j]];
408  }
409  }
410 
411  if ((Verts[i].solve == eSolveY) || (Verts[i].solve == eSolveXY))
412  {
413  for (j = 0; j < Verts[i].kspring.size(); ++j)
414  {
415  dy += fac * Verts[i].kspring[j] *
416  dverty[Verts[i].springVid[j]];
417  }
418  }
419 
420  dsum = (dx * dx + dy * dy);
421 
422  dvertx[i] = dx;
423  dverty[i] = dy;
424 
425  if (dsum > 1e-16)
426  {
427  // sum += dsum/(dvertx[i]*dvertx[i] + dverty[i]*dverty[i]);
428  sum += dsum;
429  nsum += 1;
430  }
431  }
432  }
433 
434  if (nsum)
435  {
436  sum = sqrt(sum / (NekDouble)nsum);
437 
438  NekDouble chg = sum - prev_sum;
439  prev_sum = sum;
440 
441  cerr << "Iteration " << cnt << " : " << chg << endl;
442 
443  if ((chg < tol) && (cnt > blend))
444  {
445  ContinueToIterate = false;
446  }
447  }
448  else if (cnt > blend)
449  {
450  ContinueToIterate = false;
451  }
452 
453  if (cnt++ > maxiter)
454  {
455  ContinueToIterate = false;
456  }
457  }
458 }
459 
460 // Read Composites from xml document and turn off verts that are along edge
461 // composites.
462 void TurnOffEdges(TiXmlElement *doc, SpatialDomains::SegGeomMap &meshedges,
463  Array<OneD, MoveVerts> &Verts)
464 {
465  TiXmlElement *field = doc->FirstChildElement("COMPOSITE");
466  ASSERTL0(field, "Unable to find COMPOSITE tag in file.");
467 
468  int nextCompositeNumber = -1;
469 
470  /// All elements are of the form: "<C ID = "N"> ... </C>".
471  /// Read the ID field first.
472  TiXmlElement *composite = field->FirstChildElement("C");
473 
474  while (composite)
475  {
476  nextCompositeNumber++;
477 
478  int indx;
479  int err = composite->QueryIntAttribute("ID", &indx);
480  ASSERTL0(err == TIXML_SUCCESS, "Unable to read attribute ID.");
481 
482  TiXmlNode *compositeChild = composite->FirstChild();
483  // This is primarily to skip comments that may be present.
484  // Comments appear as nodes just like elements.
485  // We are specifically looking for text in the body
486  // of the definition.
487  while (compositeChild &&
488  compositeChild->Type() != TiXmlNode::TINYXML_TEXT)
489  {
490  compositeChild = compositeChild->NextSibling();
491  }
492 
493  ASSERTL0(compositeChild, "Unable to read composite definition body.");
494  std::string compositeStr = compositeChild->ToText()->ValueStr();
495 
496  /// Parse out the element components corresponding to type of element.
497  std::istringstream compositeDataStrm(compositeStr.c_str());
498 
499  try
500  {
501  std::string compositeElementStr;
502  compositeDataStrm >> compositeElementStr;
503 
504  std::istringstream tokenStream(compositeElementStr);
505  char type;
506 
507  tokenStream >> type;
508 
509  // in what follows we are assuming there is only one block of data
510  std::string::size_type indxBeg =
511  compositeElementStr.find_first_of('[') + 1;
512  std::string::size_type indxEnd =
513  compositeElementStr.find_last_of(']') - 1;
514 
515  ASSERTL0(indxBeg <= indxEnd,
516  (std::string("Error reading index definition:") +
517  compositeElementStr)
518  .c_str());
519 
520  std::string indxStr =
521  compositeElementStr.substr(indxBeg, indxEnd - indxBeg + 1);
522  std::vector<unsigned int> seqVector;
523 
524  bool err = ParseUtils::GenerateSeqVector(indxStr, seqVector);
525 
526  ASSERTL0(err, (std::string("Error reading composite elements: ") +
527  indxStr)
528  .c_str());
529 
530  switch (type)
531  {
532  case 'E': // Turn off vertices along composite edges
533  {
534  int seqlen = seqVector.size();
535  NekDouble x0, y0, z0, x1, y1, z1;
536  int vid0, vid1;
537 
538  for (int i = 0; i < seqlen; ++i)
539  {
540  meshedges[seqVector[i]]->GetVertex(0)->GetCoords(x0, y0,
541  z0);
542  meshedges[seqVector[i]]->GetVertex(1)->GetCoords(x1, y1,
543  z1);
544  vid0 = meshedges[seqVector[i]]->GetVid(0);
545  vid1 = meshedges[seqVector[i]]->GetVid(1);
546 
547  if (fabs(x0 - x1) < 1e-8)
548  {
549  // identify corners by double visit
550  if (Verts[vid0].solve == eSolveX)
551  {
552  Verts[vid0].solve = eNoSolve;
553  }
554  else
555  {
556  Verts[vid0].solve = eSolveY;
557  }
558 
559  if (Verts[vid1].solve == eSolveX)
560  {
561  Verts[vid1].solve = eNoSolve;
562  }
563  else
564  {
565  Verts[vid1].solve = eSolveY;
566  }
567  }
568 
569  if (fabs(y0 - y1) < 1e-8)
570  {
571  // identify corners by double visit
572  if (Verts[vid0].solve == eSolveY)
573  {
574  Verts[vid0].solve = eNoSolve;
575  }
576  else
577  {
578  Verts[vid0].solve = eSolveX;
579  }
580 
581  if (Verts[vid1].solve == eSolveY)
582  {
583  Verts[vid1].solve = eNoSolve;
584  }
585  else
586  {
587  Verts[vid1].solve = eSolveX;
588  }
589  }
590  }
591  }
592  break;
593 
594  case 'T':
595  case 'Q': // do nothing
596  {
597  break;
598  }
599  default:
600  NEKERROR(ErrorUtil::efatal,
601  (std::string("Unrecognized composite token: ") +
602  compositeElementStr)
603  .c_str());
604  }
605  }
606  catch (...)
607  {
608  NEKERROR(
609  ErrorUtil::efatal,
610  (std::string("Unable to read COMPOSITE data for composite: ") +
611  compositeStr)
612  .c_str());
613  }
614 
615  /// Keep looking
616  composite = composite->NextSiblingElement("C");
617  }
618 }
619 
620 void RedefineVertices(TiXmlElement *doc, Array<OneD, NekDouble> &dvertx,
621  Array<OneD, NekDouble> &dverty)
622 {
623 
624  TiXmlElement *element = doc->FirstChildElement("VERTEX");
625  ASSERTL0(element, "Unable to find mesh VERTEX tag in file.");
626 
627  TiXmlElement *vertex = element->FirstChildElement("V");
628 
629  int indx;
630  int nextVertexNumber = -1;
631  int err; /// Error value returned by TinyXML.
632 
633  vector<NekDouble> xpts, ypts, zpts;
634  NekDouble xval, yval, zval;
635 
636  while (vertex)
637  {
638  nextVertexNumber++;
639 
640  TiXmlAttribute *vertexAttr = vertex->FirstAttribute();
641  std::string attrName(vertexAttr->Name());
642 
643  ASSERTL0(attrName == "ID",
644  (std::string("Unknown attribute name: ") + attrName).c_str());
645 
646  err = vertexAttr->QueryIntValue(&indx);
647  ASSERTL0(err == TIXML_SUCCESS, "Unable to read attribute ID.");
648 
649  // Now read body of vertex
650  std::string vertexBodyStr;
651 
652  TiXmlNode *vertexBody = vertex->FirstChild();
653 
654  while (vertexBody)
655  {
656  // Accumulate all non-comment body data.
657  if (vertexBody->Type() == TiXmlNode::TINYXML_TEXT)
658  {
659  vertexBodyStr += vertexBody->ToText()->Value();
660  vertexBodyStr += " ";
661  }
662 
663  vertexBody = vertexBody->NextSibling();
664  }
665 
666  ASSERTL0(!vertexBodyStr.empty(),
667  "Vertex definitions must contain vertex data.");
668 
669  // Get vertex data from the data string.
670  std::istringstream vertexDataStrm(vertexBodyStr.c_str());
671 
672  try
673  {
674  while (!vertexDataStrm.fail())
675  {
676  vertexDataStrm >> xval >> yval >> zval;
677  }
678 
679  xval += dvertx[indx];
680  yval += dverty[indx];
681 
682  stringstream s;
683  s << scientific << setprecision(8) << xval << " " << yval << " "
684  << zval;
685 
686  vertex->ReplaceChild(vertex->FirstChild(), TiXmlText(s.str()));
687  }
688  catch (...)
689  {
690  ASSERTL0(false, "Unable to read VERTEX data.");
691  }
692  vertex = vertex->NextSiblingElement("V");
693  }
694 }
695 
697  Array<OneD, NekDouble> &dvertx,
698  Array<OneD, NekDouble> &dverty)
699 {
700  int i, j;
701  int nverts = mesh->GetNvertices();
702  Array<OneD, NekDouble> x(nverts), y(nverts);
703  NekDouble xval, yval, zval;
704 
705  for (i = 0; i < nverts; ++i)
706  {
707  mesh->GetVertex(i)->GetCoords(xval, yval, zval);
708  x[i] = xval + dvertx[i];
709  y[i] = yval + dverty[i];
710  }
711 
712  NekDouble xmax = Vmath::Vmax(nverts, x, 1);
713  NekDouble tol = 1e-5, dist2, xrot, yrot;
714  Array<OneD, int> index(nverts);
715  // find nearest
716  for (i = 0; i < nverts; ++i)
717  {
718  xrot = -x[i] + xmax;
719  yrot = -y[i];
720  tol = 1.0;
721 
722  for (j = 0; j < nverts; ++j)
723  {
724  dist2 =
725  (x[j] - xrot) * (x[j] - xrot) + (y[j] - yrot) * (y[j] - yrot);
726  if (dist2 < tol)
727  {
728  index[i] = j;
729  tol = dist2;
730  }
731  }
732  }
733 
734  // average points and recalcualte dvertx, dverty
735  for (i = 0; i < nverts; ++i)
736  {
737  mesh->GetVertex(i)->GetCoords(xval, yval, zval);
738 
739  xrot = 0.5 * (-x[index[i]] + xmax + x[i]);
740  yrot = 0.5 * (-y[index[i]] + y[i]);
741 
742  dvertx[i] = xrot - xval;
743  dverty[i] = yrot - yval;
744  }
745 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:209
void Computestreakpositions(MultiRegions::ExpListSharedPtr &streak, Array< OneD, NekDouble > &xc, Array< OneD, NekDouble > &yc, NekDouble cr, NekDouble trans)
int main(int argc, char *argv[])
void GetNewVertexLocation(TiXmlElement *doc, SpatialDomains::MeshGraphSharedPtr &mesh, vector< int > &InterfaceVerts, Array< OneD, NekDouble > &xstreak, Array< OneD, NekDouble > &ystreak, Array< OneD, NekDouble > &vertx, Array< OneD, NekDouble > &verty, int maxiter)
void TurnOffEdges(TiXmlElement *doc, SpatialDomains::SegGeomMap &meshedges, Array< OneD, MoveVerts > &verts)
void EnforceRotationalSymmetry(SpatialDomains::MeshGraphSharedPtr &mesh, Array< OneD, NekDouble > &dvertx, Array< OneD, NekDouble > &dverty)
void RedefineVertices(TiXmlElement *doc, Array< OneD, NekDouble > &dvertx, Array< OneD, NekDouble > &dverty)
void GetInterfaceVerts(const int compositeID, SpatialDomains::MeshGraphSharedPtr &mesh, vector< int > &InterfaceVerts)
void GetStreakLocation(LibUtilities::SessionReaderSharedPtr &vSession, SpatialDomains::MeshGraphSharedPtr &mesh, string &fieldfile, Array< OneD, NekDouble > &xc, Array< OneD, NekDouble > &yc)
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
NekDouble dist(PointGeom &a)
return distance between this and input a
Definition: PointGeom.cpp:180
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...
Definition: FieldIO.cpp:290
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::map< int, QuadGeomSharedPtr > QuadGeomMap
Definition: QuadGeom.h:54
std::shared_ptr< Composite > CompositeSharedPtr
Definition: MeshGraph.h:137
std::map< int, SegGeomSharedPtr > SegGeomMap
Definition: SegGeom.h:52
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:172
std::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:59
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
Definition: Vmath.cpp:945
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:294
vector< int > springVid
vector< NekDouble > kspring