Commit 047f0a83 authored by Joachim Pouderoux's avatar Joachim Pouderoux Committed by Kitware Robot

Merge topic 'CDIReader_Upgrade'

b62bb4b6 Upgrade of vtkCDIReader and vtkFileSeriesReader.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Michael Migliore's avatarMichael Migliore <michael.migliore@kitware.com>
Acked-by: Joachim Pouderoux's avatarJoachim Pouderoux <joachim.pouderoux@kitware.com>
Merge-request: !3129
parents 72531b5c b62bb4b6
Pipeline #134879 running with stage
......@@ -30,6 +30,7 @@
#include "vtkGenericDataObjectReader.h"
#include "vtkInformation.h"
#include "vtkInformationIntegerKey.h"
#include "vtkInformationStringKey.h"
#include "vtkInformationVector.h"
#include "vtkMath.h"
#include "vtkObjectFactory.h"
......@@ -54,7 +55,9 @@
//=============================================================================
vtkStandardNewMacro(vtkFileSeriesReader);
vtkInformationKeyMacro(vtkFileSeriesReader, FILE_SERIES_NUMBER_OF_FILES, Integer);
vtkInformationKeyMacro(vtkFileSeriesReader, FILE_SERIES_CURRENT_FILE_NUMBER, Integer);
vtkInformationKeyMacro(vtkFileSeriesReader, FILE_SERIES_FIRST_FILENAME, String);
//=============================================================================
// Internal class for holding time ranges.
class vtkFileSeriesReaderTimeRanges
......@@ -537,6 +540,12 @@ int vtkFileSeriesReader::ProcessRequest(
this->RequestUpdateTimeDependentInformation(request, inputVector, outputVector);
}
// Expose number of files and first filename as
// information keys for potential use in the internal reader
outputVector->GetInformationObject(0)->Set(
FILE_SERIES_NUMBER_OF_FILES(), this->GetNumberOfFileNames());
outputVector->GetInformationObject(0)->Set(FILE_SERIES_FIRST_FILENAME(), this->GetFileName(0));
// Let the reader process anything we did not handle ourselves.
int retVal = this->Reader->ProcessRequest(request, inputVector, outputVector);
......@@ -573,6 +582,9 @@ int vtkFileSeriesReader::RequestInformation(vtkInformation* request,
// the reader.
outInfo->Remove(vtkStreamingDemandDrivenPipeline::TIME_STEPS());
outInfo->Remove(vtkStreamingDemandDrivenPipeline::TIME_RANGE());
// Expose current file number as information key for potential use in the internal reader
outputVector->GetInformationObject(requestFromPort)->Set(FILE_SERIES_CURRENT_FILE_NUMBER(), 0);
this->RequestInformationForInput(0, request, outputVector);
// vtkErrorMacro("Expecting at least 1 file. Cannot proceed.");
......@@ -583,6 +595,9 @@ int vtkFileSeriesReader::RequestInformation(vtkInformation* request,
// determine if the inputs have time information
outInfo->Remove(vtkStreamingDemandDrivenPipeline::TIME_STEPS());
outInfo->Remove(vtkStreamingDemandDrivenPipeline::TIME_RANGE());
// Expose current file number as information key for potential use in the internal reader
outputVector->GetInformationObject(requestFromPort)->Set(FILE_SERIES_CURRENT_FILE_NUMBER(), 0);
this->RequestInformationForInput(0, request, outputVector);
bool ignoreReaderTime = this->IgnoreReaderTime;
......@@ -615,6 +630,9 @@ int vtkFileSeriesReader::RequestInformation(vtkInformation* request,
// Query all the other files for time info.
for (unsigned int i = 1; i < numFiles; i++)
{
// Expose current file number as information key for potential use in the internal reader
outputVector->GetInformationObject(requestFromPort)
->Set(FILE_SERIES_CURRENT_FILE_NUMBER(), static_cast<int>(i));
this->RequestInformationForInput(static_cast<int>(i), request, outputVector);
this->Internal->TimeRanges->AddTimeRange(static_cast<int>(i), outInfo);
}
......@@ -652,6 +670,8 @@ int vtkFileSeriesReader::RequestUpdateExtent(vtkInformation* request,
// Make sure that the reader file name is set correctly and that
// RequestInformation has been called.
outputVector->GetInformationObject(requestFromPort)
->Set(FILE_SERIES_CURRENT_FILE_NUMBER(), index);
this->RequestInformationForInput(index);
// I commented out the following block because it is probably not important
......
......@@ -85,6 +85,8 @@
#include <vector> // Needed for protected API
class vtkInformationIntegerKey;
class vtkInformationStringKey;
class vtkStringArray;
struct vtkFileSeriesReaderInternals;
......@@ -151,6 +153,12 @@ public:
vtkBooleanMacro(IgnoreReaderTime, bool);
//@}
// Expose number of files, first filename and current file number as
// information keys for potential use in the internal reader
static vtkInformationIntegerKey* FILE_SERIES_NUMBER_OF_FILES();
static vtkInformationIntegerKey* FILE_SERIES_CURRENT_FILE_NUMBER();
static vtkInformationStringKey* FILE_SERIES_FIRST_FILENAME();
protected:
vtkFileSeriesReader();
~vtkFileSeriesReader() override;
......
......@@ -128,6 +128,7 @@
<Entry value="1" text="Lon/Lat Projection"/>
<Entry value="2" text="Cassini Projection"/>
<Entry value="3" text="Mollweide Projection"/>
<Entry value="4" text="Catalyst (no scaling)"/>
</EnumerationDomain>
<Documentation>
Select one out of four different projections for the data. The default is lon/lat projection.
......
......@@ -15,6 +15,25 @@
* =========================================================================*/
// .NAME cdilib.c - part of the ICON/CDI netCDF reader
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable : 4013 4068 4101 4244 4267 4273 4477 4700 )
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wstrict-overflow"
#pragma GCC diagnostic ignored "-Wuninitialized"
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
#if defined(__GNUC__) && (__GNUC___ > 8 || (__GNUC__ == 8 && __GNUC_MINOR__ >= 0))
#pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
#if defined(_WIN32) || defined(_WIN64)
#define restrict
#define ssize_t long
......@@ -5793,6 +5812,7 @@ cdiDecodeParam(param, &num, &cat, &dis);
size_t umaxlen = maxlen >= 0 ? (unsigned)maxlen : 0U;
int len;
len = 1;
/*
if ( dis == 255 && (cat == 255 || cat == 0 ) )
len = snprintf(paramstr, umaxlen, "%d", num);
......@@ -21065,19 +21085,12 @@ if ( calendar == CDI_UNDEFID && streamptr->tsteps[0].taxis.type != TAXIS_ABSOLUT
calendar = CALENDAR_STANDARD;
}
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5)
#pragma GCC diagnostic push
#pragma GCC diagnostic warning "-Wstrict-overflow"
#endif
if ( calendar != CDI_UNDEFID )
{
taxis_t *taxis = &streamptr->tsteps[0].taxis;
taxis->calendar = calendar;
taxisDefCalendar(taxisID, calendar);
}
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5)
#pragma GCC diagnostic pop
#endif
vlistDefTaxis(vlistID, taxisID);
......@@ -22615,10 +22628,10 @@ int ncvarid = *ncvaridp;
size_t len = 0;
char txt[CDI_MAX_NAME];
if ( p0status == 0 )
len = (size_t)(sprintf(txt, "%s%s %s%s", "a: a b: b p0: ", p0name, "ps: ", psname));
else
len = (size_t)(sprintf(txt, "%s%s", "ap: ap b: b ps: ", psname));
//if ( p0status == 0 )
// len = (size_t)(sprintf(txt, "%s%s %s%s", "a: a b: b p0: ", p0name, "ps: ", psname));
//else
// len = (size_t)(sprintf(txt, "%s%s", "ap: ap b: b ps: ", psname));
cdf_put_att_text(fileID, ncvarid, "formula_terms", len, txt);
int ncbvarid = CDI_UNDEFID;
......@@ -22673,10 +22686,10 @@ else
cdf_put_att_text(fileID, ncbvarid, "units", strlen(zunits), zunits);
}
if ( p0status == 0 )
len = (size_t)(sprintf(txt, "%s%s %s%s", "a: a_bnds b: b_bnds p0: ", p0name, "ps: ", psname));
else
len = (size_t)(sprintf(txt, "%s%s", "ap: ap_bnds b: b_bnds ps: ", psname));
//if ( p0status == 0 )
// len = (size_t)(sprintf(txt, "%s%s %s%s", "a: a_bnds b: b_bnds p0: ", p0name, "ps: ", psname));
//else
// len = (size_t)(sprintf(txt, "%s%s", "ap: ap_bnds b: b_bnds ps: ", psname));
cdf_put_att_text(fileID, ncbvarid, "formula_terms", len, txt);
}
}
......@@ -28532,6 +28545,7 @@ int vtime_lb, vtime_ub;
taxisInqVdateBounds ( taxisptr->self, &vdate_lb, &vdate_ub);
taxisInqVtimeBounds ( taxisptr->self, &vtime_lb, &vtime_ub);
/*
fprintf(fp,
"#\n"
"# taxisID %d\n"
......@@ -28565,7 +28579,7 @@ fprintf(fp,
taxisptr->numavg, (int)taxisptr->climatology,
(int) taxisptr->has_bounds,
vdate_lb, vtime_lb, vdate_ub, vtime_ub,
taxisptr->fc_unit, taxisptr->fc_period );
taxisptr->fc_unit, taxisptr->fc_period );*/
}
static int
......@@ -29913,14 +29927,6 @@ int varid;
const char *name;
};
static
int cdi_generate_cmp_varname(const void *s1, const void *s2)
{
const struct cdi_generate_varinfo *x = (const struct cdi_generate_varinfo *)s1,
*y = (const struct cdi_generate_varinfo *)s2;
return strcmp(x->name, y->name);
}
void cdi_generate_vars(stream_t *streamptr)
{
int vlistID = streamptr->vlistID;
......@@ -32737,8 +32743,6 @@ const char *units;
}
param_type;
static void tableLink(int tableID, const param_type *pars, int npars);
int tableDef(int modelID, int tablegribID, const char *tablename);
int tableInqParCode(int tableID, char *name, int *code);
......@@ -34555,21 +34559,6 @@ if ( units && units[0] )
}
}
static void tableLink(int tableID, const param_type *pars, int npars)
{
for ( int item = 0; item < npars; item++ )
{
parTable[tableID].pars[item].id = pars[item].id;
parTable[tableID].pars[item].ltype = pars[item].ltype;
parTable[tableID].pars[item].dupflags = 0;
parTable[tableID].pars[item].name = pars[item].name;
parTable[tableID].pars[item].longname = pars[item].longname;
parTable[tableID].pars[item].units = pars[item].units;
}
parTable[tableID].npars = npars;
}
static void parTableInitEntry(int tableID)
{
parTable[tableID].used = false;
......@@ -36850,3 +36839,11 @@ const char *cdiLibraryVersion(void)
{
return cdi_libvers;
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning( pop )
#endif
......@@ -3,6 +3,7 @@ NAME
LIBRARY_NAME
vtkCDIReader
DEPENDS
ParaView::VTKExtensionsCore
VTK::CommonCore
VTK::CommonExecutionModel
PRIVATE_DEPENDS
......
This diff is collapsed.
......@@ -48,10 +48,6 @@
class vtkCallbackCommand;
class vtkDoubleArray;
// FIXME: Don't expose this publicly.
#ifdef PARAVIEW_USE_MPI
class vtkMultiProcessController;
#endif
class vtkStringArray;
class VTKCDIREADER_EXPORT vtkCDIReader : public vtkUnstructuredGridAlgorithm
......@@ -62,15 +58,12 @@ public:
void PrintSelf(ostream& os, vtkIndent indent) override;
void SetFileName(const char* val);
vtkGetStringMacro(FileName);
vtkGetMacro(MaximumCells, int);
vtkGetMacro(MaximumPoints, int);
vtkGetMacro(NumberOfCellVars, int);
vtkGetMacro(NumberOfPointVars, int);
void SetFileSeriesNumbers(int val1, int val2);
void SetFileSeriesFirstName(const char* val);
vtkStringArray* VariableDimensions;
vtkStringArray* AllDimensions;
vtkSmartPointer<vtkIntArray> LoadingDimensions;
......@@ -183,7 +176,6 @@ protected:
bool BuildDomainCellVars();
void RemoveDuplicates(
double* PointLon, double* PointLat, int temp_nbr_vertices, int* triangle_list, int* nbr_cells);
long GetPartitioning(int piece, int numPieces, int numCellsPerLevel, int numPointsPerCell,
int& beginPoint, int& endPoint, int& beginCell, int& endCell);
void SetupPointConnectivity();
......@@ -220,7 +212,9 @@ protected:
int NumberAllPoints;
bool Decomposition;
char *FileName, *FileNameGrid, *FileSeriesFirstName;
std::string FileName;
std::string FileNameGrid;
std::string FileSeriesFirstName;
int* VariableType;
int NumberOfTimeSteps;
double DTime;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment