Changeset 236
- Timestamp:
- 06/28/11 07:36:13 (13 years ago)
- Location:
- XMLIO_V2/dev/dev_rv/src4/xmlio
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src4/xmlio/main_server.cpp
r229 r236 84 84 85 85 //vtkLSCEReader::ShowVariable("test/vtk/file_coslatgrid.nc4", "NTEMP"); 86 //vtkLSCEReader::ShowVariable("test/vtk/ucov.nc4", "ucov");87 vtkLSCEReader::ShowVariable("test/vtk/sampleCurveGrid4.nc4", "sample");86 vtkLSCEReader::ShowVariable("test/vtk/ucov.nc4", "ucov"); 87 //vtkLSCEReader::ShowVariable("test/vtk/sampleCurveGrid4.nc4", "sample"); 88 88 //vtkLSCEReader::ShowVariable("test/vtk/sampleGenGrid3.nc4", "sample"); 89 89 //vtkLSCEReader::ShowVariable("test/vtk/file_xboundsybounds.nc4", "A"); -
XMLIO_V2/dev/dev_rv/src4/xmlio/vtk/lscereader.cpp
r229 r236 12 12 #include "vtkInformationVector.h" 13 13 #include "vtkStreamingDemandDrivenPipeline.h" 14 15 #include "vtkPointLocator.h" 14 16 15 17 #include <vtkProperty.h> … … 82 84 { 83 85 this->RemoveAllSelectedVariables(); 84 this->AddVariableToSelection(variable); 86 if (Reader->hasVariable(variable)) 87 this->AddVariableToSelection(variable); 85 88 this->Modified(); 86 89 } … … 457 460 458 461 //---------------------------------------------------------------- 462 463 void vtkLSCEReader::GetDimensions(const vtkStdString & xcoordinate, 464 const vtkStdString & ycoordinate, 465 const vtkStdString & zcoordinate, 466 vtkIntArray * dimensions, bool bounds) 467 { 468 int a = (bounds) ? 1 : 0; 469 dimensions->InsertNextValue 470 ((Reader->getDimensions(&xcoordinate).begin())->second + a); 471 dimensions->InsertNextValue 472 ((Reader->getDimensions(&ycoordinate).begin())->second + a); 473 if (zcoordinate.size() > 0) 474 { 475 dimensions->InsertNextValue 476 ((Reader->getDimensions(&zcoordinate).begin())->second + a); 477 } 478 else 479 { 480 dimensions->InsertNextValue(1); 481 } 482 } 483 484 void vtkLSCEReader::GetDimensions(const vtkStdString & xcoordinate, 485 const vtkStdString & zcoordinate, 486 vtkIntArray * dimensions, bool bounds) 487 { 488 int a = (bounds) ? 1 : 0; 489 dimensions->InsertNextValue 490 (Reader->getDimensions(&xcoordinate)[Reader->getLonCoordName(xcoordinate)] + a); 491 dimensions->InsertNextValue 492 (Reader->getDimensions(&xcoordinate)[Reader->getLatCoordName(xcoordinate)] + a); 493 if (zcoordinate.size() > 0) 494 { 495 dimensions->InsertNextValue 496 ((Reader->getDimensions(&zcoordinate).begin())->second + a); 497 } 498 else 499 { 500 dimensions->InsertNextValue(1); 501 } 502 } 503 504 //---------------------------------------------------------------- 459 505 void vtkLSCEReader::GetPoints(const vtkStdString & xcoordinate, 460 506 const vtkStdString & ycoordinate, … … 656 702 657 703 //---------------------------------------------------------------- 658 704 659 705 int vtkLSCEReader::RequestData 660 706 (vtkInformation * vtkNotUsed(request), … … 665 711 vtkDataSet * output = vtkDataSet::GetData(outInfo); 666 712 667 std::cout << this->CurGridType << std::endl;668 669 713 if (!output) 670 714 { … … 689 733 vtkStructuredGrid * soutput = vtkStructuredGrid::SafeDownCast(output); 690 734 691 if (routput )735 if (routput && !this->VarNames.empty()) 692 736 { // Grille rectiliniéaire 693 737 vtkSmartPointer<vtkFloatArray> … … 711 755 } 712 756 713 if (soutput )757 if (soutput && !this->VarNames.empty()) 714 758 { // Grille structurée 715 759 … … 720 764 GetPoints(Reader->getLonCoordName(*VarNames.begin()), 721 765 Reader->getLatCoordName(*VarNames.begin()), 722 Reader->getVertCoordName(*VarNames.begin()), false, true, pts, dims);723 724 AddScalarData(soutput, *VarNames.begin(), 0, false);766 Reader->getVertCoordName(*VarNames.begin()), true, true, pts, dims); 767 768 AddScalarData(soutput, *VarNames.begin(), 0, true); 725 769 CreateStructuredGrid(soutput, outInfo, pts, dims); 726 770 } 727 771 728 if (uoutput )772 if (uoutput && !this->VarNames.empty()) 729 773 { // Grille non-structurée 730 774 … … 735 779 //CreateSimpleGrid (0, 12, 0, 12, 0, 12, pts, cells, dims); 736 780 //std::cout << Reader->getVertCoordName(*VarNames.begin()) << std::endl; 781 782 std::cout << Reader->getNbVertex(*VarNames.begin()) << std::endl; 783 737 784 GetCellsAndPoints(Reader->getLonCoordName(*VarNames.begin()), 738 785 Reader->getLatCoordName(*VarNames.begin()), … … 773 820 output->Delete(); 774 821 } 822 823 vtkRectilinearGrid * routput = vtkRectilinearGrid::SafeDownCast(output); 824 vtkStructuredGrid * soutput = vtkStructuredGrid::SafeDownCast(output); 825 826 if (routput && !this->VarNames.empty()) 827 { // Grille rectiliniéaire 828 vtkSmartPointer<vtkIntArray> dims = vtkSmartPointer<vtkIntArray>::New(); 829 this->GetDimensions(Reader->getLonCoordName(*VarNames.begin()), 830 Reader->getLatCoordName(*VarNames.begin()), 831 Reader->getVertCoordName(*VarNames.begin()), 832 dims, true); 833 834 int extent[6] = { 0, dims->GetValue(0) - 1 835 , 0, dims->GetValue(1) - 1 836 , 0, dims->GetValue(2) - 1}; 837 outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),extent,6); 838 } 839 840 if (soutput && !this->VarNames.empty()) 841 { // Grille structurée 842 843 vtkSmartPointer<vtkIntArray> dims = vtkSmartPointer<vtkIntArray>::New(); 844 this->GetDimensions(Reader->getLonCoordName(*VarNames.begin()), 845 Reader->getVertCoordName(*VarNames.begin()), 846 dims, true); 847 848 int extent[6] = { 0, dims->GetValue(0) - 1 849 , 0, dims->GetValue(1) - 1 850 , 0, dims->GetValue(2) - 1}; 851 outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),extent,6); 852 } 853 775 854 return (1); 776 855 } -
XMLIO_V2/dev/dev_rv/src4/xmlio/vtk/lscereader.hpp
r229 r236 162 162 std::size_t record, bool bounds); 163 163 164 void GetDimensions(const vtkStdString & xcoordinate, 165 const vtkStdString & ycoordinate, 166 const vtkStdString & zcoordinate, 167 vtkIntArray * dimensions, bool bounds); 168 169 void GetDimensions(const vtkStdString & xcoordinate, 170 const vtkStdString & zcoordinate, 171 vtkIntArray * dimensions, bool bounds); 172 164 173 //ETX 165 174
Note: See TracChangeset
for help on using the changeset viewer.