Commit e2e2cdc7 authored by miller86's avatar miller86
Browse files

switching to shared hdf5; removing obsolete silo code; making it possible to...

switching to shared hdf5; removing obsolete silo code; making it possible to build VisIt without silo

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@5358 18c085ea-50e0-402c-830e-de6fd14e8384
parent 2b68c205
......@@ -12,3 +12,269 @@
# PARTICULAR PURPOSE.
m4_include([acinclude.m4])
# Macro: VAC_ARG_WITH3RD
#
# Programmer: Mark C. Miller
# Created: Tue Oct 21 09:18:59 PDT 2008
#
# A very helpful third party library macro. What does this macro do?
#
# A. Prints a nice help message without the caller having to worry about
# formatting. The help message is 'integrated' with a header help
# message that details how to format the arg to --with-xxx options.
# B. Unifies and sanitizes the naming of symbols for Make and
# C Pre-Processor. For Makefiles, it defines...
# XXX_INCLUDE (which should probably really be called XXX_CPPFLAGS)
# XXX_LIB (which should probably really be called XXX_LDFLAGS)
# XXX_TARGET (used to identify make targets that depend on lib)
# For C Pre-Processor, it defines...
# HAVE_LIBXXX
# C. Handles a variety of ways of formatting the argument to a
# --with-xxx=<withval> command line option to configure where <withval>
# can be any of the following...
# no totally disable use of the specified lib
# yes use the lib as provided by the platform
# builtin use the lib in third party builtin
# <DIR>[:<DEPLIBS>] single directory above inc[lude] and lib
# <IDIR>,<LDIR>[:<DEPLIBS>] separate paths to inc[lude] and lib dirs
# where <DEPLIBS> is an optional set of dependent library paths and flags.
# D. Confirms existence and readability of key header file(s) for library.
# E. Confirms existence and readability of key library files for library.
# F. Handles variance of names of the lib (e.g. silo/siloh5)
# G. Handles variance in library extension (e.g. .a/.so/.dylib)
# H. Creates symbolic links in VisIt's lib dir for the lib and its
# dependent libs, if any. We may want to use AC_CONFIG_LINKS for this
# instead of how it is currently being handled.
# I. Handles defaults specified in config-site files using the symbols
# DEFAULT_XXX_LIBLOC
# DEFAULT_XXX_LIBDEP (optional)
#
# The arguments are...
# $1 = [REQ] library (short) name (e.g. 'hdf5' or 'zlib')
# $2 = [OPT] name of (key) header file including its extension (default is $1.h)
# $3 = [OPT] name of (key) library file NOT including leading 'lib' or trailing
# extension (default is lib$1.{dylib|so|a})
# $4 = [OPT] name of (key) function in library
# $5 = [OPT] help sub-string; the macro itself generates a pretty good default
# help string
#
# I would regard this as an m4-minimal/sh-maximal implementation of this
# macro. All string processing that can actually be done at configure time
# by sh is done so. Only the absolute minimum that has to be done by m4 at
# autoconf time is done using m4. In addition, it relies very little on
# other, pre-defined autoconf macros.
#
AC_DEFUN(VAC_ARG_WITH3RD,
[
AC_ARG_WITH($1, AC_HELP_STRING([--with-$1],ifelse(,[$5],[use $1; build related plugin(s)/code],[$5])),,
withval=$DEFAULT_[]m4_translit([$1],[a-z-],[A-Z_])_LIBLOC:$DEFAULT_[]m4_translit([$1],[a-z-],[A-Z_])_LIBDEP)
m4_translit([$1],[a-z-],[A-Z_])[]_INCLUDE=""
m4_translit([$1],[a-z-],[A-Z_])[]_LIB=""
m4_translit([$1],[a-z-],[A-Z_])[]_TARGET=""
ifelse(,[$2],incfile=[$1].h,incfile=[$2])
ifelse(,[$3],libtags="[$1]",libtags="[$3]")
incdirs="include inc ."
libdirs="libso lib ."
libexts="dylib so a"
lib_links=""
deplib_links=""
incdir=""
libdir=""
libtag=""
libfile=""
if test "$withval" = yes; then
AC_CHECK_HEADERS($incfile)
ifelse(,[$4],,
[for t in $libtags; do
AC_CHECK_LIB($t,[$4])
done])
else
AC_MSG_CHECKING(if using $1)
fi
if test "$withval" = builtin; then
libs=""
for t in $libtags; do
libs="$libs -l${t}"
done
m4_translit([$1],[a-z-],[A-Z_])[]_LIB="$libs"
m4_translit([$1],[a-z-],[A-Z_])[]_TARGET="$""(m4_translit([$1],[a-z-],[A-Z_])[]_TARGET)"
AC_DEFINE(HAVE_LIB[]m4_translit([$1],[a-z-],[A-Z_]), [1], [Define if you have $1.])
AC_MSG_RESULT(builtin)
elif test -n "$withval" && test $withval != no && test $withval != yes; then
#
# Handle various forms of the with argument
# <DIR> single dir below which inc[lude]/lib subdirs can be found
# <I-DIR>,<L-DIR> separate include/lib dirs
# <DIR>:<ADDL_LDFLAGS> same as <DIR> but with additional LDFLAGS needed to link with this lib
# <I-DIR>,<L-DIR>:<ADDL_LDFLAGS> same as <I-DIR>,<L-DIR> but with additional LDFLAGS needed to link with the lib
#
if test -n "`echo $withval | cut -d':' -f1 | grep ','`"; then
#
# confirm location of $1 header file and its existance and readability
#
incdir="`echo $withval | cut -d':' -f1 | cut -d',' -f1`"
if test ! -r $incdir/$incfile; then
incdir=""
fi
#
# confirm location of $1 lib file and its existance and readability
#
libdir="`echo $withval | cut -d':' -f1 | cut -d',' -f2`"
for t in $libtags; do
for e in $libexts; do
if test -r $libdir/lib$t.$e; then
libfile=lib$t.$e
libtag=$t
break 2
fi
done
done
if test -z "$libfile"; then
libdir=""
fi
else
locdir="`echo $withval | cut -d':' -f1`"
#
# confirm location of $1 header file and its existance and readability
#
for i in $incdirs; do
if test -r $locdir/$i/$incfile; then
incdir=$locdir/$i
break
fi
done
#
# confirm location of $1 lib file and its existance and readability
#
for l in $libdirs; do
for t in $libtags; do
for e in $libexts; do
if test -r $locdir/$l/lib$t.$e; then
libdir=$locdir/$l
libfile=lib$t.$e
libtag=$t
break 3
fi
done
done
done
fi
if test -z "$incdir"; then
AC_MSG_ERROR(cannot find or read header $incfile from info in $withval)
fi
if test -z "$libdir"; then
AC_MSG_ERROR(cannot find or read lib file(s) $libtags from info in $withval)
fi
m4_translit([$1],[a-z-],[A-Z_])[]_LIBFILE=$libdir/$libfile
#
# Make links for this lib in the lib dir
#
rm -rf lib/${libfile}*
for f in $libdir/${libfile}*; do
fb=`basename $f`
ln -s $f lib/$fb
lib_links="$lib_links $f"
done
#
# Handle dependent libs for this library
#
deplib_ldflags="`echo $withval | cut -d':' -f2 | tr ',' ' '`"
deplib_dirs=$libdir
deplib_libs=""
deplib_flags=""
if test -n "`echo $withval | grep ':'`"; then
#
# Separate into -L terms and -l terms
#
for f in $deplib_ldflags; do
if test "`echo $f | cut -d'L' -f1`" = "-"; then
deplib_dirs="$deplib_dirs `echo $f | cut -d'L' -f2-`"
elif test "`echo $f | cut -d'l' -f1`" = "-"; then
deplib_libs="$deplib_libs `echo $f | cut -d'l' -f2-`"
deplib_flags="$deplib_flags $f"
else
AC_MSG_ERROR(unrecognized dependent lib flag "$f" in "$deplib_ldflags")
fi
done
#
# Create links in lib dir
#
deplib_found="$deplib_libs"
for l in $deplib_libs; do
for d in $deplib_dirs; do
for e in $libexts; do
libfiles="`ls -1 $d/lib${l}.${e}* 2>/dev/null`"
if test -n "$libfiles"; then
rm -rf lib/lib${l}.${e}*
for lf in $libfiles; do
lfb=`basename $lf`
ln -s $lf lib/$lfb
deplib_links="$deplib_links $lf"
deplib_found="`echo $deplib_found | tr ' ' '\n' | grep -xve ${l}`"
done
continue 3
fi
done # loop over e (shared lib extensions)
done # loop over d (lib directories)
done # loop over l (lib names)
if test -n "`echo $deplib_found | tr -d '[:space:]'`"; then
AC_MSG_ERROR(unable to resolve dependent liraries "$deplib_found" for $1)
fi
fi
deplib_flags="`echo $deplib_flags | tr -d '\n'`"
m4_translit([$1],[a-z-],[A-Z_])[]_INCLUDE="-I$incdir"
m4_translit([$1],[a-z-],[A-Z_])[]_LIB="-l${libtag} $deplib_flags"
m4_translit([$1],[a-z-],[A-Z_])[]_TARGET="$""(m4_translit([$1],[a-z-],[A-Z_])[]_TARGET)"
AC_DEFINE(HAVE_LIB[]m4_translit([$1],[a-z-],[A-Z_]), [1], [Define if you have $1.])
# if these strings are all blank, then make them really so
if test -z "`echo $lib_links | tr -d '[:space:]'`"; then
lib_links=
fi
if test -z "`echo $deplib_links | tr -d '[:space:]'`"; then
deplib_links=
fi
if test -z "$deplib_links"; then
AC_MSG_RESULT([
m4_translit([$1],[a-z-],[A-Z_])[]_INCLUDE=$m4_translit([$1],[a-z-],[A-Z_])[]_INCLUDE
m4_translit([$1],[a-z-],[A-Z_])[]_LIB=$m4_translit([$1],[a-z-],[A-Z_])[]_LIB
$lib_links])
else
AC_MSG_RESULT([
m4_translit([$1],[a-z-],[A-Z_])[]_INCLUDE=$m4_translit([$1],[a-z-],[A-Z_])[]_INCLUDE
m4_translit([$1],[a-z-],[A-Z_])[]_LIB=$m4_translit([$1],[a-z-],[A-Z_])[]_LIB
$lib_links
$deplib_links])
fi
else
AC_MSG_RESULT(no)
fi
AC_SUBST(m4_translit([$1],[a-z-],[A-Z_])[]_INCLUDE)
AC_SUBST(m4_translit([$1],[a-z-],[A-Z_])[]_LIB)
AC_SUBST(m4_translit([$1],[a-z-],[A-Z_])[]_TARGET)
]
)
......@@ -1311,6 +1311,9 @@ avtSIL::MakeSILAttributes(void) const
//
// Dave Bremer, Thu Dec 20 16:49:10 PST 2007
// No longer printing whether a set is whole or not.
//
// Mark C. Miller, Tue Oct 21 09:07:50 PDT 2008
// Modified to use GetSILSet; simplified logic for loops a bit
// ****************************************************************************
void
......@@ -1329,24 +1332,17 @@ avtSIL::Print(ostream &out,
int i;
bool useInfo;
int nSets = sets.size();
if (perSetInfo.size() == nSets)
useInfo = true;
else
useInfo = false;
for (i = 0 ; i < nSets ; i++)
useInfo = perSetInfo.size() == GetNumSets();
for (i = 0 ; i < GetNumSets() ; i++)
{
out << "Set" << i << " " << (useInfo ? perSetInfo[i].c_str() : "") << endl;
avtSILSet_p s = sets[i];
avtSILSet_p s = GetSILSet(i);
s->Print(out);
}
int nColls = collections.size();
if (perCollInfo.size() == nColls)
useInfo = true;
else
useInfo = false;
useInfo = perCollInfo.size() == nColls;
for (i = 0 ; i < nColls ; i++)
{
out << "Collection " << i << " " << (useInfo ? perCollInfo[i].c_str() : "") << endl;
......@@ -1355,10 +1351,7 @@ avtSIL::Print(ostream &out,
}
int nMats = matrices.size();
if (perMatInfo.size() == nMats)
useInfo = true;
else
useInfo = false;
useInfo = perMatInfo.size() == nMats;
for (i = 0 ; i < nMats ; i++)
{
out << "Matrix " << i << " " << (useInfo ? perMatInfo[i].c_str() : "") << endl;
......
......@@ -1499,8 +1499,6 @@ PluginManager::PluginError() const
void
PluginManager::PluginClose()
{
openPlugin = "";
#if defined(_WIN32)
if(handle)
{
......@@ -1515,8 +1513,15 @@ PluginManager::PluginClose()
if(handle)
{
dlclose(handle);
if (dlclose(handle) != 0)
{
const char *pluginError = PluginError();
cerr << "Error closing plugin file: " << openPlugin
<< " (" << pluginError << ")" << endl;
}
handle = 0;
}
#endif
openPlugin = "";
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2008, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400142
* 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.
*
*****************************************************************************/
// ************************************************************************* //
// BoundaryList.C //
// ************************************************************************* //
#include <stdlib.h>
#include <string.h>
#include "BoundaryList.h"
//
// Declaration of static constants. They are not allowed as initializers in
// class definitions.
//
char * const BoundaryList::SILO_LOCATION = "/";
int const BoundaryList::SILO_NUM_COMPONENTS = 9;
char * const BoundaryList::SILO_TYPE = "BoundaryList";
char * const BoundaryList::SILO_N_MATERIAL_NUMBERS_NAME = "NMaterialNumbers";
char * const BoundaryList::SILO_MATERIAL_NUMBERS_NAME = "MaterialNumbers";
char * const BoundaryList::SILO_N_SHAPES_NAME = "NShapes";
char * const BoundaryList::SILO_SHAPE_CNT_NAME = "ShapeCnt";
char * const BoundaryList::SILO_SHAPE_SIZE_NAME = "ShapeSize";
char * const BoundaryList::SILO_N_OPPOSITE_MATERIAL_NAME
= "NOppositeMaterial";
char * const BoundaryList::SILO_OPPOSITE_MATERIAL_CNT_NAME
= "OppositeMaterialCnt";
char * const BoundaryList::SILO_OPPOSITE_MATERIAL_NUMBER_NAME
= "OppositeMaterialNumber";
char * const BoundaryList::SILO_NODE_LIST_NAME = "NodeList";
// ****************************************************************************
// Method: BoundaryList constructor
//
// Programmer: Hank Childs
// Creation: January 7, 2000
//
// ****************************************************************************
BoundaryList::BoundaryList()
{
name = NULL;
nMaterialNumbers = 0;
materialNumbers = NULL;
nShapes = NULL;
totalShapes = 0;
shapeCnt = NULL;
shapeSize = NULL;
nOppositeMaterial = NULL;
totalOpposite = 0;
oppositeMaterialCnt = NULL;
oppositeMaterialNumber = NULL;
nodeList = NULL;
}
// ****************************************************************************
// Method: BoundaryList destructor
//
// Programmer: Hank Childs
// Creation: January 7, 2000
//
// ****************************************************************************
BoundaryList::~BoundaryList()
{
if (name != NULL)
{
delete [] name;
}
if (materialNumbers != NULL)
{
delete [] materialNumbers;
}
if (nShapes != NULL)
{
delete [] nShapes;
}
if (shapeCnt != NULL)
{
delete [] shapeCnt;
}
if (shapeSize != NULL)
{
delete [] shapeSize;
}
if (nOppositeMaterial != NULL)
{
delete [] nOppositeMaterial;
}
if (oppositeMaterialCnt != NULL)
{
delete [] oppositeMaterialCnt;
}
if (oppositeMaterialNumber != NULL)
{
delete [] oppositeMaterialNumber;
}
if (nodeList != NULL)
{
delete [] nodeList;
}
}
// ****************************************************************************
// Method: BoundaryList::SetName
//
// Purpose:
// Sets the BoundaryList object's name.
//
// Programmer: Hank Childs
// Creation: January 7, 2000
//
// ****************************************************************************
void
BoundaryList::SetName(char *n)
{
name = new char[strlen(n)+1];
strcpy(name, n);
}
// ****************************************************************************
// Method: BoundaryList::AddMaterial
//
// Purpose:
// Populates a BoundaryList object from a material and an OnionPeel.
//
// Arguments:
// mat - The material to create the BoundaryList from.
// onionPeel - The object that contains the connectivity information.
// um - The unstructured mesh that corresponds to this material.
//
// Note: BoundaryList is a friend to OnionPeel.
//
// Programmer: Hank Childs
// Creation: January 7, 2000
//
// ****************************************************************************
void
BoundaryList::AddMaterial(DBmaterial *mat, OnionPeel *onionPeel,
DBzonelist *zl)
{
int i;
nMaterialNumbers = mat->nmat;
materialNumbers = new int[nMaterialNumbers];
nShapes = new int[nMaterialNumbers];
for (i = 0 ; i < nMaterialNumbers ; i++)
{
materialNumbers[i] = mat->matnos[i];
nShapes[i] = 0;
}
//
// Every material may not have every shape, but this makes calculations
// a lot easier and doesn't take up too much memory.
//
for (i = 0 ; i < zl->nzones ; i++)
{
}
}
// ****************************************************************************
// Method: BoundaryList::Write
//
// Purpose:
// Outputs a BoundaryList objects to a SILO file.
//
// Note: This object is domain based and can be written by any
// processor.
//
// Note: The type field for the DBobject, siloObj, must have its memory
// allocated through a malloc, so that when it is freed, we do
// not get a free memory mismatch from purify.
//
// Programmer: Hank Childs
// Creation: January 7, 2000
//
// ****************************************************************************
void
BoundaryList::Write(DBfile *dbfile)
{
//
// Set the directory in the file to be correct.
//
if (DBSetDir(dbfile, SILO_LOCATION) < 0)
{
cerr << "Unable to change directories in the silo file to "
<< SILO_LOCATION << "." << endl;
exit(EXIT_FAILURE);
}
//
// Create an object to be written into the SILO file.
//
DBobject *siloObj = DBMakeObject(name, DB_USERDEF, SILO_NUM_COMPONENTS);
if (siloObj == NULL)
{
cerr << "Unable to create a silo object for the mesh." << endl;
exit(EXIT_FAILURE);
}
//
// We must make a copy of the string, because the "destructor" deletes this
// field and we can't have it delete statics.
//
siloObj->type = static_cast< char * >
(calloc(strlen(SILO_TYPE)+1, sizeof(char)));
strcpy(siloObj->type, SILO_TYPE);
DBWriteObject(dbfile, siloObj, 0);
DBFreeObject(siloObj);
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2008, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400142
* 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,