reader = SerafinReader(FileName='geo_3d_dp.slf')
reader.UpdatePipeline()
reader_ds = servermanager.Fetch(reader)
+
+# Reading file with time steps (10)
+reader = SerafinReader(FileName='result.slf')
+reader.UpdatePipeline()
+reader_ds = servermanager.Fetch(reader)
+
+# Using animationScene to get tim information
+anim = GetAnimationScene()
+tk = anim.TimeKeeper
+times = tk.TimestepValues
+ref_times = [i*1.0 for i in range(10)]
+assert(times == ref_times)
int64_t ConnectivityPosition ; // La position dans le fichier de la table de connectivité
int64_t XPosition; // La position dans le fichier de la table des valeurs de X
int64_t YPosition; // La position dans le fichier de la table des valeurs de Y
- int64_t DataPosision; // La position dans le fichier des blocs de données
+ int64_t DataPosition; // La position dans le fichier des blocs de données
int NumberOfDate ; // Information sur le temps étudié
// Associe la date de début de simulation
void GetDate(SerafinDate* date)
{
- 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];
+ 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
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;
};
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();
};
- 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;
this->index->NumberOfDate = (this->index->DataSize)/(this->index->DataBlocSize);
- //vtkDebugMacro(<< "Number of Date: " << this->index->NumberOfDate << endl);
};
int i=0;
double* TimeValues = new double[totime];
- for (i=0; i<totime ;i++) {TimeValues[i] = this->Reader->GetTime(i) ;}
-
- outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(), &TimeValues[0], totime);
+ for (i=0; i<totime ;i++) {TimeValues[i] = this->Reader->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);
};
}
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);
</Documentation>
</StringVectorProperty>
+ <!-- Mandatory for time dependant reader -->
+ <DoubleVectorProperty
+ name="TimestepValues"
+ information_only="1">
+ <TimeStepsInformationHelper/>
+ <Documentation>
+ Available timestep values.
+ </Documentation>
+ </DoubleVectorProperty>
+
<IntVectorProperty name="BuildVectors"
command="SetBuildVectors"
number_of_elements="1"