Commit b01b3cde authored by whitlocb's avatar whitlocb

Added a reader for parallel Velodyne files.

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@23625 18c085ea-50e0-402c-830e-de6fd14e8384
parent 1bbebb3f
......@@ -256,6 +256,7 @@ M3D
M3DC1
PFLOTRAN
Pixie
PVLD
SAMRAI
SXRIS
Tetrad
......
# DO NOT EDIT THIS FILE! THIS FILE IS AUTOMATICALLY GENERATED BY xml2cmake
PROJECT(PVLD)
INCLUDE(${VISIT_SOURCE_DIR}/CMake/PluginMacros.cmake)
SET(COMMON_SOURCES
PVLDPluginInfo.C
PVLDCommonPluginInfo.C
)
SET(LIBI_SOURCES
PVLDPluginInfo.C
)
SET(LIBM_SOURCES
PVLDMDServerPluginInfo.C
${COMMON_SOURCES}
statm.C
dbginfo.C
Partition.C
pvldReader.C
pvldPartReader.C
avtPVLDFileFormat.C
)
SET(LIBE_SOURCES
PVLDEnginePluginInfo.C
${COMMON_SOURCES}
statm.C
dbginfo.C
Partition.C
pvldReader.C
pvldPartReader.C
avtPVLDFileFormat.C
)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${HDF5_INCLUDE_DIR}
${VISIT_COMMON_INCLUDES}
${VISIT_INCLUDE_DIR}/avt/DBAtts/MetaData
${VISIT_INCLUDE_DIR}/avt/DBAtts/SIL
${VISIT_INCLUDE_DIR}/avt/Database/Database
${VISIT_INCLUDE_DIR}/avt/Database/Formats
${VISIT_INCLUDE_DIR}/avt/Database/Ghost
${VISIT_INCLUDE_DIR}/avt/FileWriter
${VISIT_INCLUDE_DIR}/avt/Filters
${VISIT_INCLUDE_DIR}/avt/MIR/Base
${VISIT_INCLUDE_DIR}/avt/MIR/Tet
${VISIT_INCLUDE_DIR}/avt/MIR/Zoo
${VISIT_INCLUDE_DIR}/avt/Math
${VISIT_INCLUDE_DIR}/avt/Pipeline/AbstractFilters
${VISIT_INCLUDE_DIR}/avt/Pipeline/Data
${VISIT_INCLUDE_DIR}/avt/Pipeline/Pipeline
${VISIT_INCLUDE_DIR}/avt/Pipeline/Sinks
${VISIT_INCLUDE_DIR}/avt/Pipeline/Sources
${VISIT_INCLUDE_DIR}/avt/VisWindow/VisWindow
${VISIT_INCLUDE_DIR}/visit_vtk/full
${VISIT_INCLUDE_DIR}/visit_vtk/lightweight
${VTK_INCLUDE_DIRS}
)
#ADD_DEFINITIONS("-std=c++1y")
#ADD_DEFINITIONS("-std=gnu++0x")
LINK_DIRECTORIES(${VISIT_LIBRARY_DIR} ${VTK_LIBRARY_DIRS} ${HDF5_LIBRARY_DIR} )
ADD_LIBRARY(IPVLDDatabase ${LIBI_SOURCES})
TARGET_LINK_LIBRARIES(IPVLDDatabase visitcommon)
SET(INSTALLTARGETS IPVLDDatabase)
IF(NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO_ONLY)
ADD_LIBRARY(MPVLDDatabase ${LIBM_SOURCES} )
TARGET_LINK_LIBRARIES(MPVLDDatabase visitcommon avtdbatts avtdatabase_ser ${HDF5_LIB} ${ZLIB_LIB} )
ADD_TARGET_DEFINITIONS(MPVLDDatabase MDSERVER)
SET(INSTALLTARGETS ${INSTALLTARGETS} MPVLDDatabase)
ENDIF(NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO_ONLY)
ADD_LIBRARY(EPVLDDatabase_ser ${LIBE_SOURCES})
TARGET_LINK_LIBRARIES(EPVLDDatabase_ser visitcommon avtdatabase_ser avtpipeline_ser ${HDF5_LIB} ${ZLIB_LIB} )
ADD_TARGET_DEFINITIONS(EPVLDDatabase_ser ENGINE)
SET(INSTALLTARGETS ${INSTALLTARGETS} EPVLDDatabase_ser)
IF(VISIT_PARALLEL)
ADD_PARALLEL_LIBRARY(EPVLDDatabase_par ${LIBE_SOURCES})
TARGET_LINK_LIBRARIES(EPVLDDatabase_par visitcommon avtdatabase_par avtpipeline_par ${HDF5_LIB} ${ZLIB_LIB} )
ADD_TARGET_DEFINITIONS(EPVLDDatabase_par ENGINE)
SET(INSTALLTARGETS ${INSTALLTARGETS} EPVLDDatabase_par)
ENDIF(VISIT_PARALLEL)
VISIT_INSTALL_DATABASE_PLUGINS(${INSTALLTARGETS})
VISIT_PLUGIN_TARGET_RTOD(databases ${INSTALLTARGETS})
VISIT_PLUGIN_TARGET_FOLDER(databases PVLD ${INSTALLTARGETS})
This code was contributed to the VisIt project in June 2014 by
Corvid Technologies.
<?xml version="1.0"?>
<Plugin name="PVLD" type="database" label="Partitioned Velodyne plot file" version="1" enabled="true" mdspecificcode="false" engspecificcode="false" onlyengine="false" noengine="false" dbtype="STMD" haswriter="false" hasoptions="false" filePatternsStrict="false" opensWholeDirectory="false">
<FilePatterns>
*.pvld *.vld
</FilePatterns>
<CXXFLAGS>
${HDF5_INCLUDE_DIR}
-std=c++1y
</CXXFLAGS>
<LDFLAGS>
${HDF5_LIBRARY_DIR}
</LDFLAGS>
<LIBS>
${HDF5_LIB}
${ZLIB_LIB}
</LIBS>
<Files components="M">
statm.C
dbginfo.C
Partition.C
pvldReader.C
pvldPartReader.C
avtPVLDFileFormat.C
</Files>
<Files components="E">
statm.C
dbginfo.C
Partition.C
pvldReader.C
pvldPartReader.C
avtPVLDFileFormat.C
</Files>
<Attribute name="" purpose="" persistent="true" keyframe="true" exportAPI="" exportInclude="">
</Attribute>
</Plugin>
/*****************************************************************************
*
* Copyright (c) 2000 - 2014, 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 <PVLDPluginInfo.h>
#include <avtPVLDFileFormat.h>
#include <avtSTMDFileFormatInterface.h>
#include <avtGenericDatabase.h>
// ****************************************************************************
// Method: PVLDCommonPluginInfo::GetDatabaseType
//
// Purpose:
// Returns the type of a PVLD database.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
DatabaseType
PVLDCommonPluginInfo::GetDatabaseType()
{
return DB_TYPE_STMD;
}
// ****************************************************************************
// Method: PVLDCommonPluginInfo::SetupDatabase
//
// Purpose:
// Sets up a PVLD 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 PVLD database from list.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
avtDatabase *
PVLDCommonPluginInfo::SetupDatabase(const char *const *list,
int nList, int nBlock)
{
avtSTMDFileFormat **ffl = new avtSTMDFileFormat*[nList];
for (int i = 0 ; i < nList ; i++)
{
ffl[i] = new avtPVLDFileFormat(list[i]);
}
avtSTMDFileFormatInterface *inter
= new avtSTMDFileFormatInterface(ffl, nList);
return new avtGenericDatabase(inter);
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2014, 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 <PVLDPluginInfo.h>
// ****************************************************************************
// Function: GetEngineInfo
//
// Purpose:
// Return a new EnginePluginInfo for the PVLD database.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
extern "C" DBP_EXPORT EngineDatabasePluginInfo* PVLD_GetEngineInfo()
{
return new PVLDEnginePluginInfo;
}
// ****************************************************************************
// Method: PVLDEnginePluginInfo::GetWriter
//
// Purpose:
// Sets up a PVLD writer.
//
// Returns: A PVLD writer.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
avtDatabaseWriter *
PVLDEnginePluginInfo::GetWriter(void)
{
return NULL;
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2014, 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 <PVLDPluginInfo.h>
// ****************************************************************************
// Function: GetMDServerInfo
//
// Purpose:
// Return a new MDServerPluginInfo for the PVLD database.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
extern "C" DBP_EXPORT MDServerDatabasePluginInfo* PVLD_GetMDServerInfo()
{
return new PVLDMDServerPluginInfo;
}
// this makes compilers happy... remove if we ever have functions here
void PVLDMDServerPluginInfo::dummy()
{
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2014, 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: PVLDPluginInfo.C
// ************************************************************************* //
#include <PVLDPluginInfo.h>
#include <visit-config.h>
VISIT_PLUGIN_VERSION(PVLD,DBP_EXPORT)
// ****************************************************************************
// Function: GetGeneralInfo
//
// Purpose:
// Return a new GeneralPluginInfo for the PVLD database.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
extern "C" DBP_EXPORT GeneralDatabasePluginInfo* PVLD_GetGeneralInfo()
{
return new PVLDGeneralPluginInfo;
}
// ****************************************************************************
// Method: PVLDGeneralPluginInfo::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 *
PVLDGeneralPluginInfo::GetName() const
{
return "ParallelVelodyne";
}
// ****************************************************************************
// Method: PVLDGeneralPluginInfo::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 *
PVLDGeneralPluginInfo::GetVersion() const
{
return "1";
}
// ****************************************************************************
// Method: PVLDGeneralPluginInfo::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 *
PVLDGeneralPluginInfo::GetID() const
{
return "ParallelVelodyne_1";
}
// ****************************************************************************
// Method: PVLDGeneralPluginInfo::EnabledByDefault
//
// Purpose:
// Return true if this plugin should be enabled by default; false otherwise.
//
// Returns: true/false
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
bool
PVLDGeneralPluginInfo::EnabledByDefault() const
{
return true;
}
// ****************************************************************************
// Method: PVLDGeneralPluginInfo::HasWriter
//
// Purpose:
// Return true if this plugin has a database writer.
//
// Returns: true/false
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
bool
PVLDGeneralPluginInfo::HasWriter() const
{
return false;
}
// ****************************************************************************
// Method: PVLDGeneralPluginInfo::GetDefaultFilePatterns
//
// Purpose:
// Returns the default patterns for a PVLD database.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
std::vector<std::string>
PVLDGeneralPluginInfo::GetDefaultFilePatterns() const
{
std::vector<std::string> defaultPatterns;
defaultPatterns.push_back("*.vld");
defaultPatterns.push_back("*.pvld");
return defaultPatterns;
}
// ****************************************************************************
// Method: PVLDGeneralPluginInfo::AreDefaultFilePatternsStrict
//
// Purpose:
// Returns if the file patterns for a PVLD database are
// intended to be interpreted strictly by default.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
bool
PVLDGeneralPluginInfo::AreDefaultFilePatternsStrict() const
{
return false;
}
// ****************************************************************************
// Method: PVLDGeneralPluginInfo::OpensWholeDirectory
//
// Purpose:
// Returns if the PVLD plugin opens a whole directory name
// instead of a single file.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
bool
PVLDGeneralPluginInfo::OpensWholeDirectory() const
{
return false;
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2014, 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.
*
*****************************************************************************/
// ****************************************************************************
// PVLDPluginInfo.h
// ****************************************************************************
#ifndef PVLD_PLUGIN_INFO_H
#define PVLD_PLUGIN_INFO_H
#include <DatabasePluginInfo.h>
#include <database_plugin_exports.h>
class avtDatabase;
class avtDatabaseWriter;
// ****************************************************************************
// Class: PVLDDatabasePluginInfo
//
// Purpose:
// Classes that provide all the information about the PVLD plugin.
// Portions are separated into pieces relevant to the appropriate
// components of VisIt.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
class PVLDGeneralPluginInfo : 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 PVLDCommonPluginInfo : public virtual CommonDatabasePluginInfo, public virtual PVLDGeneralPluginInfo
{
public:
virtual DatabaseType GetDatabaseType();
virtual avtDatabase *SetupDatabase(const char * const *list,
int nList, int nBlock);
};
class PVLDMDServerPluginInfo : public virtual MDServerDatabasePluginInfo, public virtual PVLDCommonPluginInfo
{
public:
// this makes compilers happy... remove if we ever have functions here
virtual void dummy();
};
class PVLDEnginePluginInfo : public virtual EngineDatabasePluginInfo, public virtual PVLDCommonPluginInfo
{
public:
virtual avtDatabaseWriter *GetWriter(void);
};
#endif
#include <algorithm>
#include <Partition.h>
#include <DebugStream.h>
class Mat
{
public:
int ind,wei;
Mat() : ind(0),wei(0) {}
};
class MatCompare
{
public:
bool operator()( const Mat& m1, const Mat& m2 )
{
return m1.wei >= m2.wei;
}
};
class Prt
{
public:
int wei;
vector<int> clt;
Prt() : wei(0), clt() {}
};
class PrtCompare
{
public:
bool operator()( const Prt& m1, const Prt& m2 )
{
return m1.wei < m2.wei;
}
};
void PartitionWeights( const vector<int>& wlst,
int npart, vector< vector<int> >& part )
{
vector<Mat> mlst;
int cnt=0;
for( vector<int>::const_iterator iter=wlst.begin(); iter!=wlst.end(); iter++ )
{
Mat smp;
smp.ind = cnt++;
smp.wei = *iter;
mlst.push_back( smp );
}
//std::sort( mlst.begin(), mlst.end(), MatCompare() );
std::stable_sort( mlst.begin(), mlst.end(), MatCompare() );
// greedy algorithm for partition
vector<Prt> plst( npart );
vector<Mat>::const_iterator mloc = mlst.begin();
for( vector<Prt>::iterator iter=plst.begin(); iter!=plst.end(); ++iter )
if( mloc != mlst.end() )
{
iter->wei += mloc->wei;
iter->clt.push_back( mloc->ind );
++mloc;
}