31 #include <vtkCellTypes.h> 32 #include <vtkIdList.h> 33 #include <vtkUnstructuredGrid.h> 43 if (
nDim != inNDim || inNDim == 0) {
44 std::cerr <<
"Incompatible data size can not be appended." 45 <<
"Current nDim = " <<
nDim <<
" Requested nDim = " << inNDim
68 const std::vector<bool> &mask)
const {
72 for (
const auto &
id : mask) {
74 outBuff.insert(outBuff.end(),
slnData[cntr1]);
86 for (
int id = 0;
id <
nData;
id++) {
87 auto it = std::find(rmvIdx.begin(), rmvIdx.end(),
id);
88 if (it != rmvIdx.end())
92 for (
int iDim = 0; iDim <
nDim; iDim++)
93 nsdv.push_back(
slnData[
id * nDim + iDim]);
110 if (cg_open(cgFileName.c_str(), CG_MODE_MODIFY, &indexFile)) cg_error_exit();
113 cg_nbases(indexFile, &nBase);
115 std::cerr <<
"There are " << nBase
116 <<
" bases in the file (not supported).\n";
119 if (cg_base_read(indexFile, indexBase, basename, &cellDim, &physDim))
124 if (cg_goto(indexFile, indexBase,
"end")) cg_error_exit();
125 if (cg_units_read(&massU, &lengthU, &timeU, &tempU, &angleU)) cg_error_exit();
127 std::cout <<
" ------------------------------------------------\n" 128 <<
"Base name = " << baseName <<
"\ncellDim = " << cellDim
129 <<
"\nphysDim = " << physDim <<
"\nUnits " << massU <<
" " 130 << lengthU <<
" " << timeU <<
" " << tempU <<
" " << angleU
135 if (cg_biter_read(indexFile, indexBase, bitername, &nTStep)) cg_error_exit();
136 baseItrName = bitername;
137 if (nTStep != 1) std::cerr <<
"More than one time step is not supported.\n";
139 std::cout << baseItrName << std::endl;
140 if (cg_goto(indexFile, indexBase, bitername, 0,
"end")) cg_error_exit();
141 if (cg_array_read_as(1, CGNS_ENUMV(RealDouble), &timeLabel)) cg_error_exit();
142 if (verb > 0) std::cout <<
"Time label = " << timeLabel << std::endl;
145 cg_nzones(indexFile, indexBase, &nZone);
158 cg_zone_read(indexFile, indexBase, indexZone, zonename, cgCoreSize);
159 cg_zone_type(indexFile, indexBase, indexZone, &zoneType);
161 zoneNames.push_back(zoneName);
162 if (verb) std::cout <<
"Zone name = " << zoneName << std::endl;
165 if (zoneType == CGNS_ENUMV(ZoneTypeNull)) {
166 if (verb) std::cout <<
"Zone type = CG_ZoneTypeNull\n";
167 }
else if (zoneType == CGNS_ENUMV(Structured)) {
168 isUnstructured =
false;
169 if (verb) std::cout <<
"Zone type = CG_Structured\n";
170 std::cerr <<
"Warning: Structured meshes only supported experimentally.\n";
171 }
else if (zoneType == CGNS_ENUMV(Unstructured)) {
172 isUnstructured =
true;
173 if (verb) std::cout <<
"Zone type = CG_Unstructured\n";
174 }
else if (zoneType == CGNS_ENUMV(ZoneTypeUserDefined)) {
175 if (verb) std::cout <<
"Zone type = CG_ZoneTypeUserDefined\n";
182 if (cg_ziter_read(indexFile, indexBase, indexZone, zitername))
184 zoneItrName = zitername;
185 if (verb) std::cout <<
"Zone iterative name = " << zoneItrName << std::endl;
186 char gridcoorpntr[33], flowslnpntr[33];
187 if (cg_goto(indexFile, indexBase, zonename, 0, zitername, 0,
"end"))
192 if (!cg_goto(indexFile, indexBase,
"Zone_t", indexZone,
"ZoneIterativeData_t",
194 if (!cg_array_read_as(1, CGNS_ENUMV(Character), gridcoorpntr))
195 gridCrdPntr = gridcoorpntr;
199 std::cout <<
"Grid coordinate pointer = " << gridcoorpntr << std::endl;
200 if (!cg_array_read_as(2, CGNS_ENUMV(Character), flowslnpntr))
201 flowSlnPntr = flowslnpntr;
205 std::cout <<
"Flow solution pointer = " << flowslnpntr << std::endl;
207 std::cout <<
"This zone does not containing grid/flow pointers.\n";
211 if (zoneType == CGNS_ENUMV(Unstructured)) {
212 nVertex = cgCoreSize[0];
213 nElem = cgCoreSize[1];
222 if (cg_goto(indexFile, indexBase,
"Zone_t", zIdx,
"GridCoordinates", 0,
225 if (cg_rind_read(rdata)) cg_error_exit();
226 nRindNdeStr = rdata[1];
230 std::cout <<
"nRindNdeStr = " << nRindNdeStr <<
"\n";
232 cgCoreSize[0] += 2 * nRindNdeStr;
233 cgCoreSize[1] += 2 * nRindNdeStr;
234 cgCoreSize[2] += 2 * nRindNdeStr;
236 cgCoreSize[3] += 2 * nRindNdeStr;
237 cgCoreSize[4] += 2 * nRindNdeStr;
238 cgCoreSize[5] += 2 * nRindNdeStr;
239 nVertex = cgCoreSize[0] * cgCoreSize[1] * cgCoreSize[2];
240 nElem = cgCoreSize[3] * cgCoreSize[4] * cgCoreSize[5];
244 rmax[0] = cgCoreSize[0];
245 rmax[1] = cgCoreSize[1];
246 rmax[2] = cgCoreSize[2];
247 std::cout <<
" Number of rind node for structured zone = " << nRindNdeStr
251 std::cout <<
"Number of vertex = " << nVertex
252 <<
"\nNumber of elements = " << nElem << std::endl;
256 if (nRindNdeStr != 0)
257 for (
int i = rmin[2]; i <= rmax[2]; i++)
258 for (
int j = rmin[1]; j <= rmax[1]; j++)
259 for (
int k = rmin[0]; k <= rmax[0]; k++) {
261 if ((i <= nRindNdeStr || (rmax[2] - i) < nRindNdeStr) ||
262 (j <= nRindNdeStr || (rmax[1] - j) < nRindNdeStr) ||
263 (k <= nRindNdeStr || (rmax[0] - k) < nRindNdeStr))
264 cgRindNodeIds.push_back(ndId);
266 std::cout <<
"Total number of rind nodes = " << cgRindNodeIds.size() <<
"\n";
270 if (zoneType == CGNS_ENUMV(Unstructured)) {
272 xCrd.resize(nVertex, 0);
273 if (cg_coord_read(indexFile, indexBase, indexZone,
"CoordinateX",
274 CGNS_ENUMV(RealDouble), &one, &rmax[0],
276 std::cerr <<
"Error in load, " << cg_get_error() << std::endl;
279 yCrd.resize(nVertex, 0);
280 if (cg_coord_read(indexFile, indexBase, indexZone,
"CoordinateY",
281 CGNS_ENUMV(RealDouble), &one, &rmax[1],
283 std::cerr <<
"Error in load, " << cg_get_error() << std::endl;
286 zCrd.resize(nVertex, 0);
287 if (cg_coord_read(indexFile, indexBase, indexZone,
"CoordinateZ",
288 CGNS_ENUMV(RealDouble), &one, &rmax[2],
290 std::cerr <<
"Error in load, " << cg_get_error() << std::endl;
291 }
else if (zoneType == CGNS_ENUMV(Structured)) {
295 xCrd.resize(nVertex, 0);
296 if (cg_coord_read(indexFile, indexBase, indexZone,
"CoordinateX",
297 CGNS_ENUMV(RealDouble), &rmin[0], &rmax[0],
299 std::cerr <<
"Error in load, " << cg_get_error() << std::endl;
302 yCrd.resize(nVertex, 0);
303 if (cg_coord_read(indexFile, indexBase, indexZone,
"CoordinateY",
304 CGNS_ENUMV(RealDouble), &rmin[0], &rmax[0],
306 std::cerr <<
"Error in load, " << cg_get_error() << std::endl;
309 zCrd.resize(nVertex, 0);
310 if (cg_coord_read(indexFile, indexBase, indexZone,
"CoordinateZ",
311 CGNS_ENUMV(RealDouble), &rmin[0], &rmax[0],
313 std::cerr <<
"Error in load, " << cg_get_error() << std::endl;
315 std::cerr <<
"Error in load, only CG_Structured and CG_Unstructured girds " 321 if (zoneType == CGNS_ENUMV(Unstructured)) {
322 int indexSection, nBdry, parentFlag;
324 char sectionname[33];
325 if (cg_nsections(indexFile, indexBase, indexZone, &nSection) != CG_OK)
326 std::cerr <<
"Error in load, " << cg_get_error();
329 std::cout << nSection
330 <<
" element connectivity sections were found (real+virtual " 331 "in case of rocstar)" 332 <<
", only first section will be read for now." << std::endl;
334 if (cg_section_read(indexFile, indexBase, indexZone, indexSection,
335 sectionname, §ionType, &eBeg, &eEnd, &nBdry,
336 &parentFlag) != CG_OK)
337 std::cerr <<
"Error in load, " << cg_get_error() << std::endl;
338 sectionName = sectionname;
340 std::cout <<
"Section " << sectionname <<
" eBeg = " << eBeg
341 <<
" eEnd = " << eEnd <<
" nBdry = " << nBdry << std::endl;
342 switch (sectionType) {
343 case CGNS_ENUMV(TETRA_4): nVrtxElem = 4;
break;
344 case CGNS_ENUMV(HEXA_8): nVrtxElem = 8;
break;
345 case CGNS_ENUMV(TRI_3): nVrtxElem = 3;
break;
346 case CGNS_ENUMV(QUAD_4): nVrtxElem = 4;
break;
347 case CGNS_ENUMV(TETRA_10): nVrtxElem = 10;
break;
349 std::cerr <<
"Unknown element type " << sectionType << std::endl;
352 elemConn.resize(nVrtxElem * nElem, -1);
353 if (cg_elements_read(indexFile, indexBase, indexZone, indexSection,
354 &elemConn[0],
nullptr) != CG_OK)
355 std::cerr <<
"Error in load, " << cg_get_error() << std::endl;
360 std::cout <<
"Size of connectivity vector = " << elemConn.size()
362 }
else if (zoneType == CGNS_ENUMV(Structured)) {
365 std::cerr <<
"Warning: converting implicit structured connectivity to " 366 "8-Node hexahedrals.\n";
367 sectionType = CGNS_ENUMV(HEXA_8);
368 elemConn.resize(8 * nElem, -1);
370 int bs, d1, d2, d3, d4 ;
373 d4 = cgCoreSize[1] * cgCoreSize[0];
374 for (
int k = 1; k < cgCoreSize[2]; k++) {
376 for (
int j = 1; j < cgCoreSize[1]; j++) {
377 d2 = d1 + (cgCoreSize[0]) * (j - 1);
378 for (
int i = 1; i < cgCoreSize[0]; i++) {
382 elemConn[bs + 1] = d3 + 1;
383 elemConn[bs + 2] = d3 + 1 + cgCoreSize[0];
384 elemConn[bs + 3] = d3 + cgCoreSize[0];
385 elemConn[bs + 4] = d3 + d4;
386 elemConn[bs + 5] = d3 + 1 + d4;
387 elemConn[bs + 6] = d3 + 1 + cgCoreSize[0] + d4;
388 elemConn[bs + 7] = d3 + cgCoreSize[0] + d4;
400 if ((k <= nRindNdeStr || (cgCoreSize[2] - k) <= nRindNdeStr) ||
401 (j <= nRindNdeStr || (cgCoreSize[1] - j) <= nRindNdeStr) ||
402 (i <= nRindNdeStr || (cgCoreSize[0] - i) <= nRindNdeStr))
403 cgRindCellIds.push_back(iElm);
428 return zoneNames[iCgFile];
457 CGNS_ENUMT(MassUnits_t) cgnsAnalyzer::getMassUnit() {
return massU; }
459 CGNS_ENUMT(LengthUnits_t) cgnsAnalyzer::getLengthUnit() {
return lengthU; }
461 CGNS_ENUMT(TimeUnits_t) cgnsAnalyzer::getTimeUnit() {
return timeU; }
463 CGNS_ENUMT(TemperatureUnits_t) cgnsAnalyzer::getTemperatureUnit() {
467 CGNS_ENUMT(AngleUnits_t) cgnsAnalyzer::getAngleUnit() {
return angleU; }
469 CGNS_ENUMT(ZoneType_t) cgnsAnalyzer::getZoneType() {
return zoneType; }
483 std::vector<double> crd;
484 for (
int iVrt = 0; iVrt < nVertex; ++iVrt) {
485 crd.push_back(xCrd[iVrt]);
486 crd.push_back(yCrd[iVrt]);
487 crd.push_back(zCrd[iVrt]);
493 std::vector<double> crd;
494 if (vrtxId > nVertex || vrtxId < 0) {
495 std::cerr <<
"Requested index is out of bounds." << std::endl;
498 crd.push_back(xCrd[vrtxId]);
499 crd.push_back(yCrd[vrtxId]);
500 crd.push_back(zCrd[vrtxId]);
526 std::vector<cgsize_t> elmConn;
528 if (elemId > nElem) {
529 std::cerr <<
"Element index is out of bounds.\n";
533 if (elemId == -1) {
return elemConn; }
535 switch (sectionType) {
536 case CGNS_ENUMV(TETRA_4): nNdeElm = 4;
break;
537 case CGNS_ENUMV(HEXA_8): nNdeElm = 8;
break;
538 case CGNS_ENUMV(TRI_3):
540 elemConn.resize(3 * nElem, -1);
542 case CGNS_ENUMV(QUAD_4): nNdeElm = 4;
break;
543 case CGNS_ENUMV(TETRA_10): nNdeElm = 10;
break;
545 std::cerr <<
"Unknown element type " << sectionType << std::endl;
548 for (
int iNde = elemId * nNdeElm; iNde < (elemId + 1) * nNdeElm; ++iNde)
549 elmConn.push_back(elemConn[iNde]);
556 int nBdry, parentFlag;
559 char sectionname[33];
560 if (cg_nsections(indexFile, indexBase, indexZone, &nSection) != CG_OK)
561 std::cerr <<
"Error in reading sections, " << cg_get_error();
562 for (
int iSec = 1; iSec <= nSection; iSec++) {
563 if (cg_section_read(indexFile, indexBase, indexZone, iSec, sectionname,
564 &secTyp, &eBeg, &eEnd, &nBdry, &parentFlag) != CG_OK)
565 std::cerr <<
"Error in load, " << cg_get_error() << std::endl;
566 names.push_back(sectionname);
568 std::cout <<
"Section " << names[iSec] <<
" Type = " << secTyp
569 <<
" eBeg = " << eBeg <<
" eEnd = " << eEnd
570 <<
" nBdry = " << nBdry << std::endl;
574 CGNS_ENUMT(ElementType_t) cgnsAnalyzer::getSectionType(std::string secName) {
575 std::vector<std::string> secNames;
576 getSectionNames(secNames);
577 auto it = std::find(secNames.begin(), secNames.end(), secName);
578 if (it == secNames.end()) {
579 std::cerr <<
"No section found named " << secName <<
"\n";
582 int iSec = it - secNames.begin();
585 int nBdry, parentFlag;
588 char sectionname[33];
589 if (cg_section_read(indexFile, indexBase, indexZone, iSec, sectionname,
590 &secTyp, &eBeg, &eEnd, &nBdry, &parentFlag) != CG_OK)
591 std::cerr <<
"Error in load, " << cg_get_error() << std::endl;
596 std::vector<cgsize_t> &conn,
int &nElm) {
597 std::vector<std::string> secNames;
598 getSectionNames(secNames);
599 auto it = std::find(secNames.begin(), secNames.end(), secName);
600 if (it == secNames.end()) {
601 std::cerr <<
"No section found named " << secName <<
"\n";
606 int nBdry, parentFlag, nVrtxElem;
608 char sectionname[33];
610 int iSec = it - secNames.begin() + 1;
611 if (cg_section_read(indexFile, indexBase, indexZone, iSec, sectionname,
612 &secTyp, &eBeg, &eEnd, &nBdry, &parentFlag) != CG_OK)
613 std::cerr <<
"Error in load, " << cg_get_error() << std::endl;
615 case CGNS_ENUMV(TETRA_4): nVrtxElem = 4;
break;
616 case CGNS_ENUMV(HEXA_8): nVrtxElem = 8;
break;
617 case CGNS_ENUMV(TRI_3): nVrtxElem = 3;
break;
618 case CGNS_ENUMV(QUAD_4): nVrtxElem = 4;
break;
619 case CGNS_ENUMV(TETRA_10): nVrtxElem = 10;
break;
620 default: std::cerr <<
"Unknown element type " << secTyp << std::endl;
break;
622 nElm = eEnd - eBeg + 1;
623 conn.resize(nVrtxElem * nElm, -1);
624 if (cg_elements_read(indexFile, indexBase, indexZone, iSec, &conn[0],
626 std::cerr <<
"Error in load, " << cg_get_error() << std::endl;
628 std::cout <<
"Size of connectivity vector = " << conn.size() << std::endl;
634 if (cg_goto(indexFile, indexBase,
"Zone_t", indexZone,
"GridCoordinates", 0,
637 if (cg_rind_read(rdata)) cg_error_exit();
638 int nRindNde = rdata[1];
640 cgsize_t rmax = nVertex + nRindNde;
642 std::vector<double> xCrdR, yCrdR, zCrdR;
643 xCrdR.resize(rmax, 0);
644 yCrdR.resize(rmax, 0);
645 zCrdR.resize(rmax, 0);
646 if (cg_coord_read(indexFile, indexBase, indexZone,
"CoordinateX",
647 CGNS_ENUMV(RealDouble), &one, &rmax, &xCrdR[0]) != CG_OK)
648 std::cerr <<
"Error in load, " << cg_get_error() << std::endl;
649 if (cg_coord_read(indexFile, indexBase, indexZone,
"CoordinateY",
650 CGNS_ENUMV(RealDouble), &one, &rmax, &yCrdR[0]) != CG_OK)
651 std::cerr <<
"Error in load, " << cg_get_error() << std::endl;
652 if (cg_coord_read(indexFile, indexBase, indexZone,
"CoordinateZ",
653 CGNS_ENUMV(RealDouble), &one, &rmax, &zCrdR[0]) != CG_OK)
654 std::cerr <<
"Error in load, " << cg_get_error() << std::endl;
656 std::vector<cgsize_t> connSec;
657 getSectionConn(secName, connSec, nElmSec);
658 CGNS_ENUMT(ElementType_t) secTyp = getSectionType(secName);
663 vtkSmartPointer<vtkUnstructuredGrid> dataSet_tmp =
667 points->SetNumberOfPoints(rmax);
668 for (
int i = 0; i < rmax; ++i)
669 points->SetPoint(i, xCrdR[i], yCrdR[i], zCrdR[i]);
672 dataSet_tmp->SetPoints(points);
675 dataSet_tmp->Allocate(nElmSec);
677 int nNdeElm = connSec.size() / nElmSec;
678 for (
int i = 0; i < nElmSec; i++) {
680 vtkElmIds->SetNumberOfIds(nNdeElm);
681 for (
int j = 0; j < nNdeElm; ++j)
682 vtkElmIds->SetId(j, connSec[i * nNdeElm + j] - 1);
684 case CGNS_ENUMV(TETRA_4):
685 dataSet_tmp->InsertNextCell(VTK_TETRA, vtkElmIds);
687 case CGNS_ENUMV(HEXA_8):
688 dataSet_tmp->InsertNextCell(VTK_HEXAHEDRON, vtkElmIds);
690 case CGNS_ENUMV(TRI_3):
691 dataSet_tmp->InsertNextCell(VTK_TRIANGLE, vtkElmIds);
693 case CGNS_ENUMV(QUAD_4):
694 dataSet_tmp->InsertNextCell(VTK_QUAD, vtkElmIds);
696 case CGNS_ENUMV(TETRA_10):
697 dataSet_tmp->InsertNextCell(VTK_QUADRATIC_TETRA, vtkElmIds);
700 std::cerr <<
"Unknown element type " << sectionType << std::endl;
704 return (dataSet_tmp);
716 double x[9][17][21], y[9][17][21], z[9][17][21];
717 cgsize_t isize[3][3];
718 int ni, nj, nk, i, j, k;
719 int indexFile, icelldim, iphysdim, indexBase;
720 int indexZone, indexCoord;
721 char basename[33], zonename[33];
727 for (k = 0; k < nk; ++k) {
728 for (j = 0; j < nj; ++j) {
729 for (i = 0; i < ni; ++i) {
736 printf(
"\ncreated simple 3-D grid points");
740 if (cg_open(cgFileName.c_str(), CG_MODE_WRITE, &indexFile)) cg_error_exit();
742 strcpy(basename,
"Base");
745 cg_base_write(indexFile, basename, icelldim, iphysdim, &indexBase);
747 strcpy(zonename,
"Zone 1");
753 isize[1][0] = isize[0][0] - 1;
754 isize[1][1] = isize[0][1] - 1;
755 isize[1][2] = isize[0][2] - 1;
761 cg_zone_write(indexFile, indexBase, zonename, *isize, CGNS_ENUMV(Structured),
764 cg_coord_write(indexFile, indexBase, indexZone, CGNS_ENUMV(RealDouble),
765 "CoordinateX", x, &indexCoord);
766 cg_coord_write(indexFile, indexBase, indexZone, CGNS_ENUMV(RealDouble),
767 "CoordinateY", y, &indexCoord);
768 cg_coord_write(indexFile, indexBase, indexZone, CGNS_ENUMV(RealDouble),
769 "CoordinateZ", z, &indexCoord);
781 double x[9][17][21], y[9][17][21], z[9][17][21];
782 cgsize_t isize[3][3];
783 int ni, nj, nk, i, j, k;
784 int indexFile, icelldim, iphysdim, indexBase;
785 int indexZone, indexCoord, indexSection;
786 int index_flow, index_field;
787 char basename[33], zonename[33];
793 for (k = 0; k < nk; ++k) {
794 for (j = 0; j < nj; ++j) {
795 for (i = 0; i < ni; ++i) {
802 printf(
"\nCreated simple 3-D grid points");
806 if (cg_open(cgFileName.c_str(), CG_MODE_WRITE, &indexFile)) cg_error_exit();
808 strcpy(basename,
"Base");
811 cg_base_write(indexFile, basename, icelldim, iphysdim, &indexBase);
813 strcpy(zonename,
"Zone 1");
815 isize[0][0] = 21 * 17 * 9;
816 isize[0][1] = 20 * 16 * 8;
819 cg_zone_write(indexFile, indexBase, zonename, *isize,
820 CGNS_ENUMV(Unstructured), &indexZone);
822 cg_coord_write(indexFile, indexBase, indexZone, CGNS_ENUMV(RealDouble),
823 "CoordinateX", x, &indexCoord);
824 cg_coord_write(indexFile, indexBase, indexZone, CGNS_ENUMV(RealDouble),
825 "CoordinateY", y, &indexCoord);
826 cg_coord_write(indexFile, indexBase, indexZone, CGNS_ENUMV(RealDouble),
827 "CoordinateZ", z, &indexCoord);
829 cgsize_t elemConn[8][20 * 16 * 8];
833 for (k = 1; k < nk; ++k) {
834 for (j = 1; j < nj; ++j) {
835 for (i = 1; i < ni; ++i) {
837 int ifirstNode = i + (j - 1) * ni + (k - 1) * ni * nj;
838 elemConn[0][iElem] = ifirstNode;
839 elemConn[1][iElem] = ifirstNode + 1;
840 elemConn[2][iElem] = ifirstNode + 1 + ni;
841 elemConn[3][iElem] = ifirstNode + ni;
842 elemConn[4][iElem] = ifirstNode + ni * nj;
843 elemConn[5][iElem] = ifirstNode + ni * nj + 1;
844 elemConn[6][iElem] = ifirstNode + ni * nj + 1 + ni;
845 elemConn[7][iElem] = ifirstNode + ni * nj + ni;
850 int nElemEnd = iElem;
854 cg_section_write(indexFile, indexBase, indexZone,
"Elem", CGNS_ENUMV(HEXA_8),
855 nElemStart, nElemEnd, nBdyElem, elemConn[0], &indexSection);
857 std::string solName =
"solution";
858 cg_sol_write(indexFile, indexBase, indexZone, solName.c_str(),
859 CGNS_ENUMV(Vertex), &index_flow);
860 std::vector<double> T;
861 T.resize(isize[0][0], 10);
862 cg_field_write(indexFile, indexBase, indexZone, index_flow,
863 CGNS_ENUMV(RealDouble),
"T", &T[0], &index_field);
872 solutionNameLocMap.clear();
873 solutionName.clear();
874 solutionGridLocation.clear();
876 appendedSolutionName.clear();
878 for (
auto &it : slnDataCont)
delete it;
880 solutionDataPopulated =
false;
886 if (solutionDataPopulated)
return;
895 cg_nsols(indexFile, indexBase, indexZone, &nSolution);
896 for (
int iSol = 1; iSol <= nSolution; ++iSol) {
897 std::pair<int, keyValueList> slnPair;
899 cg_sol_info(indexFile, indexBase, indexZone, iSol, solName, &gloc);
900 cg_nfields(indexFile, indexBase, indexZone, iSol, &nFlds);
901 solutionNameLocMap[solName] = gloc;
902 for (
int iFld = 1; iFld <= nFlds; ++iFld) {
904 solutionName.push_back(solName);
905 solutionGridLocation.push_back(gloc);
907 cg_field_info(indexFile, indexBase, indexZone, iSol, iFld, &dt,
909 fldIndxSln[iFld] = fieldName;
911 slnPair.first = iSol;
912 slnPair.second = fldIndxSln;
913 solutionMap[cntr++] = slnPair;
915 solutionDataPopulated =
true;
919 populateSolutionDataNames();
920 for (
auto &it : solutionMap) {
921 std::pair<int, keyValueList> slnIndxListPair = it.second;
923 for (
auto &it2 : fldIndxSln) { list.push_back(it2.second); }
936 std::vector<double> &
slnData) {
944 for (
auto &it : solutionMap) {
945 std::pair<int, keyValueList> slnIndxListPair = it.second;
947 for (
auto &it2 : fldIndxSln) {
949 if (!((it2.second).compare(sName))) {
951 slnIndx = slnIndxListPair.first;
955 if (slnIndx != -1)
break;
959 std::cerr <<
"The solution name " << sName <<
" does not exist.\n";
963 if (cg_field_info(indexFile, indexBase, indexZone, slnIndx, fldIndx, &dt,
965 std::cerr <<
"Error in reading solution, " << cg_get_error() << std::endl;
968 dataType = solutionGridLocation[slnCntr];
969 if (isUnstructured) {
970 if (dataType == CGNS_ENUMV(Vertex)) {
971 slnData.resize(nVertex, -1.0);
973 }
else if (dataType == CGNS_ENUMV(CellCenter)) {
974 slnData.resize(nElem, -1.0);
977 std::cerr <<
"Unknown data gird location " 978 << solutionGridLocation[slnCntr] << std::endl;
982 if (dataType == CGNS_ENUMV(Vertex)) {
983 slnData.resize(nVertex, -1.0);
984 rmax[0] = cgCoreSize[0];
985 rmax[1] = cgCoreSize[1];
986 rmax[2] = cgCoreSize[2];
987 }
else if (dataType == CGNS_ENUMV(CellCenter)) {
988 slnData.resize(nElem, -1.0);
989 rmax[0] = cgCoreSize[3];
990 rmax[1] = cgCoreSize[4];
991 rmax[2] = cgCoreSize[5];
993 std::cerr <<
"Unknown data gird location " 994 << solutionGridLocation[slnCntr] << std::endl;
999 if (isUnstructured) {
1000 if (dt == CGNS_ENUMV(RealDouble)) {
1002 if (cg_field_read(indexFile, indexBase, indexZone, slnIndx, fieldName, dt,
1003 &one, &rmax[0], &slnData[0]) != CG_OK)
1004 std::cerr <<
"Error in reading solution data, " << cg_get_error()
1006 }
else if (dt == CGNS_ENUMV(Integer)) {
1008 std::vector<int> tmpSlnData;
1009 tmpSlnData.resize(rmax[0], -1);
1010 if (cg_field_read(indexFile, indexBase, indexZone, slnIndx, fieldName, dt,
1011 &one, &rmax[0], &tmpSlnData[0]) != CG_OK)
1012 std::cerr <<
"Error in reading solution data, " << cg_get_error()
1015 for (
int &it : tmpSlnData) slnData.push_back(it);
1018 if (cg_field_read(indexFile, indexBase, indexZone, slnIndx, fieldName, dt,
1019 &rmin[0], &rmax[0], &slnData[0]) != CG_OK)
1020 std::cerr <<
"Error in reading solution data, " << cg_get_error()
1034 if (!slnDataCont.empty()) {
1035 for (
auto &is : slnDataCont) {
1036 if (!strcmp((is->getDataName()).c_str(), sName.c_str())) {
return is; }
1043 std::cerr <<
"Unknown data type is not supported.!\n";
1049 slnDataObjPtr->
appendData(slnData, slnData.size(), 1);
1051 slnDataObjPtr->
appendData(slnData, slnData.size(), 1);
1053 return slnDataObjPtr;
1060 if (slnDataCont.empty()) loadSolutionDataContainer();
1063 for (
auto &is : slnDataCont)
1073 if (slnDataCont.empty()) loadSolutionDataContainer();
1076 for (
auto &is : slnDataCont)
1083 std::string sName, std::vector<double> &
slnData,
int &outNData,
1086 if (slnDataCont.empty()) loadSolutionDataContainer();
1088 for (
auto &is : slnDataCont) {
1089 if (!strcmp((is->getDataName()).c_str(), sName.c_str())) {
1090 is->getData(slnData, outNData, outNDim);
1091 return (is->getDataType());
1102 if (slnDataCont.empty()) loadSolutionDataContainer();
1105 nwSlnPtr->
appendData(slnData, inNData, inNDim);
1106 slnDataCont.push_back(nwSlnPtr);
1107 appendedSolutionName.push_back(sName);
1114 if (slnDataCont.empty()) loadSolutionDataContainer();
1117 std::vector<double> slnDataVec;
1118 slnDataVec.resize(inNData, slnData);
1119 nwSlnPtr->
appendData(slnDataVec, inNData, inNDim);
1121 slnDataCont.push_back(nwSlnPtr);
1122 appendedSolutionName.push_back(sName);
1126 for (
auto is = appendedSolutionName.begin(); is != appendedSolutionName.end();
1128 if (strcmp(sName.c_str(), (*is).c_str()) == 0) {
1129 delete getSolutionDataObj(sName);
1130 appendedSolutionName.erase(is);
1137 std::vector<std::string> &appSName) {
1138 appSName.insert(appSName.end(), appendedSolutionName.begin(),
1139 appendedSolutionName.end());
1144 return solutionName;
1148 std::vector<CGNS_ENUMT(GridLocation_t)>
1150 return solutionGridLocation;
1159 std::map<std::string, CGNS_ENUMT(GridLocation_t)>
1161 return solutionNameLocMap;
1171 vtkSmartPointer<vtkUnstructuredGrid> dataSet_tmp =
1174 points->SetNumberOfPoints(nVertex);
1175 for (
int i = 0; i < nVertex; ++i) {
1176 points->SetPoint(i, xCrd[i], yCrd[i], zCrd[i]);
1179 dataSet_tmp->SetPoints(points);
1181 dataSet_tmp->Allocate(nElem);
1183 for (
int i = 0; i < nElem; ++i) {
1185 std::vector<cgsize_t> cgnsElmIds(getElementConnectivity(i));
1186 vtkElmIds->SetNumberOfIds(cgnsElmIds.size());
1187 for (
int j = 0; j < cgnsElmIds.size(); ++j) {
1188 vtkElmIds->SetId(j, cgnsElmIds[j] - 1);
1190 switch (sectionType) {
1191 case CGNS_ENUMV(TETRA_4):
1192 dataSet_tmp->InsertNextCell(VTK_TETRA, vtkElmIds);
1194 case CGNS_ENUMV(HEXA_8):
1195 dataSet_tmp->InsertNextCell(VTK_HEXAHEDRON, vtkElmIds);
1197 case CGNS_ENUMV(TRI_3):
1198 dataSet_tmp->InsertNextCell(VTK_TRIANGLE, vtkElmIds);
1200 case CGNS_ENUMV(QUAD_4):
1201 dataSet_tmp->InsertNextCell(VTK_QUAD, vtkElmIds);
1203 case CGNS_ENUMV(TETRA_10):
1204 dataSet_tmp->InsertNextCell(VTK_QUADRATIC_TETRA, vtkElmIds);
1207 std::cerr <<
"Unknown element type " << sectionType << std::endl;
1217 if (slnDataCont.empty()) loadSolutionDataContainer();
1220 for (
auto &is : solutionMap) {
1221 std::pair<int, keyValueList> slnPair = is.second;
1222 int slnIdx = slnPair.first;
1224 for (
auto &ifl : fldLst) {
1226 std::vector<double> newData;
1227 if (solutionGridLocation[iSol] == CGNS_ENUMV(Vertex)) {
1239 if (!(ifl.second).compare(
"mdot_old")) {
continue; }
1242 std::cout <<
"Writing " << newData.size() <<
" to " << ifl.second
1243 <<
" located in " << solutionName[iSol] << std::endl;
1252 std::vector<int> newDataToInt(newData.begin(), newData.end());
1253 overwriteSolData(ifl.second, solutionName[iSol], slnIdx,
1254 CGNS_ENUMV(Integer), &newDataToInt[0]);
1256 overwriteSolData(ifl.second, solutionName[iSol], slnIdx,
1257 CGNS_ENUMV(RealDouble), &newData[0]);
1263 const std::string &ndeName,
int slnIdx,
1266 CGNS_ENUMT(GridLocation_t) gloc(solutionNameLocMap[fname]);
1268 if (cg_field_write(indexFile, indexBase, indexZone, slnIdx, dt, fname.c_str(),
1272 double *tmpData = (
double *)data;
1273 double min = tmpData[0];
1274 double max = tmpData[0];
1276 if (gloc == CGNS_ENUMV(Vertex)) {
1281 for (
int it = 0; it < nItr; ++it) {
1282 min = std::min(tmpData[it], min);
1283 max = std::max(tmpData[it], max);
1286 std::ostringstream os;
1287 os << min <<
", " << max;
1288 std::string range = os.str();
1289 if (cg_goto(indexFile, indexBase,
"Zone_t", indexZone,
"FlowSolution_t",
1290 slnIdx,
"DataArray_t", fldIdx,
"end"))
1292 if (cg_descriptor_write(
"Range", range.c_str())) cg_error_exit();
1294 if (gloc == CGNS_ENUMV(CellCenter)) {
1295 if (cg_goto(indexFile, indexBase,
"Zone_t", indexZone,
"FlowSolution_t",
1296 slnIdx,
"DataArray_t", fldIdx,
"end"))
1299 float exponents[5] = {0, 0, 0, 0, 0};
1300 if (cg_exponents_write(CGNS_ENUMV(RealSingle), exponents)) cg_error_exit();
1301 if (cg_descriptor_write(
"Units",
"dmy")) cg_error_exit();
1307 MAdToCgnsIds.clear();
1308 cgnsToMAdIds.clear();
1309 for (
int iV = 0; iV < nVertex; ++iV) {
1310 MAdMesh->add_point(iV + 1, xCrd[iV], yCrd[iV], zCrd[iV]);
1311 cgnsToMAdIds[iV] = iV + 1;
1312 MAdToCgnsIds[iV + 1] = iV;
1316 if (physDim == 3)
switch (sectionType) {
1317 case CGNS_ENUMV(TETRA_4): {
1318 for (
int iC = 0; iC < nElem; ++iC) {
1321 MAd::pGEntity geom =
1322 (MAd::pGEntity)MAd::GM_regionByTag(MAdMesh->model, 0);
1325 MAdMesh->add_tet(elemConn[iN], elemConn[iN + 1], elemConn[iN + 2],
1326 elemConn[iN + 3], geom);
1331 case CGNS_ENUMV(TRI_3): {
1332 for (
int iC = 0; iC < nElem; ++iC) {
1335 MAd::pGEntity geom =
1336 (MAd::pGEntity)MAd::GM_faceByTag(MAdMesh->model, 0);
1337 MAdMesh->add_triangle(elemConn[iN], elemConn[iN + 1],
1338 elemConn[iN + 2], geom);
1342 std::cerr <<
"Current version only works for TRI and TET elements. " 1344 << sectionType <<
" is not supported." << std::endl;
1374 MAdMesh->classify_unclassified_entities();
1375 MAdMesh->destroyStandAloneEntities();
1380 MAd::pGEntity bnd = (MAd::pGEntity)MAd::GM_faceByTag(MAdMesh->model, 0);
1381 MAdMesh->classify_grid_boundaries(bnd);
1386 MAdMesh->unclassify_grid_boundaries();
1391 if (vrtxCrd) annDeallocPts(vrtxCrd);
1393 vrtxCrd = annAllocPts(nVertex, physDim);
1394 if (kdTree) {
delete kdTree; }
1397 for (
int iVrt = 0; iVrt < nVertex; ++iVrt) {
1398 vrtxCrd[iVrt][0] = xCrd[iVrt];
1399 vrtxCrd[iVrt][1] = yCrd[iVrt];
1400 vrtxCrd[iVrt][2] = zCrd[iVrt];
1403 kdTree =
new ANNkd_tree(vrtxCrd, nVertex, physDim);
1408 if (vrtxIdx) annDeallocPts(vrtxIdx);
1410 vrtxIdx = annAllocPts(nElem, nVrtxElem);
1411 if (kdTreeElem)
delete kdTreeElem;
1414 for (
int iElem = 0; iElem < nElem; ++iElem) {
1415 for (
int iVrtx = 1; iVrtx <= nVrtxElem; ++iVrtx) {
1416 vrtxIdx[iElem][iVrtx] = elemConn[(iElem - 1) * nVrtxElem + iVrtx];
1420 kdTreeElem =
new ANNkd_tree(vrtxIdx, nElem, nVrtxElem);
1428 buildVertexKDTree();
1431 for (
int iVrt = 0; iVrt < getNVertex(); ++iVrt) {
1435 qryVrtx = annAllocPt(physDim);
1436 qryVrtx[0] = getVrtXCrd(iVrt);
1437 qryVrtx[1] = getVrtYCrd(iVrt);
1438 qryVrtx[2] = getVrtZCrd(iVrt);
1439 nnIdx =
new ANNidx[1];
1440 dists =
new ANNdist[1];
1441 kdTree->annkSearch(qryVrtx, 2, nnIdx, dists);
1442 if (dists[1] < 1e-10) {
1444 std::cout <<
"Vertex " << iVrt <<
" is duplicated." 1445 <<
" Distances = " << dists[0] <<
" " << dists[1] << std::endl;
1449 annDeallocPt(qryVrtx);
1451 std::cout <<
"Found " << nDupVer <<
" duplicate vertex.\n";
1476 std::map<int, std::set<int>> nde2Elm;
1477 for (
int iElm = 0; iElm < nElem; ++iElm)
1478 for (
int iNde = 0; iNde < nVrtxElem; ++iNde)
1479 nde2Elm[elemConn[iElm * nVrtxElem + iNde]].insert(iElm);
1494 std::vector<int> hangingElmIdx;
1495 for (
int iElm = 0; iElm < nElem; ++iElm) {
1497 for (
int iNde = 0; iNde < nVrtxElem; ++iNde)
1498 nShrdNde += nde2Elm[iNde].size() > 1;
1499 if (nShrdNde < nSharedNde) hangingElmIdx.push_back(iElm);
1502 std::cout <<
"Number of elements with less than " << nSharedNde
1503 <<
" shared node is " << hangingElmIdx.size() << std::endl;
1504 return !hangingElmIdx.empty();
1511 std::vector<double> elmCntCrds;
1512 MAd::RIter ri = M_regionIter(msh);
1514 while (MAd::pRegion pr = RIter_next(ri)) {
1516 MAd::R_center(pr, xc);
1517 elmCntCrds.push_back(xc[0]);
1518 elmCntCrds.push_back(xc[1]);
1519 elmCntCrds.push_back(xc[2]);
1530 std::cerr <<
"Error : Stitching mesh should have same dimensions." 1540 buildVertexKDTree();
1543 vrtDataMask.clear();
1544 elmDataMask.clear();
1547 std::vector<int> newVrtIdx;
1548 std::vector<int> rptVrtIdx;
1549 std::map<int, int> rptVrtMap;
1550 std::vector<double> newXCrd;
1551 std::vector<double> newYCrd;
1552 std::vector<double> newZCrd;
1554 for (
int iVrt = 0; iVrt < inCg->
getNVertex(); ++iVrt) {
1558 qryVrtx = annAllocPt(physDim);
1562 nnIdx =
new ANNidx[1];
1563 dists =
new ANNdist[1];
1564 kdTree->annkSearch(qryVrtx, 1, nnIdx, dists);
1565 if (dists[0] > searchEps) {
1567 vrtDataMask.push_back(
true);
1568 newVrtIdx.push_back(nVertex + nNewVrt);
1569 newXCrd.push_back(qryVrtx[0]);
1570 newYCrd.push_back(qryVrtx[1]);
1571 newZCrd.push_back(qryVrtx[2]);
1573 vrtDataMask.push_back(
false);
1574 newVrtIdx.push_back(nnIdx[0] + 1);
1575 rptVrtIdx.push_back(iVrt);
1576 rptVrtMap[iVrt] = nnIdx[0] + 1;
1580 annDeallocPt(qryVrtx);
1582 std::cout <<
"Found " << nNewVrt <<
" new vertices.\n";
1583 std::cout <<
"Number of repeating index " << rptVrtIdx.size() << std::endl;
1586 std::vector<int> newElemConn;
1588 for (
int iElem = 0; iElem < inCg->
getNElement(); ++iElem) {
1592 elmDataMask.push_back(
true);
1594 newElemConn.insert(newElemConn.end(), rmtElemConn.begin(),
1597 std::cout <<
"Found " << nNewElem <<
" new elements.\n";
1600 for (
int iIdx = 0; iIdx < newElemConn.size(); ++iIdx) {
1601 newElemConn[iIdx] = newVrtIdx[newElemConn[iIdx] - 1];
1605 if (withFields) stitchFields(inCg);
1610 xCrd.insert(xCrd.end(), newXCrd.begin(), newXCrd.end());
1611 yCrd.insert(yCrd.end(), newYCrd.begin(), newYCrd.end());
1612 zCrd.insert(zCrd.end(), newZCrd.begin(), newZCrd.end());
1613 elemConn.insert(elemConn.end(), newElemConn.begin(), newElemConn.end());
1619 std::vector<std::string> crntCgList;
1620 getSolutionDataNames(crntCgList);
1622 for (
auto &it : crntCgList) std::cout << it << std::endl;
1624 if (slnDataCont.empty()) {
1625 for (
auto &is : crntCgList) {
1628 std::cout << is <<
" number of data read " << slnDataPtr->
getNData()
1629 <<
" " << slnDataPtr->
getNDim() << std::endl;
1630 slnDataCont.push_back(slnDataPtr);
1634 std::cout <<
" Number of Solution Field = " << slnDataCont.size()
1640 std::vector<std::string> crntCgList;
1641 getSolutionDataNames(crntCgList);
1644 if (slnDataCont.empty()) loadSolutionDataContainer();
1647 std::vector<std::string> inCgList;
1649 for (
auto &
id : inCgList) {
1650 bool isRptData =
false;
1651 for (
auto &is : crntCgList)
1652 if (!strcmp(
id.c_str(), is.c_str())) {
1654 std::cout <<
id <<
" is an existing field.\n";
1659 std::vector<double> inCgSlnData;
1660 int outNData, outNDim;
1663 inCgSlnDataPtr->
getData(inCgSlnData, outNData, outNDim, vrtDataMask);
1667 inCgSlnDataPtr->
getData(inCgSlnData, outNData, outNDim, elmDataMask);
1672 int nData = slnDataCont.size();
1673 for (
int icd = 0; icd <
nData; icd++) {
1674 if (!strcmp((slnDataCont[icd]->
getDataName()).c_str(),
id.c_str())) {
1675 std::cout <<
"To -> " << slnDataCont[icd]->getDataName() << std::endl;
1677 slnDataCont[icd]->appendData(inCgSlnData, inCgSlnData.size(), 1);
1686 std::vector<std::string> inCgAppLst;
1688 if (appendedSolutionName.empty() || inCgAppLst.empty())
return;
1689 for (
auto &
id : inCgAppLst) {
1690 bool isRptData =
false;
1692 for (
auto &is : appendedSolutionName) {
1696 if (strcmp(
id.c_str(), is.c_str()) == 0) {
1704 std::vector<double> inCgSlnData;
1705 int outNData, outNDim;
1708 inCgSlnDataPtr->
getData(inCgSlnData, outNData, outNDim, vrtDataMask);
1712 inCgSlnDataPtr->
getData(inCgSlnData, outNData, outNDim, elmDataMask);
1714 std::cout <<
" will append " << outNData <<
" data points.\n";
1717 for (
auto &icnt : slnDataCont) {
1718 if (!strcmp((icnt->getDataName()).c_str(),
id.c_str())) {
1721 icnt->appendData(inCgSlnData, inCgSlnData.size(), 1);
1731 if (!cgRindNodeIds.empty()) {
1732 auto it = std::find(cgRindNodeIds.begin(), cgRindNodeIds.end(), cgNodeId);
1733 return (it != cgRindNodeIds.end());
1740 if (!cgRindCellIds.empty()) {
1741 auto it = std::find(cgRindCellIds.begin(), cgRindCellIds.end(), cgCellId);
1742 return (it != cgRindCellIds.end());
1750 if (!isStructured())
return;
1751 if (_rindOff)
return;
1752 std::cout <<
"Cleaning up rind data from the grid.\n";
1754 std::map<int, int> old2NewNdeIds;
1757 for (
int iNde = 1; iNde <= nVertex; iNde++)
1758 if (isCgRindNode(iNde)) {
1759 old2NewNdeIds[iNde] = -1;
1762 old2NewNdeIds[iNde] = nNewNde++;
1764 if (nRindNde != cgRindNodeIds.size()) {
1765 std::cerr <<
"Problem occured during rind node removal.\n";
1770 std::vector<double> nxCrd, nyCrd, nzCrd;
1771 for (
int iVrt = 0; iVrt < nVertex; iVrt++) {
1772 if (old2NewNdeIds[iVrt + 1] < 0) {
1776 nxCrd.push_back(xCrd[iVrt]);
1777 nyCrd.push_back(yCrd[iVrt]);
1778 nzCrd.push_back(zCrd[iVrt]);
1785 if (nRindNde != cgRindNodeIds.size()) {
1786 std::cerr <<
"Problem occured during rind coord removal.\n";
1790 std::vector<cgsize_t> newElemConn;
1791 for (
int iElm = 0; iElm < nElem; iElm++) {
1792 if (isCgRindCell(iElm + 1))
continue;
1793 for (
int id = 0;
id < 8;
id++)
1794 newElemConn.push_back(old2NewNdeIds[elemConn[iElm * 8 +
id]]);
1796 elemConn = newElemConn;
1798 for (
auto i : elemConn) i = old2NewNdeIds[i];
1801 if (!slnDataCont.empty()) {
1803 std::vector<int> intRindCellId, intRindNodeId;
1804 for (
auto i : cgRindNodeIds) intRindNodeId.push_back(i - 1);
1805 for (
auto i : cgRindCellIds) intRindCellId.push_back(i - 1);
1807 std::cout <<
"Cleaning up rind solution data ";
1809 for (
auto sd : slnDataCont) {
1818 sd->rmvDataIdx(intRindNodeId);
1820 sd->rmvDataIdx(intRindCellId);
1825 nVertex -= cgRindNodeIds.size();
1827 nElem -= cgRindCellIds.size();
void writeSampleStructured()
std::vector< double > vecSlnType
void rmvDataIdx(const std::vector< int > &rmvIdx)
data_type data
Edge/face with sorted point ids (a, b, c, ...) is located at some index i in data[b], with data[b][i].first == [a, c] (for edges, third point id treated as -1).
std::vector< cgsize_t > getElementConnectivity(int elemId)
solutionData(std::string sName, solution_type_t inDataType)
void populateSolutionDataNames()
std::vector< double > getVrtZCrd()
virtual void getPointDataArray(const std::string &name, std::vector< double > &data)
get scalar point or cell data array.
double getVrtYCrd(int vrtxId)
virtual void stitchMesh(cgnsAnalyzer *inCg, bool withFields=false)
std::vector< double > getElmCntCoords(MAd::pMesh msh)
std::string getSolutionPntr()
void loadZone(int zIdx, int verb=0)
std::vector< double > getVertexCoords()
std::vector< double > getVrtXCrd()
solutionData * getSolutionDataObj(std::string sName)
void overwriteSolData(meshBase *mbObj)
A brief description of meshBase.
void getAppendedSolutionDataName(std::vector< std::string > &appSName)
double getVrtZCrd(int vrtxId)
geoMeshBase * New(MeshType meshType)
Create a new mesh object.
void loadSolutionDataContainer(int verb=0)
void unclassifyMAdMeshBnd(MAd::pMesh MAdMesh)
void appendData(const vecSlnType &data, int inNData, int inNDim)
void buildElementKDTree()
std::vector< double > getVrtYCrd()
void getSectionConn(std::string secName, std::vector< cgsize_t > &conn, int &nElm)
std::vector< std::string > getSolutionNodeNames()
void getSectionNames(std::vector< std::string > &secNames)
std::string getZoneItrName()
void classifyMAdMeshOpt(MAd::pMesh MAdMesh)
std::map< int, std::pair< int, keyValueList > > getSolutionMap()
std::string getGridCrdPntr()
std::string getBaseItrName()
void classifyMAdMeshBnd(MAd::pMesh MAdMesh)
vtkSmartPointer< vtkDataSet > getSectionMesh(std::string secName)
void exportToMAdMesh(MAd::pMesh MAdMesh)
vtkIdType id
id in .inp file
void writeSampleUnstructured()
std::string getSectionName()
std::string getZoneName()
std::string getBaseName()
void clearAllSolutionData()
std::vector< vtkIdType > points
points given by id in .inp file
bool isCgRindCell(int cgCellId)
void loadGrid(const std::string &fname, int verb=0)
void appendSolutionData(std::string sName, std::vector< double > &slnData, solution_type_t dt, int inNData, int inNDim)
std::string getDataName() const
void getSolutionDataNames(std::vector< std::string > &list)
virtual void getCellDataArray(const std::string &name, std::vector< double > &data)
<>
solution_type_t getSolutionDataStitched(std::string sName, std::vector< double > &slnData, int &outNData, int &outNDim)
std::string getFileName()
virtual void stitchFields(cgnsAnalyzer *inCg)
bool delAppSlnData(std::string sName)
solution_type_t getSolutionData(std::string sName, std::vector< double > &slnData)
vtkSmartPointer< vtkDataSet > getVTKMesh()
bool checkElmConn(int nSharedNde)
bool isCgRindNode(int cgNdeId)
std::map< int, std::string > keyValueList
solution_type_t getDataType() const
double getVrtXCrd(int vrtxId)
std::vector< CGNS_ENUMT(GridLocation_t)> getSolutionGridLocations()
std::map< std::string, CGNS_ENUMT(GridLocation_t)> getSolutionNameLocMap()
void getData(vecSlnType &inBuff, int &outNData, int &outNDim) const