Commit 6591fa4e authored by pugmire's avatar pugmire

Add schema, specfm readers. Upgrade to 1.6.0

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@22561 18c085ea-50e0-402c-830e-de6fd14e8384
parent 3920bc25
This diff is collapsed.
......@@ -49,12 +49,18 @@
#ifdef PARALLEL
#include <mpi.h>
#else
extern "C"
{
#include <mpidummy.h>
}
#define _NOMPI
#endif
extern "C"
{
#include <adios_read.h>
extern void adios_read_bp_reset_dimension_order (const ADIOS_FILE *fp, int is_fortran);
}
class ADIOSVar;
......@@ -101,8 +107,6 @@ class ADIOSFileObject
std::string Filename() const {return fileName;}
int NumTimeSteps();
void GetCycles(std::vector<int> &cycles);
void GetCycles(std::string &varNm, std::vector<int> &cycles);
void GetTimes(std::string &varNm, std::vector<double> &times);
//Attributes
bool GetIntAttr(const std::string &nm, int &val);
......@@ -122,23 +126,27 @@ class ADIOSFileObject
//Variables.
bool ReadVariable(const std::string &nm,
int ts,
int dom,
vtkDataArray **array);
bool ReadVariable(const std::string &nm,
int ts,
int dom,
vtkFloatArray **array);
std::map<std::string, ADIOSVar> variables;
std::map<std::string, ADIOSScalar> scalars;
std::map<std::string, ADIOSAttr> attributes;
void SetResetDimensionOrder() {resetDimensionOrder = true;}
void UnsetResetDimensionOrder() {resetDimensionOrder = false;}
protected:
std::string fileName;
ADIOS_FILE *fp;
ADIOS_GROUP **gps;
void OpenGroup(int grpIdx);
void CloseGroup(int grpIdx);
int numTimeSteps;
bool resetDimensionOrder;
void ResetDimensionOrder() {adios_read_bp_reset_dimension_order(fp, 0);}
static vtkPoints *AllocatePoints(ADIOS_DATATYPES &t);
static vtkDataArray *AllocateArray(ADIOS_DATATYPES &t);
......@@ -160,13 +168,13 @@ class ADIOSVar
{
public:
ADIOSVar();
ADIOSVar(const std::string &nm, int grpIdx, ADIOS_VARINFO *avi);
ADIOSVar(const std::string &nm, ADIOS_VARINFO *avi);
~ADIOSVar() {}
void GetReadArrays(int ts, uint64_t *s, uint64_t *c, int *ntuples);
ADIOS_DATATYPES type;
int dim, groupIdx, varid, timedim;
int dim, varIdx, nTimeSteps;
uint64_t start[3], count[3], global[3];
std::string name;
double extents[2];
......@@ -298,8 +306,7 @@ class ADIOSAttr : public ADIOSScalar
inline std::ostream& operator<<(std::ostream& out, const ADIOSVar &v)
{
out<<"ADIOSVar: "<<v.name<<endl;
out<<" dim= "<<v.dim<<" timedim= "<<v.timedim<<endl;
out<<" type= "<<v.type<<" gIdx, vId= "<<v.groupIdx<<" "<<v.varid<<endl;
out<<" dim= "<<v.dim<<" type= "<<v.type<<" idx= "<<v.varIdx<<" nTime= "<<v.nTimeSteps<<endl;
out<<" global= ["<<v.global[0]<<" "<<v.global[1]<<" "<<v.global[2]<<"]"<<endl;
out<<" start= ["<<v.start[0]<<" "<<v.start[1]<<" "<<v.start[2]<<"]"<<endl;
out<<" count= ["<<v.count[0]<<" "<<v.count[1]<<" "<<v.count[2]<<"]"<<endl;
......@@ -343,10 +350,10 @@ inline std::ostream& operator<<(std::ostream& out, const ADIOSScalar &s)
inline std::ostream& operator<<(std::ostream& out, const ADIOSAttr &s)
{
out<<"ADIOSAttr: "<<s.Name()<<" value= ";
if (s.IsInt()) out<<s.AsInt();
else if (s.IsFloat()) out<<s.AsFloat();
else if (s.IsDouble()) out<<s.AsDouble();
else if (s.IsString()) out<<s.AsString();
if (s.IsInt()) out<<s.AsInt()<<" type=INT";
else if (s.IsFloat()) out<<s.AsFloat()<<" type=FLOAT";
else if (s.IsDouble()) out<<s.AsDouble()<<" type=DOUBLE";
else if (s.IsString()) out<<"'"<<s.AsString()<<"' type=STRING";
out<<endl;
return out;
}
......
......@@ -18,7 +18,9 @@ ${COMMON_SOURCES}
avtADIOSFileFormat.C
avtADIOSBasicFileFormat.C
avtXGCFileFormat.C
avtPixieFileFormat.C
#avtPixieFileFormat.C
avtSpecFEMFileFormat.C
avtADIOSSchemaFileFormat.C
ADIOSFileObject.C
)
......@@ -28,7 +30,9 @@ ${COMMON_SOURCES}
avtADIOSFileFormat.C
avtADIOSBasicFileFormat.C
avtXGCFileFormat.C
avtPixieFileFormat.C
#avtPixieFileFormat.C
avtSpecFEMFileFormat.C
avtADIOSSchemaFileFormat.C
ADIOSFileObject.C
)
......
......@@ -71,7 +71,7 @@
// ****************************************************************************
bool
avtADIOSBasicFileFormat::Identify(ADIOSFileObject *f)
avtADIOSBasicFileFormat::Identify(const char *fname)
{
//Any bp file is a basic file format.
return true;
......@@ -146,6 +146,7 @@ avtADIOSBasicFileFormat::~avtADIOSBasicFileFormat()
int
avtADIOSBasicFileFormat::GetNTimesteps()
{
cout<<"NSTEPS: "<<fileObj->NumTimeSteps()<<endl;
return fileObj->NumTimeSteps();
}
......@@ -163,7 +164,12 @@ avtADIOSBasicFileFormat::GetNTimesteps()
void
avtADIOSBasicFileFormat::GetCycles(std::vector<int> &cycles)
{
fileObj->GetCycles(cycles);
int nt = fileObj->NumTimeSteps();
cycles.resize(nt);
for (int i = 0; i < nt; i++)
cycles[i] = i;
cout<<"cycles sz= "<<cycles.size()<<endl;
}
......@@ -292,6 +298,7 @@ vtkDataSet *
avtADIOSBasicFileFormat::GetMesh(int timestate, int domain, const char *meshname)
{
debug1 << "avtADIOSBasicFileFormat::GetMesh " << meshname << endl;
cout << "avtADIOSBasicFileFormat::GetMesh " << meshname << " "<<domain<<" "<<timestate<<endl;
Initialize();
// Look it up in the mesh table.
......@@ -302,7 +309,6 @@ avtADIOSBasicFileFormat::GetMesh(int timestate, int domain, const char *meshname
grid = CreateUniformGrid(m->second.start,
m->second.count);
grid->Register(NULL);
return grid;
}
......@@ -313,8 +319,8 @@ avtADIOSBasicFileFormat::GetMesh(int timestate, int domain, const char *meshname
vtkRectilinearGrid *grid = NULL;
grid = CreateUniformGrid(v->second.start,
v->second.count);
vtkFloatArray *vals = NULL;
if (!fileObj->ReadVariable(meshname, timestate, &vals))
vtkDataArray *vals = NULL;
if (!fileObj->ReadVariable(meshname, timestate, 0, &vals))
EXCEPTION1(InvalidVariableException, meshname);
vals->SetName(meshname);
grid->GetPointData()->SetScalars(vals);
......@@ -349,9 +355,10 @@ vtkDataArray *
avtADIOSBasicFileFormat::GetVar(int timestate, int domain, const char *varname)
{
debug1 << "avtADIOSBasicFileFormat::GetVar " << varname << endl;
cout << "avtADIOSBasicFileFormat::GetVar " << varname << " "<<timestate<<" "<<domain<<endl;
Initialize();
vtkFloatArray *arr = NULL;
if (! fileObj->ReadVariable(varname, timestate, &arr))
vtkDataArray *arr = NULL;
if (! fileObj->ReadVariable(varname, timestate, 0, &arr))
EXCEPTION1(InvalidVariableException, varname);
return arr;
......@@ -401,10 +408,7 @@ avtADIOSBasicFileFormat::GenerateMeshName(const ADIOSVar &v)
std::string meshname = "mesh_";
for (int i=0; i<v.dim; i++)
{
if (i != v.timedim)
dims.insert(dims.begin(), v.global[i]);
}
dims.insert(dims.begin(), v.global[i]);
for (int i=0; i <dims.size(); i++)
{
......@@ -431,6 +435,7 @@ avtADIOSBasicFileFormat::GenerateMeshName(const ADIOSVar &v)
void
avtADIOSBasicFileFormat::Initialize()
{
cout<<"INitialize()"<<endl;
if (! fileObj->Open())
EXCEPTION0(ImproperUseException);
......@@ -558,7 +563,7 @@ avtADIOSBasicFileFormat::DoDomainDecomposition()
}
}
//Set each mesh.
//Set each mesh.v
std::map<std::string, meshInfo>::iterator m;
for (m = meshes.begin(); m != meshes.end(); m++)
{
......@@ -604,7 +609,7 @@ avtADIOSBasicFileFormat::CreateUniformGrid(const uint64_t *start,
{
vtkRectilinearGrid *grid = vtkRectilinearGrid::New();
vtkFloatArray *coords[3] = {NULL,NULL,NULL};
int dims[3] = {1,1,1};
for (int i = 0; i<3; i++)
{
......@@ -616,13 +621,8 @@ avtADIOSBasicFileFormat::CreateUniformGrid(const uint64_t *start,
int x = (int)start[i];
debug5<<"I= "<<i<<endl;
for (int j = 0; j < count[i]; j++, x++)
{
for (int j = 0; j < dims[i]; j++, x++)
data[j] = (float)x;
debug5<<" "<<x;
}
debug5<<endl;
}
grid->SetDimensions(dims);
grid->SetXCoordinates(coords[0]);
......
......@@ -72,7 +72,7 @@ class vtkRectilinearGrid;
class avtADIOSBasicFileFormat : public avtMTMDFileFormat
{
public:
static bool Identify(ADIOSFileObject *);
static bool Identify(const char *fname);
static avtFileFormatInterface *CreateInterface(const char *const *list,
int nList,
int nBlock);
......@@ -92,9 +92,7 @@ class avtADIOSBasicFileFormat : public avtMTMDFileFormat
// If you know the times and cycle numbers, overload this function.
// Otherwise, VisIt will make up some reasonable ones for you.
//
virtual void GetCycles(std::vector<int> &);
// virtual void GetTimes(std::vector<double> &);
//
virtual void GetCycles(std::vector<int> &);
virtual int GetNTimesteps(void);
......
......@@ -48,6 +48,8 @@
#include "avtADIOSBasicFileFormat.h"
#include "avtXGCFileFormat.h"
#include "avtPixieFileFormat.h"
#include "avtSpecFEMFileFormat.h"
#include <avtADIOSSchemaFileFormat.h>
// ****************************************************************************
// Method: ADIOS_CreateFileFormatInterface
......@@ -79,53 +81,71 @@ ADIOS_CreateFileFormatInterface(const char * const *list, int nList, int nBlock)
{
avtFileFormatInterface *ffi = NULL;
//ffi = avtSpecFEMFileFormat::CreateInterface(list, nList, nBlock);
//ffi = avtXGCFileFormat::CreateInterface(list, nList, nBlock);
//ffi = avtADIOSSchemaFileFormat::CreateInterface(list, nList, nBlock);
//return ffi;
if(list != NULL || nList > 0)
{
// Determine the type of reader that we want to use.
ADIOSFileObject *f = NULL;
int flavor = -1;
TRY
{
f = new ADIOSFileObject(list[0]);
f->Open();
if (avtXGCFileFormat::Identify(f))
if (avtXGCFileFormat::Identify(list[0]))
{
debug5<<"Database is avtXGCFileFormat"<<endl;
flavor = 1;
}
else if (avtPixieFileFormat::Identify(f))
/*
else if (avtPixieFileFormat::Identify(list[0]))
{
debug5<<"Database is avtPixieFileFormat"<<endl;
flavor = 2;
}
else if (avtADIOSBasicFileFormat::Identify(f))
*/
else if (avtSpecFEMFileFormat::Identify(list[0]))
{
debug5<<"Database is avtSpecFEMFileFormat"<<endl;
flavor = 3;
}
else if (avtADIOSSchemaFileFormat::Identify(list[0]))
{
debug5<<"Database is avtADIOSSchemaFileFormat"<<endl;
flavor = 4;
}
else if (avtADIOSBasicFileFormat::Identify(list[0]))
{
debug5<<"Database is avtADIOSBasicFileFormat"<<endl;
flavor = 0;
}
delete f;
}
CATCH(VisItException)
{
delete f;
RETHROW;
}
ENDTRY
switch(flavor)
{
case 1:
ffi = avtXGCFileFormat::CreateInterface(list, nList, nBlock);
break;
case 2:
ffi = avtPixieFileFormat::CreateInterface(list, nList, nBlock);
break;
case 3:
ffi = avtSpecFEMFileFormat::CreateInterface(list, nList, nBlock);
break;
case 4:
ffi = avtADIOSSchemaFileFormat::CreateInterface(list, nList, nBlock);
break;
case 0:
ffi = avtADIOSBasicFileFormat::CreateInterface(list, nList, nBlock);
break;
default:
delete f;
return NULL;
}
......
This diff is collapsed.
/*****************************************************************************
*
* Copyright (c) 2000 - 2012, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
// ************************************************************************* //
// avtADIOSFileFormat.h //
// ************************************************************************* //
#ifndef AVT_ADIOSSchema_FILE_FORMAT_H
#define AVT_ADIOSSchema_FILE_FORMAT_H
#include <avtMTMDFileFormat.h>
#include <vector>
#include <string>
#include <map>
class avtFileFormatInterface;
class vtkRectilinearGrid;
// ****************************************************************************
// Class: avtADIOSSchemaFileFormat
//
// Purpose:
// Reads in ADIOSSchema-ADIOS files as a plugin to VisIt.
//
// Programmer: Dave Pugmire
// Creation: Wed Mar 17 15:29:24 EDT 2010
//
// Modifications:
//
// ****************************************************************************
class avtADIOSSchemaFileFormat : public avtMTMDFileFormat
{
public:
static bool Identify(const char *fname);
static avtFileFormatInterface *CreateInterface(const char *const *list,
int nList,
int nBlock);
avtADIOSSchemaFileFormat(const char *);
virtual ~avtADIOSSchemaFileFormat();
virtual void GetCycles(std::vector<int> &);
virtual void GetTimes(std::vector<double> &);
virtual int GetNTimesteps(void);
virtual const char *GetType(void) { return "ADIOSSchema"; };
virtual void FreeUpResources(void);
virtual vtkDataSet *GetMesh(int, int, const char *);
virtual vtkDataArray *GetVar(int, int, const char *);
virtual vtkDataArray *GetVectorVar(int, int, const char *);
protected:
std::string filename;
bool initialized;
void Initialize();
virtual void PopulateDatabaseMetaData(avtDatabaseMetaData *, int);
ADIOS_FILE *fp;
int numTimes;
std::map<std::string, ADIOS_MESH *> meshes;
std::map<std::string, ADIOS_VARINFO *> vars;
std::map<std::string, std::string> varMeshes;
vtkDataSet * MakeUniformMesh(MESH_UNIFORM *m, int ts, int dom);
vtkDataSet * MakeRectilinearMesh(MESH_RECTILINEAR *m, int ts, int dom);
vtkDataSet * MakeStructuredMesh(MESH_STRUCTURED *m, int ts, int dom);
vtkDataSet * MakeUnstructuredMesh(MESH_UNSTRUCTURED *m, int ts, int dom);
void ReadData(ADIOS_VARINFO *avi, int ts, void *data);
};
#endif
This diff is collapsed.
/*****************************************************************************
*
* Copyright (c) 2000 - 2012, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
// ************************************************************************* //
// avtADIOSFileFormat.h //
// ************************************************************************* //
#ifndef AVT_SpecFEM_FILE_FORMAT_H
#define AVT_SpecFEM_FILE_FORMAT_H
#include <avtMTMDFileFormat.h>
#include <vector>
#include <string>
#include <map>
class ADIOSFileObject;
class avtFileFormatInterface;
class vtkRectilinearGrid;
// ****************************************************************************
// Class: avtSpecFEMFileFormat
//
// Purpose:
// Reads in SpecFEM-ADIOS files as a plugin to VisIt.
//
// Programmer: Dave Pugmire
// Creation: Wed Mar 17 15:29:24 EDT 2010
//
// Modifications:
//
// ****************************************************************************
class avtSpecFEMFileFormat : public avtMTMDFileFormat
{
public:
static bool Identify(const char *fname);
static avtFileFormatInterface *CreateInterface(const char *const *list,
int nList,
int nBlock);
static void GenerateFileNames(const std::string &nm,
std::string &meshNm, std::string &dataNm);
static bool IsMeshFile(ADIOSFileObject *);
static bool IsDataFile(ADIOSFileObject *);
avtSpecFEMFileFormat(const char *);
virtual ~avtSpecFEMFileFormat();
virtual void GetCycles(std::vector<int> &);
virtual void GetTimes(std::vector<double> &);
virtual int GetNTimesteps(void);
virtual const char *GetType(void) { return "ADIOS-SpecFEM"; };
virtual void FreeUpResources(void);
virtual vtkDataSet *GetMesh(int, int, const char *);
virtual vtkDataArray *GetVar(int, int, const char *);
virtual vtkDataArray *GetVectorVar(int, int, const char *);
protected:
ADIOSFileObject *meshFile, *dataFile;
int ngllx, nglly, ngllz, nWriters, nRegions;
int nElems, nPts;
bool initialized;
void Initialize();
virtual void PopulateDatabaseMetaData(avtDatabaseMetaData *, int);
//std::map<std::string, std::string> variables;
std::vector<std::string> variables;
std::vector<std::pair<std::string, int> > domainVarPaths;
};
#endif
This diff is collapsed.
......@@ -66,11 +66,12 @@ class vtkRectilinearGrid;
class avtXGCFileFormat : public avtMTMDFileFormat
{
public:
static bool Identify(ADIOSFileObject *);
static bool Identify(const char *fname);
static avtFileFormatInterface *CreateInterface(const char *const *list,
int nList,
int nBlock);
static std::string CreateMeshName(const std::string &filename);
static std::string CreateDiagName(const std::string &filename);
static bool IsFieldPFile(ADIOSFileObject *f);
static bool IsFieldIFile(ADIOSFileObject *f);
......@@ -104,13 +105,17 @@ class avtXGCFileFormat : public avtMTMDFileFormat
virtual vtkDataArray *GetVectorVar(int, int, const char *);
protected:
ADIOSFileObject *file, *meshFile;
ADIOSFileObject *file, *meshFile, *diagFile;
std::map<std::string, std::string> labelToVar;
bool initialized;
int numNodes, numTris, numPhi;
void Initialize();
vtkDataArray *GetTurbulence(int ts, int dom);
vtkDataArray *GetSep();
vtkDataSet *GetSepMesh();
virtual void PopulateDatabaseMetaData(avtDatabaseMetaData *, int);
};
......
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