Changeset 236


Ignore:
Timestamp:
06/28/11 07:36:13 (13 years ago)
Author:
hozdoba
Message:
 
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  
    8484        
    8585       //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"); 
    8888       //vtkLSCEReader::ShowVariable("test/vtk/sampleGenGrid3.nc4", "sample"); 
    8989       //vtkLSCEReader::ShowVariable("test/vtk/file_xboundsybounds.nc4", "A"); 
  • XMLIO_V2/dev/dev_rv/src4/xmlio/vtk/lscereader.cpp

    r229 r236  
    1212#include "vtkInformationVector.h" 
    1313#include "vtkStreamingDemandDrivenPipeline.h" 
     14 
     15#include "vtkPointLocator.h" 
    1416 
    1517#include <vtkProperty.h> 
     
    8284      { 
    8385         this->RemoveAllSelectedVariables(); 
    84          this->AddVariableToSelection(variable); 
     86         if (Reader->hasVariable(variable)) 
     87            this->AddVariableToSelection(variable); 
    8588         this->Modified(); 
    8689      } 
     
    457460 
    458461      //---------------------------------------------------------------- 
     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      //---------------------------------------------------------------- 
    459505      void vtkLSCEReader::GetPoints(const vtkStdString & xcoordinate, 
    460506                                    const vtkStdString & ycoordinate, 
     
    656702 
    657703      //---------------------------------------------------------------- 
    658  
     704       
    659705      int vtkLSCEReader::RequestData 
    660706                           (vtkInformation       *  vtkNotUsed(request), 
     
    665711         vtkDataSet     *  output  = vtkDataSet::GetData(outInfo); 
    666712          
    667          std::cout << this->CurGridType << std::endl; 
    668  
    669713         if (!output) 
    670714         { 
     
    689733         vtkStructuredGrid   * soutput  = vtkStructuredGrid::SafeDownCast(output); 
    690734 
    691          if (routput) 
     735         if (routput && !this->VarNames.empty()) 
    692736         { // Grille rectiliniéaire 
    693737            vtkSmartPointer<vtkFloatArray> 
     
    711755         } 
    712756 
    713          if (soutput) 
     757         if (soutput && !this->VarNames.empty()) 
    714758         { // Grille structurée 
    715759              
     
    720764            GetPoints(Reader->getLonCoordName(*VarNames.begin()), 
    721765                      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); 
    725769            CreateStructuredGrid(soutput, outInfo, pts, dims); 
    726770         } 
    727771 
    728          if (uoutput) 
     772         if (uoutput  && !this->VarNames.empty()) 
    729773         { // Grille non-structurée 
    730774 
     
    735779            //CreateSimpleGrid (0, 12, 0, 12, 0, 12, pts, cells, dims); 
    736780            //std::cout << Reader->getVertCoordName(*VarNames.begin()) << std::endl; 
     781             
     782            std::cout << Reader->getNbVertex(*VarNames.begin()) << std::endl; 
     783             
    737784            GetCellsAndPoints(Reader->getLonCoordName(*VarNames.begin()), 
    738785                              Reader->getLatCoordName(*VarNames.begin()), 
     
    773820            output->Delete(); 
    774821         } 
     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             
    775854         return (1); 
    776855      } 
  • XMLIO_V2/dev/dev_rv/src4/xmlio/vtk/lscereader.hpp

    r229 r236  
    162162                               std::size_t record, bool bounds); 
    163163             
     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              
    164173            //ETX 
    165174             
Note: See TracChangeset for help on using the changeset viewer.