From 5b57ed784c215aed2a03797b8d5fd08a9a82e1a9 Mon Sep 17 00:00:00 2001 From: Yoann Audouin Date: Fri, 9 Jul 2021 09:32:57 +0200 Subject: [PATCH] [SerafinReader] Correcting issue with time --- src/SerafinReader/Test/result.slf | Bin 0 -> 840 bytes src/SerafinReader/Test/test_SerafinReader.py | 12 ++++++++++++ .../SerafinReaderModule/stdSerafinReader.h | 16 +++++++++++----- .../SerafinReaderModule/vtkSerafinReader.cxx | 10 ++++------ .../SerafinReaderModule/vtkSerafinReader.h | 5 +++++ src/SerafinReader/plugin/sources.xml | 10 ++++++++++ 6 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 src/SerafinReader/Test/result.slf diff --git a/src/SerafinReader/Test/result.slf b/src/SerafinReader/Test/result.slf new file mode 100644 index 0000000000000000000000000000000000000000..8cdc4528d4aa86c2c8e3f15eb5ab700bf77db354 GIT binary patch literal 840 zcmbV~y=nqc5QQgk^HbUcQf_IPH}GzefQ?Afr3-36hy<3TNVkvTqbzw6AI0z7dxvPa zS~&1IXXl(5mPIq0y)Hi%Z}nHZdjD+a%lhnkd3Ki%R_<8>fFi@~V6{X8qRxp6^s4?Z&Kh3C8hmkeS~>x&(g8b|}xH yLjnAh-Jm>+4h8U2wnupu9SY#5>=xx&bSQuyvkiiZ-$A+rday = this->metadata->Date[2]; date->month = this->metadata->Date[1]; date->year = this->metadata->Date[0]; - date->hour = this->metadata->Date[3]; date->min = this->metadata->Date[4]; date->sec = this->metadata->Date[5]; + date->day = this->metadata->Date[2]; + date->month = this->metadata->Date[1]; + date->year = this->metadata->Date[0]; + date->hour = this->metadata->Date[3]; + date->min = this->metadata->Date[4]; + date->sec = this->metadata->Date[5]; }; // Simplifie la lecture des informations de discrétisation @@ -262,9 +266,11 @@ public: double GetTime(int timeid) { double value = 0; - FileStream->seekg( this->index->DataPosision + this->index->DataBlocSize * timeid , std::ios_base::beg ) ; + FileStream->seekg( this->index->DataPosition + this->index->DataBlocSize * timeid , + std::ios_base::beg ) ; skipReadingHeader(FileStream); (*this.*readFloatArray)(&(value), 1); + return value; }; @@ -406,7 +412,7 @@ protected: int64_t GoToData(const int time) { if (time >= GetTotalTime()) return 0 ; - FileStream->seekg( this->index->DataPosision + this->index->DataBlocSize * time + this->index->TimeSize, std::ios_base::beg ) ; + FileStream->seekg( this->index->DataPosition + this->index->DataBlocSize * time + this->index->TimeSize, std::ios_base::beg ) ; return FileStream->tellg(); }; diff --git a/src/SerafinReader/plugin/SerafinReaderModule/vtkSerafinReader.cxx b/src/SerafinReader/plugin/SerafinReaderModule/vtkSerafinReader.cxx index 299ab92..d5b2ce9 100644 --- a/src/SerafinReader/plugin/SerafinReaderModule/vtkSerafinReader.cxx +++ b/src/SerafinReader/plugin/SerafinReaderModule/vtkSerafinReader.cxx @@ -346,7 +346,7 @@ void stdSerafinReader::createIndex () - 2*index->FieldSize - (this->index->IntSize*ndp*nelem+2*this->index->TagSize); // Index to data - this->index->DataPosision = (this->index->FileSize) - (this->index->DataSize); + this->index->DataPosition = (this->index->FileSize) - (this->index->DataSize); // Index of Y coordinates this->index->YPosition = this->index->XPosition + this->index->FieldSize; @@ -357,7 +357,6 @@ void stdSerafinReader::createIndex () this->index->NumberOfDate = (this->index->DataSize)/(this->index->DataBlocSize); - //vtkDebugMacro(<< "Number of Date: " << this->index->NumberOfDate << endl); }; @@ -491,14 +490,13 @@ int vtkSerafinReader::RequestInformation(vtkInformation *vtkNotUsed(request), int i=0; double* TimeValues = new double[totime]; - for (i=0; iReader->GetTime(i) ;} - - outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(), &TimeValues[0], totime); + for (i=0; iReader->GetTime(i) ; } + outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(), &TimeValues[0], totime); double timeRange[2]; timeRange[0] = TimeValues[0]; timeRange[1] = TimeValues[totime-1]; - outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_RANGE(), timeRange, 2); + outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_RANGE(), &timeRange[0], 2); }; } diff --git a/src/SerafinReader/plugin/SerafinReaderModule/vtkSerafinReader.h b/src/SerafinReader/plugin/SerafinReaderModule/vtkSerafinReader.h index 9f650ee..676ea7d 100644 --- a/src/SerafinReader/plugin/SerafinReaderModule/vtkSerafinReader.h +++ b/src/SerafinReader/plugin/SerafinReaderModule/vtkSerafinReader.h @@ -83,6 +83,11 @@ public: vtkSetStringMacro(FileName); vtkGetStringMacro(FileName); + // Mandatory for time manipulation + vtkSetMacro(TimeStep, int); + vtkGetMacro(TimeStep, int); + int GetNumberOfTimeSteps() {this->Reader->GetTotalTime();}; + vtkSetMacro(BuildVectors, int); vtkGetMacro(BuildVectors, int); diff --git a/src/SerafinReader/plugin/sources.xml b/src/SerafinReader/plugin/sources.xml index e0825c7..2d56bd4 100644 --- a/src/SerafinReader/plugin/sources.xml +++ b/src/SerafinReader/plugin/sources.xml @@ -20,6 +20,16 @@ + + + + + Available timestep values. + + +