NEMoSys  0.63.0
A modular, extensible resource with robust automated mesh generation, mesh quality analysis, adaptive mesh refinement, and data transfer between arbitrary meshes.
rocstarCgns.C
Go to the documentation of this file.
1 /*******************************************************************************
2 * Promesh *
3 * Copyright (C) 2022, IllinoisRocstar LLC. All rights reserved. *
4 * *
5 * Promesh is the property of IllinoisRocstar LLC. *
6 * *
7 * IllinoisRocstar LLC *
8 * Champaign, IL *
9 * www.illinoisrocstar.com *
10 * promesh@illinoisrocstar.com *
11 *******************************************************************************/
12 /*******************************************************************************
13 * This file is part of Promesh *
14 * *
15 * This version of Promesh is free software: you can redistribute it and/or *
16 * modify it under the terms of the GNU Lesser General Public License as *
17 * published by the Free Software Foundation, either version 3 of the License, *
18 * or (at your option) any later version. *
19 * *
20 * Promesh is distributed in the hope that it will be useful, but WITHOUT ANY *
21 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more *
23 * details. *
24 * *
25 * You should have received a copy of the GNU Lesser General Public License *
26 * along with this program. If not, see <https://www.gnu.org/licenses/>. *
27 * *
28 *******************************************************************************/
29 /* Special purpose class for Rocstar CGNS files */
30 
31 #include "IO/rocstarCgns.H"
32 
33 ///////////////////////////////////////////////////
34 // INITIALIZATION
35 ///////////////////////////////////////////////////
36 
37 rocstarCgns::rocstarCgns(std::string fname)
38  : cgnsAnalyzer(fname), myCgFName(fname), _burn(0) {
39  std::size_t _loc = myCgFName.find_last_of("_");
40  baseCgFName = myCgFName.substr(0, _loc + 1);
41  padSize = myCgFName.size() - baseCgFName.size() - 5;
42 }
43 
44 rocstarCgns::rocstarCgns(const std::vector<std::string> &fnames)
45  : cgnsAnalyzer(fnames[0]), _burn(0), cgFNames(fnames) {
46  std::size_t _loc = fnames[0].find_last_of("_");
47  baseCgFName = fnames[0].substr(0, _loc + 1);
48 }
49 
51  // cleaning up
52  for (int ic = 0; ic < myCgObjs.size(); ic++) delete myCgObjs[ic];
53 }
54 
55 /*
56  Loads a series of cgns files based on current file name
57  and rocstar's convention.
58 */
60  for (int iCg = 0; iCg < nCg; iCg++) {
61  std::ostringstream suffix1;
62  std::ostringstream suffix2;
63  suffix1 << iCg;
64  std::string tmp = suffix1.str();
65  for (int iPad = 0; iPad < padSize - tmp.size(); iPad++) suffix2 << "0";
66  suffix2 << tmp << ".cgns";
67  std::string fName = baseCgFName + suffix2.str();
68  cgnsAnalyzer *cgTmp = new cgnsAnalyzer(fName);
69  cgTmp->loadGrid();
70  myCgObjs.push_back(cgTmp);
71  cgFNames.push_back(fName);
72  }
73 }
74 
76  for (int i = 0; i < cgFNames.size(); ++i) {
77  cgnsAnalyzer *cgTmp = new cgnsAnalyzer(cgFNames[i]);
78  cgTmp->loadGrid();
79  myCgObjs.push_back(cgTmp);
80  }
81 }
82 
84  for (auto it = myCgObjs.begin() + 1; it != myCgObjs.end(); it++)
85  (*it)->closeCG();
86 }
87 
88 int rocstarCgns::getNCgObj() { return (myCgObjs.size()); }
89 
90 std::string rocstarCgns::getBaseName() { return (baseCgFName); }
91 
92 std::string rocstarCgns::getBaseName(int indx) {
93  if (indx < myCgObjs.size()) return (myCgObjs[indx]->getBaseName());
94  return ("INVALID");
95 }
96 
97 std::string rocstarCgns::getCgFName(int indx) {
98  if (indx < cgFNames.size()) return (cgFNames[indx]);
99  return ("INVALID");
100 }
101 
102 std::string rocstarCgns::getBaseItrName(int indx) {
103  if (indx < cgFNames.size()) return (myCgObjs[indx]->getBaseItrName());
104  return ("INVALID");
105 }
106 
107 int rocstarCgns::getNTStep(int indx) {
108  if (indx < cgFNames.size()) return (myCgObjs[indx]->getNTStep());
109  return (-1);
110 }
111 
112 double rocstarCgns::getTimeStep(int indx) {
113  if (indx < cgFNames.size()) return (myCgObjs[indx]->getTimeStep());
114  return (-1);
115 }
116 
117 std::string rocstarCgns::getZoneItrName(int indx, int zidx) {
118  if (indx > cgFNames.size()) return ("INVALID");
119  myCgObjs[indx]->loadZone(zidx);
120  return (myCgObjs[indx]->getZoneItrName());
121 }
122 
123 std::string rocstarCgns::getGridCrdPntr(int indx, int zidx) {
124  if (indx > cgFNames.size()) return ("INVALID");
125  myCgObjs[indx]->loadZone(zidx);
126  return (myCgObjs[indx]->getGridCrdPntr());
127 }
128 
129 std::string rocstarCgns::getSolutionPntr(int indx, int zidx) {
130  if (indx > cgFNames.size()) return ("INVALID");
131  myCgObjs[indx]->loadZone(zidx);
132  return (myCgObjs[indx]->getSolutionPntr());
133 }
134 ////////////////////////////////////////////////////
135 // DATA PROCESSING
136 ////////////////////////////////////////////////////
138  for (int iObj = 0; iObj < getNCgObj(); iObj++) {
139  std::cout << "Reading " << myCgObjs[iObj]->getFileName() << std::endl;
140  for (int iz = 1; iz <= myCgObjs[iObj]->getNZone(); iz++) {
141  std::cout << "Zone " << getZoneName(myCgObjs[iObj], iz) << std::endl;
142  stitchMe(myCgObjs[iObj], iz);
143  }
144  }
145 }
146 
147 void rocstarCgns::stitchMe(cgnsAnalyzer *cgObj, int zoneIdx) {
148  // load proper zone
149  // asking object to load its zone information
150  // this should refresh vertex coordinates and
151  // element connectivity tables
152  cgObj->loadZone(zoneIdx);
153 
154  // check if this is the first object being stitched
155  if (nVertex == 0) {
156  // copying from the object
157  isUnstructured = !cgObj->isStructured();
158  cellDim = cgObj->getCellDim();
159  physDim = cgObj->getPhysDim();
160  massU = cgObj->getMassUnit();
161  lengthU = cgObj->getLengthUnit();
162  timeU = cgObj->getTimeUnit();
163  tempU = cgObj->getTemperatureUnit();
164  angleU = cgObj->getAngleUnit();
165  timeLabel = cgObj->getTimeStep();
166  // using the very first zone as the initial
167  // vertex and element informaiton
168  nVertex = getZoneNVrtx(cgObj, 1);
169  nElem = getZoneNCell(cgObj, 1);
170  xCrd = getZoneCoords(cgObj, 1, 1);
171  yCrd = getZoneCoords(cgObj, 1, 2);
172  zCrd = getZoneCoords(cgObj, 1, 3);
173  sectionType = (CGNS_ENUMT(ElementType_t))getZoneRealSecType(cgObj, 1);
174  elemConn = getZoneRealConn(cgObj, 1);
175  stitchFldBc(cgObj, zoneIdx);
176  return;
177  }
178 
179  // (re)building the kdTree
181 
182  // clear old masks
183  vrtDataMask.clear();
184  elmDataMask.clear();
185 
186  // adding new mesh non-repeating vertices
187  std::vector<int> newVrtIdx;
188  std::vector<int> rptVrtIdx;
189  std::map<int, int> rptVrtMap; // <newMeshIdx, currentMeshIdx>
190  std::vector<double> newXCrd;
191  std::vector<double> newYCrd;
192  std::vector<double> newZCrd;
193  int nNewVrt = 0;
194  for (int iVrt = 0; iVrt < cgObj->getNVertex(); iVrt++) {
195  ANNpoint qryVrtx;
196  ANNidxArray nnIdx;
197  ANNdistArray dists;
198  qryVrtx = annAllocPt(physDim);
199  qryVrtx[0] = cgObj->getVrtXCrd(iVrt);
200  qryVrtx[1] = cgObj->getVrtYCrd(iVrt);
201  qryVrtx[2] = cgObj->getVrtZCrd(iVrt);
202  nnIdx = new ANNidx[1];
203  dists = new ANNdist[1];
204  kdTree->annkSearch(qryVrtx, 1, nnIdx, dists);
205  if (dists[0] > searchEps) {
206  nNewVrt++;
207  vrtDataMask.push_back(true);
208  newVrtIdx.push_back(nVertex + nNewVrt);
209  newXCrd.push_back(qryVrtx[0]);
210  newYCrd.push_back(qryVrtx[1]);
211  newZCrd.push_back(qryVrtx[2]);
212  } else {
213  vrtDataMask.push_back(false);
214  newVrtIdx.push_back(nnIdx[0] + 1);
215  rptVrtIdx.push_back(iVrt);
216  rptVrtMap[iVrt] = nnIdx[0] + 1;
217  }
218  delete[] nnIdx;
219  delete[] dists;
220  annDeallocPt(qryVrtx);
221  }
222  std::cout << "Found " << nNewVrt << " new vertices.\n";
223  std::cout << "Number of repeating index " << rptVrtIdx.size() << std::endl;
224 
225  // currently implemented to add all new elements
226  std::vector<int> newElemConn;
227  int nNewElem = 0;
228  for (int iElem = 0; iElem < cgObj->getNElement(); iElem++) {
229  std::vector<cgsize_t> rmtElemConn = cgObj->getElementConnectivity(iElem);
230  // just adding all elements
231  elmDataMask.push_back(true);
232  nNewElem++;
233  newElemConn.insert(newElemConn.end(), rmtElemConn.begin(),
234  rmtElemConn.end());
235  }
236  std::cout << "Found " << nNewElem << " new elements.\n";
237 
238  // switching connectivity table to global
239  for (int iIdx = 0; iIdx < newElemConn.size(); iIdx++) {
240  newElemConn[iIdx] = newVrtIdx[newElemConn[iIdx] - 1];
241  }
242 
243  // stitching field values if requested
244  stitchFldBc(cgObj, zoneIdx);
245 
246  // updating internal datastructure
247  nVertex += nNewVrt;
248  nElem += nNewElem;
249  xCrd.insert(xCrd.end(), newXCrd.begin(), newXCrd.end());
250  yCrd.insert(yCrd.end(), newYCrd.begin(), newYCrd.end());
251  zCrd.insert(zCrd.end(), newZCrd.begin(), newZCrd.end());
252  elemConn.insert(elemConn.end(), newElemConn.begin(), newElemConn.end());
253  zoneNames.push_back(cgObj->getFileName() + "->" + cgObj->getZoneName());
254 }
255 
256 void rocstarCgns::stitchFldBc(cgnsAnalyzer *cgObj, int zoneIdx) {
257  // load proper zone
258  // asking object to load its zone information
259  // this should refresh vertex coordinates and
260  // element connectivity tables
261  cgObj->loadZone(zoneIdx);
262  cgObj->clearAllSolutionData();
263  // next two line just o triger cgObj->populateSolutionDataNames();
264  std::vector<std::string> listTmp;
265  cgObj->getSolutionDataNames(listTmp);
266 
267  // treating special first time use case
268  if (solutionMap.empty()) {
269  // populate solution data of current instance for
270  // stitching
271  // cgObj->clearAllSolutionData();
272  // cgObj->populateSolutionDataNames();
275  solutionMap = cgObj->getSolutionMap();
277  // change current instance needed data and ask it
278  // to load data into its container directly.
279  indexFile = cgObj->getIndexFile();
280  indexBase = cgObj->getIndexBase();
281  indexZone = zoneIdx;
283  // append Rocstar specific BCs as solution fields
284  if (!_burn) {
285  appendSolutionData("patchNo", getPanePatchNo(cgObj, zoneIdx),
287  appendSolutionData("bcflag", getPaneBcflag(cgObj, zoneIdx),
289  appendSolutionData("cnstr_type", getPaneCnstrType(cgObj, zoneIdx),
291  }
292  return;
293  }
294  // Rocstar specific BCs remove the old exisiting field
295  if (!_burn) {
296  cgObj->delAppSlnData("patchNo");
297  cgObj->appendSolutionData("patchNo", getPanePatchNo(cgObj, zoneIdx),
299  1);
300  cgObj->delAppSlnData("bcflag");
301  cgObj->appendSolutionData("bcflag", getPaneBcflag(cgObj, zoneIdx),
303  1);
304  cgObj->delAppSlnData("cnstr_type");
305  cgObj->appendSolutionData("cnstr_type", getPaneCnstrType(cgObj, zoneIdx),
307  1);
308  }
309  // call current object stitch field
310  stitchFields(cgObj);
311 }
312 
314  std::cout << "Stitching rocstarCGNS to myself.\n";
315  // check if this is the first object being stitched
316  if (nVertex == 0) {
317  std::cerr << "This rocstarCgns object needs to be initialized first.\n";
318  exit(-1);
319  }
320 
321  // (re)building the kdTree
323 
324  // clear old masks
325  vrtDataMask.clear();
326  elmDataMask.clear();
327 
328  // adding new mesh non-repeating vertices
329  std::vector<int> newVrtIdx;
330  std::vector<int> rptVrtIdx;
331  std::map<int, int> rptVrtMap; // <newMeshIdx, currentMeshIdx>
332  std::vector<double> newXCrd;
333  std::vector<double> newYCrd;
334  std::vector<double> newZCrd;
335  int nNewVrt = 0;
336  for (int iVrt = 0; iVrt < cgObj->getNVertex(); iVrt++) {
337  ANNpoint qryVrtx;
338  ANNidxArray nnIdx;
339  ANNdistArray dists;
340  qryVrtx = annAllocPt(physDim);
341  qryVrtx[0] = cgObj->getVrtXCrd(iVrt);
342  qryVrtx[1] = cgObj->getVrtYCrd(iVrt);
343  qryVrtx[2] = cgObj->getVrtZCrd(iVrt);
344  nnIdx = new ANNidx[1];
345  dists = new ANNdist[1];
346  kdTree->annkSearch(qryVrtx, 1, nnIdx, dists);
347  if (dists[0] > searchEps) {
348  nNewVrt++;
349  vrtDataMask.push_back(true);
350  newVrtIdx.push_back(nVertex + nNewVrt);
351  newXCrd.push_back(qryVrtx[0]);
352  newYCrd.push_back(qryVrtx[1]);
353  newZCrd.push_back(qryVrtx[2]);
354  } else {
355  vrtDataMask.push_back(false);
356  newVrtIdx.push_back(nnIdx[0] + 1);
357  rptVrtIdx.push_back(iVrt);
358  rptVrtMap[iVrt] = nnIdx[0] + 1;
359  }
360  delete[] nnIdx;
361  delete[] dists;
362  annDeallocPt(qryVrtx);
363  }
364  std::cout << "Found " << nNewVrt << " new vertices.\n";
365  std::cout << "Number of repeating index " << rptVrtIdx.size() << std::endl;
366 
367  // currently implemented to add all new elements
368  std::vector<int> newElemConn;
369  int nNewElem = 0;
370  for (int iElem = 0; iElem < cgObj->getNElement(); iElem++) {
371  std::vector<cgsize_t> rmtElemConn = cgObj->getElementConnectivity(iElem);
372 
373  // just adding all elements
374  elmDataMask.push_back(true);
375  nNewElem++;
376  newElemConn.insert(newElemConn.end(), rmtElemConn.begin(),
377  rmtElemConn.end());
378  }
379  std::cout << "Found " << nNewElem << " new elements.\n";
380 
381  // switching conncetivity table to global
382  for (int iIdx = 0; iIdx < newElemConn.size(); iIdx++) {
383  newElemConn[iIdx] = newVrtIdx[newElemConn[iIdx] - 1];
384  }
385 
386  // stitching field values if requested
387  // stitchFldBc(cgObj, zoneIdx);
388  stitchFields((cgnsAnalyzer *)cgObj);
389 
390  // updating internal datastructure
391  nVertex += nNewVrt;
392  nElem += nNewElem;
393  xCrd.insert(xCrd.end(), newXCrd.begin(), newXCrd.end());
394  yCrd.insert(yCrd.end(), newYCrd.begin(), newYCrd.end());
395  zCrd.insert(zCrd.end(), newZCrd.begin(), newZCrd.end());
396  elemConn.insert(elemConn.end(), newElemConn.begin(), newElemConn.end());
397  // zoneNames.push_back(cgObj->getFileName()+"->"+cgObj->getZoneName());
398 }
399 
400 ////////////////////////////////////////////////////
401 // ZONE DATA ACCESS
402 ////////////////////////////////////////////////////
403 int rocstarCgns::getNZone(int indx) {
404  if (indx > cgFNames.size()) return (-1);
405  return (myCgObjs[indx]->getNZone());
406 }
407 
408 std::string rocstarCgns::getZoneName(cgnsAnalyzer *cgObj, int zoneIdx) {
409  char zonename[33];
410  cgsize_t tmp[9];
411  if (cg_zone_read(cgObj->getIndexFile(), cgObj->getIndexBase(), zoneIdx,
412  zonename, tmp))
413  cg_error_exit();
414  return (zonename);
415 }
416 
417 std::string rocstarCgns::getZoneName(int cgIdx, int zoneIdx) {
418  char zonename[33];
419  cgsize_t tmp[9];
420  if (cg_zone_read(myCgObjs[cgIdx]->getIndexFile(),
421  myCgObjs[cgIdx]->getIndexBase(), zoneIdx, zonename, tmp))
422  cg_error_exit();
423  return (zonename);
424 }
425 
426 CGNS_ENUMT(ZoneType_t) rocstarCgns::getZoneType(int indx, int zidx) {
427  if (indx > cgFNames.size()) return (CGNS_ENUMV(ZoneTypeNull));
428  myCgObjs[indx]->loadZone(zidx);
429  return (myCgObjs[indx]->getZoneType());
430 }
431 
432 std::string rocstarCgns::getSectionName(int indx, int zidx) {
433  if (indx > cgFNames.size()) return ("INVALID");
434  myCgObjs[indx]->loadZone(zidx);
435  return (myCgObjs[indx]->getSectionName());
436 }
437 
438 int rocstarCgns::getElementType(int indx, int zidx) {
439  if (indx > cgFNames.size()) return (-1);
440  myCgObjs[indx]->loadZone(zidx);
441  return (myCgObjs[indx]->getElementType());
442 }
443 
444 int rocstarCgns::getZoneNVrtx(cgnsAnalyzer *cgObj, int zoneIdx) {
445  char zonename[33];
446  cgsize_t size[3];
447  if (cg_zone_read(cgObj->getIndexFile(), cgObj->getIndexBase(), zoneIdx,
448  zonename, size))
449  cg_error_exit();
450  return (size[0]);
451 }
452 
453 int rocstarCgns::getZoneNCell(cgnsAnalyzer *cgObj, int zoneIdx) {
454  char zonename[33];
455  cgsize_t size[3];
456  if (cg_zone_read(cgObj->getIndexFile(), cgObj->getIndexBase(), zoneIdx,
457  zonename, size))
458  cg_error_exit();
459  return (size[1]);
460 }
461 
462 std::vector<double> rocstarCgns::getZoneCoords(cgnsAnalyzer *cgObj, int zoneIdx,
463  int dim) {
464  std::vector<double> crds;
465  if (cg_goto(cgObj->getIndexFile(), cgObj->getIndexBase(), "Zone_t", zoneIdx,
466  "GridCoordinates_t", 1, "end"))
467  cg_error_exit();
468  char arrName[33];
469  CGNS_ENUMT(DataType_t) dt;
470  int dd;
471  cgsize_t dimVec[3];
472  if (cg_array_info(dim, arrName, &dt, &dd, dimVec)) cg_error_exit();
473  crds.resize(dimVec[0], 0);
474  if (cg_array_read(dim, &crds[0])) cg_error_exit();
475  // removing extra values that rocstar puts at the end
476  for (int iEx = dimVec[0]; iEx > getZoneNVrtx(cgObj, zoneIdx); iEx--)
477  crds.pop_back();
478  return (crds);
479 }
480 
481 std::vector<cgsize_t> rocstarCgns::getZoneRealConn(cgnsAnalyzer *cgObj,
482  int zoneIdx) {
483  std::vector<cgsize_t> conn;
484  int secidx = 1;
485  char secname[33];
486  CGNS_ENUMT(ElementType_t) et;
487  cgsize_t st, en;
488  int nbndry, parflag;
489  if (cg_section_read(cgObj->getIndexFile(), cgObj->getIndexBase(), zoneIdx,
490  secidx, secname, &et, &st, &en, &nbndry, &parflag))
491  cg_error_exit();
492  // making sure we read real one otherwise next one is the real one
493  if (std::string(secname).find("real") == std::string::npos)
494  if (cg_section_read(cgObj->getIndexFile(), cgObj->getIndexBase(), zoneIdx,
495  ++secidx, secname, &et, &st, &en, &nbndry, &parflag))
496  cg_error_exit();
497  int nVrtxElm;
498  switch (et) {
499  case CGNS_ENUMV(TETRA_4): nVrtxElm = 4; break;
500  case CGNS_ENUMV(HEXA_8): nVrtxElm = 8; break;
501  case CGNS_ENUMV(TRI_3): nVrtxElm = 3; break;
502  case CGNS_ENUMV(QUAD_4): nVrtxElm = 4; break;
503  default: std::cerr << "Unknown element type " << st << std::endl; break;
504  }
505  conn.resize((en - st + 1) * nVrtxElm, -1);
506  if (cg_elements_read(cgObj->getIndexFile(), cgObj->getIndexBase(), zoneIdx,
507  secidx, &conn[0], NULL))
508  cg_error_exit();
509  return (conn);
510 }
511 
513  std::vector<int> conn;
514  int secidx = 1;
515  char secname[33];
516  CGNS_ENUMT(ElementType_t) et;
517  cgsize_t st, en;
518  int nbndry, parflag;
519  if (cg_section_read(cgObj->getIndexFile(), cgObj->getIndexBase(), zoneIdx,
520  secidx, secname, &et, &st, &en, &nbndry, &parflag))
521  cg_error_exit();
522  // making sure we read real one otherwise next one is the real one
523  if (std::string(secname).find("real") == std::string::npos)
524  if (cg_section_read(cgObj->getIndexFile(), cgObj->getIndexBase(), zoneIdx,
525  ++secidx, secname, &et, &st, &en, &nbndry, &parflag))
526  cg_error_exit();
527  return (et);
528 }
529 
530 ////////////////////////////////////////////////////
531 // PANE DATA ACCESS
532 ////////////////////////////////////////////////////
533 int rocstarCgns::getPaneBcflag(cgnsAnalyzer *cgObj, int zoneIdx) {
534  if (cg_goto(cgObj->getIndexFile(), cgObj->getIndexBase(), "Zone_t", zoneIdx,
535  "IntegralData_t", 1, "end"))
536  cg_error_exit();
537  int nArr;
538  int iArr;
539  if (cg_narrays(&nArr)) cg_error_exit();
540  for (iArr = 1; iArr <= nArr; iArr++) {
541  char arrName[33];
542  CGNS_ENUMT(DataType_t) dt;
543  int dd;
544  cgsize_t dimVec[3];
545  if (cg_array_info(iArr, arrName, &dt, &dd, dimVec)) cg_error_exit();
546  if (!strcmp(arrName, "bcflag")) break;
547  }
548  if (iArr > nArr) {
549  std::cerr << "Can not find bcflag." << std::endl;
550  cg_error_exit();
551  }
552  int bcflag;
553  if (cg_array_read(iArr, &bcflag)) cg_error_exit();
554  return (bcflag);
555 }
556 
557 int rocstarCgns::getPanePatchNo(cgnsAnalyzer *cgObj, int zoneIdx) {
558  if (cg_goto(cgObj->getIndexFile(), cgObj->getIndexBase(), "Zone_t", zoneIdx,
559  "IntegralData_t", 1, "end"))
560  cg_error_exit();
561  int nArr;
562  int iArr;
563  if (cg_narrays(&nArr)) cg_error_exit();
564  for (iArr = 1; iArr <= nArr; iArr++) {
565  char arrName[33];
566  CGNS_ENUMT(DataType_t) dt;
567  int dd;
568  cgsize_t dimVec[3];
569  if (cg_array_info(iArr, arrName, &dt, &dd, dimVec)) cg_error_exit();
570  if (!strcmp(arrName, "patchNo")) break;
571  }
572  if (iArr > nArr) {
573  std::cerr << "Can not find patchNo." << std::endl;
574  cg_error_exit();
575  }
576  int patchNo;
577  if (cg_array_read(iArr, &patchNo)) cg_error_exit();
578  return (patchNo);
579 }
580 
581 int rocstarCgns::getPaneCnstrType(cgnsAnalyzer *cgObj, int zoneIdx) {
582  if (cg_goto(cgObj->getIndexFile(), cgObj->getIndexBase(), "Zone_t", zoneIdx,
583  "IntegralData_t", 1, "end"))
584  cg_error_exit();
585  int nArr;
586  int iArr;
587  if (cg_narrays(&nArr)) cg_error_exit();
588  for (iArr = 1; iArr <= nArr; iArr++) {
589  char arrName[33];
590  CGNS_ENUMT(DataType_t) dt;
591  int dd;
592  cgsize_t dimVec[3];
593  if (cg_array_info(iArr, arrName, &dt, &dd, dimVec)) cg_error_exit();
594  if (!strcmp(arrName, "cnstr_type")) break;
595  }
596  if (iArr > nArr) {
597  std::cerr << "Can not find cnstr_type." << std::endl;
598  cg_error_exit();
599  }
600  int cnstrType;
601  if (cg_array_read(iArr, &cnstrType)) cg_error_exit();
602  return (cnstrType);
603 }
void stitchGroup()
Definition: rocstarCgns.C:137
void stitchMe(cgnsAnalyzer *cgObj, int zoneIdx)
Definition: rocstarCgns.C:147
int getNVertex()
Definition: cgnsAnalyzer.C:445
std::vector< double > yCrd
Definition: cgnsAnalyzer.H:306
std::vector< cgsize_t > getElementConnectivity(int elemId)
Definition: cgnsAnalyzer.C:525
CGNS_ENUMT(ZoneType_t) getZoneType(int indx
void buildVertexKDTree()
bool isStructured()
Definition: cgnsAnalyzer.C:471
std::vector< bool > elmDataMask
Definition: cgnsAnalyzer.H:331
int getZoneNCell(cgnsAnalyzer *cgObj, int zoneIdx)
Definition: rocstarCgns.C:453
double getVrtYCrd(int vrtxId)
Definition: cgnsAnalyzer.C:508
int getNElement()
Definition: cgnsAnalyzer.C:447
std::string getSolutionPntr()
Definition: cgnsAnalyzer.C:443
std::string getBaseName()
Definition: rocstarCgns.C:90
double timeLabel
Definition: cgnsAnalyzer.H:304
void loadZone(int zIdx, int verb=0)
Definition: cgnsAnalyzer.C:154
std::vector< std::string > solutionName
Definition: cgnsAnalyzer.H:316
std::vector< double > xCrd
Definition: cgnsAnalyzer.H:306
void loadCgSeries()
Definition: rocstarCgns.C:75
std::string baseCgFName
Definition: rocstarCgns.H:92
double getVrtZCrd(int vrtxId)
Definition: cgnsAnalyzer.C:512
void loadSolutionDataContainer(int verb=0)
int getPaneCnstrType(cgnsAnalyzer *cgObj, int zoneIdx)
Definition: rocstarCgns.C:581
std::vector< std::string > getSolutionNodeNames()
std::string getZoneItrName()
Definition: cgnsAnalyzer.C:439
std::vector< double > getZoneCoords(cgnsAnalyzer *cgObj, int zoneIdx, int dim)
Definition: rocstarCgns.C:462
std::vector< double > zCrd
Definition: cgnsAnalyzer.H:306
rocstarCgns(std::string fname)
Definition: rocstarCgns.C:37
double searchEps
Definition: cgnsAnalyzer.H:327
std::map< int, std::pair< int, keyValueList > > solutionMap
Definition: cgnsAnalyzer.H:315
std::map< int, std::pair< int, keyValueList > > getSolutionMap()
int getIndexBase()
Definition: cgnsAnalyzer.C:417
std::string getGridCrdPntr()
Definition: cgnsAnalyzer.C:441
int getIndexFile()
Definition: cgnsAnalyzer.C:415
std::string getBaseItrName()
Definition: cgnsAnalyzer.C:433
std::map< std::string, CGNS_ENUMT(GridLocation_t)> solutionNameLocMap
Definition: cgnsAnalyzer.H:313
int getPaneBcflag(cgnsAnalyzer *cgObj, int zoneIdx)
Definition: rocstarCgns.C:533
std::vector< int > patchNo
Definition: rocstarCgns.H:102
std::vector< std::string > zoneNames
Definition: cgnsAnalyzer.H:329
int getZoneRealSecType(cgnsAnalyzer *cgObj, int zoneIdx)
Definition: rocstarCgns.C:512
std::string getCgFName(int indx)
Definition: rocstarCgns.C:97
double getTimeStep()
Definition: cgnsAnalyzer.C:455
int getNCgObj()
Definition: rocstarCgns.C:88
std::string getSectionName()
Definition: cgnsAnalyzer.C:431
std::string getZoneName()
Definition: cgnsAnalyzer.C:425
void clearAllSolutionData()
Definition: cgnsAnalyzer.C:868
std::vector< bool > vrtDataMask
Definition: cgnsAnalyzer.H:330
int getCellDim()
Definition: cgnsAnalyzer.C:419
std::string myCgFName
Definition: rocstarCgns.H:87
std::vector< std::string > cgFNames
Definition: rocstarCgns.H:94
ANNkd_tree * kdTree
Definition: cgnsAnalyzer.H:323
void loadGrid(const std::string &fname, int verb=0)
Definition: cgnsAnalyzer.H:147
std::vector< cgsize_t > elemConn
Definition: cgnsAnalyzer.H:307
void appendSolutionData(std::string sName, std::vector< double > &slnData, solution_type_t dt, int inNData, int inNDim)
void stitchFldBc(cgnsAnalyzer *cgObj, int zoneIdx)
Definition: rocstarCgns.C:256
bool isUnstructured
Definition: cgnsAnalyzer.H:277
std::vector< cgnsAnalyzer * > myCgObjs
Definition: rocstarCgns.H:96
int getPanePatchNo(cgnsAnalyzer *cgObj, int zoneIdx)
Definition: rocstarCgns.C:557
void getSolutionDataNames(std::vector< std::string > &list)
Definition: cgnsAnalyzer.C:918
int getZoneNVrtx(cgnsAnalyzer *cgObj, int zoneIdx)
Definition: rocstarCgns.C:444
std::vector< CGNS_ENUMT(GridLocation_t)> solutionGridLocation
Definition: cgnsAnalyzer.H:317
std::string getFileName()
Definition: cgnsAnalyzer.C:421
virtual void closeCG()
Definition: rocstarCgns.C:83
virtual void stitchFields(cgnsAnalyzer *inCg)
bool delAppSlnData(std::string sName)
double getVrtXCrd(int vrtxId)
Definition: cgnsAnalyzer.C:504
cgnsAnalyzer(std::string fname, int verb=0)
Definition: cgnsAnalyzer.H:107
std::vector< CGNS_ENUMT(GridLocation_t)> getSolutionGridLocations()
int getElementType()
Definition: cgnsAnalyzer.C:451
std::vector< cgsize_t > getZoneRealConn(cgnsAnalyzer *cgObj, int zoneIdx)
Definition: rocstarCgns.C:481
int getPhysDim()
Definition: cgnsAnalyzer.C:449
std::map< std::string, CGNS_ENUMT(GridLocation_t)> getSolutionNameLocMap()