Commit c4de3dba authored by Ben Boeckel's avatar Ben Boeckel

Merge branch 'upstream-visit-databases' into update-visit-20190320

* upstream-visit-databases:
  visit-databases 2019-03-20 (6cdae7fd)
parents 186d982d c97c8764
/*****************************************************************************
*
* Copyright (c) 2000 - 2017, Lawrence Livermore National Security, LLC
* Copyright (c) 2000 - 2018, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
......
/*****************************************************************************
*
* Copyright (c) 2000 - 2017, Lawrence Livermore National Security, LLC
* Copyright (c) 2000 - 2018, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
......
/*****************************************************************************
*
* Copyright (c) 2000 - 2017, Lawrence Livermore National Security, LLC
* Copyright (c) 2000 - 2018, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
......
/*****************************************************************************
*
* Copyright (c) 2000 - 2017, Lawrence Livermore National Security, LLC
* Copyright (c) 2000 - 2018, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
......
/*****************************************************************************
*
* Copyright (c) 2000 - 2017, 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.
*
*****************************************************************************/
#include <BOVPluginInfo.h>
#include <avtBOVFileFormat.h>
#include <avtSTMDFileFormatInterface.h>
#include <avtGenericDatabase.h>
#include <avtBOVOptions.h>
// ****************************************************************************
// Method: BOVCommonPluginInfo::GetDatabaseType
//
// Purpose:
// Returns the type of a BOV database.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
DatabaseType
BOVCommonPluginInfo::GetDatabaseType()
{
return DB_TYPE_STMD;
}
// ****************************************************************************
// Method: BOVCommonPluginInfo::SetupDatabase
//
// Purpose:
// Sets up a BOV database.
//
// Arguments:
// list A list of file names.
// nList The number of timesteps in list.
// nBlocks The number of blocks in the list.
//
// Returns: A BOV database from list.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
avtDatabase *
BOVCommonPluginInfo::SetupDatabase(const char *const *list,
int nList, int nBlock)
{
avtSTMDFileFormat **ffl = new avtSTMDFileFormat*[nList];
for (int i = 0 ; i < nList ; i++)
{
ffl[i] = new avtBOVFileFormat(list[i], readOptions);
}
avtSTMDFileFormatInterface *inter
= new avtSTMDFileFormatInterface(ffl, nList);
return new avtGenericDatabase(inter);
}
// ****************************************************************************
// Method: BOVCommonPluginInfo::GetReadOptions
//
// Purpose:
// Gets the read options.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
DBOptionsAttributes *
BOVCommonPluginInfo::GetReadOptions() const
{
return GetBOVReadOptions();
}
// ****************************************************************************
// Method: BOVCommonPluginInfo::GetWriteOptions
//
// Purpose:
// Gets the write options.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
DBOptionsAttributes *
BOVCommonPluginInfo::GetWriteOptions() const
{
return GetBOVWriteOptions();
}
// ****************************************************************************
// Method: BOVCommonPluginInfo::GetLicense
//
// Purpose:
// Gets the write options.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
std::string
BOVCommonPluginInfo::GetLicense() const
{
return std::string();
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2017, 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.
*
*****************************************************************************/
#include <BOVPluginInfo.h>
#include <avtBOVWriter.h>
VISIT_DATABASE_PLUGIN_ENTRY(BOV,Engine)
// ****************************************************************************
// Method: BOVEnginePluginInfo::GetWriter
//
// Purpose:
// Sets up a BOV writer.
//
// Returns: A BOV writer.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
avtDatabaseWriter *
BOVEnginePluginInfo::GetWriter(void)
{
return new avtBOVWriter(writeOptions);
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2017, 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.
*
*****************************************************************************/
// ************************************************************************* //
// File: BOVPluginInfo.C
// ************************************************************************* //
#include <BOVPluginInfo.h>
#include <visit-config.h>
VISIT_PLUGIN_VERSION(BOV,DBP_EXPORT)
VISIT_DATABASE_PLUGIN_ENTRY(BOV,General)
// ****************************************************************************
// Method: BOVGeneralPluginInfo::GetName
//
// Purpose:
// Return the name of the database plugin.
//
// Returns: A pointer to the name of the database plugin.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
const char *
BOVGeneralPluginInfo::GetName() const
{
return "BOV";
}
// ****************************************************************************
// Method: BOVGeneralPluginInfo::GetVersion
//
// Purpose:
// Return the version of the database plugin.
//
// Returns: A pointer to the version of the database plugin.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
const char *
BOVGeneralPluginInfo::GetVersion() const
{
return "1.0";
}
// ****************************************************************************
// Method: BOVGeneralPluginInfo::GetID
//
// Purpose:
// Return the id of the database plugin.
//
// Returns: A pointer to the id of the database plugin.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
const char *
BOVGeneralPluginInfo::GetID() const
{
return "BOV_1.0";
}
// ****************************************************************************
// Method: BOVGeneralPluginInfo::EnabledByDefault
//
// Purpose:
// Return true if this plugin should be enabled by default; false otherwise.
//
// Returns: true/false
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
bool
BOVGeneralPluginInfo::EnabledByDefault() const
{
return true;
}
// ****************************************************************************
// Method: BOVGeneralPluginInfo::HasWriter
//
// Purpose:
// Return true if this plugin has a database writer.
//
// Returns: true/false
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
bool
BOVGeneralPluginInfo::HasWriter() const
{
return true;
}
// ****************************************************************************
// Method: BOVGeneralPluginInfo::GetDefaultFilePatterns
//
// Purpose:
// Returns the default patterns for a BOV database.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
std::vector<std::string>
BOVGeneralPluginInfo::GetDefaultFilePatterns() const
{
std::vector<std::string> defaultPatterns;
defaultPatterns.push_back("*.bov");
defaultPatterns.push_back("*.npy");
return defaultPatterns;
}
// ****************************************************************************
// Method: BOVGeneralPluginInfo::AreDefaultFilePatternsStrict
//
// Purpose:
// Returns if the file patterns for a BOV database are
// intended to be interpreted strictly by default.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
bool
BOVGeneralPluginInfo::AreDefaultFilePatternsStrict() const
{
return false;
}
// ****************************************************************************
// Method: BOVGeneralPluginInfo::OpensWholeDirectory
//
// Purpose:
// Returns if the BOV plugin opens a whole directory name
// instead of a single file.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
bool
BOVGeneralPluginInfo::OpensWholeDirectory() const
{
return false;
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2017, 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.
*
*****************************************************************************/
// ****************************************************************************
// BOVPluginInfo.h
// ****************************************************************************
#ifndef BOV_PLUGIN_INFO_H
#define BOV_PLUGIN_INFO_H
#include <DatabasePluginInfo.h>
#include <database_plugin_exports.h>
class avtDatabase;
class avtDatabaseWriter;
// ****************************************************************************
// Class: BOVDatabasePluginInfo
//
// Purpose:
// Classes that provide all the information about the BOV plugin.
// Portions are separated into pieces relevant to the appropriate
// components of VisIt.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
class BOVGeneralPluginInfo : public virtual GeneralDatabasePluginInfo
{
public:
virtual const char *GetName() const;
virtual const char *GetVersion() const;
virtual const char *GetID() const;
virtual bool EnabledByDefault() const;
virtual bool HasWriter() const;
virtual std::vector<std::string> GetDefaultFilePatterns() const;
virtual bool AreDefaultFilePatternsStrict() const;
virtual bool OpensWholeDirectory() const;
};
class BOVCommonPluginInfo : public virtual CommonDatabasePluginInfo, public virtual BOVGeneralPluginInfo
{
public:
virtual DatabaseType GetDatabaseType();
virtual avtDatabase *SetupDatabase(const char * const *list,
int nList, int nBlock);
virtual DBOptionsAttributes *GetReadOptions() const;
virtual DBOptionsAttributes *GetWriteOptions() const;
virtual std::string GetLicense() const;
};
class BOVMDServerPluginInfo : public virtual MDServerDatabasePluginInfo, public virtual BOVCommonPluginInfo
{
public:
// this makes compilers happy... remove if we ever have functions here
virtual void dummy();
};
class BOVEnginePluginInfo : public virtual EngineDatabasePluginInfo, public virtual BOVCommonPluginInfo
{
public:
virtual avtDatabaseWriter *GetWriter(void);
};
#endif
set(SOURCES
avtBOVFileFormat.C
avtBOVOptions.C
avtBOVWriter.C
BOVPluginInfo.C
BOVEnginePluginInfo.C
BOVCommonPluginInfo.C
)
ADD_VISIT_READER(VisItBOVReader "1.0"
VISIT_READER_TYPE "STMD"
VISIT_READER_NAME "avtBOVFileFormat"
VISIT_READER_USES_OPTIONS ON
SERVER_SOURCES ${SOURCES}
)
......@@ -83,9 +83,13 @@
#include <cstring>
#include <cerrno>
#include <avtBOVOptions.h>
#include <DBOptionsAttributes.h>
#ifdef _WIN32
#define FSEEK _fseeki64
#define strcasecmp stricmp
#include <Shlwapi.h> // for PathIsRelative
#else
#define FSEEK fseek
#endif
......@@ -135,9 +139,13 @@ static bool fillSpace = true;
// Hank Childs, Tue Nov 30 11:41:44 PST 2010
// Initialize members for whether or not the time or cycle is accurate.
//
// Alister Maguire, Thu Sep 7 09:02:03 PDT 2017
// Added DBOptionsAttributes as a constructor argument.
//
// ****************************************************************************
avtBOVFileFormat::avtBOVFileFormat(const char *fname)
avtBOVFileFormat::avtBOVFileFormat(const char *fname,
DBOptionsAttributes *opts)
: avtSTMDFileFormat(&fname, 1)
{
//
......@@ -953,7 +961,11 @@ avtBOVFileFormat::GetVar(int dom, const char *var)
char filename[1024];
sprintf(filename, file_pattern.c_str(), dom);
char qual_filename[1024];
#ifdef WIN32
if (PathIsRelative(filename))