19 NbTP(0), NbSL(0), NbVL(0), NbTL(0), NbST(0), NbVT(0), NbTT(0), NbSQ(0),
20 NbVQ(0), NbTQ(0), NbSG(0), NbVG(0), NbTG(0), NbSS(0), NbVS(0), NbTS(0),
21 NbSH(0), NbVH(0), NbTH(0), NbSI(0), NbVI(0), NbTI(0), NbSY(0), NbVY(0),
22 NbTY(0), NbSR(0), NbVR(0), NbTR(0), NbSD(0), NbVD(0), NbTD(0), NbT2(0),
23 NbT3(0), _lastElement(-1), _lastDimension(-1), _lastNumNodes(-1),
24 _lastNumComponents(-1), _lastNumValues(-1), _lastNumEdges(-1),
25 _lastType(-1), _lastXYZ(nullptr), _lastVal(nullptr), _isAdapted(isAdapted)
27 for(
int i = 0; i < 33; i++)
_index[i] = 0;
38 for(std::size_t i = 0; i < std::min(x.size(), y.size()); i++) {
49 std::vector<double> &
z, std::vector<double> &v)
53 int n = std::min(std::min(std::min(x.size(), y.size()),
z.size()), v.size());
54 for(
int i = 0; i < n; i++) {
66 if(
NbSP != (
int)y.size()) {
67 Msg::Error(
"Wrong number of values while adding step in list-based view");
71 std::vector<double> tmp;
72 int stride =
SP.size() /
NbSP;
73 for(
int i = 0; i <
NbSP; i++) {
74 for(
int j = 0; j < stride; j++) tmp.push_back(
SP[i * stride + j]);
82 const std::string &interpolationScheme)
142 for(
int i = 0; i < 33; i++) {
144 for(
int j = 0; j <= i; j++)
_index[i] += nb[j];
177 if(step < 0 || step >= (
int)
Time.size())
return 0.;
182 int forceNumComponents,
int componentMap[9])
186 if(forceNumComponents || tensorRep) {
190 for(
int nod = 0; nod <
getNumNodes(step, ent, ele); nod++) {
193 forceNumComponents, componentMap);
194 vmin = std::min(vmin, val);
201 if(step < 0)
return Min;
206 int forceNumComponents,
int componentMap[9])
210 if(forceNumComponents || tensorRep) {
214 for(
int nod = 0; nod <
getNumNodes(step, ent, ele); nod++) {
217 forceNumComponents, componentMap);
218 vmax = std::max(vmax, val);
225 if(step < 0)
return Max;
232 for(std::size_t i = 0; i <
D.size(); i += nb) {
233 double beg =
D[i + nb - 1];
235 if(i + 2 * nb >
D.size())
238 end =
D[i + nb + nb - 1];
239 char *
c = &C[(int)beg];
241 for(
int j = 0; j < (int)(end - beg); j++)
242 if(
c[j] ==
'\0') nbtime++;
246 for(std::size_t i = 0; i <
D.size(); i += nb)
257 int nbval = nbcomp * nbnod;
260 std::vector<fullMatrix<double> *> im;
262 if(nim == 4) nbnod = im[2]->size1();
263 if(nim) nbval = nbcomp * im[0]->size1();
266 int nb = list.size() / nbelm;
267 for(
int ele = 0; ele < nbelm; ele++) {
274 nbval = nbcomp * nbnod;
276 int N = nb - 3 * nbnod;
277 double *X = &list[i];
278 double *Y = &list[i + 1 * nbnod];
279 double *Z = &list[i + 2 * nbnod];
280 double *V = &list[i + 3 * nbnod];
283 for(
int j = 0; j < nbnod; j++)
BBox +=
SPoint3(X[j], Y[j], Z[j]);
302 for(
int j = 0; j < N; j += nbcomp) {
316 int type, std::vector<double> &list,
int nblist)
319 std::vector<fullMatrix<double> *> im;
328 int nb = list.size() / nblist;
352 else if(ele <
_index[5]) {
360 else if(ele <
_index[8]) {
368 else if(ele <
_index[11]) {
376 else if(ele <
_index[14]) {
384 else if(ele <
_index[17]) {
392 else if(ele <
_index[20]) {
400 else if(ele <
_index[23]) {
408 else if(ele <
_index[26]) {
416 else if(ele <
_index[29]) {
425 else if(ele <
_index[32]) {
449 double &y,
double &
z)
518 double &x,
double &y,
double &
z,
double &style)
527 std::vector<double> &td = (dim == 2) ?
T2D :
T3D;
528 std::vector<char> &tc = (dim == 2) ?
T2C :
T3C;
529 int nbd = (dim == 2) ? 4 : 5;
532 double *d1 = &td[i * nbd];
533 double *d2 = ((i + 1) * nbd < (
int)td.size()) ? &td[(i + 1) * nbd] :
nullptr;
542 nbchar = (int)d2[3] - index;
544 nbchar = tc.size() - index;
553 nbchar = (int)d2[4] - index;
555 nbchar = tc.size() - index;
558 char *
c = &tc[index];
560 while(k < nbchar && l != step) {
561 if(
c[k++] ==
'\0') l++;
563 if(k < nbchar && l == step)
564 str = std::string(&
c[k]);
566 str = std::string(
c);
570 double &y,
double &style)
577 double &y,
double &
z,
double &style)
592 for(std::size_t i = 0; i < V.size(); i++) V[i] =
_lastVal[i];
611 int nbTimeStep,
int nbVert,
int nbComp,
615 double *vals =
new double[nbTimeStep * nbComp];
616 int nb = list.size() / nbList;
617 for(std::size_t i = 0; i < list.size(); i += nb) {
618 double *x = &list[i];
619 double *y = &list[i + nbVert];
620 double *
z = &list[i + 2 * nbVert];
621 double *v = &list[i + 3 * nbVert];
622 for(
int j = 0; j < nbVert; j++) {
623 for(
int ts = 0; ts < nbTimeStep; ts++)
624 for(
int k = 0; k < nbComp; k++)
625 vals[nbComp * ts + k] = v[nbVert * nbComp * ts + nbComp * j + k];
626 data.
add(x[j], y[j],
z[j], nbTimeStep * nbComp, vals);
632 static void smoothList(std::vector<double> &list,
int nbList,
int nbTimeStep,
636 double *vals =
new double[nbTimeStep * nbComp];
637 int nb = list.size() / nbList;
638 for(std::size_t i = 0; i < list.size(); i += nb) {
639 double *x = &list[i];
640 double *y = &list[i + nbVert];
641 double *
z = &list[i + 2 * nbVert];
642 double *v = &list[i + 3 * nbVert];
643 for(
int j = 0; j < nbVert; j++) {
644 if(data.
get(x[j], y[j],
z[j], nbTimeStep * nbComp, vals)) {
645 for(
int ts = 0; ts < nbTimeStep; ts++)
646 for(
int k = 0; k < nbComp; k++)
647 v[nbVert * nbComp * ts + nbComp * j + k] = vals[nbComp * ts + k];
660 std::vector<double> *list =
nullptr;
661 int *nbe =
nullptr, nbc, nbn;
662 for(
int i = 0; i < 27; i++) {
666 for(
int i = 0; i < 27; i++) {
678 b += (
SP.size() +
VP.size() +
TP.size()) *
sizeof(
double);
679 b += (
SL.size() +
VL.size() +
TL.size()) *
sizeof(
double);
680 b += (
ST.size() +
VT.size() +
TT.size()) *
sizeof(
double);
681 b += (
SQ.size() +
VQ.size() +
TQ.size()) *
sizeof(
double);
682 b += (
SG.size() +
VG.size() +
TG.size()) *
sizeof(
double);
683 b += (
SS.size() +
VS.size() +
TS.size()) *
sizeof(
double);
684 b += (
SH.size() +
VH.size() +
TH.size()) *
sizeof(
double);
685 b += (
SI.size() +
VI.size() +
TI.size()) *
sizeof(
double);
686 b += (
SY.size() +
VY.size() +
TY.size()) *
sizeof(
double);
687 b += (
SR.size() +
VR.size() +
TR.size()) *
sizeof(
double);
688 b += (
SD.size() +
VD.size() +
TD.size()) *
sizeof(
double);
689 b += (
T2D.size() +
T3D.size()) *
sizeof(
double);
690 return b / 1024. / 1024.;
693 static void dVecMerge(std::vector<double> &v, std::vector<double> &dest)
695 for(std::size_t i = 0; i < v.size(); i++) dest.push_back(v[i]);
701 if(nd.
data.size() < 2)
return false;
702 int ts = nd.
data[0]->getNumTimeSteps();
703 for(std::size_t i = 1; i < nd.
data.size(); i++) {
704 if(!nd.
data[i]->empty() && nd.
data[i]->getNumTimeSteps() != ts) {
705 Msg::Error(
"Cannot combine views having different number of time steps");
710 for(std::size_t i = 0; i < nd.
data.size(); i++) {
721 for(std::size_t i = 0; i < it->second.size(); i++)
784 for(std::size_t i = 0; i < l->
T2D.size(); i += 4) {
786 T2D.push_back(l->
T2D[i + 1]);
787 T2D.push_back(l->
T2D[i + 2]);
788 T2D.push_back(
T2C.size());
789 double beg = l->
T2D[i + 3];
791 if(i > l->
T2D.size() - 8)
794 end = l->
T2D[i + 3 + 4];
795 char *
c = &l->
T2C[(int)beg];
796 for(
int j = 0; j < (int)(end - beg); j++)
T2C.push_back(
c[j]);
799 for(std::size_t i = 0; i < l->
T3D.size(); i += 5) {
801 T3D.push_back(l->
T3D[i + 1]);
802 T3D.push_back(l->
T3D[i + 2]);
803 T3D.push_back(l->
T3D[i + 3]);
804 T3D.push_back(
T3C.size());
805 double beg = l->
T3D[i + 4];
807 if(i > l->
T3D.size() - 10)
810 end = l->
T3D[i + 4 + 5];
811 char *
c = &l->
T3C[(int)beg];
812 for(
int j = 0; j < (int)(end - beg); j++)
T3C.push_back(
c[j]);
818 if(nd.
name ==
"__all__")
820 else if(nd.
name ==
"__vis__")
825 sprintf(name,
"%s_Combine", tmp.c_str());
835 if(nd.
data.size() < 2)
return false;
836 std::vector<PViewDataList *> data(nd.
data.size());
837 for(std::size_t i = 0; i < nd.
data.size(); i++) {
845 int *nbe =
nullptr, *nbe2 =
nullptr, nbn, nbn2, nbc, nbc2;
846 std::vector<double> *list =
nullptr, *list2 =
nullptr;
849 for(
int i = 0; i < 27; i++) {
851 data[0]->_getRawData(i, &list2, &nbe2, &nbc2, &nbn2);
854 NbT2 = data[0]->NbT2;
855 NbT3 = data[0]->NbT3;
857 it != data[0]->_interpolation.end(); it++)
859 for(std::size_t i = 0; i < it->second.size(); i++)
864 for(
int i = 0; i < 27; i++) {
866 for(
int j = 0; j < *nbe; j++) {
867 for(std::size_t k = 0; k < data.size(); k++) {
868 data[k]->_getRawData(i, &list2, &nbe2, &nbc2, &nbn2);
869 if(*nbe && *nbe == *nbe2) {
870 int nb2 = list2->size() / *nbe2;
874 for(
int l = 0; l < 3 * nbn2; l++)
875 list->push_back((*list2)[j * nb2 + l]);
878 for(
int l = 0; l < nb2 - 3 * nbn2; l++)
879 list->push_back((*list2)[j * nb2 + 3 * nbn2 + l]);
886 for(
int j = 0; j <
NbT2; j++) {
887 for(std::size_t k = 0; k < data.size(); k++) {
891 T2D.push_back(data[k]->
T2D[j * 4]);
892 T2D.push_back(data[k]->
T2D[j * 4 + 1]);
893 T2D.push_back(data[k]->
T2D[j * 4 + 2]);
895 T2D.push_back(
T2C.size());
898 double beg = data[k]->T2D[j * 4 + 3];
901 end = data[k]->T2C.size();
903 end = data[k]->T2D[j * 4 + 4 + 3];
904 char *
c = &data[k]->T2C[(int)beg];
905 for(
int l = 0; l < (int)(end - beg); l++)
T2C.push_back(
c[l]);
911 for(
int j = 0; j <
NbT3; j++) {
912 for(std::size_t k = 0; k < data.size(); k++) {
916 T3D.push_back(data[k]->
T3D[j * 5]);
917 T3D.push_back(data[k]->
T3D[j * 5 + 1]);
918 T3D.push_back(data[k]->
T3D[j * 5 + 2]);
919 T3D.push_back(data[k]->
T3D[j * 5 + 3]);
921 T3D.push_back(
T3C.size());
924 double beg = data[k]->T3D[j * 5 + 4];
927 end = data[k]->T3C.size();
929 end = data[k]->T3D[j * 5 + 5 + 4];
930 char *
c = &data[k]->T3C[(int)beg];
931 for(
int l = 0; l < (int)(end - beg); l++)
T3C.push_back(
c[l]);
943 double t0 =
Time[0], ti;
944 bool allTheSame =
true;
945 for(std::size_t i = 1; i <
Time.size(); i++) {
952 if(allTheSame)
Time.clear();
956 if(nd.
name ==
"__all__")
958 else if(nd.
name ==
"__vis__")
963 sprintf(name,
"%s_Combine", tmp.c_str());
975 if(idxtype > 26 && idxtype < 33)
976 Msg::Warning(
"No constant number of nodes for polygons and polyhedra");
1209 default:
Msg::Error(
"Wrong type in PViewDataList");
break;
1213 std::vector<fullMatrix<double> *> im;
1215 if(nim == 4) *nn = im[2]->size1();
1235 Msg::Error(
"Could not find polynomial function space for element type %d",
1253 else if(numComp == 3) {
1257 else if(numComp == 9) {
1267 else if(numComp == 3) {
1271 else if(numComp == 9) {
1281 else if(numComp == 3) {
1285 else if(numComp == 9) {
1295 else if(numComp == 3) {
1299 else if(numComp == 9) {
1309 else if(numComp == 3) {
1313 else if(numComp == 9) {
1323 else if(numComp == 3) {
1327 else if(numComp == 9) {
1337 else if(numComp == 3) {
1341 else if(numComp == 9) {
1351 else if(numComp == 3) {
1355 else if(numComp == 9) {
1365 else if(numComp == 3) {
1369 else if(numComp == 9) {
1383 else if(numComp == 3) {
1387 else if(numComp == 9) {
1401 else if(numComp == 3) {
1405 else if(numComp == 9) {