[MOAB-dev] commit/MOAB: danwu: Merged master into error_handling_enhancement
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Feb 26 15:19:00 CST 2014
1 new commit in MOAB:
https://bitbucket.org/fathomteam/moab/commits/ad0c3fcf685f/
Changeset: ad0c3fcf685f
Branch: error_handling_enhancement
User: danwu
Date: 2014-02-26 22:18:55
Summary: Merged master into error_handling_enhancement
Affected #: 10 files
diff --git a/MeshFiles/unittest/io/Makefile.am b/MeshFiles/unittest/io/Makefile.am
index dbce393..3b767aa 100644
--- a/MeshFiles/unittest/io/Makefile.am
+++ b/MeshFiles/unittest/io/Makefile.am
@@ -5,6 +5,7 @@ EXTRA_DIST = HommeMapping.nc \
camEul26x48x96.t3.nc \
fv26x46x72.t.3.nc \
cubtest12.cub \
+ cubtest14.cub \
cubtest.jou \
dum.sat \
dum.stp \
diff --git a/MeshFiles/unittest/io/cubtest14.cub b/MeshFiles/unittest/io/cubtest14.cub
new file mode 100644
index 0000000..ae88269
Binary files /dev/null and b/MeshFiles/unittest/io/cubtest14.cub differ
diff --git a/config/hdf5.m4 b/config/hdf5.m4
index 4d3d11d..b603d24 100644
--- a/config/hdf5.m4
+++ b/config/hdf5.m4
@@ -28,16 +28,17 @@ if test "xyes" != "x$HAVE_LIB_HDF5"; then
HAVE_LIB_HDF5=no
FATHOM_HDF5_LIBS_HELPER
+ FATHOM_HDF5_LIBS_HELPER([-ldl])
if test $HAVE_ZLIB = yes; then
- FATHOM_HDF5_LIBS_HELPER([-lz])
- FATHOM_HDF5_LIBS_HELPER([-lz -lpthread])
+ FATHOM_HDF5_LIBS_HELPER([-lz -ldl])
+ FATHOM_HDF5_LIBS_HELPER([-lz -ldl -lpthread])
fi
if test $HAVE_SZIP = yes; then
- FATHOM_HDF5_LIBS_HELPER([-lsz])
- FATHOM_HDF5_LIBS_HELPER([-lsz -lpthread])
+ FATHOM_HDF5_LIBS_HELPER([-lsz -ldl])
+ FATHOM_HDF5_LIBS_HELPER([-lsz -ldl -lpthread])
if test $HAVE_ZLIB = yes; then
- FATHOM_HDF5_LIBS_HELPER([-lsz -lz])
- FATHOM_HDF5_LIBS_HELPER([-lsz -lz -lpthread])
+ FATHOM_HDF5_LIBS_HELPER([-lsz -lz -ldl])
+ FATHOM_HDF5_LIBS_HELPER([-lsz -lz -ldl -lpthread])
fi
fi
fi
diff --git a/config/netcdf.m4 b/config/netcdf.m4
index 041327d..4c13802 100644
--- a/config/netcdf.m4
+++ b/config/netcdf.m4
@@ -85,33 +85,47 @@ if test "xno" != "x$NETCDF_ARG"; then
NETCDF_CPPFLAGS="-I${NETCDF_ARG}"
fi
fi
-
+
+ AC_PATH_PROG([NC_CONFIG], [nc-config], [no], [${NETCDF_ARG}/bin])
+ if test "$NC_CONFIG" != "no" ; then
+ NETCDF_CPPFLAGS="`$NC_CONFIG --cflags`"
+ NETCDF_LDFLAGS="`$NC_CONFIG --libs`"
+ NETCDF_VERSION="`$NC_CONFIG --version`"
+ AC_SUBST([NETCDF_CPPFLAGS])
+ AC_SUBST([NETCDF_LDFLAGS])
+ AC_SUBST([NETCDF_VERSION])
+ else
+ HAVE_NETCDF=no
+ AC_MSG_WARN("NetCDF configuration utility not found")
+ fi
+
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$NETCDF_CPPFLAGS $CPPFLAGS"
old_LDFLAGS="$LDFLAGS"
- LDFLAGS="$NETCDF_LDFLAGS $HDF5_LDFLAGS $LDFLAGS"
+ LDFLAGS="$NETCDF_LDFLAGS $LDFLAGS"
# Check for C library
AC_LANG_PUSH([C])
AC_CHECK_HEADERS( [netcdf.h],
[FATHOM_CHECK_NETCDF_LIMITS([$1],[$2],[netcdf.h],[NETCDF_SUFFICIENT_DIM_VARS])],
[AC_MSG_WARN([[NetCDF header not found.]]); HAVE_NETCDF=no] )
-
+
# Check if netcdf is usable by itself
+ # AC_CHECK_LIB( [netcdf], [nc_create], [NETCDF_LIBS="-lnetcdf"], [NETCDF_LIBS=${NETCDF_LDFLAGS}] )
AC_CHECK_LIB( [netcdf], [nc_create], [NETCDF_LIBS="-lnetcdf"], [
- # Check if netcdf is usable with HDF5
+ # Check if netcdf is usable with HDF5
unset ac_cv_lib_netcdf
unset ac_cv_lib_netcdf_nc_create
- # If we haven't already looked for HDF5 libraries, again now incase
- # they're in the NetCDF lib directory.
+ # If we haven't already looked for HDF5 libraries, again now incase
+ # they're in the NetCDF lib directory.
FATHOM_DETECT_HDF5_LIBS
LDFLAGS="$LDFLAGS $HDF5_LDFLAGS"
- AC_CHECK_LIB( [netcdf], [nc_create], [NETCDF_LIBS="-lnetcdf -lhdf5_hl"], [
+ AC_CHECK_LIB( [netcdf], [nc_create], [NETCDF_LIBS="-lnetcdf -lhdf5_hl $HDF5_LIBS"], [
# Try one more time with HDF5 and libcurl
unset ac_cv_lib_netcdf
unset ac_cv_lib_netcdf_nc_create
- AC_CHECK_LIB( [netcdf], [nc_create], [NETCDF_LIBS="-lnetcdf -lhdf5_hl -lcurl"],
- [HAVE_NETCDF=no], [-lhdf5_hl $HDF5_LIBS -lcurl] )],
+ AC_CHECK_LIB( [netcdf], [nc_create], [NETCDF_LIBS="-lnetcdf -lhdf5_hl -lcurl "],
+ [HAVE_NETCDF=no], [-lhdf5_hl $HDF5_LIBS -lcurl ] )],
[-lhdf5_hl $HDF5_LIBS] )],
)
diff --git a/configure.ac b/configure.ac
index ea22a5e..82bf72b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -593,13 +593,14 @@ AC_ARG_WITH( [vtk-lib-suffix],
[case "x$withval" in
xyes)
AC_MSG_ERROR([Must specify a non-empty suffix!])
- VTK_LIB_SUFFIX=
+ VTK_LIB_SUFFIX=
;;
xno)
- VTK_LIB_SUFFIX=
+ AC_MSG_ERROR([Must specify a non-empty suffix!])
+ VTK_LIB_SUFFIX=
;;
x*)
- VTK_LIB_SUFFIX="$withval"
+ VTK_LIB_SUFFIX="$withval"
DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-vtk-lib-suffix=\"${withval}\""
;;
esac],[VTK_LIB_SUFFIX=] )
@@ -758,6 +759,40 @@ AC_SUBST(ZOLTAN_INC_FLAGS)
EXPORT_LDFLAGS="$ZOLTAN_LIB_FLAGS $EXPORT_LDFLAGS"
+
+dnl Define a function that checks for the existence of a library
+dnl and if it exists, prepends the corresponding link flag to a
+dnl sepecified variable
+dnl Arguments:
+dnl - The library name
+dnl - The name of the variable to which to prepend the library link flag
+dnl - List of extra libraries required for link test
+dnl - Optional library path linker argument (e.g. -L/opt/foo)
+ AC_DEFUN([FATHOM_CHECK_LIB_LIST],[
+ old_LIBS="$LIBS"
+ LIBS="$5 ${$3} $old_LIBS"
+ AC_HAVE_LIBRARY([$1],[$3="-l$1 ${$3}"],[],[$4])
+ LIBS="$old_LIBS"
+ ])
+
+dnl Define a function that checks for the existence of a library
+dnl and if it exists, prepends the corresponding link flag to a
+dnl sepecified variable
+dnl Arguments:
+dnl - The library name
+dnl - The name of the variable to which to prepend the library link flag
+dnl - List of extra libraries required for link test
+dnl - Optional library path linker argument (e.g. -L/opt/foo)
+ AC_DEFUN([FATHOM_CHECK_VTK_LIB_LIST],[
+ old_LIBS="$LIBS"
+ LIBS="$5 ${$3} $old_LIBS"
+ AC_CHECK_LIB([$1$VTK_LIB_SUFFIX], main,
+ [$3="-l$1$VTK_LIB_SUFFIX ${$3}"],
+ [],[$4])dnl
+ LIBS="$old_LIBS"
+ ])
+
+
################################################################################
# VTK for qvdual and/or vtkMOABReader
################################################################################
@@ -786,7 +821,6 @@ if test "xno" != "x$WITH_VTK" -a "x" != "x$WITH_VTK"; then
AC_LANG_CPLUSPLUS
VTK_INCLUDES=
- VTK_LIB_SUFFIX=-pv3.98
case "x$WITH_VTK" in
xyes|x)
VTK_LIB_DIR=
@@ -806,9 +840,7 @@ if test "xno" != "x$WITH_VTK" -a "x" != "x$WITH_VTK"; then
for dir in /usr/lib/vtk /usr/lib /usr/bin /usr; do
if test "x" = "x$VTK_LIB_DIR"; then
LIBS="$old_LIBS -L$dir"
- unset ac_cv_lib_vtkCommon
- unset ac_cv_lib_vtkCommon_main
- AC_HAVE_LIBRARY([vtkCommonCore$VTK_LIB_SUFFIX],[VTK_LIB_DIR=$dir])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkCommonCore],[$VTK_LIB_SUFFIX], [VTK_LIB_DIR],[],[-L$dir])
fi
done
if test "x" = "x$VTK_LIB_DIR"; then
@@ -828,15 +860,15 @@ if test "xno" != "x$WITH_VTK" -a "x" != "x$WITH_VTK"; then
# Check for non-installed VTK source
AC_CHECK_FILE([vtkUnstructuredGrid.h],[
for subdir in . Common Common/DataModel Filtering GenericFiltering Graphics Hybrid Imaging Parallel Patented Rendering Utilities Utilities/vtkexpat Utilities/expat Utilities/DICOMParser Utilties/vtkpng Utilities/vtkzlib Utilities/freetype/include/freetype Wrapping; do
- AC_MSG_CHECKING([for directory ${WITH_VTK}/$subdir])
- if test -d ${WITH_VTK}/$subdir; then
- VTK_INC_DIR="$VTK_INC_DIR -I${WITH_VTK}/$subdir"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- fi
- done
- ],[AC_MSG_ERROR([VTK includes not found])]
+ AC_MSG_CHECKING([for directory ${WITH_VTK}/$subdir])
+ if test -d ${WITH_VTK}/$subdir; then
+ VTK_INC_DIR="$VTK_INC_DIR -I${WITH_VTK}/$subdir"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ done
+ ],[AC_MSG_ERROR([VTK includes not found])]
)
fi
VTK_INCLUDES="$VTK_INC_DIR"
@@ -844,7 +876,7 @@ if test "xno" != "x$WITH_VTK" -a "x" != "x$WITH_VTK"; then
for dir in ${WITH_VTK}/lib ${WITH_VTK}/lib/vtk ${VTK_DIR}/bin ${WITH_VTK}/bin ${WITH_VTK}; do
if test "x" = "x$VTK_LIB_DIR"; then
LIBS="$old_LIBS -L$dir"
- AC_HAVE_LIBRARY([vtkCommonCore$VTK_LIB_SUFFIX],[VTK_LIB_DIR=$dir])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkCommonCore],[$VTK_LIB_SUFFIX], [VTK_LIB_DIR],[],[-L$dir])
fi
done
if test "x" = "x$VTK_LIB_DIR"; then
@@ -853,22 +885,7 @@ if test "xno" != "x$WITH_VTK" -a "x" != "x$WITH_VTK"; then
LIBS="$old_LIBS"
;;
esac
-
-dnl Define a function that checks for the existence of a library
-dnl and if it exists, prepends the corresponding link flag to a
-dnl sepecified variable
-dnl Arguments:
-dnl - The library name
-dnl - The name of the variable to which to prepend the library link flag
-dnl - List of extra libraries required for link test
-dnl - Optional library path linker argument (e.g. -L/opt/foo)
- AC_DEFUN([FATHOM_CHECK_LIB_LIST],[
- old_LIBS="$LIBS"
- LIBS="$5 ${$3} $old_LIBS"
- AC_HAVE_LIBRARY([$1$2],[$3="-l$1$2 ${$3}"],[],[$4])
- LIBS="$old_LIBS"
- ])
-
+
# These are ordered such that a given library depends only on those libraries
# that preceed it in the list.
FATHOM_CHECK_LIB_LIST([pthread],[],[vtk_sys_libs])
@@ -883,27 +900,28 @@ dnl - Optional library path linker argument (e.g. -L/opt/foo)
FATHOM_CHECK_LIB_LIST([GL],[], [vtk_x_libs],[$x_libs_arg],[-L$x_libraries])
FATHOM_CHECK_LIB_LIST([GLU],[], [vtk_x_libs],[$x_libs_arg],[-L$x_libraries])
vtk_libs_arg="-L$x_libraries $vtk_x_libs $X_EXTRA_LIBS -lX11 $X_PRE_LIBS $vtk_sys_libs"
- FATHOM_CHECK_LIB_LIST([vtksys],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkCommonCore],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkDICOMParser],[$VTK_LIB_SUFFIX],[vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkfreetype],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkexpat],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkzlib],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkpng],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkjpeg],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtktiff],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkftgl],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkFiltering],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkImaging],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([verdict],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkGraphics],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkNetCDF],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkexoIIc],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkmetaio],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkIO],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkRendering],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkParallel],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
- FATHOM_CHECK_LIB_LIST([vtkHybrid],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+
+ FATHOM_CHECK_VTK_LIB_LIST([vtksys],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkCommonCore],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkDICOMParser],[$VTK_LIB_SUFFIX],[vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkfreetype],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkexpat],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkzlib],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkpng],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkjpeg],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtktiff],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkftgl],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkFiltersCore],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkImagingCore],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([verdict],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkGraphics],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkNetCDF],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkexoIIc],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkmetaio],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkIOCore],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkRenderingCore],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ FATHOM_CHECK_VTK_LIB_LIST([vtkParallelCore],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
+ #FATHOM_CHECK_VTK_LIB_LIST([vtkHybrid],[$VTK_LIB_SUFFIX], [vtk_libs],[$vtk_libs_arg],[-L$VTK_LIB_DIR])
# Make sure we found at least vtkCommonCore and vtkRendering
if ! echo "x $vtk_libs" | grep lvtkCommonCore >/dev/null; then
diff --git a/examples/LoadPartial.cpp b/examples/LoadPartial.cpp
new file mode 100644
index 0000000..ef1f2e7
--- /dev/null
+++ b/examples/LoadPartial.cpp
@@ -0,0 +1,63 @@
+/** @example LoadPartial.cpp \n
+ * \brief Load a part of a file \n
+ * <b>To run</b>: LoadPartial <file><tag_name><val1><val2> ...\n
+ *
+ * In this example, it is shown how to load only a part of one file; the file must be organized in sets.
+ * (cherry-picking only the sets we want)
+ * The sets to load are identified by a tag name and the tag values for the sets of interest.
+ * This procedure is used when reading in parallel, as each processor will load only
+ * its part of the file, identified either by partition or by material/block sets
+ * by default, this example will load parallel partition sets
+ * with values 1, 2, and 5 from ../MeshFiles/unittest/64bricks_1khex.h5m
+ * The example will always write the output to a file name part.h5m
+ */
+
+#include <iostream>
+#include <vector>
+
+// Include header for MOAB instance and tag conventions for
+#include "moab/Core.hpp"
+#include "MBTagConventions.hpp"
+
+int main(int argc, char **argv) {
+
+ // instantiate & load a file
+ moab::Interface *mb = new moab::Core();
+
+ moab::ErrorCode rval;
+ if (argc <= 1) //
+ {
+ // the default file to load
+ int set_tag_values[] = {1, 2, 5};
+ int num_set_tag_values = 3;
+ // this file is in the mesh files directory
+ rval = mb->load_file("../MeshFiles/unittest/64bricks_1khex.h5m",
+ 0, 0, PARALLEL_PARTITION_TAG_NAME, set_tag_values, num_set_tag_values);
+ }
+ else
+ {
+ // first arg is input file, second is tag name, then are the tag values
+ if (argc < 4)
+ {
+ std::cout<< " usage is " << argv[0] << " <file><tag_name><value1><value2> .. \n";
+ return 0;
+ }
+
+ else
+ {
+ std::vector<int> vals(argc-3); // the first 3 args are exe, file, tagname; the rest are values
+ for (int i=3; i<argc; i++)
+ vals[i-3] = atoi(argv[i]);
+ rval = mb->load_file(argv[1], 0, 0, argv[2], &vals[0], (int) vals.size() );
+ }
+ }
+ if (moab::MB_SUCCESS!=rval)
+ std::cout << " failed to read\n";
+ rval = mb->write_file("part.h5m");
+ if (moab::MB_SUCCESS!=rval)
+ std::cout << " failed to write partial file.\n";
+ else
+ std::cout << " wrote successfully part.h5m.\n";
+ delete mb;
+ return 0;
+}
diff --git a/examples/makefile b/examples/makefile
index 9cb50bf..7b18e33 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -7,7 +7,7 @@ include ${MOAB_DIR}/lib/iMesh-Defs.inc
# MESH_DIR is the directory containing mesh files that come with MOAB source
MESH_DIR="../MeshFiles/unittest"
-EXAMPLES = HelloMOAB GetEntities SetsNTags structuredmesh StructuredMeshSimple DirectAccessWithHoles DirectAccessNoHoles point_in_elem_search DeformMeshRemap
+EXAMPLES = HelloMOAB GetEntities SetsNTags LoadPartial structuredmesh StructuredMeshSimple DirectAccessWithHoles DirectAccessNoHoles point_in_elem_search DeformMeshRemap
PAREXAMPLES = HelloParMOAB ReduceExchangeTags LloydRelaxation CrystalRouterExample
EXOIIEXAMPLES = TestExodusII
ERROREXAMPLES = TestErrorHandling TestErrorHandlingPar
@@ -15,7 +15,7 @@ F90EXAMPLES = DirectAccessNoHolesF90 PushParMeshIntoMoabF90
default: ${EXAMPLES} ${PAREXAMPLES} ${EXOIIEXAMPLES} ${ERROREXAMPLES} ${F90EXAMPLES}
-HelloMOAB : HelloMOAB.o ${MOAB_LIBDIR}/libMOAB.la
+HelloMOAB: HelloMOAB.o ${MOAB_LIBDIR}/libMOAB.la
${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
GetEntities: GetEntities.o ${MOAB_LIBDIR}/libMOAB.la
@@ -27,10 +27,13 @@ SetsNTags: SetsNTags.o ${MOAB_LIBDIR}/libMOAB.la
LloydRelaxation: LloydRelaxation.o ${MOAB_LIBDIR}/libMOAB.la
${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
-structuredmesh : structuredmesh.o ${MOAB_LIBDIR}/libMOAB.la
+LoadPartial: LoadPartial.o ${MOAB_LIBDIR}/libMOAB.la
+ ${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK} ${MOAB_LIBS_LINK}
+
+structuredmesh: structuredmesh.o ${MOAB_LIBDIR}/libMOAB.la
${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
-StructuredMeshSimple : StructuredMeshSimple.o ${MOAB_LIBDIR}/libMOAB.la
+StructuredMeshSimple: StructuredMeshSimple.o ${MOAB_LIBDIR}/libMOAB.la
${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
DirectAccessWithHoles: DirectAccessWithHoles.o ${MOAB_LIBDIR}/libMOAB.la
@@ -42,13 +45,13 @@ DirectAccessNoHoles: DirectAccessNoHoles.o ${MOAB_LIBDIR}/libMOAB.la
DirectAccessNoHolesF90: DirectAccessNoHolesF90.o ${MOAB_LIBDIR}/libMOAB.la
${MOAB_FC} -o $@ $< ${IMESH_LIBS}
-ReduceExchangeTags : ReduceExchangeTags.o ${MOAB_LIBDIR}/libMOAB.la
+ReduceExchangeTags: ReduceExchangeTags.o ${MOAB_LIBDIR}/libMOAB.la
${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
HelloParMOAB: HelloParMOAB.o ${MOAB_LIBDIR}/libMOAB.la
${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
-CrystalRouterExample: CrystalRouterExample.o ${MOAB_LIBDIR}/libMOAB.la
+CrystalRouterExample: CrystalRouterExample.o ${MOAB_LIBDIR}/libMOAB.la
${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
TestExodusII: TestExodusII.o ${MOAB_LIBDIR}/libMOAB.la
@@ -72,9 +75,9 @@ TestErrorHandlingPar: TestErrorHandlingPar.o ${MOAB_LIBDIR}/libMOAB.la
clean:
rm -rf *.o *.mod *.h5m ${EXAMPLES} ${PAREXAMPLES} ${EXOIIEXAMPLES} ${F90EXAMPLES}
-.cpp.o :
+.cpp.o:
${MOAB_CXX} ${CXXFLAGS} ${MOAB_CXXFLAGS} ${MOAB_CPPFLAGS} ${MOAB_INCLUDES} -DMESH_DIR=\"${MESH_DIR}\" -c $<
-.F90.o :
+.F90.o:
${IMESH_FC} ${FCFLAGS} ${IMESH_FCFLAGS} ${MOAB_CPPFLAGS} ${IMESH_INCLUDES} ${IMESH_FCDEFS} -DMESH_DIR=\"${MESH_DIR}\" -c $<
diff --git a/src/ScdInterface.cpp b/src/ScdInterface.cpp
index 12f5b89..3f95538 100644
--- a/src/ScdInterface.cpp
+++ b/src/ScdInterface.cpp
@@ -339,6 +339,13 @@ ErrorCode ScdInterface::create_box_set(const HomCoord low, const HomCoord high,
Tag ScdInterface::box_periodic_tag(bool create_if_missing)
{
+ // Reset boxPeriodicTag in case it has been deleted (e.g. by Core::clean_up_failed_read)
+ if (boxPeriodicTag) {
+ std::string tag_name;
+ if (MB_TAG_NOT_FOUND == mbImpl->tag_get_name(boxPeriodicTag, tag_name))
+ boxPeriodicTag = NULL;
+ }
+
if (boxPeriodicTag || !create_if_missing) return boxPeriodicTag;
ErrorCode rval = mbImpl->tag_get_handle("BOX_PERIODIC", 3, MB_TYPE_INTEGER,
@@ -349,6 +356,13 @@ Tag ScdInterface::box_periodic_tag(bool create_if_missing)
Tag ScdInterface::box_dims_tag(bool create_if_missing)
{
+ // Reset boxDimsTag in case it has been deleted (e.g. by clean_up_failed_read)
+ if (boxDimsTag) {
+ std::string tag_name;
+ if (MB_TAG_NOT_FOUND == mbImpl->tag_get_name(boxDimsTag, tag_name))
+ boxDimsTag = NULL;
+ }
+
if (boxDimsTag || !create_if_missing) return boxDimsTag;
ErrorCode rval = mbImpl->tag_get_handle("BOX_DIMS", 6, MB_TYPE_INTEGER,
@@ -359,6 +373,13 @@ Tag ScdInterface::box_dims_tag(bool create_if_missing)
Tag ScdInterface::global_box_dims_tag(bool create_if_missing)
{
+ // Reset globalBoxDimsTag in case it has been deleted (e.g. by Core::clean_up_failed_read)
+ if (globalBoxDimsTag) {
+ std::string tag_name;
+ if (MB_TAG_NOT_FOUND == mbImpl->tag_get_name(globalBoxDimsTag, tag_name))
+ globalBoxDimsTag = NULL;
+ }
+
if (globalBoxDimsTag || !create_if_missing) return globalBoxDimsTag;
ErrorCode rval = mbImpl->tag_get_handle("GLOBAL_BOX_DIMS", 6, MB_TYPE_INTEGER,
@@ -369,6 +390,13 @@ Tag ScdInterface::global_box_dims_tag(bool create_if_missing)
Tag ScdInterface::part_method_tag(bool create_if_missing)
{
+ // Reset partMethodTag in case it has been deleted (e.g. by Core::clean_up_failed_read)
+ if (partMethodTag) {
+ std::string tag_name;
+ if (MB_TAG_NOT_FOUND == mbImpl->tag_get_name(partMethodTag, tag_name))
+ partMethodTag = NULL;
+ }
+
if (partMethodTag || !create_if_missing) return partMethodTag;
ErrorCode rval = mbImpl->tag_get_handle("PARTITION_METHOD", 1, MB_TYPE_INTEGER,
@@ -379,6 +407,13 @@ Tag ScdInterface::part_method_tag(bool create_if_missing)
Tag ScdInterface::box_set_tag(bool create_if_missing)
{
+ // Reset boxSetTag in case it has been deleted (e.g. by Core::clean_up_failed_read)
+ if (boxSetTag) {
+ std::string tag_name;
+ if (MB_TAG_NOT_FOUND == mbImpl->tag_get_name(boxSetTag, tag_name))
+ boxSetTag = NULL;
+ }
+
if (boxSetTag || !create_if_missing) return boxSetTag;
ErrorCode rval = mbImpl->tag_get_handle("__BOX_SET", sizeof(ScdBox*), MB_TYPE_OPAQUE,
diff --git a/src/io/Tqdcfr.cpp b/src/io/Tqdcfr.cpp
index 76767ea..afc0493 100644
--- a/src/io/Tqdcfr.cpp
+++ b/src/io/Tqdcfr.cpp
@@ -2920,7 +2920,7 @@ int main(int argc, char* argv[])
MPI_Init(&argc, &argv);
#endif
// Check command line arg
- const char* file = STRINGIFY(SRCDIR) "/brick_cubit10.2.cub";
+ const char* file = STRINGIFY(MESHDIR) "/io/brick_cubit10.2.cub";
if (argc < 2)
{
std::cout << "Usage: tqdcfr <cub_file_name>" << std::endl;
diff --git a/test/io/cub_file_test.cc b/test/io/cub_file_test.cc
index 691fea3..f9a65bf 100644
--- a/test/io/cub_file_test.cc
+++ b/test/io/cub_file_test.cc
@@ -3,6 +3,7 @@
#include "MBTagConventions.hpp"
#include "moab/CN.hpp"
#include "moab/Range.hpp"
+#include "moab/GeomTopoTool.hpp"
#include <math.h>
#include <algorithm>
@@ -80,10 +81,12 @@ using namespace moab;
static const char input_file_1[] = STRINGIFY(MESHDIR) "/io/test.cub";
static const char ho_file[] = STRINGIFY(MESHDIR) "/io/ho_test.cub";
static const char cubit12_file[] = STRINGIFY(MESHDIR) "/io/cubtest12.cub";
+static const char cubit14_file[] = STRINGIFY(MESHDIR) "/io/cubtest14.cub";
#else
static const char input_file_1[] = "test.cub";
static const char ho_file[] = "ho_test.cub";
static const char cubit12_file[] = "cubtest12.cub";
+static const char cubit12_file[] = "cubtest14.cub";
#endif
void read_file( Interface& moab, const char* input_file );
@@ -143,6 +146,7 @@ void test_hex27() { test_ho_elements(MBHEX, 27); }
void test_multiple_files();
void test_cubit12();
+void test_cubit14();
int main()
{
@@ -170,6 +174,7 @@ int main()
result += RUN_TEST(test_hex27);
result += RUN_TEST(test_multiple_files);
result += RUN_TEST(test_cubit12);
+ result += RUN_TEST(test_cubit14);
return result;
}
@@ -1075,3 +1080,22 @@ void test_cubit12()
Interface& mb = mb_impl;
read_file( mb, cubit12_file);
}
+
+void test_cubit14()
+{
+ Core mb_impl;
+ Interface& mb = mb_impl;
+ read_file( mb, cubit14_file);
+ // check the global id for some geometry sets
+ GeomTopoTool gtt(&mb_impl);
+ Range ranges[5];
+ ErrorCode rval = gtt.find_geomsets(ranges);
+ CHECK_ERR(rval);
+ EntityHandle set0=ranges[0][0]; // does it have a global id > 0?
+ Tag gid_tag;
+ rval = mb.tag_get_handle( "GLOBAL_ID", 1, MB_TYPE_INTEGER, gid_tag ); CHECK_ERR(rval);
+
+ int val;
+ rval = mb.tag_get_data(gid_tag, &set0, 1, &val );
+ CHECK ( val!=0 );
+}
Repository URL: https://bitbucket.org/fathomteam/moab/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the moab-dev
mailing list