11 namespace tecplotconst = rsvs3d::constants::tecplot;
16 void ExtractMeshData(
const mesh &grid,
int *nVert,
int *nEdge,
int *nVolu,
int *nSurf,
int *totNumFaceNode)
21 *nVert = grid.verts.size();
22 *nVolu = grid.volus.size();
23 *nSurf = grid.surfs.size();
24 *nEdge = grid.edges.size();
26 for (ii = 0; ii < *nSurf; ++ii)
28 *totNumFaceNode = *totNumFaceNode + int(grid.surfs(ii)->edgeind.size());
34 void Coord(
tecplotfile &tecout,
const mesh &meshout,
int nVert,
int nVertDat)
38 nCoord = int(meshout.verts(0)->coord.size());
39 nCoord = nCoord > nVertDat ? nVertDat : nCoord;
40 for (jj = 0; jj < nCoord; ++jj)
42 for (ii = 0; ii < nVert; ++ii)
44 tecout.Print(
"%.16lf ", meshout.verts(ii)->coord[jj]);
48 for (jj =
int(meshout.verts(0)->coord.size()); jj < nVertDat; ++jj)
50 for (ii = 0; ii < nVert; ++ii)
52 tecout.Print(
"%lf ", 0.0);
61 for (ii = 0; ii < nVert; ++ii)
63 tecout.Print(
"%.16lf ", snakeout.snaxs(ii)->d);
66 for (ii = 0; ii < nVert; ++ii)
68 tecout.Print(
"%.16lf ", snakeout.snaxs(ii)->v);
71 for (ii = 0; ii < nVert; ++ii)
73 auto temp = snakeout.snakeconn.verts(ii)->elmind(snakeout.snakeconn, 2);
75 for (
auto surfSub : temp)
77 int tempSize = snakeout.snakeconn.surfs.isearch(surfSub)->edgeind.size();
78 maxSize = maxSize < tempSize ? tempSize : maxSize;
81 tecout.Print(
"%i ", maxSize);
95 std::vector<double> coords = MeshUnitNormals(meshin);
97 for (
int j = 0; j < 3; ++j)
99 for (
int i = 0; i < nVert; ++i)
101 tecout.Print(
"%.16lf ", coords[i * 3 + j]);
106 void VertexLaplacian(
tecplotfile &tecout,
const mesh &meshin,
int nVert)
108 auto coords = MeshLaplacians(meshin);
109 for (
int j = 0; j < 3; ++j)
111 for (
int i = 0; i < nVert; ++i)
113 tecout.Print(
"%.16lf ", coords[i * 3 + j]);
121 auto coords = snakein.MoveDirections();
122 for (
int j = 0; j < 3; ++j)
124 for (
int i = 0; i < nVert; ++i)
126 tecout.Print(
"%.16lf ", coords[i * 3 + j]);
134 int tecplotfile::VolDataBlock(
const mesh &meshout,
int nVert,
int nVolu,
int nVertDat,
const std::vector<int> &voluList,
135 const std::vector<int> &vertList)
141 nCoord = int(meshout.verts(0)->coord.size());
142 nCoord = nCoord > nVertDat ? nVertDat : nCoord;
143 if (vertList.size() == 0)
145 dataoutput::Coord(*
this, meshout, nVert, nVertDat);
149 for (jj = 0; jj < nCoord; ++jj)
151 for (
auto ii : vertList)
153 this->Print(
"%.16lf ", meshout.verts.isearch(ii)->coord[jj]);
157 nVert = vertList.size();
158 for (jj =
int(meshout.verts(0)->coord.size()); jj < nVertDat; ++jj)
160 for (ii = 0; ii < nVert; ++ii)
162 this->Print(
"%lf ", 0.0);
168 if (voluList.size() == 0)
170 for (ii = 0; ii < nVolu; ++ii)
172 this->Print(
"%.16lf ", meshout.volus(ii)->fill);
175 for (ii = 0; ii < nVolu; ++ii)
177 this->Print(
"%.16lf ", meshout.volus(ii)->target);
180 for (ii = 0; ii < nVolu; ++ii)
182 this->Print(
"%.16lf ", meshout.volus(ii)->error);
188 for (
auto ii : voluList)
190 this->Print(
"%.16lf ", meshout.volus.isearch(ii)->fill);
194 for (
auto ii : voluList)
196 this->Print(
"%.16lf ", meshout.volus.isearch(ii)->target);
199 for (
auto ii : voluList)
201 this->Print(
"%.16lf ", meshout.volus.isearch(ii)->error);
208 int tecplotfile::SnakeDataBlock(
const snake &snakeout,
int nVert,
int nVertDat, std::string snakeData,
bool printCoord)
213 dataoutput::Coord(*
this, snakeout.snakeconn, nVert, nVertDat);
216 if (snakeData.compare(tecplotconst::snakedata::snaxel) == 0)
218 dataoutput::Snaxel(*
this, snakeout, nVert);
220 else if (snakeData.compare(tecplotconst::snakedata::normal) == 0)
224 else if (snakeData.compare(tecplotconst::snakedata::laplacian) == 0)
226 dataoutput::VertexLaplacian(*
this, snakeout.snakeconn, nVert);
228 else if (snakeData.compare(tecplotconst::snakedata::direction) == 0)
230 dataoutput::SnaxelDirection(*
this, snakeout, nVert);
235 errstr <<
"Unknown snake data output '" << snakeData <<
"'";
242 int tecplotfile::SurfDataBlock(
const mesh &meshout,
int nVert,
int nSurf,
int nVertDat)
248 dataoutput::Coord(*
this, meshout, nVert, nVertDat);
250 for (ii = 0; ii < nSurf; ++ii)
252 this->Print(
"%.16lf ", meshout.surfs(ii)->fill);
255 for (ii = 0; ii < nSurf; ++ii)
257 this->Print(
"%.16lf ", meshout.surfs(ii)->target);
260 for (ii = 0; ii < nSurf; ++ii)
262 this->Print(
"%.16lf ", meshout.surfs(ii)->error);
268 int tecplotfile::LineDataBlock(
const mesh &meshout,
int nVert,
int nEdge,
int nVertDat,
int nCellDat)
274 dataoutput::Coord(*
this, meshout, nVert, nVertDat);
276 for (jj = 0; jj < nCellDat; ++jj)
278 for (ii = 0; ii < nEdge; ++ii)
280 this->Print(
"%i ", 0);
287 int tecplotfile::VertDataBlock(
const mesh &meshout,
int nVert,
int nVertDat,
int nCellDat,
const vector<int> &vertList)
292 nCoord = int(meshout.verts(0)->coord.size());
294 if (vertList.size() > 0)
296 for (jj = 0; jj < nCoord; ++jj)
298 for (ii = 0; ii < nVert; ++ii)
300 this->Print(
"%.16lf ", meshout.verts.isearch(vertList[ii])->coord[jj]);
305 else if (
int(vertList.size()) == meshout.verts.size())
307 for (jj = 0; jj < nCoord; ++jj)
309 for (ii = 0; ii < nVert; ++ii)
313 this->Print(
"%.16lf ", meshout.verts(ii)->coord[jj]);
321 for (jj = 0; jj < nCoord; ++jj)
323 for (ii = 0; ii < nVert; ++ii)
325 this->Print(
"%.16lf ", meshout.verts(ii)->coord[jj]);
330 for (jj = nCoord; jj < nVertDat; ++jj)
332 for (ii = 0; ii < nVert; ++ii)
334 this->Print(
"%lf ", 0.0);
339 for (jj = 0; jj < nCellDat; ++jj)
341 for (ii = 0; ii < nVert; ++ii)
343 this->Print(
"%i ", 0);
350 int tecplotfile::SurfFaceMap(
const mesh &meshout,
int nEdge)
355 for (ii = 0; ii < nEdge; ++ii)
357 verts[0] = meshout.edges(ii)->vertind[0];
358 verts[1] = meshout.edges(ii)->vertind[1];
359 this->Print(
"%i %i\n", meshout.verts.find(verts[0]) + 1, meshout.verts.find(verts[1]) + 1);
363 for (jj = 0; jj < 2; ++jj)
365 for (ii = 0; ii < nEdge; ++ii)
368 actVert = meshout.edges(ii)->surfind[jj];
369 this->Print(
"%i ", meshout.surfs.find(actVert) + 1);
377 int tecplotfile::LineFaceMap(
const mesh &meshout,
int nEdge)
382 for (ii = 0; ii < nEdge; ++ii)
384 verts[0] = meshout.edges(ii)->vertind[0];
385 verts[1] = meshout.edges(ii)->vertind[1];
386 this->Print(
"%i %i\n", meshout.verts.find(verts[0]) + 1, meshout.verts.find(verts[1]) + 1);
393 int tecplotfile::VolFaceMap(
const mesh &meshout,
int nSurf)
395 int ii, jj, actVert, edgeCurr;
396 int verts[2], vertsPast[2];
397 for (ii = 0; ii < nSurf; ++ii)
399 this->Print(
"%i ",
int(meshout.surfs(ii)->edgeind.size()));
403 for (ii = 0; ii < nSurf; ++ii)
405 jj = int(meshout.surfs(ii)->edgeind.size()) - 1;
407 edgeCurr = meshout.edges.find(meshout.surfs(ii)->edgeind[jj]);
408 verts[0] = meshout.verts.find(meshout.edges(edgeCurr)->vertind[0]);
409 verts[1] = meshout.verts.find(meshout.edges(edgeCurr)->vertind[1]);
410 vertsPast[0] = verts[0];
411 vertsPast[1] = verts[1];
413 for (jj = 0; jj < int(meshout.surfs(ii)->edgeind.size()); ++jj)
415 edgeCurr = meshout.edges.find(meshout.surfs(ii)->edgeind[jj]);
417 verts[0] = meshout.verts.find(meshout.edges(edgeCurr)->vertind[0]);
418 verts[1] = meshout.verts.find(meshout.edges(edgeCurr)->vertind[1]);
420 if ((verts[0] == vertsPast[0]) || (verts[1] == vertsPast[0]))
424 #ifdef TEST_POSTPROCESSING
425 else if ((verts[0] == vertsPast[1]) || (verts[1] == vertsPast[1]))
433 #ifdef TEST_POSTPROCESSING
436 cerr <<
"Warning: postprocessing.cpp:tecplotfile::VolFaceMap" << endl;
437 cerr <<
" Mesh Output failed in output of facemap data" << endl;
438 cerr <<
" Surface is not ordered " << endl;
443 this->Print(
"%i ", vertsPast[actVert] + 1);
444 vertsPast[0] = verts[0];
445 vertsPast[1] = verts[1];
449 for (jj = 0; jj < 2; ++jj)
451 for (ii = 0; ii < nSurf; ++ii)
454 actVert = meshout.surfs(ii)->voluind[jj];
455 this->Print(
"%i ", meshout.volus.find(actVert) + 1);
462 int tecplotfile::VolFaceMap(
const mesh &meshout,
const std::vector<int> &surfList,
const std::vector<int> &voluList,
463 const std::vector<int> &vertList)
465 int jj, actVert, edgeCurr;
466 int verts[2], vertsPast[2];
467 for (
auto ii : meshout.surfs.find_list(surfList))
469 this->Print(
"%i ",
int(meshout.surfs(ii)->edgeind.size()));
473 verthash.vec = vertList;
474 verthash.GenerateHash();
475 for (
auto ii : meshout.surfs.find_list(surfList))
477 jj = int(meshout.surfs(ii)->edgeind.size()) - 1;
479 edgeCurr = meshout.edges.find(meshout.surfs(ii)->edgeind[jj]);
480 verts[0] = verthash.find(meshout.edges(edgeCurr)->vertind[0]);
481 verts[1] = verthash.find(meshout.edges(edgeCurr)->vertind[1]);
482 vertsPast[0] = verts[0];
483 vertsPast[1] = verts[1];
485 for (jj = 0; jj < int(meshout.surfs(ii)->edgeind.size()); ++jj)
487 edgeCurr = meshout.edges.find(meshout.surfs(ii)->edgeind[jj]);
489 verts[0] = verthash.find(meshout.edges(edgeCurr)->vertind[0]);
490 verts[1] = verthash.find(meshout.edges(edgeCurr)->vertind[1]);
492 if ((verts[0] == vertsPast[0]) || (verts[1] == vertsPast[0]))
496 #ifdef TEST_POSTPROCESSING
497 else if ((verts[0] == vertsPast[1]) || (verts[1] == vertsPast[1]))
505 #ifdef TEST_POSTPROCESSING
508 cerr <<
"Warning: postprocessing.cpp:tecplotfile::VolFaceMap" << endl;
509 cerr <<
" Mesh Output failed in output of facemap data" << endl;
510 cerr <<
" Surface is not ordered " << endl;
515 this->Print(
"%i ", vertsPast[actVert] + 1);
516 vertsPast[0] = verts[0];
517 vertsPast[1] = verts[1];
521 for (jj = 0; jj < 2; ++jj)
523 for (
auto ii : meshout.surfs.find_list(surfList))
526 actVert = meshout.surfs(ii)->voluind[jj];
528 bool notFoundCell =
true;
529 for (
auto j : voluList)
534 notFoundCell =
false;
542 this->Print(
"%i ", k);
550 int tecplotfile::PrintMesh(
const mesh &meshout,
int strandID,
double timeStep,
int forceOutType,
551 const vector<int> &vertList)
558 int nVert, nEdge, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat;
560 ExtractMeshData(meshout, &nVert, &nEdge, &nVolu, &nSurf, &totNumFaceNode);
567 this->Print(
"VARIABLES = \"X\" ,\"Y\" , \"Z\" ,\"v1\" "
568 ",\"v2\", \"v3\"\n");
575 this->StrandTime(strandID, timeStep);
581 if (forceOutType == tecplotconst::autoselect)
585 forceOutType = tecplotconst::polyhedron;
589 forceOutType = tecplotconst::polygon;
593 forceOutType = tecplotconst::line;
597 forceOutType = tecplotconst::point;
601 if (forceOutType == tecplotconst::polyhedron)
603 this->ZoneHeaderPolyhedron(nVert, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat);
604 this->VolDataBlock(meshout, nVert, nVolu, nVertDat);
605 this->VolFaceMap(meshout, nSurf);
607 else if (forceOutType == tecplotconst::polygon)
609 this->ZoneHeaderPolygon(nVert, nEdge, nSurf, nVertDat, nCellDat);
610 this->SurfDataBlock(meshout, nVert, nSurf, nVertDat);
611 this->SurfFaceMap(meshout, nEdge);
613 else if (forceOutType == tecplotconst::line)
615 this->ZoneHeaderFelineseg(nVert, nEdge, nVertDat, nCellDat);
616 this->LineDataBlock(meshout, nVert, nEdge, nVertDat, nCellDat);
617 this->LineFaceMap(meshout, nEdge);
619 else if (forceOutType == tecplotconst::point)
621 if (
int(vertList.size()) == nVert)
624 for (
int ii = 0; ii < int(vertList.size()); ++ii)
626 nVert += int(vertList[ii]);
629 else if (vertList.size() > 0)
631 nVert = int(vertList.size());
633 this->ZoneHeaderOrdered(nVert, nVertDat, nCellDat);
634 this->VertDataBlock(meshout, nVert, nVertDat, nCellDat, vertList);
637 else if (forceOutType == 5)
639 if (vertList.size() > 0)
641 nVolu = int(vertList.size());
646 " least be length 1");
650 auto voluSubList = meshout.volus.find_list(vertList);
651 auto surfList = ConcatenateVectorField(meshout.volus, &volu::surfind, voluSubList);
654 nSurf = surfList.size();
655 auto surfSubList = meshout.surfs.find_list(surfList);
656 auto edgeList = ConcatenateVectorField(meshout.surfs, &surf::edgeind, surfSubList);
657 auto edgeSubList = meshout.edges.find_list(edgeList);
658 auto actualVert = ConcatenateVectorField(meshout.edges, &edge::vertind, edgeSubList);
661 nVert = actualVert.size();
663 for (
auto j : surfList)
665 totNumFaceNode += meshout.surfs.isearch(j)->edgeind.size();
668 this->ZoneHeaderPolyhedron(nVert, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat);
669 this->VolDataBlock(meshout, nVert, nVolu, nVertDat, vertList, actualVert);
670 this->VolFaceMap(meshout, surfList, vertList, actualVert);
676 int tecplotfile::PrintSnake(
const snake &snakeout,
int strandID,
double timeStep,
int forceOutType,
677 const vector<int> &vertList)
679 return this->PrintSnake(tecplotconst::snakedata::__default, snakeout, strandID, timeStep, forceOutType,
680 tecplotconst::nosharedzone, vertList);
682 int tecplotfile::PrintSnake(std::string snakeData,
const snake &snakeout,
int strandID,
double timeStep,
683 int forceOutType,
int coordConnShareZone,
const vector<int> &vertList)
690 int nVert, nEdge, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat;
692 ExtractMeshData(snakeout.snakeconn, &nVert, &nEdge, &nVolu, &nSurf, &totNumFaceNode);
700 this->Print(
"VARIABLES = \"X\" ,\"Y\" , \"Z\" ,\"v1\" ,\"v2\", \"v3\"\n");
707 this->StrandTime(strandID, timeStep);
713 if (forceOutType == tecplotconst::autoselect)
717 forceOutType = tecplotconst::polyhedron;
721 forceOutType = tecplotconst::polygon;
725 forceOutType = tecplotconst::line;
729 forceOutType = tecplotconst::point;
733 bool zoneSharing = tecplotconst::__issharedzone(coordConnShareZone);
734 bool printCoord = !zoneSharing;
735 if (forceOutType == tecplotconst::polyhedron)
737 this->ZoneHeaderPolyhedronSnake(nVert, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat);
740 this->DefShareZoneVolume(coordConnShareZone, nVertDat);
742 this->SnakeDataBlock(snakeout, nVert, nVertDat, snakeData, printCoord);
745 this->VolFaceMap(snakeout.snakeconn, nSurf);
748 else if (forceOutType == tecplotconst::polygon)
750 this->ZoneHeaderPolygonSnake(nVert, nEdge, nSurf, nVertDat, nCellDat);
753 this->DefShareZoneVolume(coordConnShareZone, nVertDat);
755 this->SnakeDataBlock(snakeout, nVert, nVertDat, snakeData, printCoord);
758 this->SurfFaceMap(snakeout.snakeconn, nEdge);
761 else if (forceOutType == tecplotconst::line)
763 this->ZoneHeaderFelinesegSnake(nVert, nEdge, nVertDat, nCellDat);
766 this->DefShareZoneVolume(coordConnShareZone, nVertDat);
768 this->SnakeDataBlock(snakeout, nVert, nVertDat, snakeData, printCoord);
771 this->LineFaceMap(snakeout.snakeconn, nEdge);
774 else if (forceOutType == tecplotconst::point)
776 if (
int(vertList.size()) == nVert)
779 for (
int ii = 0; ii < int(vertList.size()); ++ii)
781 nVert += int(vertList[ii]);
784 else if (vertList.size() > 0)
786 nVert = int(vertList.size());
788 this->ZoneHeaderOrdered(nVert, nVertDat, nCellDat);
791 this->DefShareZoneVolume(coordConnShareZone, nVertDat);
793 this->SnakeDataBlock(snakeout, nVert, nVertDat, snakeData, printCoord);
799 int tecplotfile::PrintVolumeDat(
const mesh &meshout,
int shareZone,
int strandID,
double timeStep)
801 int nVert, nEdge, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat;
805 this->Print(
"VARIABLES = \"X\" ,\"Y\" , \"Z\" ,\"v1\" ,\"v2\", \"v3\"\n");
812 this->StrandTime(strandID, timeStep);
814 ExtractMeshData(meshout, &nVert, &nEdge, &nVolu, &nSurf, &totNumFaceNode);
822 forceOutType = tecplotconst::polyhedron;
826 forceOutType = tecplotconst::polygon;
830 forceOutType = tecplotconst::line;
834 forceOutType = tecplotconst::point;
838 if (forceOutType == tecplotconst::polyhedron)
840 this->ZoneHeaderPolyhedron(nVert, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat);
841 this->DefShareZoneVolume(shareZone, nVertDat);
842 this->VolDataBlock(meshout, nVert, nVolu, 0);
845 else if (forceOutType == tecplotconst::polygon)
847 this->ZoneHeaderPolygon(nVert, nEdge, nSurf, nVertDat, nCellDat);
848 this->DefShareZoneVolume(shareZone, nVertDat);
849 this->SurfDataBlock(meshout, nVert, nSurf, 0);
852 else if (forceOutType == tecplotconst::line)
856 else if (forceOutType == tecplotconst::point)
864 int tecplotfile::DefShareZoneVolume(
int shareZone,
int nVertDat)
866 this->Print(
"CONNECTIVITYSHAREZONE=%i\n", shareZone);
867 this->Print(
"VARSHARELIST=([%i-%i]=%i )\n", 1, nVertDat, shareZone);
872 int tecplotfile::PrintSnakeInternalPts(
const snake &snakein,
int strandID,
double timeStep)
880 std::vector<int> vertList;
882 for (jj = 0; jj < int(snakein.isMeshVertIn.size()); ++jj)
884 if (snakein.isMeshVertIn[jj])
886 vertList.push_back(snakein.snakemesh()->verts(jj)->index);
889 if (
int(snakein.isMeshVertIn.size()) == 0)
891 vertList.push_back(snakein.snakemesh()->verts(0)->index);
893 jj = PrintMesh(*(snakein.snakemesh()), strandID, timeStep, 4, vertList);
899 int *nSurf,
int *totNumFaceNode)
903 *nVert = (triout.*mp).size() * 3;
905 *nSurf = (triout.*mp).size();
906 *nEdge = (triout.*mp).size() * 3;
907 *totNumFaceNode = (triout.*mp).size() * 3;
910 void ExtractTriData(
int nTriangles,
int *nVert,
int *nEdge,
int *nVolu,
int *nSurf,
int *totNumFaceNode)
914 *nVert = nTriangles * 3;
917 *nEdge = nTriangles * 3;
918 *totNumFaceNode = nTriangles * 3;
927 int nTri, currInd, currType, nCoord;
928 nTri = (triout.*mp).size();
929 nCoord = int(triout.meshDep->verts(0)->coord.size());
931 for (jj = 0; jj < nCoord; ++jj)
933 for (ii = 0; ii < nTri; ++ii)
935 for (kk = 0; kk < (3); ++kk)
937 currType = (triout.*mp)(ii)->pointtype[kk];
938 currInd = (triout.*mp)(ii)->pointind[kk];
941 this->Print(
"%.16lf ", triout.meshDep->verts.isearch(currInd)->coord[jj]);
943 else if (currType == 2)
945 this->Print(
"%.16lf ", triout.snakeDep->snakeconn.verts.isearch(currInd)->coord[jj]);
947 else if (currType == 3)
949 this->Print(
"%.16lf ", triout.trivert.isearch(currInd)->coord(jj));
955 for (jj = nCoord; jj < nVertDat; ++jj)
957 for (ii = 0; ii < nVert; ++ii)
959 this->Print(
"%lf ", 0.0);
965 for (ii = 0; ii < nVolu; ++ii)
967 this->Print(
"%.16lf ", 0.0);
970 for (ii = 0; ii < nVolu; ++ii)
972 this->Print(
"%.16lf ", 0.0);
975 for (ii = 0; ii < nVolu; ++ii)
977 this->Print(
"%.16lf ", 0.0);
989 int nTri, currInd, currType, nCoord;
990 nTri = (triout.*mp).size();
991 nCoord = int(triout.meshDep->verts(0)->coord.size());
993 for (jj = 0; jj < nCoord; ++jj)
995 for (ii = 0; ii < nTri; ++ii)
997 for (kk = 0; kk < (3); ++kk)
999 currType = (triout.*mp)(ii)->pointtype[kk];
1000 currInd = (triout.*mp)(ii)->pointind[kk];
1003 this->Print(
"%.16lf ", triout.meshDep->verts.isearch(currInd)->coord[jj]);
1005 else if (currType == 2)
1007 this->Print(
"%.16lf ", triout.snakeDep->snakeconn.verts.isearch(currInd)->coord[jj]);
1009 else if (currType == 3)
1011 this->Print(
"%.16lf ", triout.trivert.isearch(currInd)->coord(jj));
1017 for (jj = nCoord; jj < nVertDat; ++jj)
1019 for (ii = 0; ii < nVert; ++ii)
1021 this->Print(
"%lf ", 0.0);
1027 for (ii = 0; ii < nSurf; ++ii)
1029 this->Print(
"%.16lf ", 0.0);
1032 for (ii = 0; ii < nSurf; ++ii)
1034 this->Print(
"%.16lf ", 0.0);
1037 for (ii = 0; ii < nSurf; ++ii)
1039 this->Print(
"%.16lf ", 0.0);
1046 int nVertDat,
int nCellDat)
1051 int nTri, currInd, currType, nCoord;
1052 nTri = (triout.*mp).size();
1053 nCoord = int(triout.meshDep->verts(0)->coord.size());
1055 for (jj = 0; jj < nCoord; ++jj)
1057 for (ii = 0; ii < nTri; ++ii)
1059 for (kk = 0; kk < (3); ++kk)
1061 currType = (triout.*mp)(ii)->pointtype[kk];
1062 currInd = (triout.*mp)(ii)->pointind[kk];
1065 this->Print(
"%.16lf ", triout.meshDep->verts.isearch(currInd)->coord[jj]);
1067 else if (currType == 2)
1069 this->Print(
"%.16lf ", triout.snakeDep->snakeconn.verts.isearch(currInd)->coord[jj]);
1071 else if (currType == 3)
1073 this->Print(
"%.16lf ", triout.trivert.isearch(currInd)->coord(jj));
1083 for (jj = nCoord; jj < nVertDat; ++jj)
1085 for (ii = 0; ii < nVert; ++ii)
1087 this->Print(
"%lf ", 0.0);
1092 for (jj = 0; jj < nCellDat; ++jj)
1094 for (ii = 0; ii < nEdge; ++ii)
1096 this->Print(
"%i ", 0);
1104 int nVertDat,
int nCellDat,
const vector<int> &triList)
1109 int nTri, currInd, currType, nCoord;
1110 nTri = int(triList.size());
1111 nCoord = int(triout.meshDep->verts(0)->coord.size());
1113 for (jj = 0; jj < nCoord; ++jj)
1115 for (ii = 0; ii < nTri; ++ii)
1117 for (kk = 0; kk < (3); ++kk)
1119 currType = (triout.*mp).isearch(triList[ii])->pointtype[kk];
1120 currInd = (triout.*mp).isearch(triList[ii])->pointind[kk];
1123 this->Print(
"%.16lf ", triout.meshDep->verts.isearch(currInd)->coord[jj]);
1125 else if (currType == 2)
1127 this->Print(
"%.16lf ", triout.snakeDep->snakeconn.verts.isearch(currInd)->coord[jj]);
1129 else if (currType == 3)
1131 this->Print(
"%.16lf ", triout.trivert.isearch(currInd)->coord(jj));
1141 for (jj = nCoord; jj < nVertDat; ++jj)
1143 for (ii = 0; ii < nVert; ++ii)
1145 this->Print(
"%lf ", 0.0);
1150 for (jj = 0; jj < nCellDat; ++jj)
1152 for (ii = 0; ii < nEdge; ++ii)
1154 this->Print(
"%i ", 0);
1166 nTri = (triout.*mp).size();
1169 for (ii = 0; ii < nTri; ++ii)
1171 for (jj = 0; jj < 3; ++jj)
1175 this->Print(
"%i %i\n", kk - 2, kk);
1179 this->Print(
"%i %i\n", kk, kk + 1);
1186 for (ii = 0; ii < nTri; ++ii)
1188 for (jj = 0; jj < 3; ++jj)
1190 this->Print(
"%i ", ii + 1);
1194 for (ii = 0; ii < 3 * nTri; ++ii)
1196 this->Print(
"%i ", 0);
1207 nTri = (triout.*mp).size();
1210 for (ii = 0; ii < nTri; ++ii)
1212 for (jj = 0; jj < 3; ++jj)
1216 this->Print(
"%i %i\n", kk - 2, kk);
1220 this->Print(
"%i %i\n", kk, kk + 1);
1230 int tecplotfile::LineFaceMap(
const vector<int> &triList)
1235 nTri = int(triList.size());
1238 for (ii = 0; ii < nTri; ++ii)
1240 for (jj = 0; jj < 3; ++jj)
1244 this->Print(
"%i %i\n", kk - 2, kk);
1248 this->Print(
"%i %i\n", kk, kk + 1);
1261 n = (triout.*mp)(0)->pointind.size();
1262 for (ii = 0; ii < nSurf; ++ii)
1264 this->Print(
"%i ", n);
1268 for (ii = 0; ii < nSurf; ++ii)
1270 for (jj = 0; jj < 3; ++jj)
1272 this->Print(
"%i ", kk);
1277 for (ii = 0; ii < nSurf; ++ii)
1279 this->Print(
"%i ", 1);
1282 for (ii = 0; ii < nSurf; ++ii)
1284 this->Print(
"%i ", 0);
1291 double timeStep,
int forceOutType,
const vector<int> &triList)
1293 if (!this->isOpen())
1298 int nVert, nEdge, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat;
1300 if (triList.size() == 0 || forceOutType != 3)
1302 ExtractTriData(triout, mp, &nVert, &nEdge, &nVolu, &nSurf, &totNumFaceNode);
1306 ExtractTriData(triList.size(), &nVert, &nEdge, &nVolu, &nSurf, &totNumFaceNode);
1312 this->Print(
"VARIABLES = \"X\" ,\"Y\" , \"Z\" ,\"v1\" ,\"v2\", \"v3\"\n");
1319 this->StrandTime(strandID, timeStep);
1325 if (forceOutType == tecplotconst::autoselect)
1327 if (nVolu > 0 && triout.snakeDep->Check3D())
1329 forceOutType = tecplotconst::polyhedron;
1333 forceOutType = tecplotconst::polygon;
1337 forceOutType = tecplotconst::line;
1341 if (forceOutType == tecplotconst::polyhedron)
1343 this->ZoneHeaderPolyhedron(nVert, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat);
1344 this->VolDataBlock(triout, mp, nVert, nVolu, nVertDat);
1345 this->VolFaceMap(triout, mp, nSurf);
1347 else if (forceOutType == tecplotconst::polygon)
1349 this->ZoneHeaderPolygon(nVert, nEdge, nSurf, nVertDat, nCellDat);
1350 this->SurfDataBlock(triout, mp, nVert, nSurf, nVertDat);
1351 this->SurfFaceMap(triout, mp);
1353 else if (forceOutType == tecplotconst::line)
1355 this->ZoneHeaderFelineseg(nVert, nEdge, nVertDat, nCellDat);
1356 if (triList.size() == 0)
1358 this->LineDataBlock(triout, mp, nVert, nEdge, nVertDat, nCellDat);
1359 this->LineFaceMap(triout, mp);
1363 this->LineDataBlock(triout, mp, nVert, nEdge, nVertDat, nCellDat, triList);
1364 this->LineFaceMap(triList);
1373 int *nSurf,
int *totNumFaceNode)
1378 *nSurf = (triout.*mp).size();
1382 for (ii = 0; ii < *nSurf; ii++)
1384 *nVert += (triout.*mp)(ii)->indvert.size();
1388 *totNumFaceNode = *nVert;
1397 int nTri, currInd, currType, nCoord;
1398 nTri = (triout.*mp).size();
1399 nCoord = int(triout.meshDep->verts(0)->coord.size());
1401 for (jj = 0; jj < nCoord; ++jj)
1403 for (ii = 0; ii < nTri; ++ii)
1405 for (kk = 0; kk < int((triout.*mp)(ii)->typevert.size()); ++kk)
1407 currType = (triout.*mp)(ii)->typevert[kk];
1408 currInd = (triout.*mp)(ii)->indvert[kk];
1411 this->Print(
"%.16lf ", triout.meshDep->verts.isearch(currInd)->coord[jj]);
1413 else if (currType == 2)
1415 this->Print(
"%.16lf ", triout.snakeDep->snakeconn.verts.isearch(currInd)->coord[jj]);
1417 else if (currType == 3)
1419 this->Print(
"%.16lf ", triout.trivert.isearch(currInd)->coord(jj));
1425 for (jj = nCoord; jj < nVertDat; ++jj)
1427 for (ii = 0; ii < nVert; ++ii)
1429 this->Print(
"%lf ", 0.0);
1435 for (ii = 0; ii < nVolu; ++ii)
1437 this->Print(
"%.16lf ", 0.0);
1440 for (ii = 0; ii < nVolu; ++ii)
1442 this->Print(
"%.16lf ", 0.0);
1445 for (ii = 0; ii < nVolu; ++ii)
1447 this->Print(
"%.16lf ", 0.0);
1459 int nTri, currInd, currType, nCoord;
1460 nTri = (triout.*mp).size();
1461 nCoord = int(triout.meshDep->verts(0)->coord.size());
1463 for (jj = 0; jj < nCoord; ++jj)
1465 for (ii = 0; ii < nTri; ++ii)
1467 for (kk = 0; kk < int((triout.*mp)(ii)->typevert.size()); ++kk)
1469 currType = (triout.*mp)(ii)->typevert[kk];
1470 currInd = (triout.*mp)(ii)->indvert[kk];
1473 this->Print(
"%.16lf ", triout.meshDep->verts.isearch(currInd)->coord[jj]);
1475 else if (currType == 2)
1477 this->Print(
"%.16lf ", triout.snakeDep->snakeconn.verts.isearch(currInd)->coord[jj]);
1479 else if (currType == 3)
1481 this->Print(
"%.16lf ", triout.trivert.isearch(currInd)->coord(jj));
1487 for (jj = nCoord; jj < nVertDat; ++jj)
1489 for (ii = 0; ii < nVert; ++ii)
1491 this->Print(
"%lf ", 0.0);
1497 for (ii = 0; ii < nSurf; ++ii)
1499 this->Print(
"%.16lf ", 0.0);
1502 for (ii = 0; ii < nSurf; ++ii)
1504 this->Print(
"%.16lf ", 0.0);
1507 for (ii = 0; ii < nSurf; ++ii)
1509 this->Print(
"%.16lf ", 0.0);
1516 int nVertDat,
int nCellDat)
1521 int nTri, currInd, currType, nCoord;
1522 nTri = (triout.*mp).size();
1523 nCoord = int(triout.meshDep->verts(0)->coord.size());
1525 for (jj = 0; jj < nCoord; ++jj)
1527 for (ii = 0; ii < nTri; ++ii)
1529 for (kk = 0; kk < int((triout.*mp)(ii)->typevert.size()); ++kk)
1531 currType = (triout.*mp)(ii)->typevert[kk];
1532 currInd = (triout.*mp)(ii)->indvert[kk];
1535 this->Print(
"%.16lf ", triout.meshDep->verts.isearch(currInd)->coord[jj]);
1537 else if (currType == 2)
1539 this->Print(
"%.16lf ", triout.snakeDep->snakeconn.verts.isearch(currInd)->coord[jj]);
1541 else if (currType == 3)
1543 this->Print(
"%.16lf ", triout.trivert.isearch(currInd)->coord(jj));
1553 for (jj = nCoord; jj < nVertDat; ++jj)
1555 for (ii = 0; ii < nVert; ++ii)
1557 this->Print(
"%lf ", 0.0);
1562 for (jj = 0; jj < nCellDat; ++jj)
1564 for (ii = 0; ii < nEdge; ++ii)
1566 this->Print(
"%i ", 0);
1577 nTri = (triout.*mp).size();
1580 for (ii = 0; ii < nTri; ++ii)
1582 for (jj = 0; jj < int((triout.*mp)(ii)->typevert.size()); ++jj)
1584 if (jj == (
int((triout.*mp)(ii)->typevert.size()) - 1))
1586 this->Print(
"%i %i\n", kk - (
int((triout.*mp)(ii)->typevert.size()) - 1), kk);
1590 this->Print(
"%i %i\n", kk, kk + 1);
1597 for (ii = 0; ii < nTri; ++ii)
1599 for (jj = 0; jj < 3; ++jj)
1601 this->Print(
"%i ", ii + 1);
1605 for (ii = 0; ii < 3 * nTri; ++ii)
1607 this->Print(
"%i ", 0);
1618 nTri = (triout.*mp).size();
1621 for (ii = 0; ii < nTri; ++ii)
1623 for (jj = 0; jj < int((triout.*mp)(ii)->typevert.size()); ++jj)
1625 if (jj == (
int((triout.*mp)(ii)->typevert.size()) - 1))
1627 this->Print(
"%i %i\n", kk - (
int((triout.*mp)(ii)->typevert.size()) - 1), kk);
1631 this->Print(
"%i %i\n", kk, kk + 1);
1645 for (ii = 0; ii < nSurf; ++ii)
1647 this->Print(
"%i ",
int((triout.*mp)(ii)->typevert.size()));
1651 for (ii = 0; ii < nSurf; ++ii)
1653 for (jj = 0; jj < int((triout.*mp)(ii)->typevert.size()); ++jj)
1655 this->Print(
"%i ", kk);
1660 for (ii = 0; ii < nSurf; ++ii)
1662 this->Print(
"%i ", 1);
1665 for (ii = 0; ii < nSurf; ++ii)
1667 this->Print(
"%i ", 0);
1674 double timeStep,
int forceOutType)
1676 if (!this->isOpen())
1681 int nVert, nEdge, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat;
1683 ExtractTriData(triout, mp, &nVert, &nEdge, &nVolu, &nSurf, &totNumFaceNode);
1688 this->Print(
"VARIABLES = \"X\" ,\"Y\" , \"Z\" ,\"v1\" ,\"v2\", \"v3\"\n");
1695 this->StrandTime(strandID, timeStep);
1701 if (forceOutType == tecplotconst::autoselect)
1703 if (nVolu > 0 && triout.snakeDep->Check3D())
1705 forceOutType = tecplotconst::polyhedron;
1709 forceOutType = tecplotconst::polygon;
1713 forceOutType = tecplotconst::line;
1717 if (forceOutType == tecplotconst::polyhedron)
1719 this->ZoneHeaderPolyhedron(nVert, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat);
1720 this->VolDataBlock(triout, mp, nVert, nVolu, nVertDat);
1721 this->VolFaceMap(triout, mp, nSurf);
1723 else if (forceOutType == tecplotconst::polygon)
1725 this->ZoneHeaderPolygon(nVert, nEdge, nSurf, nVertDat, nCellDat);
1726 this->SurfDataBlock(triout, mp, nVert, nSurf, nVertDat);
1727 this->SurfFaceMap(triout, mp);
1729 else if (forceOutType == tecplotconst::line)
1731 this->ZoneHeaderFelineseg(nVert, nEdge, nVertDat, nCellDat);
1732 this->LineDataBlock(triout, mp, nVert, nEdge, nVertDat, nCellDat);
1733 this->LineFaceMap(triout, mp);
1739 void tecplotfile::ZoneHeaderPolyhedron(
int nVert,
int nVolu,
int nSurf,
int totNumFaceNode,
int nVertDat,
int nCellDat)
1741 this->Print(
"ZONETYPE = FEPOLYHEDRON\n");
1742 this->Print(
"NODES = %i\n", nVert);
1743 this->Print(
"ELEMENTS = %i\n", nVolu);
1744 this->Print(
"FACES = %i\n", nSurf);
1745 this->Print(
"TOTALNUMFACENODES = %i\n", totNumFaceNode);
1746 this->Print(
"NUMCONNECTEDBOUNDARYFACES = 0\n");
1747 this->Print(
"TOTALNUMBOUNDARYCONNECTIONS = 0\n");
1748 this->Print(
"VARLOCATION=([%i-%i]=NODAL ,[%i-%i]=CELLCENTERED)\n", 1, nVertDat, nVertDat + 1, nVertDat + nCellDat);
1749 this->Print(
"DATAPACKING=BLOCK\n");
1752 void tecplotfile::ZoneHeaderPolygon(
int nVert,
int nEdge,
int nSurf,
int nVertDat,
int nCellDat)
1754 this->Print(
"ZONETYPE = FEPOLYGON\n");
1755 this->Print(
"NODES = %i\n", nVert);
1756 this->Print(
"ELEMENTS = %i\n", nSurf);
1757 this->Print(
"FACES = %i\n", nEdge);
1758 this->Print(
"TOTALNUMFACENODES = %i\n", 2 * nEdge);
1759 this->Print(
"NUMCONNECTEDBOUNDARYFACES = 0\n");
1760 this->Print(
"TOTALNUMBOUNDARYCONNECTIONS = 0\n");
1761 this->Print(
"VARLOCATION=([%i-%i]=NODAL ,[%i-%i]=CELLCENTERED)\n", 1, nVertDat, nVertDat + 1, nVertDat + nCellDat);
1762 this->Print(
"DATAPACKING=BLOCK\n");
1765 void tecplotfile::ZoneHeaderFelineseg(
int nVert,
int nEdge,
int nVertDat,
int nCellDat)
1767 this->Print(
"ZONETYPE = FELINESEG\n");
1768 this->Print(
"NODES = %i\n", nVert);
1769 this->Print(
"ELEMENTS = %i\n", nEdge);
1770 this->Print(
"FACES = %i\n", nEdge);
1771 this->Print(
"VARLOCATION=([%i-%i]=NODAL ,[%i-%i]=CELLCENTERED)\n", 1, nVertDat, nVertDat + 1, nVertDat + nCellDat);
1772 this->Print(
"DATAPACKING=BLOCK\n");
1775 void tecplotfile::ZoneHeaderPolyhedronSnake(
int nVert,
int nVolu,
int nSurf,
int totNumFaceNode,
int nVertDat,
1776 int nCellDat,
int nSensDat)
1778 this->Print(
"ZONETYPE = FEPOLYHEDRON\n");
1779 this->Print(
"NODES = %i\n", nVert);
1780 this->Print(
"ELEMENTS = %i\n", nVolu);
1781 this->Print(
"FACES = %i\n", nSurf);
1782 this->Print(
"TOTALNUMFACENODES = %i\n", totNumFaceNode);
1783 this->Print(
"NUMCONNECTEDBOUNDARYFACES = 0\n");
1784 this->Print(
"TOTALNUMBOUNDARYCONNECTIONS = 0\n");
1785 this->Print(
"VARLOCATION=([%i-%i]=NODAL)\n", 1, nVertDat + nCellDat + nSensDat);
1787 this->Print(
"DATAPACKING=BLOCK\n");
1790 void tecplotfile::ZoneHeaderPolygonSnake(
int nVert,
int nEdge,
int nSurf,
int nVertDat,
int nCellDat,
int nSensDat)
1792 this->Print(
"ZONETYPE = FEPOLYGON\n");
1793 this->Print(
"NODES = %i\n", nVert);
1794 this->Print(
"ELEMENTS = %i\n", nSurf);
1795 this->Print(
"FACES = %i\n", nEdge);
1796 this->Print(
"TOTALNUMFACENODES = %i\n", 2 * nEdge);
1797 this->Print(
"NUMCONNECTEDBOUNDARYFACES = 0\n");
1798 this->Print(
"TOTALNUMBOUNDARYCONNECTIONS = 0\n");
1799 this->Print(
"VARLOCATION=([%i-%i]=NODAL)\n", 1, nVertDat + nCellDat + nSensDat);
1801 this->Print(
"DATAPACKING=BLOCK\n");
1804 void tecplotfile::ZoneHeaderFelinesegSnake(
int nVert,
int nEdge,
int nVertDat,
int nCellDat,
int nSensDat)
1806 this->Print(
"ZONETYPE = FELINESEG\n");
1807 this->Print(
"NODES = %i\n", nVert);
1808 this->Print(
"ELEMENTS = %i\n", nEdge);
1809 this->Print(
"FACES = %i\n", nEdge);
1810 this->Print(
"VARLOCATION=([%i-%i]=NODAL)\n", 1, nVertDat + nCellDat + nSensDat);
1812 this->Print(
"DATAPACKING=BLOCK\n");
1815 void tecplotfile::ZoneHeaderOrdered(
int nVert,
int nVertDat,
int nCellDat,
int nSensDat)
1817 this->Print(
"ZONETYPE = ORDERED\n");
1818 this->Print(
"I = %i\n", nVert);
1819 this->Print(
"VARLOCATION=([%i-%i]=NODAL)\n", 1, nVertDat + nCellDat + nSensDat);
1820 this->Print(
"DATAPACKING=BLOCK\n");
1824 int tecplotfile::PrintSnakeSensitivity(
const triangulation &triRSVS,
const RSVScalc &calcObj,
int strandID,
1825 double timeStep,
int forceOutType,
const vector<int> &vertList)
1827 if (!this->isOpen())
1832 int nVert, nEdge, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat, nSensDat;
1833 const snake &snakeout = *triRSVS.snakeDep;
1834 ExtractMeshData(snakeout.snakeconn, &nVert, &nEdge, &nVolu, &nSurf, &totNumFaceNode);
1842 this->Print(
"VARIABLES = \"X\" ,\"Y\" , \"Z\" ,\"v1\" ,\"v2\", \"v3\"");
1843 for (
int i = 0; i < calcObj.
numConstr(); ++i)
1845 this->Print(
", \"sens_%i\"", i);
1854 this->StrandTime(strandID, timeStep);
1861 if (forceOutType == tecplotconst::autoselect)
1865 forceOutType = tecplotconst::polyhedron;
1869 forceOutType = tecplotconst::polygon;
1873 forceOutType = tecplotconst::line;
1877 forceOutType = tecplotconst::point;
1881 if (forceOutType == tecplotconst::polyhedron)
1883 this->ZoneHeaderPolyhedronSnake(nVert, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat, nSensDat);
1884 this->SnakeDataBlock(snakeout, nVert, nVertDat);
1885 this->RSVScalcDataBlock(triRSVS, calcObj, nVert, nSensDat);
1886 this->VolFaceMap(snakeout.snakeconn, nSurf);
1888 else if (forceOutType == tecplotconst::polygon)
1890 this->ZoneHeaderPolygonSnake(nVert, nEdge, nSurf, nVertDat, nCellDat, nSensDat);
1891 this->SnakeDataBlock(snakeout, nVert, nVertDat);
1892 this->RSVScalcDataBlock(triRSVS, calcObj, nVert, nSensDat);
1893 this->SurfFaceMap(snakeout.snakeconn, nEdge);
1895 else if (forceOutType == tecplotconst::line)
1897 this->ZoneHeaderFelinesegSnake(nVert, nEdge, nVertDat, nCellDat, nSensDat);
1898 this->SnakeDataBlock(snakeout, nVert, nVertDat);
1899 this->RSVScalcDataBlock(triRSVS, calcObj, nVert, nSensDat);
1900 this->LineFaceMap(snakeout.snakeconn, nEdge);
1902 else if (forceOutType == tecplotconst::point)
1904 if (
int(vertList.size()) == nVert)
1907 for (
int ii = 0; ii < int(vertList.size()); ++ii)
1909 nVert += int(vertList[ii]);
1912 else if (vertList.size() > 0)
1914 nVert = int(vertList.size());
1916 this->ZoneHeaderOrdered(nVert, nVertDat, nCellDat, nSensDat);
1917 this->SnakeDataBlock(snakeout, nVert, nVertDat);
1918 this->RSVScalcDataBlock(triRSVS, calcObj, nVert, nSensDat);
1924 int tecplotfile::PrintSnakeGradients(
const triangulation &triRSVS,
const RSVScalc &calcObj,
int strandID,
1925 double timeStep,
int forceOutType,
const vector<int> &vertList)
1927 if (!this->isOpen())
1932 int nVert, nEdge, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat, nSensDat;
1933 const snake &snakeout = *triRSVS.snakeDep;
1934 ExtractMeshData(snakeout.snakeconn, &nVert, &nEdge, &nVolu, &nSurf, &totNumFaceNode);
1942 this->Print(
"VARIABLES = \"X\" ,\"Y\" , \"Z\" ,\"v1\" ,\"v2\", \"v3\"");
1943 this->Print(
", \"dObj\"");
1944 this->Print(
", \"dLag\"");
1945 this->Print(
", \"HObj\"");
1946 this->Print(
", \"HConstr\"");
1947 this->Print(
", \"HLag\"");
1948 this->Print(
", \"deltaDV\"");
1949 for (
int i = 0; i < calcObj.
numConstr(); ++i)
1951 this->Print(
", \"dConstr_%i\"", i);
1960 this->StrandTime(strandID, timeStep);
1965 nSensDat = calcObj.
numConstr() + nPreConstr;
1967 if (forceOutType == tecplotconst::autoselect)
1971 forceOutType = tecplotconst::polyhedron;
1975 forceOutType = tecplotconst::polygon;
1979 forceOutType = tecplotconst::line;
1983 forceOutType = tecplotconst::point;
1987 if (forceOutType == tecplotconst::polyhedron)
1989 this->ZoneHeaderPolyhedronSnake(nVert, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat, nSensDat);
1990 this->SnakeDataBlock(snakeout, nVert, nVertDat);
1991 this->RSVScalcDataBlock(triRSVS, calcObj, nVert, nSensDat - nPreConstr, -nPreConstr, 2);
1992 this->VolFaceMap(snakeout.snakeconn, nSurf);
1994 else if (forceOutType == tecplotconst::polygon)
1996 this->ZoneHeaderPolygonSnake(nVert, nEdge, nSurf, nVertDat, nCellDat, nSensDat);
1997 this->SnakeDataBlock(snakeout, nVert, nVertDat);
1998 this->RSVScalcDataBlock(triRSVS, calcObj, nVert, nSensDat - nPreConstr, -nPreConstr, 2);
1999 this->SurfFaceMap(snakeout.snakeconn, nEdge);
2001 else if (forceOutType == tecplotconst::line)
2003 this->ZoneHeaderFelinesegSnake(nVert, nEdge, nVertDat, nCellDat, nSensDat);
2004 this->SnakeDataBlock(snakeout, nVert, nVertDat);
2005 this->RSVScalcDataBlock(triRSVS, calcObj, nVert, nSensDat - nPreConstr, -nPreConstr, 2);
2006 this->LineFaceMap(snakeout.snakeconn, nEdge);
2008 else if (forceOutType == tecplotconst::point)
2010 if (
int(vertList.size()) == nVert)
2013 for (
int ii = 0; ii < int(vertList.size()); ++ii)
2015 nVert += int(vertList[ii]);
2018 else if (vertList.size() > 0)
2020 nVert = int(vertList.size());
2022 this->ZoneHeaderOrdered(nVert, nVertDat, nCellDat, nSensDat);
2023 this->SnakeDataBlock(snakeout, nVert, nVertDat);
2024 this->RSVScalcDataBlock(triRSVS, calcObj, nVert, nSensDat - nPreConstr, -nPreConstr, 2);
2030 int tecplotfile::RSVScalcDataBlock(
const triangulation &triRSVS,
const RSVScalc &calcObj,
int nVert,
int nSensDat,
2031 int sensStart,
int methodProcess)
2033 if (!this->isOpen())
2042 std::vector<double> sensTemp;
2044 if (methodProcess == 1)
2046 mp = &RSVScalc::ReturnSensitivities;
2048 else if (methodProcess == 2)
2050 mp = &RSVScalc::ReturnGradient;
2055 "(sensitivities) and 2 (derivatives).");
2058 for (jj = sensStart; jj < nSensDat; ++jj)
2060 (calcObj.*mp)(triRSVS, sensTemp, jj);
2061 for (ii = 0; ii < nVert; ++ii)
2063 this->Print(
"%.16lf ", sensTemp[ii]);
2070 int tecplotfile::RSVScalcVectorDataBlock(
const triangulation &triRSVS,
const RSVScalc &calcObj,
int nVert,
2071 int numConstrPlot,
int methodProcess)
2073 if (!this->isOpen())
2082 std::vector<double> sensTemp;
2085 if (methodProcess == 1)
2087 mp = &RSVScalc::ReturnSensitivities;
2089 else if (methodProcess == 2)
2091 mp = &RSVScalc::ReturnGradient;
2096 "(sensitivities) and 2 (derivatives).");
2098 auto normals = MeshUnitNormals(triRSVS.snakeDep->snakeconn);
2099 auto directions = triRSVS.snakeDep->MoveDirections();
2101 (calcObj.*mp)(triRSVS, sensTemp, numConstrPlot);
2102 for (ii = 0; ii < nVert; ++ii)
2104 double dotProd = 0.0;
2105 for (
int j = 0; j < 3; ++j)
2107 dotProd += normals[ii * 3 + j] * directions[ii * 3 + j];
2109 this->Print(
"%.16lf ", sensTemp[ii]);
2110 sensTemp[ii] *= dotProd;
2113 for (
int j = 0; j < 3; ++j)
2115 for (ii = 0; ii < nVert; ++ii)
2117 this->Print(
"%.16lf ", sensTemp[ii] * normals[ii * 3 + j]);
2126 int tecplotfile::PrintSnakeSensitivityTime(
const triangulation &triRSVS,
const RSVScalc &calcObj,
int strandID,
2127 double timeStep,
int forceOutType,
const vector<int> &vertList)
2129 if (!this->isOpen())
2134 int nVert, nEdge, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat, nSensDat, nSensStep;
2135 const snake &snakeout = *triRSVS.snakeDep;
2136 ExtractMeshData(snakeout.snakeconn, &nVert, &nEdge, &nVolu, &nSurf, &totNumFaceNode);
2148 this->Print(
"VARIABLES = \"X\" ,\"Y\" , \"Z\" ,\"v1\" ,\"v2\", \"v3\"");
2149 for (
int i = 0; i < nSensDat; ++i)
2151 this->Print(
", \"sens_%i\"", i);
2159 while (this->isStrand(++strandID) && strandID <= 100)
2165 this->StrandTime(strandID, timeStep);
2169 if (forceOutType == tecplotconst::autoselect)
2173 forceOutType = tecplotconst::polyhedron;
2177 forceOutType = tecplotconst::polygon;
2181 forceOutType = tecplotconst::line;
2185 forceOutType = tecplotconst::point;
2189 if (forceOutType == tecplotconst::polyhedron)
2191 this->ZoneHeaderPolyhedronSnake(nVert, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat, nSensDat);
2192 this->SnakeDataBlock(snakeout, nVert, nVertDat);
2193 this->RSVScalcDataBlock(triRSVS, calcObj, nVert, nSensDat);
2194 this->VolFaceMap(snakeout.snakeconn, nSurf);
2196 else if (forceOutType == tecplotconst::polygon)
2198 this->ZoneHeaderPolygonSnake(nVert, nEdge, nSurf, nVertDat, nCellDat, nSensDat);
2199 this->SnakeDataBlock(snakeout, nVert, nVertDat);
2200 this->RSVScalcDataBlock(triRSVS, calcObj, nVert, nSensDat);
2201 this->SurfFaceMap(snakeout.snakeconn, nEdge);
2203 else if (forceOutType == tecplotconst::line)
2205 this->ZoneHeaderFelinesegSnake(nVert, nEdge, nVertDat, nCellDat, nSensDat);
2206 this->SnakeDataBlock(snakeout, nVert, nVertDat);
2207 this->RSVScalcDataBlock(triRSVS, calcObj, nVert, nSensDat);
2208 this->LineFaceMap(snakeout.snakeconn, nEdge);
2210 else if (forceOutType == tecplotconst::point)
2212 if (
int(vertList.size()) == nVert)
2215 for (
int ii = 0; ii < int(vertList.size()); ++ii)
2217 nVert += int(vertList[ii]);
2220 else if (vertList.size() > 0)
2222 nVert = int(vertList.size());
2224 this->ZoneHeaderOrdered(nVert, nVertDat, nCellDat, nSensDat);
2225 this->SnakeDataBlock(snakeout, nVert, nVertDat);
2226 this->RSVScalcDataBlock(triRSVS, calcObj, nVert, nSensDat);
2229 int shareZone = this->ZoneNum();
2230 double tStepMultiplier = pow(10, -ceil(log10(
double(nSensStep))));
2231 for (
int i = nSensDat; i < nSensStep; ++i)
2234 this->StrandTime(strandID, timeStep + tStepMultiplier * i);
2235 if (forceOutType == tecplotconst::polyhedron)
2237 this->ZoneHeaderPolyhedronSnake(nVert, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat, nSensDat);
2239 else if (forceOutType == tecplotconst::polygon)
2241 this->ZoneHeaderPolygonSnake(nVert, nEdge, nSurf, nVertDat, nCellDat, nSensDat);
2243 else if (forceOutType == tecplotconst::line)
2245 this->ZoneHeaderFelinesegSnake(nVert, nEdge, nVertDat, nCellDat, nSensDat);
2247 else if (forceOutType == tecplotconst::point)
2249 this->ZoneHeaderOrdered(nVert, nVertDat, nCellDat, nSensDat);
2251 this->DefShareZoneVolume(shareZone, nVertDat + nCellDat);
2252 this->RSVScalcDataBlock(triRSVS, calcObj, nVert, i + 1, i);
2259 int tecplotfile::PrintSnakeSensitivityVector(
const triangulation &triRSVS,
const RSVScalc &calcObj,
int strandID,
2260 double timeStep,
int forceOutType,
const vector<int> &vertList)
2262 if (!this->isOpen())
2267 int nVert, nEdge, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat, nSensDat, nSensStep;
2268 const snake &snakeout = *triRSVS.snakeDep;
2269 ExtractMeshData(snakeout.snakeconn, &nVert, &nEdge, &nVolu, &nSurf, &totNumFaceNode);
2281 this->Print(
"VARIABLES = \"X\" ,\"Y\" , \"Z\" ,\"v1\" ,\"v2\", \"v3\"");
2282 for (
int i = 0; i < nSensDat; ++i)
2284 this->Print(
", \"sens_%i\"", i);
2292 while (this->isStrand(++strandID) && strandID <= 100)
2298 this->StrandTime(strandID, timeStep);
2302 if (forceOutType == tecplotconst::autoselect)
2306 forceOutType = tecplotconst::polyhedron;
2310 forceOutType = tecplotconst::polygon;
2314 forceOutType = tecplotconst::line;
2318 forceOutType = tecplotconst::point;
2322 if (forceOutType == tecplotconst::polyhedron)
2324 this->ZoneHeaderPolyhedronSnake(nVert, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat, nSensDat);
2325 this->SnakeDataBlock(snakeout, nVert, nVertDat);
2326 this->RSVScalcVectorDataBlock(triRSVS, calcObj, nVert);
2327 this->VolFaceMap(snakeout.snakeconn, nSurf);
2329 else if (forceOutType == tecplotconst::polygon)
2331 this->ZoneHeaderPolygonSnake(nVert, nEdge, nSurf, nVertDat, nCellDat, nSensDat);
2332 this->SnakeDataBlock(snakeout, nVert, nVertDat);
2333 this->RSVScalcVectorDataBlock(triRSVS, calcObj, nVert);
2334 this->SurfFaceMap(snakeout.snakeconn, nEdge);
2336 else if (forceOutType == tecplotconst::line)
2338 this->ZoneHeaderFelinesegSnake(nVert, nEdge, nVertDat, nCellDat, nSensDat);
2339 this->SnakeDataBlock(snakeout, nVert, nVertDat);
2340 this->RSVScalcVectorDataBlock(triRSVS, calcObj, nVert);
2341 this->LineFaceMap(snakeout.snakeconn, nEdge);
2343 else if (forceOutType == tecplotconst::point)
2345 if (
int(vertList.size()) == nVert)
2348 for (
int ii = 0; ii < int(vertList.size()); ++ii)
2350 nVert += int(vertList[ii]);
2353 else if (vertList.size() > 0)
2355 nVert = int(vertList.size());
2357 this->ZoneHeaderOrdered(nVert, nVertDat, nCellDat, nSensDat);
2358 this->SnakeDataBlock(snakeout, nVert, nVertDat);
2359 this->RSVScalcVectorDataBlock(triRSVS, calcObj, nVert);
2362 int shareZone = this->ZoneNum();
2363 double tStepMultiplier = pow(10, -ceil(log10(
double(nSensStep))));
2364 for (
int i = 1; i < nSensStep; ++i)
2367 this->StrandTime(strandID, timeStep + tStepMultiplier * i);
2368 if (forceOutType == tecplotconst::polyhedron)
2370 this->ZoneHeaderPolyhedronSnake(nVert, nVolu, nSurf, totNumFaceNode, nVertDat, nCellDat, nSensDat);
2372 else if (forceOutType == tecplotconst::polygon)
2374 this->ZoneHeaderPolygonSnake(nVert, nEdge, nSurf, nVertDat, nCellDat, nSensDat);
2376 else if (forceOutType == tecplotconst::line)
2378 this->ZoneHeaderFelinesegSnake(nVert, nEdge, nVertDat, nCellDat, nSensDat);
2380 else if (forceOutType == tecplotconst::point)
2382 this->ZoneHeaderOrdered(nVert, nVertDat, nCellDat, nSensDat);
2384 this->DefShareZoneVolume(shareZone, nVertDat + nCellDat);
2385 this->RSVScalcVectorDataBlock(triRSVS, calcObj, nVert, i);
2393 int tecplotfile::OpenFile(
const char *str,
const char *mode)
2399 fid = fopen(str, mode);
2402 cout <<
"File '" << str <<
"' failed to open" << endl;
2407 void tecplotfile::CloseFile()
2417 int Test_tecplotfile()
2419 const char *fileToOpen;
2423 fileToOpen =
"../TESTOUT/tecout.plt";
2425 errFlag = outmesh.OpenFile(fileToOpen);
2433 int TestCompareReadWrite(
const char *fileToOpen,
mesh &blockGrid,
tecplotfile &outmesh1)
2440 fid = fopen(fileToOpen,
"w");
2443 blockGrid.PrepareForUse();
2444 blockGrid.SetBorders();
2445 blockGrid.write(fid);
2447 fid = fopen(fileToOpen,
"r");
2450 blockGrid2.read(fid);
2452 blockGrid.PrepareForUse();
2453 blockGrid2.PrepareForUse();
2455 outmesh1.PrintMesh(blockGrid2);
2456 errTest = CompareDisp(blockGrid, blockGrid2);
2461 cerr <<
"Error: Displays were not the same after write read" << endl;
2467 cout <<
"File for mesh out failed to open" << endl;
2472 cout <<
"File for mesh out failed to open" << endl;
Provides the infrastructure for calculation of the RSVS equations.
Class to handle the RSVS calculation.
int numConstr() const
Getter for the number of constraints.
Provides all the mesh tools used for the generation of 3D grids and geometries.
std::tuple< coordvec, double > VertexNormal(const std::vector< double > ¢re, const grid::coordlist &vecPts)
Calculates the vertex normal weighted by surface angle partitions.
Tools for the mathematical processing of meshes.
Provide tecplot file formating for mesh and snake outputs.
Provides a triangulation for snake and meshes.
Provides the error and warning system used by the RSVS3D project.
#define RSVS3D_ERROR_NOTHROW(M)
Generic rsvs warning.
#define RSVS3D_ERROR_ARGUMENT(M)
Throw a invalid_argument.