39 std::size_t _loc =
myCgFName.find_last_of(
"_");
46 std::size_t _loc = fnames[0].find_last_of(
"_");
60 for (
int iCg = 0; iCg < nCg; iCg++) {
61 std::ostringstream suffix1;
62 std::ostringstream suffix2;
64 std::string tmp = suffix1.str();
65 for (
int iPad = 0; iPad <
padSize - tmp.size(); iPad++) suffix2 <<
"0";
66 suffix2 << tmp <<
".cgns";
76 for (
int i = 0; i <
cgFNames.size(); ++i) {
118 if (indx >
cgFNames.size())
return (
"INVALID");
124 if (indx >
cgFNames.size())
return (
"INVALID");
130 if (indx >
cgFNames.size())
return (
"INVALID");
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++) {
160 massU = cgObj->getMassUnit();
161 lengthU = cgObj->getLengthUnit();
162 timeU = cgObj->getTimeUnit();
163 tempU = cgObj->getTemperatureUnit();
164 angleU = cgObj->getAngleUnit();
187 std::vector<int> newVrtIdx;
188 std::vector<int> rptVrtIdx;
189 std::map<int, int> rptVrtMap;
190 std::vector<double> newXCrd;
191 std::vector<double> newYCrd;
192 std::vector<double> newZCrd;
194 for (
int iVrt = 0; iVrt < cgObj->
getNVertex(); iVrt++) {
202 nnIdx =
new ANNidx[1];
203 dists =
new ANNdist[1];
204 kdTree->annkSearch(qryVrtx, 1, nnIdx, dists);
208 newVrtIdx.push_back(
nVertex + nNewVrt);
209 newXCrd.push_back(qryVrtx[0]);
210 newYCrd.push_back(qryVrtx[1]);
211 newZCrd.push_back(qryVrtx[2]);
214 newVrtIdx.push_back(nnIdx[0] + 1);
215 rptVrtIdx.push_back(iVrt);
216 rptVrtMap[iVrt] = nnIdx[0] + 1;
220 annDeallocPt(qryVrtx);
222 std::cout <<
"Found " << nNewVrt <<
" new vertices.\n";
223 std::cout <<
"Number of repeating index " << rptVrtIdx.size() << std::endl;
226 std::vector<int> newElemConn;
228 for (
int iElem = 0; iElem < cgObj->
getNElement(); iElem++) {
233 newElemConn.insert(newElemConn.end(), rmtElemConn.begin(),
236 std::cout <<
"Found " << nNewElem <<
" new elements.\n";
239 for (
int iIdx = 0; iIdx < newElemConn.size(); iIdx++) {
240 newElemConn[iIdx] = newVrtIdx[newElemConn[iIdx] - 1];
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());
264 std::vector<std::string> listTmp;
314 std::cout <<
"Stitching rocstarCGNS to myself.\n";
317 std::cerr <<
"This rocstarCgns object needs to be initialized first.\n";
329 std::vector<int> newVrtIdx;
330 std::vector<int> rptVrtIdx;
331 std::map<int, int> rptVrtMap;
332 std::vector<double> newXCrd;
333 std::vector<double> newYCrd;
334 std::vector<double> newZCrd;
336 for (
int iVrt = 0; iVrt < cgObj->
getNVertex(); iVrt++) {
344 nnIdx =
new ANNidx[1];
345 dists =
new ANNdist[1];
346 kdTree->annkSearch(qryVrtx, 1, nnIdx, dists);
350 newVrtIdx.push_back(
nVertex + nNewVrt);
351 newXCrd.push_back(qryVrtx[0]);
352 newYCrd.push_back(qryVrtx[1]);
353 newZCrd.push_back(qryVrtx[2]);
356 newVrtIdx.push_back(nnIdx[0] + 1);
357 rptVrtIdx.push_back(iVrt);
358 rptVrtMap[iVrt] = nnIdx[0] + 1;
362 annDeallocPt(qryVrtx);
364 std::cout <<
"Found " << nNewVrt <<
" new vertices.\n";
365 std::cout <<
"Number of repeating index " << rptVrtIdx.size() << std::endl;
368 std::vector<int> newElemConn;
370 for (
int iElem = 0; iElem < cgObj->
getNElement(); iElem++) {
376 newElemConn.insert(newElemConn.end(), rmtElemConn.begin(),
379 std::cout <<
"Found " << nNewElem <<
" new elements.\n";
382 for (
int iIdx = 0; iIdx < newElemConn.size(); iIdx++) {
383 newElemConn[iIdx] = newVrtIdx[newElemConn[iIdx] - 1];
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());
404 if (indx >
cgFNames.size())
return (-1);
427 if (indx >
cgFNames.size())
return (CGNS_ENUMV(ZoneTypeNull));
429 return (
myCgObjs[indx]->getZoneType());
433 if (indx >
cgFNames.size())
return (
"INVALID");
439 if (indx >
cgFNames.size())
return (-1);
464 std::vector<double> crds;
466 "GridCoordinates_t", 1,
"end"))
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();
476 for (
int iEx = dimVec[0]; iEx >
getZoneNVrtx(cgObj, zoneIdx); iEx--)
483 std::vector<cgsize_t> conn;
490 secidx, secname, &et, &st, &en, &nbndry, &parflag))
493 if (std::string(secname).find(
"real") == std::string::npos)
495 ++secidx, secname, &et, &st, &en, &nbndry, &parflag))
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;
505 conn.resize((en - st + 1) * nVrtxElm, -1);
507 secidx, &conn[0], NULL))
513 std::vector<int> conn;
520 secidx, secname, &et, &st, &en, &nbndry, &parflag))
523 if (std::string(secname).find(
"real") == std::string::npos)
525 ++secidx, secname, &et, &st, &en, &nbndry, &parflag))
535 "IntegralData_t", 1,
"end"))
539 if (cg_narrays(&nArr)) cg_error_exit();
540 for (iArr = 1; iArr <= nArr; iArr++) {
545 if (cg_array_info(iArr, arrName, &dt, &dd, dimVec)) cg_error_exit();
546 if (!strcmp(arrName,
"bcflag"))
break;
549 std::cerr <<
"Can not find bcflag." << std::endl;
553 if (cg_array_read(iArr, &bcflag)) cg_error_exit();
559 "IntegralData_t", 1,
"end"))
563 if (cg_narrays(&nArr)) cg_error_exit();
564 for (iArr = 1; iArr <= nArr; iArr++) {
569 if (cg_array_info(iArr, arrName, &dt, &dd, dimVec)) cg_error_exit();
570 if (!strcmp(arrName,
"patchNo"))
break;
573 std::cerr <<
"Can not find patchNo." << std::endl;
577 if (cg_array_read(iArr, &patchNo)) cg_error_exit();
583 "IntegralData_t", 1,
"end"))
587 if (cg_narrays(&nArr)) cg_error_exit();
588 for (iArr = 1; iArr <= nArr; iArr++) {
593 if (cg_array_info(iArr, arrName, &dt, &dd, dimVec)) cg_error_exit();
594 if (!strcmp(arrName,
"cnstr_type"))
break;
597 std::cerr <<
"Can not find cnstr_type." << std::endl;
601 if (cg_array_read(iArr, &cnstrType)) cg_error_exit();
void stitchMe(cgnsAnalyzer *cgObj, int zoneIdx)
std::vector< double > yCrd
std::vector< cgsize_t > getElementConnectivity(int elemId)
CGNS_ENUMT(ZoneType_t) getZoneType(int indx
std::vector< bool > elmDataMask
int getZoneNCell(cgnsAnalyzer *cgObj, int zoneIdx)
double getVrtYCrd(int vrtxId)
std::string getSolutionPntr()
std::string getBaseName()
void loadZone(int zIdx, int verb=0)
std::vector< std::string > solutionName
std::vector< double > xCrd
double getVrtZCrd(int vrtxId)
void loadSolutionDataContainer(int verb=0)
int getPaneCnstrType(cgnsAnalyzer *cgObj, int zoneIdx)
std::vector< std::string > getSolutionNodeNames()
std::string getZoneItrName()
std::vector< double > getZoneCoords(cgnsAnalyzer *cgObj, int zoneIdx, int dim)
std::vector< double > zCrd
rocstarCgns(std::string fname)
std::map< int, std::pair< int, keyValueList > > solutionMap
std::map< int, std::pair< int, keyValueList > > getSolutionMap()
std::string getGridCrdPntr()
std::string getBaseItrName()
std::map< std::string, CGNS_ENUMT(GridLocation_t)> solutionNameLocMap
int getPaneBcflag(cgnsAnalyzer *cgObj, int zoneIdx)
std::vector< int > patchNo
std::vector< std::string > zoneNames
int getZoneRealSecType(cgnsAnalyzer *cgObj, int zoneIdx)
std::string getCgFName(int indx)
std::string getSectionName()
std::string getZoneName()
void clearAllSolutionData()
std::vector< bool > vrtDataMask
std::vector< std::string > cgFNames
void loadGrid(const std::string &fname, int verb=0)
std::vector< cgsize_t > elemConn
void appendSolutionData(std::string sName, std::vector< double > &slnData, solution_type_t dt, int inNData, int inNDim)
void stitchFldBc(cgnsAnalyzer *cgObj, int zoneIdx)
std::vector< cgnsAnalyzer * > myCgObjs
int getPanePatchNo(cgnsAnalyzer *cgObj, int zoneIdx)
void getSolutionDataNames(std::vector< std::string > &list)
int getZoneNVrtx(cgnsAnalyzer *cgObj, int zoneIdx)
std::vector< CGNS_ENUMT(GridLocation_t)> solutionGridLocation
std::string getFileName()
virtual void stitchFields(cgnsAnalyzer *inCg)
bool delAppSlnData(std::string sName)
double getVrtXCrd(int vrtxId)
cgnsAnalyzer(std::string fname, int verb=0)
std::vector< CGNS_ENUMT(GridLocation_t)> getSolutionGridLocations()
std::vector< cgsize_t > getZoneRealConn(cgnsAnalyzer *cgObj, int zoneIdx)
std::map< std::string, CGNS_ENUMT(GridLocation_t)> getSolutionNameLocMap()