Commit 62ac28e322bb49aaebc35f1af97cfa32422c7bfd

Authored by Peter Zhigalov
1 parent 2ddecb4e

Исправил обработку случая, когда входной файл задан в системе IJ, причем I не равно J

src_qt/paintwidget.cpp
... ... @@ -385,8 +385,8 @@ void paintwidget::tec_read(const QString & filename)
385 385 ind[1] = 1;
386 386 }
387 387 }
388   - nx = IJK[ind[0]];
389   - ny = IJK[ind[1]];
  388 + nx = IJK[ind[1]];
  389 + ny = IJK[ind[0]];
390 390 label_x = var_c[ind[0]];
391 391 label_y = var_c[ind[1]];
392 392  
... ... @@ -556,14 +556,14 @@ void paintwidget::set_div_num(size_t num)
556 556 {
557 557 for(size_t j = 0; j < ny - 1; j++)
558 558 {
559   - float x0 = tec_data[i * nx + j].coord.x;
560   - float y0 = tec_data[i * nx + j].coord.y;
561   - float x1 = tec_data[(i + 1) * nx + j + 1].coord.x;
562   - float y1 = tec_data[(i + 1) * nx + j + 1].coord.y;
  559 + float x0 = tec_data[i * ny + j].coord.x;
  560 + float y0 = tec_data[i * ny + j].coord.y;
  561 + float x1 = tec_data[(i + 1) * ny + j + 1].coord.x;
  562 + float y1 = tec_data[(i + 1) * ny + j + 1].coord.y;
563 563 float hx = x1 - x0;
564 564 float hy = y1 - y0;
565   - float step_x_i = std::fabs(tec_data[(i + 1) * nx + j].coord.x - x0);
566   - float step_x_j = std::fabs(tec_data[i * nx + j + 1].coord.x - x0);
  565 + float step_x_i = std::fabs(tec_data[(i + 1) * ny + j].coord.x - x0);
  566 + float step_x_j = std::fabs(tec_data[i * ny + j + 1].coord.x - x0);
567 567 bool native_order = (step_x_i > step_x_j) ? true : false;
568 568  
569 569 for(size_t tn = 0; tn < tmp1_size; tn++)
... ... @@ -587,17 +587,17 @@ void paintwidget::set_div_num(size_t num)
587 587 float r1, r2;
588 588 if(native_order)
589 589 {
590   - r1 = (x1 - tmp_tr.nodes[k].x) / hx * tec_data[i * nx + j].value[m] +
591   - (tmp_tr.nodes[k].x - x0) / hx * tec_data[(i + 1) * nx + j].value[m];
592   - r2 = (x1 - tmp_tr.nodes[k].x) / hx * tec_data[i * nx + j + 1].value[m] +
593   - (tmp_tr.nodes[k].x - x0) / hx * tec_data[(i + 1) * nx + j + 1].value[m];
  590 + r1 = (x1 - tmp_tr.nodes[k].x) / hx * tec_data[i * ny + j].value[m] +
  591 + (tmp_tr.nodes[k].x - x0) / hx * tec_data[(i + 1) * ny + j].value[m];
  592 + r2 = (x1 - tmp_tr.nodes[k].x) / hx * tec_data[i * ny + j + 1].value[m] +
  593 + (tmp_tr.nodes[k].x - x0) / hx * tec_data[(i + 1) * ny + j + 1].value[m];
594 594 }
595 595 else
596 596 {
597   - r1 = (x1 - tmp_tr.nodes[k].x) / hx * tec_data[i * nx + j].value[m] +
598   - (tmp_tr.nodes[k].x - x0) / hx * tec_data[i * nx + j + 1].value[m];
599   - r2 = (x1 - tmp_tr.nodes[k].x) / hx * tec_data[(i + 1) * nx + j].value[m] +
600   - (tmp_tr.nodes[k].x - x0) / hx * tec_data[(i + 1) * nx + j + 1].value[m];
  597 + r1 = (x1 - tmp_tr.nodes[k].x) / hx * tec_data[i * ny + j].value[m] +
  598 + (tmp_tr.nodes[k].x - x0) / hx * tec_data[i * ny + j + 1].value[m];
  599 + r2 = (x1 - tmp_tr.nodes[k].x) / hx * tec_data[(i + 1) * ny + j].value[m] +
  600 + (tmp_tr.nodes[k].x - x0) / hx * tec_data[(i + 1) * ny + j + 1].value[m];
601 601 }
602 602 tmp_tr.solution[k][m] = (y1 - tmp_tr.nodes[k].y) / hy * r1 +
603 603 (tmp_tr.nodes[k].y - y0) / hy * r2;
... ... @@ -621,17 +621,17 @@ void paintwidget::set_div_num(size_t num)
621 621 float r1, r2;
622 622 if(native_order)
623 623 {
624   - r1 = (x1 - barycenter.x) / hx * tec_data[i * nx + j].value[m] +
625   - (barycenter.x - x0) / hx * tec_data[(i + 1) * nx + j].value[m];
626   - r2 = (x1 - barycenter.x) / hx * tec_data[i * nx + j + 1].value[m] +
627   - (barycenter.x - x0) / hx * tec_data[(i + 1) * nx + j + 1].value[m];
  624 + r1 = (x1 - barycenter.x) / hx * tec_data[i * ny + j].value[m] +
  625 + (barycenter.x - x0) / hx * tec_data[(i + 1) * ny + j].value[m];
  626 + r2 = (x1 - barycenter.x) / hx * tec_data[i * ny + j + 1].value[m] +
  627 + (barycenter.x - x0) / hx * tec_data[(i + 1) * ny + j + 1].value[m];
628 628 }
629 629 else
630 630 {
631   - r1 = (x1 - barycenter.x) / hx * tec_data[i * nx + j].value[m] +
632   - (barycenter.x - x0) / hx * tec_data[i * nx + j + 1].value[m];
633   - r2 = (x1 - barycenter.x) / hx * tec_data[(i + 1) * nx + j].value[m] +
634   - (barycenter.x - x0) / hx * tec_data[(i + 1) * nx + j + 1].value[m];
  631 + r1 = (x1 - barycenter.x) / hx * tec_data[i * ny + j].value[m] +
  632 + (barycenter.x - x0) / hx * tec_data[i * ny + j + 1].value[m];
  633 + r2 = (x1 - barycenter.x) / hx * tec_data[(i + 1) * ny + j].value[m] +
  634 + (barycenter.x - x0) / hx * tec_data[(i + 1) * ny + j + 1].value[m];
635 635 }
636 636 center[m] = (y1 - barycenter.y) / hy * r1 +
637 637 (barycenter.y - y0) / hy * r2;
... ... @@ -1331,7 +1331,7 @@ void paintwidget::draw(QPaintDevice * device, bool transparency, bool is_svg)
1331 1331 {
1332 1332 for(size_t i = 0; i < nx; i += skip_vec)
1333 1333 {
1334   - tecplot_node * v = & tec_data[j * nx + i];
  1334 + tecplot_node * v = & tec_data[i * ny + j];
1335 1335 QPoint begin = to_window((v->coord.x - min_x) / size_x, (v->coord.y - min_y) / size_y);
1336 1336 float len_x = v->value[ind_vec_1];
1337 1337 float len_y = v->value[ind_vec_2];
... ...
src_winapi/paintwidget.cpp
... ... @@ -439,8 +439,8 @@ void paintwidget::tec_read(LPCTSTR filename)
439 439 ind[1] = 1;
440 440 }
441 441 }
442   - nx = IJK[ind[0]];
443   - ny = IJK[ind[1]];
  442 + nx = IJK[ind[1]];
  443 + ny = IJK[ind[0]];
444 444 label_x = var_c[ind[0]];
445 445 label_y = var_c[ind[1]];
446 446  
... ... @@ -610,14 +610,14 @@ void paintwidget::set_div_num(size_t num)
610 610 {
611 611 for(size_t j = 0; j < ny - 1; j++)
612 612 {
613   - float x0 = tec_data[i * nx + j].coord.x;
614   - float y0 = tec_data[i * nx + j].coord.y;
615   - float x1 = tec_data[(i + 1) * nx + j + 1].coord.x;
616   - float y1 = tec_data[(i + 1) * nx + j + 1].coord.y;
  613 + float x0 = tec_data[i * ny + j].coord.x;
  614 + float y0 = tec_data[i * ny + j].coord.y;
  615 + float x1 = tec_data[(i + 1) * ny + j + 1].coord.x;
  616 + float y1 = tec_data[(i + 1) * ny + j + 1].coord.y;
617 617 float hx = x1 - x0;
618 618 float hy = y1 - y0;
619   - float step_x_i = std::fabs(tec_data[(i + 1) * nx + j].coord.x - x0);
620   - float step_x_j = std::fabs(tec_data[i * nx + j + 1].coord.x - x0);
  619 + float step_x_i = std::fabs(tec_data[(i + 1) * ny + j].coord.x - x0);
  620 + float step_x_j = std::fabs(tec_data[i * ny + j + 1].coord.x - x0);
621 621 bool native_order = (step_x_i > step_x_j) ? true : false;
622 622  
623 623 for(size_t tn = 0; tn < tmp1_size; tn++)
... ... @@ -641,17 +641,17 @@ void paintwidget::set_div_num(size_t num)
641 641 float r1, r2;
642 642 if(native_order)
643 643 {
644   - r1 = (x1 - tmp_tr.nodes[k].x) / hx * tec_data[i * nx + j].value[m] +
645   - (tmp_tr.nodes[k].x - x0) / hx * tec_data[(i + 1) * nx + j].value[m];
646   - r2 = (x1 - tmp_tr.nodes[k].x) / hx * tec_data[i * nx + j + 1].value[m] +
647   - (tmp_tr.nodes[k].x - x0) / hx * tec_data[(i + 1) * nx + j + 1].value[m];
  644 + r1 = (x1 - tmp_tr.nodes[k].x) / hx * tec_data[i * ny + j].value[m] +
  645 + (tmp_tr.nodes[k].x - x0) / hx * tec_data[(i + 1) * ny + j].value[m];
  646 + r2 = (x1 - tmp_tr.nodes[k].x) / hx * tec_data[i * ny + j + 1].value[m] +
  647 + (tmp_tr.nodes[k].x - x0) / hx * tec_data[(i + 1) * ny + j + 1].value[m];
648 648 }
649 649 else
650 650 {
651   - r1 = (x1 - tmp_tr.nodes[k].x) / hx * tec_data[i * nx + j].value[m] +
652   - (tmp_tr.nodes[k].x - x0) / hx * tec_data[i * nx + j + 1].value[m];
653   - r2 = (x1 - tmp_tr.nodes[k].x) / hx * tec_data[(i + 1) * nx + j].value[m] +
654   - (tmp_tr.nodes[k].x - x0) / hx * tec_data[(i + 1) * nx + j + 1].value[m];
  651 + r1 = (x1 - tmp_tr.nodes[k].x) / hx * tec_data[i * ny + j].value[m] +
  652 + (tmp_tr.nodes[k].x - x0) / hx * tec_data[i * ny + j + 1].value[m];
  653 + r2 = (x1 - tmp_tr.nodes[k].x) / hx * tec_data[(i + 1) * ny + j].value[m] +
  654 + (tmp_tr.nodes[k].x - x0) / hx * tec_data[(i + 1) * ny + j + 1].value[m];
655 655 }
656 656 tmp_tr.solution[k][m] = (y1 - tmp_tr.nodes[k].y) / hy * r1 +
657 657 (tmp_tr.nodes[k].y - y0) / hy * r2;
... ... @@ -675,17 +675,17 @@ void paintwidget::set_div_num(size_t num)
675 675 float r1, r2;
676 676 if(native_order)
677 677 {
678   - r1 = (x1 - barycenter.x) / hx * tec_data[i * nx + j].value[m] +
679   - (barycenter.x - x0) / hx * tec_data[(i + 1) * nx + j].value[m];
680   - r2 = (x1 - barycenter.x) / hx * tec_data[i * nx + j + 1].value[m] +
681   - (barycenter.x - x0) / hx * tec_data[(i + 1) * nx + j + 1].value[m];
  678 + r1 = (x1 - barycenter.x) / hx * tec_data[i * ny + j].value[m] +
  679 + (barycenter.x - x0) / hx * tec_data[(i + 1) * ny + j].value[m];
  680 + r2 = (x1 - barycenter.x) / hx * tec_data[i * ny + j + 1].value[m] +
  681 + (barycenter.x - x0) / hx * tec_data[(i + 1) * ny + j + 1].value[m];
682 682 }
683 683 else
684 684 {
685   - r1 = (x1 - barycenter.x) / hx * tec_data[i * nx + j].value[m] +
686   - (barycenter.x - x0) / hx * tec_data[i * nx + j + 1].value[m];
687   - r2 = (x1 - barycenter.x) / hx * tec_data[(i + 1) * nx + j].value[m] +
688   - (barycenter.x - x0) / hx * tec_data[(i + 1) * nx + j + 1].value[m];
  685 + r1 = (x1 - barycenter.x) / hx * tec_data[i * ny + j].value[m] +
  686 + (barycenter.x - x0) / hx * tec_data[i * ny + j + 1].value[m];
  687 + r2 = (x1 - barycenter.x) / hx * tec_data[(i + 1) * ny + j].value[m] +
  688 + (barycenter.x - x0) / hx * tec_data[(i + 1) * ny + j + 1].value[m];
689 689 }
690 690 center[m] = (y1 - barycenter.y) / hy * r1 +
691 691 (barycenter.y - y0) / hy * r2;
... ... @@ -1338,7 +1338,7 @@ void paintwidget::draw(HDC hdc_local)
1338 1338 {
1339 1339 for(size_t i = 0; i < nx; i += skip_vec)
1340 1340 {
1341   - tecplot_node * v = & tec_data[j * nx + i];
  1341 + tecplot_node * v = & tec_data[i * ny + j];
1342 1342 int begin_x, begin_y;
1343 1343 to_window((v->coord.x - min_x) / size_x, (v->coord.y - min_y) / size_y, begin_x, begin_y);
1344 1344 float len_x = v->value[ind_vec_1];
... ...