Changeset 239 for XMLIO_V2/dev
- Timestamp:
- 06/29/11 07:22:13 (14 years ago)
- Location:
- XMLIO_V2/dev/dev_rv/src4/xmlio/vtk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src4/xmlio/vtk/lscereader.cpp
r236 r239 27 27 #include "inetcdf4_impl.hpp" 28 28 #include "inetcdf4_adv_impl.hpp" 29 30 // BibliothÚque C++ 31 #include <algorithm> 29 32 30 33 // Type Fortran … … 609 612 const vtkStdString & ycoordinate, 610 613 const vtkStdString & zcoordinate, 611 bool bounds, bool proj, std::size_t nbvertex,614 bool bounds, bool proj, bool clean, std::size_t nbvertex, 612 615 vtkCellArray * cells, vtkPoints * points, 613 616 vtkIntArray * dimensions) 614 617 { 615 float value[3];618 float value[3], range[2]; 616 619 double h = 1.0; 617 double cartesianCoord[3] ;620 double cartesianCoord[3], vbounds[6]; 618 621 vtkIdType pts[nbvertex] ; 619 622 bool is2D = true; 620 623 ARRAY_CREATE(xvalue, float, 1, [1]); 621 624 ARRAY_CREATE(yvalue, float, 1, [1]); 622 vtkSmartPointer<vtkFloatArray> zspacing = vtkSmartPointer<vtkFloatArray>::New(); 625 vtkSmartPointer<vtkPointLocator> locator = vtkSmartPointer<vtkPointLocator>::New(); 626 vtkSmartPointer<vtkFloatArray> zspacing = vtkSmartPointer<vtkFloatArray>::New(); 627 623 628 if (zcoordinate.size() > 0) 624 629 { … … 628 633 else 629 634 zspacing->InsertNextValue(0); 635 636 zspacing->GetValueRange (range); 630 637 631 638 std::size_t size = (*Reader->getDimensions(&xcoordinate).begin()).second; … … 634 641 vtkStdString boundid = Reader->getBoundsId(xcoordinate); 635 642 Reader->readData(*xvalue, boundid); 643 if (!proj) 644 { 645 vbounds[0] = *std::min_element(xvalue->begin(), xvalue->end()); 646 vbounds[1] = *std::max_element(xvalue->begin(), xvalue->end()); 647 } 648 else 649 { 650 vbounds[0] = -h; 651 vbounds[1] = h; 652 } 636 653 } 637 654 if (Reader->hasBounds(ycoordinate)) … … 639 656 vtkStdString boundid = Reader->getBoundsId(ycoordinate); 640 657 Reader->readData(*yvalue, boundid); 641 } 642 658 if (!proj) 659 { 660 vbounds[2] = *std::min_element(yvalue->begin(), yvalue->end()); 661 vbounds[3] = *std::max_element(yvalue->begin(), yvalue->end()); 662 } 663 else 664 { 665 vbounds[2] = -h; 666 vbounds[3] = h; 667 } 668 } 669 if (!proj) 670 { 671 vbounds[4] = range[0]; 672 vbounds[5] = range[1]; 673 } 674 else 675 { 676 vbounds[4] = -h; 677 vbounds[5] = h; 678 } 679 locator->InitPointInsertion(points, vbounds, size * zspacing->GetNumberOfTuples() * nbvertex); 680 643 681 for (std::size_t u = 0; u < size; u++) 644 682 { … … 660 698 cartesianCoord[1] = h * sin(value[0]) * cos(value[1]); 661 699 cartesianCoord[2] = h * sin(value[1]); 662 points->InsertPoint (pts[w], cartesianCoord); 700 if (clean) locator->InsertUniquePoint (cartesianCoord, pts[w]); 701 else points->InsertPoint (pts[w], cartesianCoord); 663 702 } 664 703 else 665 704 { 666 points->InsertPoint (pts[w], value); 705 cartesianCoord[0] = value[0]; 706 cartesianCoord[1] = value[1]; 707 cartesianCoord[2] = value[2]; 708 if (clean) locator->InsertUniquePoint (cartesianCoord, pts[w]); 709 else points->InsertPoint (pts[w], cartesianCoord); 667 710 } 668 711 } … … 780 823 //std::cout << Reader->getVertCoordName(*VarNames.begin()) << std::endl; 781 824 782 std::cout << Reader->getNbVertex(*VarNames.begin()) << std::endl;783 784 825 GetCellsAndPoints(Reader->getLonCoordName(*VarNames.begin()), 785 826 Reader->getLatCoordName(*VarNames.begin()), 786 Reader->getVertCoordName(*VarNames.begin()), true, true,827 Reader->getVertCoordName(*VarNames.begin()), true, false, true, 787 828 Reader->getNbVertex(*VarNames.begin()), cells, pts, dims); 788 829 -
XMLIO_V2/dev/dev_rv/src4/xmlio/vtk/lscereader.hpp
r236 r239 153 153 const vtkStdString & ycoordinate, 154 154 const vtkStdString & zcoordinate, 155 bool bounds, bool proj, std::size_t nbvertex,155 bool bounds, bool proj, bool clean, std::size_t nbvertex, 156 156 vtkCellArray * cells, vtkPoints * points, 157 157 vtkIntArray * dimensions);
Note: See TracChangeset
for help on using the changeset viewer.