[MOAB-dev] commit/MOAB: 47 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Jun 11 23:24:01 CDT 2014


47 new commits in MOAB:

https://bitbucket.org/fathomteam/moab/commits/d5e78c76987a/
Changeset:   d5e78c76987a
Branch:      None
User:        judajake
Date:        2014-01-04 01:13:34
Summary:     initial cmakeifing

Affected #:  16 files

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6b18435..1eb461e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,135 +1,192 @@
-# check if we are using MPI - reset compilers accordingly
-if ( MOAB_USE_MPI )
-  SET(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER})
-  SET(CMAKE_C_COMPILER ${MPI_C_COMPILER})
-endif ( MOAB_USE_MPI )
-
+cmake_minimum_required( VERSION 2.8.10 )
+cmake_policy( SET CMP0003 NEW )
+cmake_policy(SET CMP0020 NEW)
 project( MOAB )
 
-  cmake_minimum_required( VERSION 2.4 )
-  if ( COMMAND cmake_policy )
-    cmake_policy( SET CMP0003 NEW )
-  endif ( COMMAND cmake_policy )
-  # Always build tests
-  enable_testing()
-
-  list (APPEND CMAKE_MODULE_PATH "${MOAB_SOURCE_DIR}/config")
-  include (config/GetAcInitVersion.cmake)
-
-  # enable_language( Fortran )
-
-  get_ac_init_version()
-  set ( MOAB_VERSION_MAJOR  "${MAJOR_VERSION}"  )
-  set ( MOAB_VERSION_MINOR  "${MINOR_VERSION}"  )
-  set ( MOAB_VERSION        "${VERSION_STRING}" )
-  set ( MOAB_VERSION_STRING "${VERSION_STRING}" )
-  if ( DEFINED PATCH_VERSION )
-    set ( MOAB_VERSION_PATCH "${PATCH_VERSION}" )
-  else ( DEFINED PATCH_VERSION )
-    if ( MOAB_VERSION_MINOR EQUAL 99 )
-      set ( MOAB_VERSION_STRING "${MOAB_VERSION_STRING} (alpha)" )
-    else ( MOAB_VERSION_MINOR EQUAL 99 )
-      set ( MOAB_VERSION_STRING "${MOAB_VERSION_STRING} (beta)" )
-    endif ( MOAB_VERSION_MINOR EQUAL 99 )
-  endif ( DEFINED PATCH_VERSION )
-
-  set ( EXECUTABLE_OUTPUT_PATH ${MOAB_BINARY_DIR}/bin CACHE PATH "Path to executables" FORCE )
-  set ( LIBRARY_OUTPUT_PATH    ${MOAB_BINARY_DIR}/bin CACHE PATH "Path to libraries"   FORCE )
-  mark_as_advanced(
-    EXECUTABLE_OUTPUT_PATH
-    LIBRARY_OUTPUT_PATH
-  )
-
-  # Compiler defines... this should really be in a config file.
-  set( MOAB_DEFINES "" )
-
-  include ( CheckIncludeFile )
-  include ( CheckFunctionExists )
-  include ( CheckTypeSize )
-
-  # Shared libraries
-  option ( BUILD_SHARED_LIBS "Should shared or static libraries be created?" ON )
-
-  # HANDLE SIZE
-  option ( MOAB_FORCE_64_BIT_HANDLES "Force MBEntityHandle to be 64 bits (uint64_t)" OFF )
-  option ( MOAB_FORCE_32_BIT_HANDLES "Force MBEntityHandle to be 32 bits (uint32_t)" OFF )
-  mark_as_advanced(
+# Always build tests
+#enable_testing()
+
+#Add our Cmake directory to the module search path
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/config ${CMAKE_MODULE_PATH})
+
+################################################################################
+# Set up version info
+################################################################################
+include (config/GetAcInitVersion.cmake)
+get_ac_init_version()
+set ( MOAB_VERSION_MAJOR  "${MAJOR_VERSION}"  )
+set ( MOAB_VERSION_MINOR  "${MINOR_VERSION}"  )
+set ( MOAB_VERSION        "${VERSION_STRING}" )
+set ( MOAB_VERSION_STRING "${VERSION_STRING}" )
+if ( DEFINED PATCH_VERSION )
+  set ( MOAB_VERSION_PATCH "${PATCH_VERSION}" )
+else ( DEFINED PATCH_VERSION )
+  if ( MOAB_VERSION_MINOR EQUAL 99 )
+    set ( MOAB_VERSION_STRING "${MOAB_VERSION_STRING} (alpha)" )
+  else ( MOAB_VERSION_MINOR EQUAL 99 )
+    set ( MOAB_VERSION_STRING "${MOAB_VERSION_STRING} (beta)" )
+  endif ( MOAB_VERSION_MINOR EQUAL 99 )
+endif ( DEFINED PATCH_VERSION )
+
+################################################################################
+# Install Related Settings
+################################################################################
+
+## Set the directory where the binaries will be stored
+set( EXECUTABLE_OUTPUT_PATH
+  ${PROJECT_BINARY_DIR}/bin
+  CACHE PATH
+  "Directory where all executable will be stored"
+)
+
+## Set the directory where the libraries will be stored
+set( LIBRARY_OUTPUT_PATH
+  ${PROJECT_BINARY_DIR}/lib
+  CACHE PATH
+  "Directory where all the libraries will be stored"
+)
+mark_as_advanced(
+  EXECUTABLE_OUTPUT_PATH
+  LIBRARY_OUTPUT_PATH)
+
+include ( CheckIncludeFile )
+include ( CheckFunctionExists )
+include ( CheckTypeSize )
+
+# Compiler defines... this should really be in a config file.
+set( MOAB_DEFINES "" )
+set( MOAB_INSTALL_TARGETS )
+
+################################################################################
+# Options that the user controls
+################################################################################
+option ( BUILD_SHARED_LIBS   "Should shared or static libraries be created?"   ON  )
+option ( MOAB_USE_SZIP       "Should build with szip support?"                 OFF )
+option ( MOAB_USE_CGM        "Should build with CGM support?"                  OFF )
+option ( MOAB_USE_MPI        "Should MOAB be compiled with MPI support?"       OFF )
+option ( MOAB_USE_HDF        "Include HDF I/O in the build?"                   OFF )
+option ( MOAB_USE_NETCDF     "Include NetCDF support (ExodusII) in the build?" OFF )
+option ( MOAB_ENABLE_TESTING "Enable Testing"                                  ON  )
+option ( MOAB_FORCE_64_BIT_HANDLES "Force MBEntityHandle to be 64 bits (uint64_t)" OFF )
+option ( MOAB_FORCE_32_BIT_HANDLES "Force MBEntityHandle to be 32 bits (uint32_t)" OFF )
+
+mark_as_advanced(
     MOAB_FORCE_64_BIT_HANDLES
     MOAB_FORCE_32_BIT_HANDLES
   )
 
-  if ( MOAB_FORCE_64_BIT_HANDLES AND MOAB_FORCE_32_BIT_HANDLES )
-    message( FATAL_ERROR
+
+################################################################################
+# Check for system include files
+################################################################################
+check_include_file( inttypes.h   MOAB_HAVE_INTTYPES_H )
+check_include_file( stdint.h     MOAB_HAVE_STDINT_H )
+check_include_file( stddef.h     MOAB_HAVE_STDDEF_H )
+check_include_file( stdlib.h     MOAB_HAVE_STDLIB_H )
+check_include_file( sys/types.h  MOAB_HAVE_SYS_TYPES_H )
+set( HAVE_SYS_TYPES_H ${MOAB_HAVE_SYS_TYPES_H} )
+set( HAVE_STDDEF_H    ${MOAB_HAVE_STDDEF_H} )
+set( HAVE_STDINT_H    ${MOAB_HAVE_STDINT_H} )
+set( HAVE_INTTYPES_H    ${MOAB_HAVE_INTTYPES_H} )
+set( HAVE_STDLIB_H    ${MOAB_HAVE_STDLIB_H} )
+check_include_file( memory.h     HAVE_MEMORY_H )
+
+################################################################################
+# Interger size Related Settings
+################################################################################
+if ( MOAB_FORCE_64_BIT_HANDLES AND MOAB_FORCE_32_BIT_HANDLES )
+  message( FATAL_ERROR
       "You may not turn both MOAB_FORCE_64_BIT_HANDLES and MOAB_FORCE_32_BIT_HANDLES on. Turn one off to continue."
     )
-  endif ( MOAB_FORCE_64_BIT_HANDLES AND MOAB_FORCE_32_BIT_HANDLES )
-
-  check_include_file( inttypes.h   MOAB_HAVE_INTTYPES_H )
-  check_include_file( stdint.h     MOAB_HAVE_STDINT_H )
-  check_include_file( stddef.h     MOAB_HAVE_STDDEF_H )
-  check_include_file( stdlib.h     MOAB_HAVE_STDLIB_H )
-  check_include_file( sys/types.h  MOAB_HAVE_SYS_TYPES_H )
-  set( HAVE_SYS_TYPES_H ${MOAB_HAVE_SYS_TYPES_H} )
-  set( HAVE_STDDEF_H    ${MOAB_HAVE_STDDEF_H} )
-  set( HAVE_STDINT_H    ${MOAB_HAVE_STDINT_H} )
-  set( HAVE_INTTYPES_H    ${MOAB_HAVE_INTTYPES_H} )
-  set( HAVE_STDLIB_H    ${MOAB_HAVE_STDLIB_H} )
-  check_include_file( memory.h     HAVE_MEMORY_H )
-
-  if ( NOT MOAB_FORCE_64_BIT_HANDLES AND NOT MOAB_FORCE_32_BIT_HANDLES )
-    if ( MOAB_HAVE_INTTYPES_H )
-      set ( CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};inttypes.h" )
-    endif ( MOAB_HAVE_INTTYPES_H )
-    if ( MOAB_HAVE_STDLIB_H )
-      set ( CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};stdlib.h" )
-      #set ( CHECK_TYPE_SIZE_PREMAIN "${CHECK_TYPE_SIZE_PREMAIN}\n#include <stdlib.h>\n" )
-    endif ( MOAB_HAVE_STDLIB_H )
-    check_type_size(  size_t       HAVE_SIZE_T )
-    check_type_size(  ptrdiff_t    HAVE_PTRDIFF_T )
-    set ( MOAB_HAVE_SIZE_T ${HAVE_SIZE_T} )
-    set ( MOAB_HAVE_PTRDIFF_T ${HAVE_PTRDIFF_T} )
-  endif ( NOT MOAB_FORCE_64_BIT_HANDLES AND NOT MOAB_FORCE_32_BIT_HANDLES )
-
-  try_compile( TEMPLATE_DEFS_INCLUDED ${MOAB_BINARY_DIR} ${MOAB_SOURCE_DIR}/config/TemplateSpecialization.cxx OUTPUT_VARIABLE BLORT )
-  if ( TEMPLATE_DEFS_INCLUDED )
-    set ( MOAB_DEFINES "${MOAB_DEFINES} -DTEMPLATE_DEFS_INCLUDED" )
-  endif ( TEMPLATE_DEFS_INCLUDED )
-
-  # find Verdict
-  find_package( verdict REQUIRED )
-
-  # Build options
-  option ( MOAB_USE_MPI    "Should MOAB be compiled with MPI support?"       OFF )
-  option ( MOAB_USE_HDF    "Include HDF I/O in the build?"                   OFF )
-  option ( MOAB_USE_NETCDF "Include NetCDF support (ExodusII) in the build?" OFF )
-
-  # iMesh
-  option ( MOAB_BUILD_IMESH        "Build the iMesh interface?"           ON )
-
-  # check for MPI package
-  if ( MOAB_USE_MPI )
-    find_package( MPI )
-    # CMake FindMPI script is sorely lacking:
-    if ( MPI_LIBRARY AND MPI_INCLUDE_PATH )
-      set( MPI_FOUND 1 )
-    endif ( MPI_LIBRARY AND MPI_INCLUDE_PATH )
-
-    if ( MPI_FOUND )
-      set ( MOAB_DEFINES "${MOAB_DEFINES} -DUSE_MPI" )
-    endif ( MPI_FOUND )
-  endif ( MOAB_USE_MPI )
-
-  if ( MOAB_USE_NETCDF )
-    find_package( NetCDF )
-  endif ( MOAB_USE_NETCDF )
-
-  if ( MOAB_USE_HDF )
-    # HDF5
-    find_package( HDF5 )
-  endif ( MOAB_USE_HDF )
-
-  add_subdirectory( src )
-  add_subdirectory( itaps/imesh )
-  add_subdirectory( tools )
-  add_subdirectory( test )
+endif ( MOAB_FORCE_64_BIT_HANDLES AND MOAB_FORCE_32_BIT_HANDLES )
+
+if ( NOT MOAB_FORCE_64_BIT_HANDLES AND NOT MOAB_FORCE_32_BIT_HANDLES )
+  if ( MOAB_HAVE_INTTYPES_H )
+    set ( CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};inttypes.h" )
+  endif ( MOAB_HAVE_INTTYPES_H )
+  if ( MOAB_HAVE_STDLIB_H )
+    set ( CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};stdlib.h" )
+    #set ( CHECK_TYPE_SIZE_PREMAIN "${CHECK_TYPE_SIZE_PREMAIN}\n#include <stdlib.h>\n" )
+  endif ( MOAB_HAVE_STDLIB_H )
+  check_type_size(  size_t       HAVE_SIZE_T )
+  check_type_size(  ptrdiff_t    HAVE_PTRDIFF_T )
+  set ( MOAB_HAVE_SIZE_T ${HAVE_SIZE_T} )
+  set ( MOAB_HAVE_PTRDIFF_T ${HAVE_PTRDIFF_T} )
+endif ( NOT MOAB_FORCE_64_BIT_HANDLES AND NOT MOAB_FORCE_32_BIT_HANDLES )
+
+
+################################################################################
+# Find packages
+################################################################################
+find_package( verdict REQUIRED )
+
+# check for MPI package
+if ( MOAB_USE_MPI )
+  find_package( MPI REQUIRED )
+  # CMake FindMPI script is sorely lacking:
+  if ( MPI_LIBRARY AND MPI_INCLUDE_PATH )
+    set( MPI_FOUND 1 )
+  endif ( MPI_LIBRARY AND MPI_INCLUDE_PATH )
+
+  if ( MPI_FOUND )
+    set ( MOAB_DEFINES "${MOAB_DEFINES} -DUSE_MPI" )
+  endif ( MPI_FOUND )
+endif ( MOAB_USE_MPI )
 
+if ( MOAB_USE_NETCDF )
+  find_package( NetCDF REQUIRED )
+endif ( MOAB_USE_NETCDF )
+
+if ( MOAB_USE_HDF )
+  find_package( HDF5 REQUIRED )
+endif ( MOAB_USE_HDF )
+
+if ( MOAB_USE_ZLIB )
+  find_package( ZLIB REQUIRED )
+endif ( )
+
+if ( MOAB_USE_CGM )
+   find_package( CGM REQUIRED )
+   set( MOAB_DEFINES "-DCGM ${MOAB_DEFINES}" )
+endif ()
+
+################################################################################
+# Add Directories
+################################################################################
+add_subdirectory( src )
+add_subdirectory( itaps )
+add_subdirectory( tools )
+
+################################################################################
+# Testing Related Settings
+################################################################################
+#turn on ctest if we want testing
+if ( MOAB_ENABLE_TESTING )
+  enable_testing()
+  add_subdirectory( test )
+endif()
+
+###############################################################################
+#
+###############################################################################
+export(TARGETS ${MOAB_INSTALL_TARGETS}
+              FILE "${PROJECT_BINARY_DIR}/MOABTargets.cmake")
+install(EXPORT MOABTargets DESTINATION lib)
+
+################################################################################
+# Generate the MOABConfig.cmake file
+################################################################################
+set(CXX ${CMAKE_CXX_COMPILER})
+set(CC ${CMAKE_C_COMPILER})
+set(F77 "" )
+set(FC "")
+set(CXXFLAGS ${MOAB_DEFINES})
+set(AM_CXXFLAGS)
+set(CFLAGS ${MOAB_DEFINES})
+set(AM_CFLAGS)
+set(MOAB_FFLAGS)
+set(AM_FFLAGS)
+
+configure_file(MOABConfig.new.cmake.in
+  "${PROJECT_BINARY_DIR}/MOABConfig.cmake" @ONLY)
+install( FILES "${PROJECT_BINARY_DIR}/MOABConfig.cmake" DESTINATION lib )

diff --git a/MOABConfig.new.cmake.in b/MOABConfig.new.cmake.in
new file mode 100644
index 0000000..0031a83
--- /dev/null
+++ b/MOABConfig.new.cmake.in
@@ -0,0 +1,27 @@
+# Config file for MOAB; use the CMake find_package() function to pull this into
+# your own CMakeLists.txt file.
+#
+# This file defines the following variables:
+# MOAB_FOUND        - boolean indicating that MOAB is found
+# MOAB_INCLUDE_DIRS - include directories from which to pick up MOAB includes
+# MOAB_LIBRARIES    - libraries need to link to MOAB; use this in target_link_libraries for MOAB-dependent targets
+# MOAB_CXX, MOAB_CC, MOAB_F77, MOAB_FC - compilers used to compile MOAB
+# MOAB_CXXFLAGS, MOAB_CCFLAGS, MOAB_FFLAGS, MOAB_FCFLAGS - compiler flags used to compile MOAB; possibly need to use these in add_definitions or CMAKE_<LANG>_FLAGS_<MODE> 
+
+set(MOAB_FOUND 1)
+
+# Compiler flags used by MOAB
+
+set(MOAB_CXXFLAGS "@CXXFLAGS@ @AM_CXXFLAGS@")
+set(MOAB_CFLAGS "@CFLAGS@ @AM_CFLAGS@")
+set(MOAB_FORTRAN_FLAGS "@MOAB_FFLAGS@ @AM_FFLAGS@")
+
+# Library and include defs
+get_filename_component(MOAB_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+if(NOT TARGET MOAB AND NOT MOAB_BINARY_DIR)
+  include("${MOAB_CMAKE_DIR}/MOABTargets.cmake")
+endif()
+
+set(MOAB_INCLUDE_DIRS "%CMAKE_INSTALL_PREFIX%/include")
+set(MOAB_LIBRARIES MOAB)

diff --git a/config/AutoconfHeader.cmake b/config/AutoconfHeader.cmake
index 360f2b8..1d83ee8 100644
--- a/config/AutoconfHeader.cmake
+++ b/config/AutoconfHeader.cmake
@@ -27,3 +27,10 @@ else ( EXISTS "${OUTFILE}" )
 endif ( EXISTS "${OUTFILE}" )
 
 endmacro( autoconf_header )
+
+macro( moab_install_headers )
+  foreach (header ${ARGV})
+    string(REGEX MATCH "(.*)/" DIR ${header})
+    install(FILES ${header} DESTINATION include/${DIR})
+  endforeach()
+endmacro(moab_install_headers)

diff --git a/config/FindCGM.cmake b/config/FindCGM.cmake
index 5bc833e..da3ac32 100644
--- a/config/FindCGM.cmake
+++ b/config/FindCGM.cmake
@@ -1,5 +1,4 @@
 # Find the common geometry module libraries
-
 if ( NOT CGM_SOURCE_DIR )
   find_path( CGM_SOURCE_DIR
     NAMES geom/CubitGeomConfigure.h.in

diff --git a/itaps/CMakeLists.txt b/itaps/CMakeLists.txt
new file mode 100644
index 0000000..3bf949a
--- /dev/null
+++ b/itaps/CMakeLists.txt
@@ -0,0 +1,14 @@
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+set( BASE_INCLUDE_HEADERS iBase.h iBase_f.h)
+option ( ENABLE_IMESH        "Should build IMESH?"       OFF )
+option ( ENABLE_IGEOM        "Should build IGEOM?"       OFF )
+
+if(ENABLE_IMESH )
+  add_subdirectory(imesh)
+endif()
+
+if(ENABLE_IGEOM )
+  add_subdirectory(igeom)
+endif()
+
+install(FILES ${BASE_INCLUDE_HEADERS} DESTINATION include)

diff --git a/itaps/igeom/CMakeLists.txt b/itaps/igeom/CMakeLists.txt
new file mode 100644
index 0000000..b311cd1
--- /dev/null
+++ b/itaps/igeom/CMakeLists.txt
@@ -0,0 +1,20 @@
+ADD_CUSTOM_COMMAND(
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FBiGeom_protos.h
+  COMMAND ${CMAKE_COMMAND}
+          -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/FBiGeom.h
+          -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/FBiGeom_protos.h
+          -Dprefix:STRING=FBiGeom
+          -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh.h )
+
+set( FBiGEOM_SOURCE FBiGeom_MOAB.hpp FBiGeom_MOAB.cpp )
+set( FBiGEOM_INCLUDE_HEADERS FBiGeom.h
+                             ${CMAKE_CURRENT_BINARY_DIR}/FBiGeom_protos.h
+	                           FBiGeom_f.h )
+
+add_library( FBiGeomMOAB
+  ${FBiGEOM_SOURCE}
+  ${FBiGEOM_INCLUDE_HEADERS} )
+
+target_link_libraries( FBiGeomMOAB MOAB )
+

diff --git a/itaps/imesh/CMakeLists.txt b/itaps/imesh/CMakeLists.txt
index e98c0b1..a7fa3ae 100644
--- a/itaps/imesh/CMakeLists.txt
+++ b/itaps/imesh/CMakeLists.txt
@@ -7,8 +7,7 @@ ADD_CUSTOM_COMMAND(
           -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMesh_protos.h
           -Dprefix:STRING=iMesh
           -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
-  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh.h
-  )
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh.h )
 ADD_CUSTOM_COMMAND(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMesh_extensions_protos.h
   COMMAND ${CMAKE_COMMAND}
@@ -16,56 +15,60 @@ ADD_CUSTOM_COMMAND(
           -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMesh_extensions_protos.h
           -Dprefix:STRING=iMesh
           -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
-  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh_extensions.h
-  )
-ADD_CUSTOM_COMMAND(
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
-  COMMAND ${CMAKE_COMMAND}
-          -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMeshP.h
-          -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
-          -Dprefix:STRING=iMeshP
-          -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
-  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMeshP.h
-  )
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh_extensions.h )
 
 set ( MOAB_IMESH_SRCS
-      iMesh_MOAB.cpp
-      ${CMAKE_CURRENT_BINARY_DIR}/iMesh_protos.h
-      ${CMAKE_CURRENT_BINARY_DIR}/iMesh_extensions_protos.h
-      ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h )
+          iMesh_MOAB.hpp iMesh_MOAB.cpp
+          MBIter.hpp )
+set ( MOAB_IMESH_LIB_INCLUDES
+          iMesh.h
+          iMesh_extensions.h
+          ${CMAKE_CURRENT_BINARY_DIR}/iMesh_extensions_protos.h
+          iMesh_f.h
+          ${CMAKE_CURRENT_BINARY_DIR}/iMesh_protos.h
+          MBiMesh.hpp )
 
-include_directories(
-    ${MOAB_BINARY_DIR}
-    ${MOAB_BINARY_DIR}/src
-    ${MOAB_BINARY_DIR}/src/parallel
-    ${MOAB_SOURCE_DIR}/src
-    ${MOAB_SOURCE_DIR}/itaps
-    ${MOAB_SOURCE_DIR}/itaps/imesh
-  )
+if ( MOAB_USE_MPI AND MPI_FOUND )
+  ADD_CUSTOM_COMMAND(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
+    COMMAND ${CMAKE_COMMAND}
+            -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMeshP.h
+            -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
+            -Dprefix:STRING=iMeshP
+            -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
+    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMeshP.h )
 
-if ( MOAB_USE_HDF5 AND HDF5_FOUND )
-  include_directories(
-    ${HDF5_INCLUDE_DIRECTORIES}
-    ${MOAB_SOURCE_DIR}/src/io/mhdf/include
-  )
-endif ( MOAB_USE_HDF5 AND HDF5_FOUND )
+  set(MOAB_IMESH_SRCS ${MOAB_IMESH_SRCS}
+                      iMeshP_MOAB.cpp)
+  set(MOAB_IMESH_LIB_INCLUDES
+          ${MOAB_IMESH_LIB_INCLUDES}
+          ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h )
+  include_directories( ${CMAKE_SOURCE_DIR}/src/parallel )
+endif()
 
-if ( MOAB_USE_MPI AND MPI_FOUND )
-  LIST ( APPEND MOAB_IMESH_SRCS
-         iMeshP_MOAB.cpp
-         ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h )
+include_directories( #${CMAKE_BINARY_DIR}
+                     #${CMAKE_BINARY_DIR}/src
+                     #${CMAKE_BINARY_DIR}/src/parallel
+                     ${CMAKE_SOURCE_DIR}/src
+                     ${CMAKE_SOURCE_DIR}/itaps
+                     ${CMAKE_SOURCE_DIR}/itaps/imesh )
 
-  include_directories(
-    ${MOAB_SOURCE_DIR}/src/parallel
-  )
-endif ( MOAB_USE_MPI AND MPI_FOUND )
+if ( MOAB_USE_HDF5 AND HDF5_FOUND )
+  include_directories( ${HDF5_INCLUDE_DIRECTORIES}
+                       ${CMAKE_SOURCE_DIR}/src/io/mhdf/include )
+endif( )
 
-set_source_files_properties( ${MOAB_IMESH_SRCS}
-  COMPILE_FLAGS "${MOAB_DEFINES}"
-)
+set_source_files_properties( ${MOAB_IMESH_SRCS} COMPILE_FLAGS "${MOAB_DEFINES}" )
 
-add_library( iMesh
-  ${MOAB_IMESH_SRCS}
-  )
+add_library( iMesh ${MOAB_IMESH_SRCS}
+                   ${MOAB_IMESH_LIB_INCLUDES} )
 
 target_link_libraries( iMesh MOAB )
+
+install(TARGETS iMesh EXPORT MOABTargets
+                      RUNTIME DESTINATION bin
+                      LIBRARY DESTINATION lib
+                      ARCHIVE DESTINATION lib )
+set( MOAB_INSTALL_TARGETS ${MOAB_INSTALL_TARGETS} iMesh)
+
+install(FILES ${MOAB_IMESH_LIB_INCLUDES} DESTINATION include)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 280b203..1328d00 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,182 +1,178 @@
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}
+                    parallel
+                    LocalDiscretization
+                    io )
 
-  # MOAB Library
-  set ( MOABCORE_LIB_SRCS
-    AdaptiveKDTree.cpp
-    AEntityFactory.cpp
-    AffineXform.cpp
-    AxisBox.cpp
-    BitPage.cpp
-    BitTag.cpp
-    BSPTree.cpp
-    BSPTreePoly.cpp
-    CN.cpp
-    CartVect.cpp
-    Core.cpp
-    DebugOutput.cpp
-    DenseTag.cpp
-    DualTool.cpp
-    EntitySequence.cpp
-    Factory.cpp
-    FileOptions.cpp
-    GeomUtil.cpp
-    GeomTopoTool.cpp
-    HigherOrderFactory.cpp
-    HomXform.cpp
-    MeshSet.cpp
-    MeshSetSequence.cpp
-    MeshTag.cpp
-    MeshTopoUtil.cpp
-    OrientedBox.cpp
-    OrientedBoxTreeTool.cpp
-    PolyElementSeq.cpp
-    Range.cpp
-    RangeSeqIntersectIter.cpp
-    ReadUtil.cpp
-    ScdElementData.cpp
-    ScdInterface.cpp
-    ScdVertexData.cpp
-    SequenceData.cpp
-    SequenceManager.cpp
-    SetIterator.cpp
-    Skinner.cpp
-    SparseTag.cpp
-    StructuredElementSeq.cpp
-    SweptElementData.cpp
-    SweptElementSeq.cpp
-    SweptVertexData.cpp
-    SysUtil.cpp
-    TagInfo.cpp
-    Types.cpp
-    TypeSequenceManager.cpp
-    UnstructuredElemSeq.cpp
-    Util.cpp
-    VarLenDenseTag.cpp
-    VarLenSparseTag.cpp
-    VertexSequence.cpp
-    WriteUtil.cpp
-  )
+if(MOAB_USE_MPI AND MPI_FOUND)
+  add_subdirectory(parallel)
+  set( MOAB_MPI MOABpar )
+endif()
 
-  set ( MOABPTLOC_LIB_SRCS
-    lotte/findpt.c
-    lotte/errmem.c
-    lotte/poly.c
-    lotte/tensor.c
-  )
+add_subdirectory(io)
+add_subdirectory(LocalDiscretization)
+add_subdirectory(oldinc)
 
-  set ( MOABIO_LIB_SRCS
-    io/IODebugTrack.cpp
-    io/ExoIIUtil.cpp
-    io/FileTokenizer.cpp
-    io/GmshUtil.cpp
-    io/ReadABAQUS.cpp
-    io/ReadGmsh.cpp
-    io/ReadGCRM.cpp
-    io/ReadIDEAS.cpp
-    io/ReadMCNP5.cpp
-    io/ReadNASTRAN.cpp
-    io/ReadSmf.cpp
-    io/ReadSms.cpp
-    io/ReadSTL.cpp
-    io/ReadTemplate.cpp
-    io/ReadTetGen.cpp
-    io/ReadTxt.cpp
-    io/ReadVtk.cpp
-    io/SMF_State.cpp
-    io/Tqdcfr.cpp
-    io/VtkUtil.cpp
-    io/WriteAns.cpp
-    io/WriteGMV.cpp
-    io/WriteGmsh.cpp
-    io/WriteSTL.cpp
-    io/WriteSmf.cpp
-    io/WriteTemplate.cpp
-    io/WriteVtk.cpp
-    ReaderWriterSet.cpp
-  )
-  include_directories(
-    ${MOAB_BINARY_DIR}
-    ${MOAB_SOURCE_DIR}/src
-    ${MOAB_BINARY_DIR}/src
-    ${MOAB_SOURCE_DIR}/src/io
-    ${MOAB_SOURCE_DIR}/src/parallel
-    ${MOAB_BINARY_DIR}/src/parallel
-    ${MOAB_SOURCE_DIR}/src/moab/point_locater/lotte
-  )
+set(MOAB_LIB_SOURCES
+        AdaptiveKDTree.cpp
+        AEntityFactory.hpp AEntityFactory.cpp
+        AffineXform.hpp    AffineXform.cpp
+        AxisBox.hpp        AxisBox.cpp
+        BitPage.hpp        BitPage.cpp
+        BitTag.hpp         BitTag.cpp
+        BoundBox.cpp
+        BSPTree.cpp
+        BSPTreePoly.cpp
+        BVHTree.cpp
+        CN.cpp
+        CartVect.cpp
+        Core.cpp
+        DebugOutput.hpp DebugOutput.cpp
+        DenseTag.hpp    DenseTag.cpp
+        DualTool.cpp
+        ElementSequence.hpp
+        EntitySequence.hpp  EntitySequence.cpp
+        Factory.cpp
+        FBEngine.cpp
+        FileOptions.cpp
+        GeomUtil.cpp
+        GeomTopoTool.cpp
+        HigherOrderFactory.cpp
+        HomXform.cpp
+        Internals.hpp
+        MBCNArrays.hpp
+        MergeMesh.cpp
+        MeshSet.hpp         MeshSet.cpp
+        MeshSetSequence.hpp MeshSetSequence.cpp
+        MeshTag.hpp         MeshTag.cpp
+        MeshTopoUtil.cpp
+        OrientedBox.hpp     OrientedBox.cpp
+        OrientedBoxTreeTool.cpp
+        lotte/poly.c
+        lotte/findpt.c
+        lotte/errmem.c
+        lotte/tensor.c
+        PolyElementSeq.hpp  PolyElementSeq.cpp
+        ProgOptions.cpp
+        Range.cpp
+        RangeSeqIntersectIter.hpp RangeSeqIntersectIter.cpp
+        ReadUtil.hpp              ReadUtil.cpp
+        ReaderWriterSet.cpp
+        ReorderTool.cpp
+        ScdElementData.hpp        ScdElementData.cpp
+        ScdInterface.cpp
+        ScdVertexData.hpp         ScdVertexData.cpp
+        SequenceData.hpp          SequenceData.cpp
+        SequenceManager.hpp       SequenceManager.cpp
+        SetIterator.cpp
+        Skinner.cpp
+        SmoothCurve.hpp           SmoothCurve.cpp
+        SmoothFace.hpp            SmoothFace.cpp
+        SparseTag.hpp             SparseTag.cpp
+        SpatialLocator.cpp
+        SpectralMeshTool.cpp
+        StructuredElementSeq.hpp  StructuredElementSeq.cpp
+        SweptElementData.hpp      SweptElementData.cpp
+        SweptElementSeq.hpp       SweptElementSeq.cpp
+        SweptVertexData.hpp       SweptVertexData.cpp
+        SysUtil.hpp               SysUtil.cpp
+        TagCompare.hpp
+        TagInfo.hpp               TagInfo.cpp
+        Tree.cpp
+        Types.cpp
+        TypeSequenceManager.hpp   TypeSequenceManager.cpp
+        UnstructuredElemSeq.hpp   UnstructuredElemSeq.cpp
+        Util.cpp
+        VarLenDenseTag.hpp        VarLenDenseTag.cpp
+        VarLenSparseTag.hpp       VarLenSparseTag.cpp
+        VarLenTag.hpp      
+        VertexSequence.hpp        VertexSequence.cpp
+        WriteUtil.hpp             WriteUtil.cpp
+        moab_mpe.h )
 
-  if ( NetCDF_FOUND )
-    set ( MOAB_DEFINES "${MOAB_DEFINES} -DNETCDF_FILE" )
-    set ( MOABIO_LIB_SRCS
-      ${MOABIO_LIB_SRCS}
-      io/ReadNC.cpp
-      io/ReadNCDF.cpp
-      io/WriteNCDF.cpp
-      io/WriteSLAC.cpp
-      io/NCHelper.cpp
-      io/NCHelperEuler.cpp
-      io/NCHelperFV.cpp
-      io/NCHelperHOMME.cpp
-      io/NCHelperMPAS.cpp
-      SpectralMeshTool.cpp
-    )
-    include_directories(
-      ${NetCDF_INCLUDE_DIRECTORIES}
-    )
-  endif ( NetCDF_FOUND )
+set( MOAB_INSTALL_HEADERS
+        moab/AdaptiveKDTree.hpp
+        moab/BoundBox.hpp
+        moab/BSPTree.hpp
+        moab/BSPTreePoly.hpp
+        moab/BVHTree.hpp
+        moab/CN.hpp
+        moab/CartVect.hpp
+        moab/Compiler.hpp
+        moab/Core.hpp
+        moab/CpuTimer.hpp
+        moab/DualTool.hpp
+        moab/Error.hpp
+        moab/GeomTopoTool.hpp
+        moab/HigherOrderFactory.hpp
+        moab/HomXform.hpp
+        moab/EigenDecomp.hpp
+        moab/EntityType.hpp
+        moab/EntityHandle.hpp
+        moab/FBEngine.hpp
+        moab/FileOptions.hpp
+        moab/FindPtFuncs.h
+        moab/Forward.hpp
+        moab/GeomUtil.hpp
+        moab/Interface.hpp
+        moab/point_locater/tree/common_tree.hpp
+        moab/point_locater/tree/element_tree.hpp
+        moab/point_locater/tree/bvh_tree.hpp
+        moab/point_locater/io.hpp 
+        moab/point_locater/element_maps/linear_hex_map.hpp 
+        moab/point_locater/element_maps/linear_tet_map.hpp 
+        moab/point_locater/element_maps/spectral_hex_map.hpp 
+        moab/point_locater/element_maps/quadratic_hex_map.hpp 
+        moab/point_locater/point_locater.hpp
+        moab/point_locater/parametrizer.hpp
+        moab/Matrix3.hpp
+        moab/MergeMesh.hpp
+        moab/MeshTopoUtil.hpp
+        moab/OrientedBoxTreeTool.hpp
+        moab/ProgOptions.hpp
+        moab/Range.hpp
+        moab/RangeMap.hpp
+        moab/ReadUtilIface.hpp
+        moab/ReaderIface.hpp
+        moab/ReaderWriterSet.hpp
+        moab/ReorderTool.hpp
+        moab/ScdInterface.hpp
+        moab/SetIterator.hpp
+        moab/Skinner.hpp
+        moab/SpatialLocator.hpp
+        moab/SpectralMeshTool.hpp
+        moab/Tree.hpp
+        moab/TreeStats.hpp
+        moab/Types.hpp
+        moab/UnknownInterface.hpp
+        moab/Util.hpp
+        moab/WriteUtilIface.hpp
+        moab/WriterIface.hpp
+        MBEntityType.h
+        MBCN.h
+        MOAB_FCDefs.h
+        MBCN_protos.h
+        MBTagConventions.hpp )
+        
+if( CGM_FOUND )
+  set( MOAB_CGM_LIBS ${CGM_LIBRARIES} )
+endif()
 
-  if ( HDF5_FOUND )
-    set ( MOAB_DEFINES "${MOAB_DEFINES} -DHDF5_FILE" )
-    check_function_exists( H5Pset_fapl_mpio MOAB_HDF_HAVE_PARALLEL )
-    set ( MOABIO_LIB_SRCS
-      ${MOABIO_LIB_SRCS}
-      io/HDF5Common.cpp
-      io/ReadHDF5.cpp
-      io/ReadHDF5Dataset.cpp
-      io/ReadHDF5VarLen.cpp
-      io/WriteHDF5.cpp
-    )
+if (MBZOLTAN_ENABLE AND ZOLTAN_FOUND)
+  set( MOAB_LIB_SOURCES ${MOAB_LIB_SOURCES}
+          ${CMAKE_SOURCE_DIR}/tools/mbzoltan/MBZoltan.cpp )
+  set( MOAB_INSTALL_HEADERS ${MOAB_INSTALL_HEADERS}
+          ${CMAKE_SOURCE_DIR}/tools/mbzoltan/MBZoltan.hpp )
+endif()
 
-    include_directories(
-      ${HDF5_INCLUDE_DIR}
-      io/mhdf/include
-    )
-    add_subdirectory( io/mhdf )
-  endif ( HDF5_FOUND )
+add_library( MOAB ${MOAB_LIB_SOURCES} ${MOAB_INSTALL_HEADERS} )
+target_link_libraries( MOAB PRIVATE moabio moab_loc_discr )
+target_link_libraries( MOAB ${MOAB_MPI} ${MOAB_CGM_LIBS} )
+set_target_properties( MOAB PROPERTIES COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}")
 
-
-  SET(MOAB_LIB_SRCS ${MOABCORE_LIB_SRCS} ${MOABPTLOC_LIB_SRCS} ${MOABIO_LIB_SRCS})
-
-  set_source_files_properties( ${MOAB_LIB_SRCS}
-    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}"
-  )
-  add_library( MOAB
-    ${MOAB_LIB_SRCS}
-  )
-
-  if ( MOAB_USE_NETCDF AND NetCDF_FOUND )
-    target_link_libraries( MOAB ${NetCDF_LIBRARIES} )
-  endif ( MOAB_USE_NETCDF AND NetCDF_FOUND )
-
-  if ( MOAB_USE_HDF AND HDF5_FOUND )
-    target_link_libraries( MOAB mhdf ${HDF5_LIBRARIES} )
-  endif ( MOAB_USE_HDF AND HDF5_FOUND )
-
-  if ( MOAB_USE_MPI AND MPI_FOUND )
-    add_subdirectory( parallel )
-    target_link_libraries( MOAB MOABpar )
-  endif ( MOAB_USE_MPI AND MPI_FOUND )
-
-  include( ${MOAB_SOURCE_DIR}/config/AutoconfHeader.cmake )
-  # Define some more variables so they will be substituted properly in the autoconf files.
-  set( MB_VERSION        "\"${MOAB_VERSION}\"" )
-  set( MB_VERSION_MAJOR  ${MOAB_VERSION_MAJOR} )
-  set( MB_VERSION_MINOR  ${MOAB_VERSION_MINOR} )
-  if ( DEFINED MOAB_VERSION_PATCH )
-    set( MB_VERSION_PATCH  ${MOAB_VERSION_PATCH} )
-  endif ( DEFINED MOAB_VERSION_PATCH )
-  set( MB_VERSION_STRING "\"${MOAB_VERSION_STRING}\"" )
-
-  autoconf_header( ${MOAB_SOURCE_DIR}/src/moab/Version.h.in ${MOAB_BINARY_DIR}/src/moab/Version.h )
-  autoconf_header( ${MOAB_SOURCE_DIR}/src/moab/EntityHandle.hpp.in ${MOAB_BINARY_DIR}/src/moab/EntityHandle.hpp )
-  autoconf_header( ${MOAB_SOURCE_DIR}/src/parallel/moab_mpi_config.h.in ${MOAB_BINARY_DIR}/src/parallel/moab_mpi_config.h )
-  autoconf_header( ${MOAB_SOURCE_DIR}/src/FCDefs.h.in ${MOAB_BINARY_DIR}/MOAB_FCDefs.h )
-  file( WRITE ${MOAB_BINARY_DIR}/src/MBCN_protos.h "" )
+install(TARGETS MOAB EXPORT MOABTargets
+                     RUNTIME DESTINATION bin
+                     LIBRARY DESTINATION lib
+                     ARCHIVE DESTINATION lib )
+set( MOAB_INSTALL_TARGETS ${MOAB_INSTALL_TARGETS} MOAB)
+include(AutoconfHeader)
+moab_install_headers(${MOAB_INSTALL_HEADERS})

diff --git a/src/LocalDiscretization/CMakeLists.txt b/src/LocalDiscretization/CMakeLists.txt
new file mode 100644
index 0000000..0a6a269
--- /dev/null
+++ b/src/LocalDiscretization/CMakeLists.txt
@@ -0,0 +1,23 @@
+set( MOAB_LOC_DSCR_SRCS ElemEvaluator.cpp
+                        LinearHex.cpp
+                        LinearQuad.cpp
+                        LinearTet.cpp
+                        QuadraticHex.cpp )
+
+set( MOAB_LOCALDSRC_Install_Headers moab/ElemEvaluator.hpp
+                                    moab/LinearHex.hpp
+                                    moab/LinearQuad.hpp
+	                                  moab/LinearTet.hpp
+                                    moab/QuadraticHex.hpp )
+
+add_library( moab_loc_discr STATIC
+                ${MOAB_LOC_DSCR_SRCS}
+                ${MOAB_LOCALDSRC_Install_Headers} )
+
+target_link_libraries( moab_loc_discr )
+
+set_target_properties( moab_loc_discr 
+                       PROPERTIES COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}")
+
+include(AutoconfHeader)
+moab_install_headers(${MOAB_LOCALDSRC_Install_Headers})

diff --git a/src/io/CMakeLists.txt b/src/io/CMakeLists.txt
new file mode 100644
index 0000000..8b2f4c9
--- /dev/null
+++ b/src/io/CMakeLists.txt
@@ -0,0 +1,106 @@
+include_directories(${MOAB_SOURCE_DIR}/src/io)
+set( MOABIO_LIBS )
+set( MOABIO_DEFINES "-DIS_BUILDING_MB" )
+set( MOABIO_INSTALL_HEADERS moab/ExoIIInterface.hpp )
+set( MOABIO_LIB_SRCS
+        exodus_order.h
+        patran_order.h
+        IODebugTrack.hpp  IODebugTrack.cpp
+        ExoIIUtil.hpp     ExoIIUtil.cpp
+        FileTokenizer.hpp FileTokenizer.cpp
+        GmshUtil.hpp      GmshUtil.cpp
+        ReadABAQUS.hpp    ReadABAQUS.cpp
+        ReadGmsh.hpp      ReadGmsh.cpp
+        ReadIDEAS.hpp     ReadIDEAS.cpp
+        ReadMCNP5.hpp     ReadMCNP5.cpp
+        ReadNASTRAN.hpp   ReadNASTRAN.cpp
+        ReadSmf.hpp       ReadSmf.cpp
+        ReadSms.hpp       ReadSms.cpp
+        ReadSTL.hpp       ReadSTL.cpp
+        ReadTemplate.hpp  ReadTemplate.cpp
+        ReadTetGen.hpp    ReadTetGen.cpp
+        ReadTxt.hpp       ReadTxt.cpp
+        ReadVtk.hpp       ReadVtk.cpp
+        SMF_State.hpp     SMF_State.cpp
+        Tqdcfr.hpp        Tqdcfr.cpp
+        VtkUtil.hpp       VtkUtil.cpp
+        WriteAns.hpp      WriteAns.cpp
+        WriteGMV.hpp      WriteGMV.cpp
+        WriteGmsh.hpp     WriteGmsh.cpp
+        WriteSTL.hpp      WriteSTL.cpp
+        WriteSmf.hpp      WriteSmf.cpp
+        WriteTemplate.hpp WriteTemplate.cpp
+        WriteVtk.hpp      WriteVtk.cpp )
+
+if( MOAB_USE_NETCDF )
+  set( MOAB_NETCDF_SRCS
+          ReadNCDF.hpp      ReadNCDF.cpp
+          WriteNCDF.hpp     WriteNCDF.cpp
+          WriteSLAC.hpp     WriteSLAC.cpp
+          ReadNC.hpp        ReadNC.cpp
+          NCHelper.hpp      NCHelper.cpp
+          NCHelperEuler.hpp NCHelperEuler.cpp
+          NCHelperFV.hpp    NCHelperFV.cpp
+          NCHelperHOMME.hpp NCHelperHOMME.cpp
+          NCHelperMPAS.hpp  NCHelperMPAS.cpp
+          ReadGCRM.hpp      ReadGCRM.cpp )
+  include_directories( ${NetCDF_INCLUDE_DIRECTORIES} )
+  set ( MOABIO_DEFINES "${MOABIO_DEFINES} -DNETCDF_FILE" )
+  set( MOABIO_LIBS ${MOABIO_LIBS} ${NetCDF_LIBRARIES} )
+elseif( MOAB_USE_PNETCDF )
+  set( MOAB_NETCDF_SRCS
+          ReadNC.hpp        ReadNC.cpp
+          NCHelper.hpp      NCHelper.cpp
+          NCHelperEuler.hpp NCHelperEuler.cpp
+          NCHelperFV.hpp    NCHelperFV.cpp
+          NCHelperHOMME.hpp NCHelperHOMME.cpp
+          NCHelperMPAS.hpp  NCHelperMPAS.cpp
+          ReadGCRM.hpp      ReadGCRM.cpp )
+  set( MOABIO_LIBS ${MOABIO_LIBS} ${PNetCDF_LIBRARIES} )
+endif()
+
+if ( MOAB_USE_CGNS )
+  set( MOAB_CGNS_SRCS ReadCGNS.hpp ReadCGNS.cpp
+                      WriteCGNS.hpp WriteCGNS.cpp)
+  set( MOABIO_LIBS ${MOABIO_LIBS} ${CGNS_LIBRARIES} )
+endif()
+
+if( MOAB_USE_HDF )
+  include_directories( ${HDF5_INCLUDE_DIR} mhdf/include )
+  add_subdirectory( mhdf )
+  set( MOAB_HDF5_SRCS
+          HDF5Common.hpp HDF5Common.cpp
+          ReadHDF5.hpp ReadHDF5.cpp
+          ReadHDF5Dataset.hpp ReadHDF5Dataset.cpp
+          ReadHDF5VarLen.hpp ReadHDF5VarLen.cpp
+          WriteHDF5.cpp WriteHDF5.hpp )
+  set( MOABIO_LIBS ${MOABIO_LIBS} ${HDF5_LIBRARIES} mhdf )
+  set ( MOABIO_DEFINES "${MOABIO_DEFINES} -DHDF5_FILE" )
+  check_function_exists( H5Pset_fapl_mpio MOAB_HDF_HAVE_PARALLEL )
+endif()
+
+if( MOAB_USE_CCMIO )
+  set( MOAB_CCMIO_SRCS WriteCCMIO.hpp WriteCCMIO.cpp 
+                       ReadCCMIO.hpp ReadCCMIO.cpp )
+endif()
+
+if( MOAD_USE_DAMSEL )
+  set( MOAB_DAMSEL_SRCS
+          WriteDamsel.hpp WriteDamsel.cpp 
+          ReadDamsel.hpp  ReadDamsel.cpp
+          DamselUtil.hpp  DamselUtil.cpp )
+endif()
+
+if( CGM_FOUND )
+  set( MOAB_CGM_SRCS ReadCGM.hpp ReadCGM.cpp )
+endif()
+
+add_library( moabio STATIC
+                ${MOABIO_LIB_SRCS} ${MOAB_NETCDF_SRCS}
+                ${MOAB_CGNS_SRCS}  ${MOAB_HDF5_SRCS}
+                ${MOAB_CCMIO_SRCS} ${MOAB_DAMSEL_SRCS}
+                ${MOAB_CGM_SRCS}   ${MOABIO_INSTALL_HEADERS} )
+target_link_libraries( moabio ${MOABIO_LIBS} )
+set_target_properties( moabio PROPERTIES COMPILE_FLAGS "${MOABIO_DEFINES} ${MOAB_DEFINES}")
+include(AutoconfHeader)
+moab_install_headers(${MOABIO_INSTALL_HEADERS})

diff --git a/src/io/mhdf/CMakeLists.txt b/src/io/mhdf/CMakeLists.txt
index 5aeee9b..aa5585d 100644
--- a/src/io/mhdf/CMakeLists.txt
+++ b/src/io/mhdf/CMakeLists.txt
@@ -1,33 +1,33 @@
 project(mhdf)
 
-include_directories(
-  ${HDF5_INCLUDE_DIR}
-)
+include_directories( ${HDF5_INCLUDE_DIR} )
 
 set ( mhdf_LIB_SRCS
-  src/adjacency.c
-  src/connectivity.c
-  src/file-handle.c
-  src/file-desc.c
-  src/file.c
-  src/nodes.c
-  src/sets.c
-  src/status.c
-  src/status.h
-  src/tags.c
-  src/util.c
+        include/mhdf.h
+        src/adjacency.c
+        src/connectivity.c
+        src/file-desc.c
+        src/file-handle.h  src/file-handle.c
+        src/file.c
+        src/names-and-paths.h
+        src/nodes.c
+        src/sets.c
+        src/status.h src/status.c
+        src/tags.c
+        src/util.h src/util.c
 )
 
-add_library( mhdf
-  ${mhdf_LIB_SRCS}
-)
+add_library( mhdf STATIC ${mhdf_LIB_SRCS} )
+target_link_libraries( mhdf ${HDF5_LIBRARIES} )
 
-target_link_libraries(
-  mhdf
-  ${HDF5_LIBRARIES}
-)
+add_executable( h5minfo include/mhdf.h example/info.c )
+target_link_libraries( h5minfo mhdf )
+install(TARGETS h5minfo RUNTIME DESTINATION bin
+                        LIBRARY DESTINATION lib
+                        ARCHIVE DESTINATION lib )
 
-#include/mhdf.h \
-#src/file-handle.h \
-#src/names-and-paths.h \
-#src/util.h
+add_executable( h5mvalidate example/validate.c )
+target_link_libraries( h5mvalidate mhdf )
+install(TARGETS h5mvalidate RUNTIME DESTINATION bin
+                            LIBRARY DESTINATION lib
+                            ARCHIVE DESTINATION lib )

diff --git a/src/oldinc/CMakeLists.txt b/src/oldinc/CMakeLists.txt
new file mode 100644
index 0000000..be4a712
--- /dev/null
+++ b/src/oldinc/CMakeLists.txt
@@ -0,0 +1,29 @@
+set(moab_old_include_headers MBAdaptiveKDTree.hpp
+                             MBBSPTree.hpp
+                             MBBSPTreePoly.hpp
+                             MBCartVect.hpp
+                             MBCN.hpp
+                             MBCore.hpp
+                             MBEntityHandle.h
+                             MBForward.hpp
+                             MBGeomUtil.hpp
+                             MBInterface.hpp
+                             MBmpi.h
+                             MBOrientedBoxTreeTool.hpp
+                             MBParallelComm.hpp
+                             MBParallelData.hpp
+                             MBProcConfig.hpp
+                             MBRange.hpp
+                             MBReaderIface.hpp
+                             MBReaderWriterSet.hpp
+                             MBReadUtilIface.hpp
+                             MBSkinner.hpp
+                             MBTypes.h
+                             MBUnknownInterface.hpp
+                             MBUtil.hpp
+                             MBVersion.h
+                             MBWriterIface.hpp
+                             MBWriteUtilIface.hpp )
+
+include(AutoconfHeader)
+moab_install_headers(${moab_old_include_headers})

diff --git a/src/parallel/CMakeLists.txt b/src/parallel/CMakeLists.txt
index 7583885..ce0156f 100644
--- a/src/parallel/CMakeLists.txt
+++ b/src/parallel/CMakeLists.txt
@@ -2,23 +2,35 @@ set( moab_PARALLEL_SRCS
   ParallelComm.cpp
   ProcConfig.cpp
   ParallelData.cpp
-  ReadParallel.cpp
+  ParallelMergeMesh.cpp
+  ReadParallel.hpp      ReadParallel.cpp
+  SharedSetData.hpp     SharedSetData.cpp
   gs.cpp
   TupleList.cpp
-  SharedSetData.cpp
 )
 
+set(moab_PARALLEL_INSTALL_HDRS moab/gs.hpp
+                               moab_mpi.h
+                               moab_mpi_config.h
+                               moab/ParallelComm.hpp
+                               moab/ParallelMergeMesh.hpp
+                               moab/ProcConfig.hpp
+                               moab/ParallelData.hpp
+                               MBParallelConventions.h
+                               moab/TupleList.hpp )
+
 include_directories(
     ${MOAB_SOURCE_DIR}/src
     ${MOAB_SOURCE_DIR}/src/parallel
   )
 
 if ( MOAB_USE_HDF AND MOAB_HDF_HAVE_PARALLEL )
-  set( moab_PARALLEL_SRCS
-    ${moab_PARALLEL_SRCS}
-    WriteHDF5Parallel.cpp
-  )
-endif ( MOAB_USE_HDF AND MOAB_HDF_HAVE_PARALLEL )
+  set( moab_PARALLEL_SRCS ${moab_PARALLEL_SRCS}
+                          WriteHDF5Parallel.cpp )
+  
+  set( moab_PARALLEL_INSTALL_HDRS ${moab_PARALLEL_INSTALL_HDRS}
+                                  WriteHDF5Parallel.hpp )
+endif()
 
 if ( MOAB_USE_HDF )
   include_directories(
@@ -26,28 +38,16 @@ if ( MOAB_USE_HDF )
   )
 endif ( MOAB_USE_HDF )
 
-# On Mac OS X, shared libraries may not have circular
-# dependencies (e.g., MOAB depends on MOABpar depends on MOAB).
-# Force a static MOABpar library in this case.
-if ( APPLE AND BUILD_SHARED_LIBS )
-  set ( MOABpar_LIB_TYPE "STATIC" )
-else ( APPLE AND BUILD_SHARED_LIBS )
-  if ( BUILD_SHARED_LIBS )
-    set ( MOABpar_LIB_TYPE "SHARED" )
-  else ( BUILD_SHARED_LIBS )
-    set ( MOABpar_LIB_TYPE "STATIC" )
-  endif ( BUILD_SHARED_LIBS )
-endif ( APPLE AND BUILD_SHARED_LIBS )
-
 set_source_files_properties( ${moab_PARALLEL_SRCS}
   COMPILE_FLAGS "-DIS_BUILDING_MB -DSRCDIR=\"${MOAB_SOURCE_DIR}\" ${MOAB_DEFINES}"
 )
-add_library( MOABpar ${MOABpar_LIB_TYPE}
-  ${moab_PARALLEL_SRCS}
-)
+add_library( MOABpar STATIC ${moab_PARALLEL_INSTALL_HDRS} ${moab_PARALLEL_SRCS} )
 
 target_link_libraries( MOABpar
   ${MPI_LIBRARY}
   ${MPI_EXTRA_LIBRARY}
 )
 
+include(AutoconfHeader)
+moab_install_headers(${moab_PARALLEL_INSTALL_HDRS})
+

diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index fd85330..8296cd5 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -1,117 +1,154 @@
-
-  # Documentation
-  # Optional tools
-  option ( MOAB_BUILD_MBCONVERT    "Build the MOAB mesh converter tool?"  ON )
-  option ( MOAB_BUILD_HEXMODOPS    "Build the hexahedral modops tool?"    ON )
-  option ( MOAB_BUILD_MBCHACO      "Build MOAB Chaco interface?"          OFF )
-  option ( MOAB_BUILD_MBPERF       "Build the MOAB performance tool?"     ON )
-  option ( MOAB_BUILD_QVDUAL       "Build the qvdual application?"        OFF )
-  option ( MOAB_BUILD_MBSIZE       "Build the mbsize tool?"               ON )
-  option ( MOAB_BUILD_MBMEM        "Build the mbmem tool?"                ON )
-  option ( MOAB_BUILD_MBSKIN       "Build the mbskin tool?"               ON )
-  option ( MOAB_BUILD_MBDEPTH      "Build the mbdepth tool?"              ON )
-  option ( MOAB_BUILD_MBTAGPROP    "Build the mbtagprop tool?"            ON )
-  option ( MOAB_BUILD_MBGSETS      "Build the mbgsets tool?"              ON )
-  option ( MOAB_BUILD_MBCONVERT    "Build the mbconvert tool?"            ON )
-  option ( MOAB_BUILD_SPHEREDECOMP "Build the sphere decomposition tool?" ON )
-  option ( MOAB_BUILD_MBSURFPLOT   "Build the mbsurfplot application?"    ON )
-  option ( MOAB_BUILD_MBZOLTAN     "Build the mbzoltan partitioner?"      OFF )
-  option ( MOAB_BUILD_DAGMC        "Build the dagmc tool?"                ON )
-  option ( MOAB_BUILD_MBCOUPLER    "Build the mesh coupler tool?"         ON )
-
-  if ( MOAB_USE_MPI AND MPI_FOUND )
-    add_subdirectory( refiner )
-  endif ( MOAB_USE_MPI AND MPI_FOUND )
-
-  include_directories(
-    ${MOAB_BINARY_DIR}
-    ${MOAB_BINARY_DIR}/src
-    ${MOAB_BINARY_DIR}/src/parallel
-    ${MOAB_SOURCE_DIR}/src
-    ${MOAB_SOURCE_DIR}/src/parallel
-    ${CMAKE_CURRENT_SOURCE_DIR}
-  )
-
-  # MBSIZE
-  if ( MOAB_BUILD_MBSIZE )
-    add_executable( mbsize size.cpp measure.cpp)
-    set_source_files_properties( size.cpp measure.cpp COMPILE_FLAGS "${MOAB_DEFINES}" )
-    target_link_libraries( mbsize MOAB )
-  endif ( MOAB_BUILD_MBSIZE )
-
-  # MBMEM
-  if ( MOAB_BUILD_MBMEM )
-    add_executable( mbmem mbmem.cpp)
-    set_source_files_properties( mbmem.cpp COMPILE_FLAGS "${MOAB_DEFINES}" )
-    target_link_libraries( mbmem MOAB )
-  endif ( MOAB_BUILD_MBMEM )
-
-  # MBCONVERT
-  if ( MOAB_BUILD_MBCONVERT )
-    add_executable( mbconvert convert.cpp)
-    set_source_files_properties( convert.cpp COMPILE_FLAGS "${MOAB_DEFINES}" )
-    target_link_libraries( mbconvert MOAB )
-  endif ( MOAB_BUILD_MBCONVERT )
-
-  # MBMEM
-  if ( MOAB_BUILD_MBDEPTH )
-    add_executable( mbdepth depth.cpp)
-    set_source_files_properties( depth.cpp COMPILE_FLAGS "${MOAB_DEFINES}" )
-    target_link_libraries( mbdepth MOAB )
-  endif ( MOAB_BUILD_MBDEPTH )
-
-  # MBSKIN
-  if ( MOAB_BUILD_MBSKIN )
-    add_executable( mbskin skin.cpp)
-    set_source_files_properties( skin.cpp COMPILE_FLAGS "${MOAB_DEFINES}" )
-    target_link_libraries( mbskin MOAB )
-  endif ( MOAB_BUILD_MBSKIN )
-
-  # MBSURFPLOT
-  if ( MOAB_BUILD_MBSURFPLOT )
-    add_executable( mbsurfplot surfplot.cpp )
-    set_source_files_properties( surfplot.cpp COMPILE_FLAGS "${MOAB_DEFINES}" )
-    target_link_libraries( mbsurfplot MOAB )
-  endif ( MOAB_BUILD_MBSURFPLOT )
-
-  # MBTAGPROP
-  if ( MOAB_BUILD_MBTAGPROP )
-    add_executable( mbtagprop parse.cpp propagate_tags.cpp  )
-    set_source_files_properties( parse.cpp propagate_tags.cpp COMPILE_FLAGS "${MOAB_DEFINES}" )
-    target_link_libraries( mbtagprop MOAB )
-  endif ( MOAB_BUILD_MBTAGPROP )
-
-  # MBGSETS
-  if ( MOAB_BUILD_MBGSETS )
-    add_executable( mbgsets gsets.cc )
-    set_source_files_properties( gsets.cc COMPILE_FLAGS "${MOAB_DEFINES}" )
-    target_link_libraries( mbgsets MOAB )
-  endif ( MOAB_BUILD_MBGSETS )
-
-  # CGM
-  if ( MOAB_BUILD_DAGMC )
-    add_subdirectory( dagmc )
-  endif ( MOAB_BUILD_DAGMC )
-
-  # Zoltan
-  if ( MOAB_BUILD_MBZOLTAN )
-    add_subdirectory( mbzoltan )
-  endif ( MOAB_BUILD_MBZOLTAN )
-
-  # Chaco
-
-  # QVDual
-  if ( MOAB_BUILD_QVDUAL )
-    add_subdirectory( qvdual )
-  endif ( MOAB_BUILD_QVDUAL )
-
-  # CGM
-  if ( MOAB_BUILD_DAGMC )
-    add_subdirectory( dagmc )
-  endif ( MOAB_BUILD_DAGMC )
-
-  # MBCoupler
-  if ( MOAB_USE_MPI AND MPI_FOUND AND MOAB_BUILD_MBCOUPLER )
-#  if ( MOAB_BUILD_MBCOUPLER )
-    add_subdirectory( mbcoupler )
-  endif ( MOAB_USE_MPI AND MPI_FOUND AND MOAB_BUILD_MBCOUPLER )
+# Documentation
+# Optional tools
+option ( MOAB_BUILD_MBCONVERT    "Build the MOAB mesh converter tool?"  ON )
+option ( MOAB_BUILD_HEXMODOPS    "Build the hexahedral modops tool?"    ON )
+option ( MOAB_BUILD_MBCHACO      "Build MOAB Chaco interface?"          OFF )
+option ( MOAB_BUILD_MBPERF       "Build the MOAB performance tool?"     ON )
+option ( MOAB_BUILD_QVDUAL       "Build the qvdual application?"        OFF )
+option ( MOAB_BUILD_MBSIZE       "Build the mbsize tool?"               ON )
+option ( MOAB_BUILD_MBMEM        "Build the mbmem tool?"                ON )
+option ( MOAB_BUILD_MBSKIN       "Build the mbskin tool?"               ON )
+option ( MOAB_BUILD_MBDEPTH      "Build the mbdepth tool?"              ON )
+option ( MOAB_BUILD_MBTAGPROP    "Build the mbtagprop tool?"            ON )
+option ( MOAB_BUILD_MBGSETS      "Build the mbgsets tool?"              ON )
+option ( MOAB_BUILD_MBCONVERT    "Build the mbconvert tool?"            ON )
+option ( MOAB_BUILD_SPHEREDECOMP "Build the sphere decomposition tool?" ON )
+option ( MOAB_BUILD_MBSURFPLOT   "Build the mbsurfplot application?"    ON )
+option ( MOAB_BUILD_MBZOLTAN     "Build the mbzoltan partitioner?"      OFF )
+option ( MOAB_BUILD_DAGMC        "Build the dagmc tool?"                ON )
+option ( MOAB_BUILD_MBCOUPLER    "Build the mesh coupler tool?"         ON )
+
+if ( MOAB_USE_MPI AND MPI_FOUND )
+  add_subdirectory( refiner )
+endif ( )
+
+include_directories(
+  #${CMAKE_BINARY_DIR}
+  #${CMAKE_BINARY_DIR}/src
+  #${CMAKE_BINARY_DIR}/src/parallel
+  ${CMAKE_SOURCE_DIR}/src
+  ${CMAKE_SOURCE_DIR}/src/parallel
+  ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+# MBSIZE
+if ( MOAB_BUILD_MBSIZE )
+  add_executable( mbsize size.cpp measure.cpp)
+  set_source_files_properties( size.cpp measure.cpp COMPILE_FLAGS "${MOAB_DEFINES}" )
+  target_link_libraries( mbsize MOAB )
+  install(TARGETS mbsize RUNTIME DESTINATION bin
+                         LIBRARY DESTINATION lib
+                         ARCHIVE DESTINATION lib )
+endif ( )
+
+# MBMEM
+if ( MOAB_BUILD_MBMEM )
+  add_executable( mbmem mbmem.cpp)
+  set_source_files_properties( mbmem.cpp COMPILE_FLAGS "${MOAB_DEFINES}" )
+  target_link_libraries( mbmem MOAB )
+  install(TARGETS mbmem RUNTIME DESTINATION bin
+                         LIBRARY DESTINATION lib
+                         ARCHIVE DESTINATION lib )
+endif ( )
+
+# MBCONVERT
+if ( MOAB_BUILD_MBCONVERT )
+  add_executable( mbconvert convert.cpp)
+  set_source_files_properties( convert.cpp COMPILE_FLAGS "${MOAB_DEFINES}" )
+  target_link_libraries( mbconvert MOAB )
+  install(TARGETS mbconvert RUNTIME DESTINATION bin
+                            LIBRARY DESTINATION lib
+                            ARCHIVE DESTINATION lib )
+endif ( )
+
+# MBMEM
+if ( MOAB_BUILD_MBDEPTH )
+  add_executable( mbdepth depth.cpp)
+  set_source_files_properties( depth.cpp COMPILE_FLAGS "${MOAB_DEFINES}" )
+  target_link_libraries( mbdepth MOAB )
+  install(TARGETS mbdepth RUNTIME DESTINATION bin
+                          LIBRARY DESTINATION lib
+                          ARCHIVE DESTINATION lib )
+endif ( )
+
+# MBSKIN
+if ( MOAB_BUILD_MBSKIN )
+  add_executable( mbskin skin.cpp)
+  set_source_files_properties( skin.cpp COMPILE_FLAGS "${MOAB_DEFINES}" )
+  target_link_libraries( mbskin MOAB )
+  install(TARGETS mbskin RUNTIME DESTINATION bin
+                         LIBRARY DESTINATION lib
+                         ARCHIVE DESTINATION lib )
+endif ( )
+
+# MBSURFPLOT
+if ( MOAB_BUILD_MBSURFPLOT )
+  add_executable( mbsurfplot surfplot.cpp )
+  set_source_files_properties( surfplot.cpp COMPILE_FLAGS "${MOAB_DEFINES}" )
+  target_link_libraries( mbsurfplot MOAB )
+  install(TARGETS mbsurfplot RUNTIME DESTINATION bin
+                             LIBRARY DESTINATION lib
+                             ARCHIVE DESTINATION lib )
+endif ( )
+
+# MBTAGPROP
+if ( MOAB_BUILD_MBTAGPROP )
+  add_executable( mbtagprop parse.cpp propagate_tags.cpp  )
+  set_source_files_properties( parse.cpp propagate_tags.cpp COMPILE_FLAGS "${MOAB_DEFINES}" )
+  target_link_libraries( mbtagprop MOAB )
+  install(TARGETS mbtagprop RUNTIME DESTINATION bin
+                            LIBRARY DESTINATION lib
+                            ARCHIVE DESTINATION lib )
+endif ( )
+
+# MBGSETS
+if ( MOAB_BUILD_MBGSETS )
+  add_executable( mbgsets gsets.cc )
+  set_source_files_properties( gsets.cc COMPILE_FLAGS "${MOAB_DEFINES}" )
+  target_link_libraries( mbgsets MOAB )
+  install(TARGETS mbgsets RUNTIME DESTINATION bin
+                          LIBRARY DESTINATION lib
+                          ARCHIVE DESTINATION lib )
+endif( )
+
+# CGM
+if ( MOAB_BUILD_DAGMC )
+  add_subdirectory( dagmc )
+endif( )
+
+# Zoltan
+if ( MOAB_BUILD_MBZOLTAN )
+  add_subdirectory( mbzoltan )
+endif( )
+
+# Chaco
+
+# QVDual
+if ( MOAB_BUILD_QVDUAL )
+  add_subdirectory( qvdual )
+endif( )
+
+# MBCoupler
+if ( MOAB_USE_MPI AND MPI_FOUND AND MOAB_BUILD_MBCOUPLER )
+  add_subdirectory( mbcoupler )
+endif ( )
+
+# hexmodops
+if( MOAB_BUILD_HEXMODOPS )
+  add_executable( hexmodops makeops.cpp )
+  target_link_libraries( hexmodops MOAB )
+  install(TARGETS hexmodops RUNTIME DESTINATION bin
+                            LIBRARY DESTINATION lib
+                            ARCHIVE DESTINATION lib )
+endif()
+
+#spheredecomp
+if( MOAB_BUILD_SPHEREDECOMP )
+  add_executable( spheredecomp SphereDecomp.hpp 
+                               SphereDecomp.cpp 
+                               sphere_decomp.cpp )
+  target_link_libraries( spheredecomp MOAB )
+  install(TARGETS spheredecomp RUNTIME DESTINATION bin
+                               LIBRARY DESTINATION lib
+                               ARCHIVE DESTINATION lib )
+endif()

diff --git a/tools/dagmc/CMakeLists.txt b/tools/dagmc/CMakeLists.txt
index 2326f55..cffbfc6 100644
--- a/tools/dagmc/CMakeLists.txt
+++ b/tools/dagmc/CMakeLists.txt
@@ -4,58 +4,47 @@ find_package( CGM )
 include_directories(
   ${CMAKE_CURRENT_BINARY_DIR}
   ${CMAKE_CURRENT_SOURCE_DIR}
-  ${MOAB_BINARY_DIR}/src
-  ${MOAB_SOURCE_DIR}/src
-)
+  ${CMAKE_SOURCE_DIR}/src )
 
-set( MOAB_DAGMC_LIB_SRCS
-  DagMC.cpp
-)
+if ( CGM_FOUND )
+  include_directories( ${CGM_INCLUDE_DIRECTORIES} )
+endif( )
 
-set( MOAB_TEST_GEOM_SRCS
-  test_geom.cc
-)
+add_library( dagmc DagMC.hpp DagMC.cpp )
+target_link_libraries( dagmc  MOAB)
+install(TARGETS dagmc EXPORT MOABTargets
+                      RUNTIME DESTINATION bin
+                      LIBRARY DESTINATION lib
+                      ARCHIVE DESTINATION lib )
+set( MOAB_INSTALL_TARGETS ${MOAB_INSTALL_TARGETS} dagmc)
+install( FILES DagMC.hpp DESTINATION include )
 
-if ( CGM_FOUND )
-  set( MOAB_DAGMC_LIB_SRCS
-    ${MOAB_DAGMC_LIB_SRCS}
-  )
-  set( MOAB_DAGMC_SRCS
-    main.cc
-    cubfile.c
-  )
-  include_directories(
-    ${CGM_INCLUDE_DIRECTORIES}
-  )
-endif ( CGM_FOUND )
-
-add_library( dagmc
-  ${MOAB_DAGMC_LIB_SRCS}
-)
-target_link_libraries( dagmc
-  MOAB
-)
-
-add_executable( test_geom
-  ${MOAB_TEST_GEOM_SRCS}
-)
-target_link_libraries( test_geom
-  dagmc
-  MOAB
-)
 
-if ( CGM_FOUND )
-  target_link_libraries( dagmc
-    ${CGM_LIBRARIES}
-  )
-  target_link_libraries( test_geom
-    ${CGM_LIBRARIES}
-  )
-  add_executable( cgm2moab
-    ${MOAB_DAGMC_SRCS}
-  )
-  target_link_libraries( cgm2moab
-    dagmc
-    ${CGM_LIBRARIES}
-  )
-endif ( CGM_FOUND )
+
+add_executable( dagmc_preproc dagmc_preproc.cpp 
+                              obb_analysis.cpp 
+                              dagmc_preproc.hpp )
+target_link_libraries( dagmc_preproc MOAB dagmc )
+install(TARGETS dagmc_preproc RUNTIME DESTINATION bin
+                              LIBRARY DESTINATION lib
+                              ARCHIVE DESTINATION lib )
+
+add_executable( test_geom test_geom.cc )
+target_link_libraries( test_geom dagmc MOAB)
+
+if ( MOAB_USE_CGM )
+  target_link_libraries( dagmc ${CGM_LIBRARIES} )
+  target_link_libraries( test_geom ${CGM_LIBRARIES} )
+  option ( MOAB_BUILD_CGM2MOAB    "Build cgm2moab?"  OFF )
+  if(MOAB_BUILD_CGM2MOAB)
+    add_executable( cgm2moab dagmc_preproc.cpp
+                             obb_analysis.cpp
+                             dagmc_preproc.hpp )
+    target_link_libraries( cgm2moab
+                           dagmc
+                           ${CGM_LIBRARIES} )
+    install(TARGETS cgm2moab RUNTIME DESTINATION bin
+                             LIBRARY DESTINATION lib
+                             ARCHIVE DESTINATION lib )
+  endif()
+endif( )

diff --git a/tools/mbcoupler/CMakeLists.txt b/tools/mbcoupler/CMakeLists.txt
index da316c8..c2a01cf 100644
--- a/tools/mbcoupler/CMakeLists.txt
+++ b/tools/mbcoupler/CMakeLists.txt
@@ -1,34 +1,40 @@
 include_directories(
     ${CMAKE_CURRENT_SOURCE_DIR}
-    ${MOAB_SOURCE_DIR}/src
-    ${MOAB_SOURCE_DIR}/src/parallel
-    ${MOAB_SOURCE_DIR}/src/moab/point_locater/lotte
-    ${MOAB_SOURCE_DIR}/itaps
-    ${MOAB_SOURCE_DIR}/itaps/imesh
-    ${MOAB_BINARY_DIR}
-    ${MOAB_BINARY_DIR}/src
-    ${MOAB_BINARY_DIR}/src/parallel
-)
-
-set( MBCOUPLER_SRCS
-  Coupler.cpp
-  ElemUtil.cpp
-)
+    ${CMAKE_SOURCE_DIR}/src
+    ${CMAKE_SOURCE_DIR}/src/parallel
+    ${CMAKE_SOURCE_DIR}/src/moab/point_locater/lotte
+    ${CMAKE_SOURCE_DIR}/itaps
+    ${CMAKE_SOURCE_DIR}/itaps/imesh
+    ${CMAKE_BINARY_DIR}
+    ${CMAKE_BINARY_DIR}/src
+    ${CMAKE_BINARY_DIR}/src/parallel )
+
+set( MBCOUPLER_SRCS Coupler.cpp
+                    ElemUtil.cpp )
+
+set( MBCOUPLER_INCLUDE_SRCS Coupler.hpp
+                            ElemUtil.hpp )
 
 set_source_files_properties( ${MBCOUPLER_SRCS}
-  COMPILE_FLAGS "${MOAB_DEFINES}"
-)
+  COMPILE_FLAGS "${MOAB_DEFINES}" )
 
 add_library( mbcoupler
   ${MBCOUPLER_SRCS}
-)
+  ${MBCOUPLER_INCLUDE_SRCS} )
 
 target_link_libraries( mbcoupler MOAB iMesh )
 if ( MOAB_USE_MPI )
   target_link_libraries( mbcoupler MOABpar )
-endif ( MOAB_USE_MPI )
+endif ( )
+
+if ( MOAB_USE_NETCDF )
+  set(netcdf_progs update_coords)
+endif()
 
-enable_testing()
+install(TARGETS mbcoupler RUNTIME DESTINATION bin
+                          LIBRARY DESTINATION lib
+                          ARCHIVE DESTINATION lib )
+install(FILES ${MBCOUPLER_INCLUDE_SRCS} DESTINATION includes)
 
 # A test for the coupler library
 add_executable( findpt_test findpt_test.cpp )


https://bitbucket.org/fathomteam/moab/commits/3fe581b5f67c/
Changeset:   3fe581b5f67c
Branch:      None
User:        judajake
Date:        2014-01-04 02:34:54
Summary:     fix errors with generated files

Affected #:  4 files

diff --git a/config/ITAPSFortranMangling.cmake b/config/ITAPSFortranMangling.cmake
index 0dcd687..d0d9a49 100644
--- a/config/ITAPSFortranMangling.cmake
+++ b/config/ITAPSFortranMangling.cmake
@@ -4,12 +4,12 @@
 
 SET( match_expr "^[ \\t]*void[ \\t]+${prefix}_([a-z][_a-zA-Z0-9]*)[ \\t]*\\(.*$" )
 FILE( STRINGS ${input_file} data REGEX ${match_expr} )
-FILE( WRITE ${output_file} "#include \"MOAB_FCDefs.h\"\n#ifdef FC_FUNC_\n\n" )
+FILE( WRITE ${output_file} "#include \"MOAB_FCDefs.h\"\n#ifdef MOAB_FC_FUNC_\n\n" )
 FOREACH( line ${data} )
   STRING(REGEX REPLACE ${match_expr} "${prefix}_\\1" func ${line})
   STRING(TOUPPER ${func} upper)
   STRING(TOLOWER ${func} lower)
-  FILE( APPEND ${output_file}  "#define ${func} FC_FUNC_( ${upper}, ${lower} )\n" )
+  FILE( APPEND ${output_file}  "#define ${func} ${DEF}_FC_FUNC_( ${lower}, ${upper} )\n" )
 ENDFOREACH( line )
 FILE( APPEND ${output_file} "\n#endif\n" )
 

diff --git a/itaps/igeom/CMakeLists.txt b/itaps/igeom/CMakeLists.txt
index b311cd1..828d0b7 100644
--- a/itaps/igeom/CMakeLists.txt
+++ b/itaps/igeom/CMakeLists.txt
@@ -1,6 +1,7 @@
 ADD_CUSTOM_COMMAND(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FBiGeom_protos.h
   COMMAND ${CMAKE_COMMAND}
+          -DDEF:STRING=MOAB
           -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/FBiGeom.h
           -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/FBiGeom_protos.h
           -Dprefix:STRING=FBiGeom

diff --git a/itaps/imesh/CMakeLists.txt b/itaps/imesh/CMakeLists.txt
index a7fa3ae..775e725 100644
--- a/itaps/imesh/CMakeLists.txt
+++ b/itaps/imesh/CMakeLists.txt
@@ -3,6 +3,7 @@
 ADD_CUSTOM_COMMAND(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMesh_protos.h
   COMMAND ${CMAKE_COMMAND}
+          -DDEF:STRING=MOAB
           -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMesh.h
           -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMesh_protos.h
           -Dprefix:STRING=iMesh
@@ -11,6 +12,7 @@ ADD_CUSTOM_COMMAND(
 ADD_CUSTOM_COMMAND(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMesh_extensions_protos.h
   COMMAND ${CMAKE_COMMAND}
+          -DDEF:STRING=MOAB
           -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMesh_extensions.h
           -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMesh_extensions_protos.h
           -Dprefix:STRING=iMesh
@@ -32,6 +34,7 @@ if ( MOAB_USE_MPI AND MPI_FOUND )
   ADD_CUSTOM_COMMAND(
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
     COMMAND ${CMAKE_COMMAND}
+            -DDEF:STRING=MOAB
             -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMeshP.h
             -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
             -Dprefix:STRING=iMeshP

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1328d00..7eaa0c6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -8,6 +8,13 @@ if(MOAB_USE_MPI AND MPI_FOUND)
   set( MOAB_MPI MOABpar )
 endif()
 
+#create the FCDefs.h and src/MOAB_FCDefs.h files
+configure_file(FCDefs.h.in "${CMAKE_BINARY_DIR}/src/FCDefs.h" @ONLY)
+#sed -e "s/FC_FUNC/MOAB_FC_FUNC/" src/FCDefs.h >src/MOAB_FCDefs.h
+FILE(READ ${CMAKE_BINARY_DIR}/src/FCDefs.h infile)
+STRING( REGEX REPLACE "FC_FUNC" "MOAB_FC_FUNC" outstring "${infile}" )
+FILE(WRITE "${CMAKE_BINARY_DIR}/src/MOAB_FCDefs.h" "${outstring}")
+
 add_subdirectory(io)
 add_subdirectory(LocalDiscretization)
 add_subdirectory(oldinc)
@@ -149,7 +156,7 @@ set( MOAB_INSTALL_HEADERS
         moab/WriterIface.hpp
         MBEntityType.h
         MBCN.h
-        MOAB_FCDefs.h
+        ${CMAKE_BINARY_DIR}/src/MOAB_FCDefs.h
         MBCN_protos.h
         MBTagConventions.hpp )
         
@@ -166,7 +173,7 @@ endif()
 
 add_library( MOAB ${MOAB_LIB_SOURCES} ${MOAB_INSTALL_HEADERS} )
 target_link_libraries( MOAB PRIVATE moabio moab_loc_discr )
-target_link_libraries( MOAB ${MOAB_MPI} ${MOAB_CGM_LIBS} )
+target_link_libraries( MOAB PUBLIC ${MOAB_MPI} ${MOAB_CGM_LIBS} )
 set_target_properties( MOAB PROPERTIES COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}")
 
 install(TARGETS MOAB EXPORT MOABTargets


https://bitbucket.org/fathomteam/moab/commits/81f5cf30eaac/
Changeset:   81f5cf30eaac
Branch:      None
User:        judajake
Date:        2014-01-04 03:23:07
Summary:     need to have capt first letter

Affected #:  2 files

diff --git a/config/ITAPSFortranMangling.cmake b/config/ITAPSFortranMangling.cmake
index d0d9a49..5b2c381 100644
--- a/config/ITAPSFortranMangling.cmake
+++ b/config/ITAPSFortranMangling.cmake
@@ -2,7 +2,7 @@
 
 # MACRO ( itaps_fortran_mangle input_file output_file prefix )
 
-SET( match_expr "^[ \\t]*void[ \\t]+${prefix}_([a-z][_a-zA-Z0-9]*)[ \\t]*\\(.*$" )
+SET( match_expr "^[ \\t]*void[ \\t]+${prefix}_([a-zA-Z][_a-zA-Z0-9]*)[ \\t]*\\(.*$" )
 FILE( STRINGS ${input_file} data REGEX ${match_expr} )
 FILE( WRITE ${output_file} "#include \"MOAB_FCDefs.h\"\n#ifdef MOAB_FC_FUNC_\n\n" )
 FOREACH( line ${data} )

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7eaa0c6..dec1404 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,16 +9,27 @@ if(MOAB_USE_MPI AND MPI_FOUND)
 endif()
 
 #create the FCDefs.h and src/MOAB_FCDefs.h files
-configure_file(FCDefs.h.in "${CMAKE_BINARY_DIR}/src/FCDefs.h" @ONLY)
+configure_file(FCDefs.h.in "${CMAKE_CURRENT_BINARY_DIR}/FCDefs.h" @ONLY)
 #sed -e "s/FC_FUNC/MOAB_FC_FUNC/" src/FCDefs.h >src/MOAB_FCDefs.h
 FILE(READ ${CMAKE_BINARY_DIR}/src/FCDefs.h infile)
 STRING( REGEX REPLACE "FC_FUNC" "MOAB_FC_FUNC" outstring "${infile}" )
-FILE(WRITE "${CMAKE_BINARY_DIR}/src/MOAB_FCDefs.h" "${outstring}")
+FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/MOAB_FCDefs.h" "${outstring}")
 
 add_subdirectory(io)
 add_subdirectory(LocalDiscretization)
 add_subdirectory(oldinc)
 
+ADD_CUSTOM_COMMAND(
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/MBCN_protos.h
+  COMMAND ${CMAKE_COMMAND}
+          -DDEF:STRING=MOAB
+          -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/MBCN.h
+          -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/MBCN_protos.h
+          -Dprefix:STRING=MBCN
+          -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/MBCN.h )
+
+
 set(MOAB_LIB_SOURCES
         AdaptiveKDTree.cpp
         AEntityFactory.hpp AEntityFactory.cpp
@@ -156,8 +167,8 @@ set( MOAB_INSTALL_HEADERS
         moab/WriterIface.hpp
         MBEntityType.h
         MBCN.h
-        ${CMAKE_BINARY_DIR}/src/MOAB_FCDefs.h
-        MBCN_protos.h
+        ${CMAKE_CURRENT_BINARY_DIR}/MOAB_FCDefs.h
+        ${CMAKE_CURRENT_BINARY_DIR}/MBCN_protos.h
         MBTagConventions.hpp )
         
 if( CGM_FOUND )


https://bitbucket.org/fathomteam/moab/commits/de63ac00b52d/
Changeset:   de63ac00b52d
Branch:      None
User:        judajake
Date:        2014-01-06 20:37:07
Summary:     add generation of another config file

Affected #:  2 files

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1eb461e..e4ba4bf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -84,6 +84,10 @@ check_include_file( stdint.h     MOAB_HAVE_STDINT_H )
 check_include_file( stddef.h     MOAB_HAVE_STDDEF_H )
 check_include_file( stdlib.h     MOAB_HAVE_STDLIB_H )
 check_include_file( sys/types.h  MOAB_HAVE_SYS_TYPES_H )
+check_type_size( size_t SIZE_T)
+check_type_size( ptrdiff_t PTRDIFF_T )
+set( MOAB_HAVE_SIZE_T ${HAVE_SIZE_T} )
+set( MOAB_HAVE_PTRDIFF_T ${HAVE_PTRDIFF_T} )
 set( HAVE_SYS_TYPES_H ${MOAB_HAVE_SYS_TYPES_H} )
 set( HAVE_STDDEF_H    ${MOAB_HAVE_STDDEF_H} )
 set( HAVE_STDINT_H    ${MOAB_HAVE_STDINT_H} )

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index dec1404..7cbc003 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -11,10 +11,16 @@ endif()
 #create the FCDefs.h and src/MOAB_FCDefs.h files
 configure_file(FCDefs.h.in "${CMAKE_CURRENT_BINARY_DIR}/FCDefs.h" @ONLY)
 #sed -e "s/FC_FUNC/MOAB_FC_FUNC/" src/FCDefs.h >src/MOAB_FCDefs.h
-FILE(READ ${CMAKE_BINARY_DIR}/src/FCDefs.h infile)
+FILE(READ ${CMAKE_CURRENT_BINARY_DIR}/FCDefs.h infile)
 STRING( REGEX REPLACE "FC_FUNC" "MOAB_FC_FUNC" outstring "${infile}" )
 FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/MOAB_FCDefs.h" "${outstring}")
 
+#Create the moab/EntityHandle.hpp file
+FILE(READ ${CMAKE_CURRENT_SOURCE_DIR}/moab/EntityHandle.hpp.in infile2)
+STRING( REGEX REPLACE "#undef" "#cmakedefine" outstring2 "${infile2}" )
+FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp.in" "${outstring2}")
+CONFIGURE_FILE(${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp)
+
 add_subdirectory(io)
 add_subdirectory(LocalDiscretization)
 add_subdirectory(oldinc)
@@ -125,7 +131,7 @@ set( MOAB_INSTALL_HEADERS
         moab/HomXform.hpp
         moab/EigenDecomp.hpp
         moab/EntityType.hpp
-        moab/EntityHandle.hpp
+        ${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp
         moab/FBEngine.hpp
         moab/FileOptions.hpp
         moab/FindPtFuncs.h


https://bitbucket.org/fathomteam/moab/commits/fd793a6c591c/
Changeset:   fd793a6c591c
Branch:      None
User:        judajake
Date:        2014-01-06 21:05:32
Summary:     add current binary directory to search

Affected #:  1 file

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7cbc003..ab2a5ff 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,4 +1,5 @@
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}
+                    ${CMAKE_CURRENT_BINARY_DIR}
                     parallel
                     LocalDiscretization
                     io )


https://bitbucket.org/fathomteam/moab/commits/5e95910d73f5/
Changeset:   5e95910d73f5
Branch:      None
User:        judajake
Date:        2014-01-06 21:49:15
Summary:     configure a version file

Signed-off-by: Jacob Becker <jacob.becker at kitware.com>

Affected #:  1 file

diff --git a/src/moab/Version.h.cmake.in b/src/moab/Version.h.cmake.in
new file mode 100644
index 0000000..ffd9fc2
--- /dev/null
+++ b/src/moab/Version.h.cmake.in
@@ -0,0 +1,20 @@
+/* src/moab/Version.h.  Generated from Version.h.in by configure.  */
+#ifndef MB_VERSION_H
+#define MB_VERSION_H
+
+/* MOAB Version */
+#define MB_VERSION "@MOAB_VERSION@"
+
+/* MOAB Major Version */
+#define MB_VERSION_MAJOR @MOAB_VERSION_MAJOR@
+
+/* MOAB Minor Version */
+#define MB_VERSION_MINOR @MOAB_VERSION_MINOR@
+
+/* MOAB Patch Level */
+#define MB_VERSION_PATCH @MOAB_VERSION_PATCH@
+
+/* MOAB Version String */
+#define MB_VERSION_STRING "@MOAB_VERSION@"
+
+#endif


https://bitbucket.org/fathomteam/moab/commits/95e61a938c57/
Changeset:   95e61a938c57
Branch:      None
User:        judajake
Date:        2014-01-06 21:50:35
Summary:     add config to the cmake script

Affected #:  1 file

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ab2a5ff..0378031 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -12,15 +12,19 @@ endif()
 #create the FCDefs.h and src/MOAB_FCDefs.h files
 configure_file(FCDefs.h.in "${CMAKE_CURRENT_BINARY_DIR}/FCDefs.h" @ONLY)
 #sed -e "s/FC_FUNC/MOAB_FC_FUNC/" src/FCDefs.h >src/MOAB_FCDefs.h
-FILE(READ ${CMAKE_CURRENT_BINARY_DIR}/FCDefs.h infile)
-STRING( REGEX REPLACE "FC_FUNC" "MOAB_FC_FUNC" outstring "${infile}" )
-FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/MOAB_FCDefs.h" "${outstring}")
+file(READ ${CMAKE_CURRENT_BINARY_DIR}/FCDefs.h infile)
+string( REGEX REPLACE "FC_FUNC" "MOAB_FC_FUNC" outstring "${infile}" )
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/MOAB_FCDefs.h" "${outstring}")
 
 #Create the moab/EntityHandle.hpp file
-FILE(READ ${CMAKE_CURRENT_SOURCE_DIR}/moab/EntityHandle.hpp.in infile2)
-STRING( REGEX REPLACE "#undef" "#cmakedefine" outstring2 "${infile2}" )
-FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp.in" "${outstring2}")
-CONFIGURE_FILE(${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp)
+file(READ ${CMAKE_CURRENT_SOURCE_DIR}/moab/EntityHandle.hpp.in infile2)
+string( REGEX REPLACE "#undef" "#cmakedefine" outstring2 "${infile2}" )
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp.in" "${outstring2}")
+configure_file(${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp)
+
+#generate the Version.h file
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/moab/Version.h.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/moab/Version.h" @ONLY)
+
 
 add_subdirectory(io)
 add_subdirectory(LocalDiscretization)


https://bitbucket.org/fathomteam/moab/commits/4207fb3f6332/
Changeset:   4207fb3f6332
Branch:      None
User:        judajake
Date:        2014-01-06 22:06:09
Summary:     add binary source to includes:

Affected #:  1 file

diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 8296cd5..97f6b6f 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -24,7 +24,7 @@ endif ( )
 
 include_directories(
   #${CMAKE_BINARY_DIR}
-  #${CMAKE_BINARY_DIR}/src
+  ${CMAKE_BINARY_DIR}/src
   #${CMAKE_BINARY_DIR}/src/parallel
   ${CMAKE_SOURCE_DIR}/src
   ${CMAKE_SOURCE_DIR}/src/parallel


https://bitbucket.org/fathomteam/moab/commits/2265899598ca/
Changeset:   2265899598ca
Branch:      None
User:        judajake
Date:        2014-01-06 22:16:45
Summary:     include the binary directory

Affected #:  1 file

diff --git a/itaps/imesh/CMakeLists.txt b/itaps/imesh/CMakeLists.txt
index 775e725..762584b 100644
--- a/itaps/imesh/CMakeLists.txt
+++ b/itaps/imesh/CMakeLists.txt
@@ -49,9 +49,8 @@ if ( MOAB_USE_MPI AND MPI_FOUND )
   include_directories( ${CMAKE_SOURCE_DIR}/src/parallel )
 endif()
 
-include_directories( #${CMAKE_BINARY_DIR}
-                     #${CMAKE_BINARY_DIR}/src
-                     #${CMAKE_BINARY_DIR}/src/parallel
+include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
+                     ${CMAKE_CURRENT_BINARY_DIR}
                      ${CMAKE_SOURCE_DIR}/src
                      ${CMAKE_SOURCE_DIR}/itaps
                      ${CMAKE_SOURCE_DIR}/itaps/imesh )


https://bitbucket.org/fathomteam/moab/commits/f75649efa585/
Changeset:   f75649efa585
Branch:      None
User:        judajake
Date:        2014-01-06 22:18:33
Summary:     include the binary directory

Affected #:  1 file

diff --git a/itaps/imesh/CMakeLists.txt b/itaps/imesh/CMakeLists.txt
index 762584b..4073cce 100644
--- a/itaps/imesh/CMakeLists.txt
+++ b/itaps/imesh/CMakeLists.txt
@@ -51,6 +51,7 @@ endif()
 
 include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
                      ${CMAKE_CURRENT_BINARY_DIR}
+                     ${CMAKE_BINARY_DIR}/src
                      ${CMAKE_SOURCE_DIR}/src
                      ${CMAKE_SOURCE_DIR}/itaps
                      ${CMAKE_SOURCE_DIR}/itaps/imesh )


https://bitbucket.org/fathomteam/moab/commits/cfa781363c1d/
Changeset:   cfa781363c1d
Branch:      None
User:        judajake
Date:        2014-01-07 02:56:26
Summary:     expaneded the tests

Affected #:  7 files

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4ba4bf..93edd64 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required( VERSION 2.8.10 )
+cmake_minimum_required( VERSION 2.8.12 )
 cmake_policy( SET CMP0003 NEW )
 cmake_policy(SET CMP0020 NEW)
 project( MOAB )
@@ -55,6 +55,7 @@ include ( CheckTypeSize )
 
 # Compiler defines... this should really be in a config file.
 set( MOAB_DEFINES "" )
+set( MOAB_LIBS )
 set( MOAB_INSTALL_TARGETS )
 
 ################################################################################
@@ -63,6 +64,7 @@ set( MOAB_INSTALL_TARGETS )
 option ( BUILD_SHARED_LIBS   "Should shared or static libraries be created?"   ON  )
 option ( MOAB_USE_SZIP       "Should build with szip support?"                 OFF )
 option ( MOAB_USE_CGM        "Should build with CGM support?"                  OFF )
+option ( MOAB_USE_CGNS       "Should build with CGNS support?"                 OFF )
 option ( MOAB_USE_MPI        "Should MOAB be compiled with MPI support?"       OFF )
 option ( MOAB_USE_HDF        "Include HDF I/O in the build?"                   OFF )
 option ( MOAB_USE_NETCDF     "Include NetCDF support (ExodusII) in the build?" OFF )
@@ -139,10 +141,16 @@ endif ( MOAB_USE_MPI )
 
 if ( MOAB_USE_NETCDF )
   find_package( NetCDF REQUIRED )
+  set( MOAB_DEFINES "-DNETCDF_FILE ${MOAB_DEFINES}" )
+  include_directories( ${NetCDF_INCLUDE_DIRECTORIES} )
+  set( MOAB_LIBS ${MOAB_LIBS} ${NetCDF_LIBRARIES} )
 endif ( MOAB_USE_NETCDF )
 
 if ( MOAB_USE_HDF )
   find_package( HDF5 REQUIRED )
+  set( MOAB_DEFINES "-DHDF5_FILE ${MOAB_DEFINES}" )
+  set( MOAB_LIBS ${MOAB_LIBS} ${HDF5_LIBRARIES} mhdf )
+  include_directories( ${HDF5_INCLUDE_DIR} src/io/mhdf/include )
 endif ( MOAB_USE_HDF )
 
 if ( MOAB_USE_ZLIB )
@@ -151,9 +159,13 @@ endif ( )
 
 if ( MOAB_USE_CGM )
    find_package( CGM REQUIRED )
-   set( MOAB_DEFINES "-DCGM ${MOAB_DEFINES}" )
+   set( MOAB_DEFINES "${CGM_DEFINES} -DCGM ${MOAB_DEFINES}" )
 endif ()
 
+if (MOAB_USE_CGNS)
+  set( MOABIO_LIBS ${MOABIO_LIBS} ${CGNS_LIBRARIES} )
+endif()
+
 ################################################################################
 # Add Directories
 ################################################################################

diff --git a/config/FindCGM.cmake b/config/FindCGM.cmake
index da3ac32..1e31874 100644
--- a/config/FindCGM.cmake
+++ b/config/FindCGM.cmake
@@ -143,3 +143,5 @@ else ( NOT CGM_INCLUDE_DIRECTORIES OR NOT CGM_LIBRARIES )
   set( CGM_FOUND 1 )
 endif ( NOT CGM_INCLUDE_DIRECTORIES OR NOT CGM_LIBRARIES )
 
+set( CGM_DEFINES "" CACHE STRING "The defines for CGM")
+

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0378031..658fffe 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,7 +2,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
                     ${CMAKE_CURRENT_BINARY_DIR}
                     parallel
                     LocalDiscretization
-                    io )
+                    io io/mhdf )
 
 if(MOAB_USE_MPI AND MPI_FOUND)
   add_subdirectory(parallel)
@@ -25,7 +25,7 @@ configure_file(${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp.in ${CMAKE_CURR
 #generate the Version.h file
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/moab/Version.h.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/moab/Version.h" @ONLY)
 
-
+set(moab_link_lib)
 add_subdirectory(io)
 add_subdirectory(LocalDiscretization)
 add_subdirectory(oldinc)
@@ -192,10 +192,10 @@ if (MBZOLTAN_ENABLE AND ZOLTAN_FOUND)
   set( MOAB_INSTALL_HEADERS ${MOAB_INSTALL_HEADERS}
           ${CMAKE_SOURCE_DIR}/tools/mbzoltan/MBZoltan.hpp )
 endif()
-
-add_library( MOAB ${MOAB_LIB_SOURCES} ${MOAB_INSTALL_HEADERS} )
-target_link_libraries( MOAB PRIVATE moabio moab_loc_discr )
-target_link_libraries( MOAB PUBLIC ${MOAB_MPI} ${MOAB_CGM_LIBS} )
+add_library( MOAB ${MOAB_LIB_SOURCES} ${MOAB_INSTALL_HEADERS} $<TARGET_OBJECTS:moabio> )
+target_link_libraries( MOAB PRIVATE moab_loc_discr )
+message("here: ${MOAB_LIBS}")
+target_link_libraries( MOAB PUBLIC ${MOAB_MPI} ${MOAB_LIBS} ${MOAB_CGM_LIBS} )
 set_target_properties( MOAB PROPERTIES COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}")
 
 install(TARGETS MOAB EXPORT MOABTargets

diff --git a/src/io/CMakeLists.txt b/src/io/CMakeLists.txt
index 8b2f4c9..ffd1f43 100644
--- a/src/io/CMakeLists.txt
+++ b/src/io/CMakeLists.txt
@@ -1,4 +1,5 @@
-include_directories(${MOAB_SOURCE_DIR}/src/io)
+include_directories( ${MOAB_SOURCE_DIR}/src/io
+                     ${MOAB_SOURCE_DIR}/src/mhdf )
 set( MOABIO_LIBS )
 set( MOABIO_DEFINES "-DIS_BUILDING_MB" )
 set( MOABIO_INSTALL_HEADERS moab/ExoIIInterface.hpp )
@@ -44,8 +45,6 @@ if( MOAB_USE_NETCDF )
           NCHelperHOMME.hpp NCHelperHOMME.cpp
           NCHelperMPAS.hpp  NCHelperMPAS.cpp
           ReadGCRM.hpp      ReadGCRM.cpp )
-  include_directories( ${NetCDF_INCLUDE_DIRECTORIES} )
-  set ( MOABIO_DEFINES "${MOABIO_DEFINES} -DNETCDF_FILE" )
   set( MOABIO_LIBS ${MOABIO_LIBS} ${NetCDF_LIBRARIES} )
 elseif( MOAB_USE_PNETCDF )
   set( MOAB_NETCDF_SRCS
@@ -56,17 +55,14 @@ elseif( MOAB_USE_PNETCDF )
           NCHelperHOMME.hpp NCHelperHOMME.cpp
           NCHelperMPAS.hpp  NCHelperMPAS.cpp
           ReadGCRM.hpp      ReadGCRM.cpp )
-  set( MOABIO_LIBS ${MOABIO_LIBS} ${PNetCDF_LIBRARIES} )
 endif()
 
 if ( MOAB_USE_CGNS )
   set( MOAB_CGNS_SRCS ReadCGNS.hpp ReadCGNS.cpp
                       WriteCGNS.hpp WriteCGNS.cpp)
-  set( MOABIO_LIBS ${MOABIO_LIBS} ${CGNS_LIBRARIES} )
 endif()
 
 if( MOAB_USE_HDF )
-  include_directories( ${HDF5_INCLUDE_DIR} mhdf/include )
   add_subdirectory( mhdf )
   set( MOAB_HDF5_SRCS
           HDF5Common.hpp HDF5Common.cpp
@@ -75,7 +71,6 @@ if( MOAB_USE_HDF )
           ReadHDF5VarLen.hpp ReadHDF5VarLen.cpp
           WriteHDF5.cpp WriteHDF5.hpp )
   set( MOABIO_LIBS ${MOABIO_LIBS} ${HDF5_LIBRARIES} mhdf )
-  set ( MOABIO_DEFINES "${MOABIO_DEFINES} -DHDF5_FILE" )
   check_function_exists( H5Pset_fapl_mpio MOAB_HDF_HAVE_PARALLEL )
 endif()
 
@@ -95,12 +90,11 @@ if( CGM_FOUND )
   set( MOAB_CGM_SRCS ReadCGM.hpp ReadCGM.cpp )
 endif()
 
-add_library( moabio STATIC
+add_library( moabio OBJECT
                 ${MOABIO_LIB_SRCS} ${MOAB_NETCDF_SRCS}
                 ${MOAB_CGNS_SRCS}  ${MOAB_HDF5_SRCS}
                 ${MOAB_CCMIO_SRCS} ${MOAB_DAMSEL_SRCS}
                 ${MOAB_CGM_SRCS}   ${MOABIO_INSTALL_HEADERS} )
-target_link_libraries( moabio ${MOABIO_LIBS} )
 set_target_properties( moabio PROPERTIES COMPILE_FLAGS "${MOABIO_DEFINES} ${MOAB_DEFINES}")
 include(AutoconfHeader)
 moab_install_headers(${MOABIO_INSTALL_HEADERS})

diff --git a/src/io/mhdf/CMakeLists.txt b/src/io/mhdf/CMakeLists.txt
index aa5585d..b1b1d9a 100644
--- a/src/io/mhdf/CMakeLists.txt
+++ b/src/io/mhdf/CMakeLists.txt
@@ -18,7 +18,11 @@ set ( mhdf_LIB_SRCS
 )
 
 add_library( mhdf STATIC ${mhdf_LIB_SRCS} )
-target_link_libraries( mhdf ${HDF5_LIBRARIES} )
+target_link_libraries( mhdf  ${HDF5_LIBRARIES} )
+install(TARGETS mhdf EXPORT MOABTargets
+                     RUNTIME DESTINATION bin
+                     LIBRARY DESTINATION lib
+                     ARCHIVE DESTINATION lib )
 
 add_executable( h5minfo include/mhdf.h example/info.c )
 target_link_libraries( h5minfo mhdf )

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 4689130..4416255 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,60 +1,102 @@
-  add_subdirectory(io)
+add_subdirectory(io)
 
-  include_directories(
-    ${MOAB_BINARY_DIR}
-    ${MOAB_BINARY_DIR}/src
+include_directories(
+    ${CMAKE_BINARY_DIR}/src
     ${CMAKE_CURRENT_SOURCE_DIR}
-    ${MOAB_SOURCE_DIR}/src
-    ${MOAB_BINARY_DIR}/src/parallel
-    ${MOAB_SOURCE_DIR}/src/parallel
-  )
-
-  add_executable( moab_test MBTest.cpp )
-  target_link_libraries( moab_test MOAB )
-  set_source_files_properties( mBTest.cpp
-    COMPILE_FLAGS "-DSRCDIR=${CMAKE_CURRENT_SOURCE_DIR}" )
-  add_test( TestMOAB ${EXECUTABLE_OUTPUT_PATH}/moab_test -nostress )
-  # FIXME: moab_test depends on: test/mb_big_test.g test/cell1.gen test/cell2.gen
-
-  add_executable( tag_test TagTest.cpp )
-  target_link_libraries( tag_test MOAB )
-  add_test( TagTest ${EXECUTABLE_OUTPUT_PATH}/tag_test )
-
-  add_executable( seq_man_test TestTypeSequenceManager.cpp )
-  target_link_libraries( seq_man_test MOAB )
-  set_source_files_properties( TestTypeSequenceManager.cpp
-    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}" )
-   add_test( TestTypeSequenceManager ${EXECUTABLE_OUTPUT_PATH}/seq_man_test )
+    ${CMAKE_SOURCE_DIR}/src
+    ${CMAKE_SOURCE_DIR}/src/parallel )
 
-  add_executable( homxform_test ${MOAB_SOURCE_DIR}/src/HomXform.cpp )
-  set_source_files_properties( ${MOAB_SOURCE_DIR}/src/HomXform.cpp
-    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
-  target_link_libraries( homxform_test MOAB )
-  add_test( TestHomXform ${EXECUTABLE_OUTPUT_PATH}/homxform_test )
+set(TEST_COMP_FLAGS "-DMESHDIR=${CMAKE_SOURCE_DIR}/MeshFiles/unittest")
 
-  add_executable( scdseq_test scdseq_test.cpp )
-  set_source_files_properties( scdseq_test.cpp
-    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}" )
-  target_link_libraries( scdseq_test MOAB )
-  add_test( TestSCDSeq ${EXECUTABLE_OUTPUT_PATH}/scdseq_test )
+set( TESTS range_test.cpp
+           scdseq_test.cpp
+           scd_test_partn.cpp
+           test_adj.cpp
+           GeomUtilTests.cpp
+           OBBTest.cpp
+           adaptive_kd_tree_tests.cpp
+           kd_tree_test.cpp
+           bsp_tree_test.cpp
+           reorder_test.cpp
+           elem_eval_test.cpp
+           VarLenTagTest.cpp
+           TagTest.cpp
+           spatial_locator_test.cpp
+           bsp_tree_poly_test.cpp
+           test_prog_opt.cpp
+           coords_connect_iterate.cpp
+           test_boundbox.cpp )
+           
+if(MOAB_USE_HDF5)
+  set( TESTS ${TESTS}
+             mergemesh_test.cpp
+             mbfacet_test.cpp
+             mbground_test.cpp
+             gttool_test.cpp
+             crop_vol_test.cpp )
+endif()
 
-  add_executable( bsp_tree_test bsp_tree_test.cpp )
-  set_source_files_properties( bsp_tree_test.cpp
-    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
-  target_link_libraries( bsp_tree_test MOAB )
-  add_test( TestBSPTree ${EXECUTABLE_OUTPUT_PATH}/bsp_tree_test )
+foreach( fname ${TESTS} )
+  string( REPLACE ".cpp" "" tmp ${fname} )
+  string( REPLACE ".cc" "" base ${tmp} )
+  add_executable( ${base} ${CMAKE_SOURCE_DIR}/test/TestUtil.hpp ${fname})
+  set_target_properties( ${base} PROPERTIES COMPILE_FLAGS "${TEST_COMP_FLAGS} ${MOAB_DEFINES} -DTEST" )
+  target_link_libraries( ${base} MOAB )
+  add_test( ${base} ${EXECUTABLE_OUTPUT_PATH}/${base} )
+endforeach()
 
-  add_executable( geomutiltests GeomUtilTests.cpp )
-  set_source_files_properties( GeomUtilTests.cpp
-    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
-  target_link_libraries( geomutiltests MOAB )
-  add_test( TestGeomUtil ${EXECUTABLE_OUTPUT_PATH}/geomutiltests )
+add_executable( TestTypeSequenceManager ${CMAKE_SOURCE_DIR}/test/TestUtil.hpp TestTypeSequenceManager.cpp)
+set_target_properties( TestTypeSequenceManager PROPERTIES COMPILE_FLAGS "${TEST_COMP_FLAGS} ${MOAB_DEFINES} -DTEST -DIS_BUILDING_MB" )
+target_link_libraries( TestTypeSequenceManager MOAB )
+add_test( TestTypeSequenceManager ${EXECUTABLE_OUTPUT_PATH}/TestTypeSequenceManager )
 
-  add_executable( range_test range_test.cpp )
-  set_source_files_properties( range_test.cpp
-    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
-  target_link_libraries( range_test MOAB )
-  add_test( TestRange ${EXECUTABLE_OUTPUT_PATH}/range_test )
+#Test_MBMeshSet.cpp
+add_executable( Test_MBMeshSet ${CMAKE_SOURCE_DIR}/test/TestUtil.hpp Test_MBMeshSet.cpp)
+set_target_properties( Test_MBMeshSet PROPERTIES COMPILE_FLAGS "${TEST_COMP_FLAGS} ${MOAB_DEFINES} -DTEST -DIS_BUILDING_MB" )
+target_link_libraries( Test_MBMeshSet MOAB )
+add_test( Test_MBMeshSet ${EXECUTABLE_OUTPUT_PATH}/Test_MBMeshSet )
+
+#MBTest.cpp #TODO:
+add_executable( moab_test MBTest.cpp )
+target_link_libraries( moab_test MOAB )
+set_source_files_properties( MBTest.cpp
+COMPILE_FLAGS "-DSRCDIR=${CMAKE_CURRENT_SOURCE_DIR}" )
+add_test( TestMOAB ${EXECUTABLE_OUTPUT_PATH}/moab_test -nostress )
+# FIXME: moab_test depends on: test/mb_big_test.g test/cell1.gen test/cell2.gen
+
+add_executable( var_len_test_no_template VarLenTagTest.cpp )
+set_source_files_properties( ${CMAKE_SOURCE_DIR}/src/VarLenTagTest.cpp
+                             COMPILE_FLAGS "-UTEMPLATE_SPECIALIZATION ${MOAB_DEFINES}" )
+target_link_libraries( var_len_test_no_template MOAB )
+add_test( var_len_test_no_template ${EXECUTABLE_OUTPUT_PATH}/var_len_test_no_template )
+
+add_executable( mbcn_test ${CMAKE_SOURCE_DIR}/src/moab/CN.hpp
+                          ${CMAKE_SOURCE_DIR}/src/CN.cpp
+                          mbcn_test.cc )
+set_target_properties( mbcn_test PROPERTIES 
+                       COMPILE_FLAGS "-UTEMPLATE_SPECIALIZATION ${MOAB_DEFINES}" )
+target_link_libraries( mbcn_test MOAB )
+add_test( mbcn_test ${EXECUTABLE_OUTPUT_PATH}/mbcn_test )
+
+
+add_executable( file_options_test ${CMAKE_SOURCE_DIR}/src/FileOptions.cpp )
+set_source_files_properties( ${CMAKE_SOURCE_DIR}/src/FileOptions.cpp
+                             COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
+target_link_libraries( file_options_test MOAB )
+add_test( file_options_test ${EXECUTABLE_OUTPUT_PATH}/file_options_test )
+
+
+add_executable( homxform_test ${CMAKE_SOURCE_DIR}/src/HomXform.cpp )
+set_source_files_properties( ${CMAKE_SOURCE_DIR}/src/HomXform.cpp
+                             COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
+target_link_libraries( homxform_test MOAB )
+add_test( TestHomXform ${EXECUTABLE_OUTPUT_PATH}/homxform_test )
+
+add_executable( xform_test ${CMAKE_SOURCE_DIR}/src/AffineXform.cpp )
+set_source_files_properties( ${CMAKE_SOURCE_DIR}/src/AffineXform.cpp
+                             COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
+target_link_libraries( xform_test MOAB )
+add_test( xform_test ${EXECUTABLE_OUTPUT_PATH}/xform_test )
 
 if ( MOAB_USE_MPI AND MPI_FOUND )
 
@@ -64,21 +106,21 @@ if ( MOAB_USE_MPI AND MPI_FOUND )
     COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}" )
   add_test( TestParallelComm-BcastDelete
     ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
-    ${EXECUTABLE_OUTPUT_PATH}/mbparallelcomm_test ${MPIEXEC_POSTFLAGS} 0 ${MOAB_SOURCE_DIR}/parallel/ptest.cub )
+    ${EXECUTABLE_OUTPUT_PATH}/mbparallelcomm_test ${MPIEXEC_POSTFLAGS} 0 ${CMAKE_SOURCE_DIR}/parallel/ptest.cub )
   add_test( TestParallelComm-ReadDelete
     ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
-    ${EXECUTABLE_OUTPUT_PATH}/mbparallelcomm_test ${MPIEXEC_POSTFLAGS} -1 ${MOAB_SOURCE_DIR}/parallel/ptest.cub )
+    ${EXECUTABLE_OUTPUT_PATH}/mbparallelcomm_test ${MPIEXEC_POSTFLAGS} -1 ${CMAKE_SOURCE_DIR}/parallel/ptest.cub )
   add_test( TestParallelComm-ReadParallel
     ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
-    ${EXECUTABLE_OUTPUT_PATH}/mbparallelcomm_test ${MPIEXEC_POSTFLAGS} -2 ${MOAB_SOURCE_DIR}/parallel/ptest.cub )
+    ${EXECUTABLE_OUTPUT_PATH}/mbparallelcomm_test ${MPIEXEC_POSTFLAGS} -2 ${CMAKE_SOURCE_DIR}/parallel/ptest.cub )
   add_test( TestParallelComm-Broadcast
     ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
-    ${EXECUTABLE_OUTPUT_PATH}/mbparallelcomm_test ${MPIEXEC_POSTFLAGS} -3 ${MOAB_SOURCE_DIR}/parallel/ptest.cub )
+    ${EXECUTABLE_OUTPUT_PATH}/mbparallelcomm_test ${MPIEXEC_POSTFLAGS} -3 ${CMAKE_SOURCE_DIR}/parallel/ptest.cub )
 
   if ( MOAB_USE_HDF )
     include_directories(
       ${HDF5_INCLUDE_DIR}
-      ${MOAB_SOURCE_DIR}/src/io/mhdf/include
+      ${CMAKE_SOURCE_DIR}/src/io/mhdf/include
     )
     add_executable( mhdf_parallel parallel/mhdf_parallel.c )
     target_link_libraries( mhdf_parallel MOAB MOABpar mhdf )
@@ -91,7 +133,7 @@ if ( MOAB_USE_MPI AND MPI_FOUND )
   target_link_libraries( parallel_unit_tests MOAB )
   add_test( TestParallel
     ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
-    ${EXECUTABLE_OUTPUT_PATH}/parallel_unit_tests ${MPIEXEC_POSTFLAGS} ${MOAB_SOURCE_DIR}/parallel/ptest.cub )
+    ${EXECUTABLE_OUTPUT_PATH}/parallel_unit_tests ${MPIEXEC_POSTFLAGS} ${CMAKE_SOURCE_DIR}/parallel/ptest.cub )
   set_source_files_properties( parallel/parallel_unit_tests.cpp
     COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
 
@@ -99,7 +141,7 @@ if ( MOAB_USE_MPI AND MPI_FOUND )
   target_link_libraries( pcomm_serial MOAB )
   add_test( TestPCommSerial
     ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${MPIEXEC_PREFLAGS}
-    ${EXECUTABLE_OUTPUT_PATH}/pcomm_serial ${MPIEXEC_POSTFLAGS} ${MOAB_SOURCE_DIR}/parallel/ptest.cub )
+    ${EXECUTABLE_OUTPUT_PATH}/pcomm_serial ${MPIEXEC_POSTFLAGS} ${CMAKE_SOURCE_DIR}/parallel/ptest.cub )
   set_source_files_properties( parallel/pcomm_serial.cpp
     COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
 

diff --git a/test/io/CMakeLists.txt b/test/io/CMakeLists.txt
index 48d329f..cb1c3af 100644
--- a/test/io/CMakeLists.txt
+++ b/test/io/CMakeLists.txt
@@ -1,13 +1,45 @@
+include_directories(
+    ${CMAKE_SOURCE_DIR}/src
+    ${CMAKE_SOURCE_DIR}/src/io
+    ${CMAKE_SOURCE_DIR}/test
+    ${CMAKE_BINARY_DIR}/src
+    ${CMAKE_SOURCE_DIR}/src/parallel
+)
+  
+set(TEST_COMP_FLAGS "-DMESHDIR=${CMAKE_SOURCE_DIR}/MeshFiles/unittest")
 
-  include_directories(
-    ${MOAB_SOURCE_DIR}/src
-    ${MOAB_BINARY_DIR}/src
-    ${MOAB_SOURCE_DIR}/src/parallel
-    ${MOAB_BINARY_DIR}/src/parallel
-  )
-
-  add_executable( tqdcfr ${MOAB_SOURCE_DIR}/src/io/Tqdcfr.cpp )
-  set_source_files_properties( ${MOAB_SOURCE_DIR}/src/io/Tqdcfr.cpp
-    COMPILE_FLAGS "-DTEST_TQDCFR -DIS_BUILDING_MB ${MOAB_DEFINES}" )
-  target_link_libraries( tqdcfr MOAB )
-  add_test( TestTQDCFR ${EXECUTABLE_OUTPUT_PATH}/tqdcfr )
+set( TESTS readutil_test.cpp VtkTest.cpp cub_file_test.cc gmsh_test.cc nastran_test.cc ideas_test.cc stl_test.cc smf_test.cc)
+if( MOAB_USE_NETCDF )
+  set( TESTS ${TESTS} exodus_test.cc )
+  set( TESTS ${TESTS} read_nc.cpp )
+  set( TESTS ${TESTS} read_ucd_nc.cpp )
+  set( TESTS ${TESTS} read_mpas_nc.cpp )
+endif()
+
+if(MOAB_USE_CCMIO)
+  set( TESTS ${TESTS} ccmio_test.cpp )
+endif()
+
+if( MOAB_USE_CGM )
+  set( TESTS ${TESTS} read_cgm_test.cpp )
+endif()
+
+if( MOAB_USE_CGNS )
+  set( TESTS ${TESTS} cgns_test.cpp )
+endif()
+
+foreach( fname ${TESTS} )
+  string( REPLACE ".cpp" "" tmp ${fname} )
+  string( REPLACE ".cc" "" base ${tmp} )
+  add_executable( ${base} ${CMAKE_SOURCE_DIR}/test/TestUtil.hpp ${fname})
+  set_target_properties( ${base} PROPERTIES COMPILE_FLAGS "${TEST_COMP_FLAGS} ${MOAB_DEFINES}" )
+  target_link_libraries( ${base} MOAB )
+  add_test( ${base} ${EXECUTABLE_OUTPUT_PATH}/${base} )
+endforeach()
+
+
+add_executable( tqdcfr ${CMAKE_SOURCE_DIR}/src/io/Tqdcfr.cpp )
+set_source_files_properties( ${CMAKE_SOURCE_DIR}/src/io/Tqdcfr.cpp
+    COMPILE_FLAGS "-DTEST_TQDCFR ${MOAB_DEFINES}" )
+target_link_libraries( tqdcfr MOAB )
+add_test( TestTQDCFR ${EXECUTABLE_OUTPUT_PATH}/tqdcfr )


https://bitbucket.org/fathomteam/moab/commits/314d6b087df8/
Changeset:   314d6b087df8
Branch:      None
User:        judajake
Date:        2014-01-07 22:02:20
Summary:     add more tests and improve linking

Affected #:  12 files

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 93edd64..537e591 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -149,7 +149,7 @@ endif ( MOAB_USE_NETCDF )
 if ( MOAB_USE_HDF )
   find_package( HDF5 REQUIRED )
   set( MOAB_DEFINES "-DHDF5_FILE ${MOAB_DEFINES}" )
-  set( MOAB_LIBS ${MOAB_LIBS} ${HDF5_LIBRARIES} mhdf )
+  set( MOAB_LIBS ${MOAB_LIBS} ${HDF5_LIBRARIES} )
   include_directories( ${HDF5_INCLUDE_DIR} src/io/mhdf/include )
 endif ( MOAB_USE_HDF )
 

diff --git a/itaps/imesh/CMakeLists.txt b/itaps/imesh/CMakeLists.txt
index 4073cce..0a0a95f 100644
--- a/itaps/imesh/CMakeLists.txt
+++ b/itaps/imesh/CMakeLists.txt
@@ -30,7 +30,8 @@ set ( MOAB_IMESH_LIB_INCLUDES
           ${CMAKE_CURRENT_BINARY_DIR}/iMesh_protos.h
           MBiMesh.hpp )
 
-if ( MOAB_USE_MPI AND MPI_FOUND )
+if ( MOAB_USE_MPI )
+  include_directories( ${CMAKE_SOURCE_DIR}/src/parallel )
   ADD_CUSTOM_COMMAND(
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
     COMMAND ${CMAKE_COMMAND}
@@ -46,7 +47,6 @@ if ( MOAB_USE_MPI AND MPI_FOUND )
   set(MOAB_IMESH_LIB_INCLUDES
           ${MOAB_IMESH_LIB_INCLUDES}
           ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h )
-  include_directories( ${CMAKE_SOURCE_DIR}/src/parallel )
 endif()
 
 include_directories( ${CMAKE_CURRENT_SOURCE_DIR}

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 658fffe..b7f2518 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -192,10 +192,11 @@ if (MBZOLTAN_ENABLE AND ZOLTAN_FOUND)
   set( MOAB_INSTALL_HEADERS ${MOAB_INSTALL_HEADERS}
           ${CMAKE_SOURCE_DIR}/tools/mbzoltan/MBZoltan.hpp )
 endif()
-add_library( MOAB ${MOAB_LIB_SOURCES} ${MOAB_INSTALL_HEADERS} $<TARGET_OBJECTS:moabio> )
-target_link_libraries( MOAB PRIVATE moab_loc_discr )
-message("here: ${MOAB_LIBS}")
-target_link_libraries( MOAB PUBLIC ${MOAB_MPI} ${MOAB_LIBS} ${MOAB_CGM_LIBS} )
+add_library( MOAB ${MOAB_LIB_SOURCES} ${MOAB_INSTALL_HEADERS}
+                  $<TARGET_OBJECTS:moabio> 
+                  $<TARGET_OBJECTS:moab_loc_discr> 
+                  ${MDHF_OBJ} )
+target_link_libraries( MOAB ${MOAB_MPI} ${MOAB_LIBS} ${MOAB_CGM_LIBS} )
 set_target_properties( MOAB PROPERTIES COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}")
 
 install(TARGETS MOAB EXPORT MOABTargets

diff --git a/src/LocalDiscretization/CMakeLists.txt b/src/LocalDiscretization/CMakeLists.txt
index 0a6a269..f349764 100644
--- a/src/LocalDiscretization/CMakeLists.txt
+++ b/src/LocalDiscretization/CMakeLists.txt
@@ -10,12 +10,8 @@ set( MOAB_LOCALDSRC_Install_Headers moab/ElemEvaluator.hpp
 	                                  moab/LinearTet.hpp
                                     moab/QuadraticHex.hpp )
 
-add_library( moab_loc_discr STATIC
-                ${MOAB_LOC_DSCR_SRCS}
-                ${MOAB_LOCALDSRC_Install_Headers} )
-
-target_link_libraries( moab_loc_discr )
-
+add_library( moab_loc_discr OBJECT ${MOAB_LOC_DSCR_SRCS}
+                                   ${MOAB_LOCALDSRC_Install_Headers} )
 set_target_properties( moab_loc_discr 
                        PROPERTIES COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}")
 

diff --git a/src/io/CMakeLists.txt b/src/io/CMakeLists.txt
index ffd1f43..a05c511 100644
--- a/src/io/CMakeLists.txt
+++ b/src/io/CMakeLists.txt
@@ -70,7 +70,8 @@ if( MOAB_USE_HDF )
           ReadHDF5Dataset.hpp ReadHDF5Dataset.cpp
           ReadHDF5VarLen.hpp ReadHDF5VarLen.cpp
           WriteHDF5.cpp WriteHDF5.hpp )
-  set( MOABIO_LIBS ${MOABIO_LIBS} ${HDF5_LIBRARIES} mhdf )
+  set( MDHF_OBJ $<TARGET_OBJECTS:mhdf> PARENT_SCOPE )
+  set( MOABIO_LIBS ${MOABIO_LIBS} ${HDF5_LIBRARIES} )
   check_function_exists( H5Pset_fapl_mpio MOAB_HDF_HAVE_PARALLEL )
 endif()
 
@@ -90,11 +91,10 @@ if( CGM_FOUND )
   set( MOAB_CGM_SRCS ReadCGM.hpp ReadCGM.cpp )
 endif()
 
-add_library( moabio OBJECT
-                ${MOABIO_LIB_SRCS} ${MOAB_NETCDF_SRCS}
-                ${MOAB_CGNS_SRCS}  ${MOAB_HDF5_SRCS}
-                ${MOAB_CCMIO_SRCS} ${MOAB_DAMSEL_SRCS}
-                ${MOAB_CGM_SRCS}   ${MOABIO_INSTALL_HEADERS} )
+add_library( moabio OBJECT ${MOABIO_LIB_SRCS} ${MOAB_NETCDF_SRCS}
+                           ${MOAB_CGNS_SRCS}  ${MOAB_HDF5_SRCS}
+                           ${MOAB_CCMIO_SRCS} ${MOAB_DAMSEL_SRCS}
+                           ${MOAB_CGM_SRCS}   ${MOABIO_INSTALL_HEADERS} )
 set_target_properties( moabio PROPERTIES COMPILE_FLAGS "${MOABIO_DEFINES} ${MOAB_DEFINES}")
 include(AutoconfHeader)
 moab_install_headers(${MOABIO_INSTALL_HEADERS})

diff --git a/src/io/mhdf/CMakeLists.txt b/src/io/mhdf/CMakeLists.txt
index b1b1d9a..b8e013f 100644
--- a/src/io/mhdf/CMakeLists.txt
+++ b/src/io/mhdf/CMakeLists.txt
@@ -1,5 +1,3 @@
-project(mhdf)
-
 include_directories( ${HDF5_INCLUDE_DIR} )
 
 set ( mhdf_LIB_SRCS
@@ -17,21 +15,16 @@ set ( mhdf_LIB_SRCS
         src/util.h src/util.c
 )
 
-add_library( mhdf STATIC ${mhdf_LIB_SRCS} )
-target_link_libraries( mhdf  ${HDF5_LIBRARIES} )
-install(TARGETS mhdf EXPORT MOABTargets
-                     RUNTIME DESTINATION bin
-                     LIBRARY DESTINATION lib
-                     ARCHIVE DESTINATION lib )
+add_library( mhdf OBJECT ${mhdf_LIB_SRCS} )
 
-add_executable( h5minfo include/mhdf.h example/info.c )
-target_link_libraries( h5minfo mhdf )
+add_executable( h5minfo include/mhdf.h example/info.c $<TARGET_OBJECTS:mhdf> )
+target_link_libraries( h5minfo ${HDF5_LIBRARIES} )
 install(TARGETS h5minfo RUNTIME DESTINATION bin
                         LIBRARY DESTINATION lib
                         ARCHIVE DESTINATION lib )
 
-add_executable( h5mvalidate example/validate.c )
-target_link_libraries( h5mvalidate mhdf )
+add_executable( h5mvalidate example/validate.c $<TARGET_OBJECTS:mhdf> )
 install(TARGETS h5mvalidate RUNTIME DESTINATION bin
                             LIBRARY DESTINATION lib
                             ARCHIVE DESTINATION lib )
+target_link_libraries( h5mvalidate ${HDF5_LIBRARIES} )

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 4416255..b2d5a82 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,11 +1,17 @@
-add_subdirectory(io)
-
 include_directories(
     ${CMAKE_BINARY_DIR}/src
     ${CMAKE_CURRENT_SOURCE_DIR}
     ${CMAKE_SOURCE_DIR}/src
+    ${CMAKE_SOURCE_DIR}/src/io
     ${CMAKE_SOURCE_DIR}/src/parallel )
 
+add_subdirectory(io)
+add_subdirectory(dual)
+add_subdirectory(h5file)
+add_subdirectory(obb)
+add_subdirectory(oldinc)
+add_subdirectory(perf)
+
 set(TEST_COMP_FLAGS "-DMESHDIR=${CMAKE_SOURCE_DIR}/MeshFiles/unittest")
 
 set( TESTS range_test.cpp
@@ -27,7 +33,7 @@ set( TESTS range_test.cpp
            coords_connect_iterate.cpp
            test_boundbox.cpp )
            
-if(MOAB_USE_HDF5)
+if(MOAB_USE_HDF)
   set( TESTS ${TESTS}
              mergemesh_test.cpp
              mbfacet_test.cpp
@@ -98,6 +104,21 @@ set_source_files_properties( ${CMAKE_SOURCE_DIR}/src/AffineXform.cpp
 target_link_libraries( xform_test MOAB )
 add_test( xform_test ${EXECUTABLE_OUTPUT_PATH}/xform_test )
 
+#add imesh tests
+set( TESTS MOAB_iMesh_unit_tests.cpp
+           MOAB_iMesh_extensions_tests.cpp )
+if(MOAB_USE_MPI)
+    set(TESTS ${TESTS} MOAB_iMeshP_unit_tests.cpp )
+endif()
+foreach( fname ${TESTS} )
+    string( REPLACE ".cpp" "" tmp ${fname} )
+    string( REPLACE ".cc" "" base ${tmp} )
+    add_executable( ${base} ${CMAKE_SOURCE_DIR}/test/TestUtil.hpp ${CMAKE_SOURCE_DIR}/itaps/imesh/${fname})
+    set_target_properties( ${base} PROPERTIES COMPILE_FLAGS "-DSRCDIR=${CMAKE_SOURCE_DIR}/itaps/imesh/ -DMESHDIR=${CMAKE_SOURCE_DIR}/MeshFiles/unittest ${MOAB_DEFINES} -DTEST" )
+    target_link_libraries( ${base} MOAB iMesh)
+    add_test( ${base} ${EXECUTABLE_OUTPUT_PATH}/${base} )
+endforeach()
+
 if ( MOAB_USE_MPI AND MPI_FOUND )
 
   add_executable ( mbparallelcomm_test parallel/mbparallelcomm_test.cpp )

diff --git a/test/obb/CMakeLists.txt b/test/obb/CMakeLists.txt
new file mode 100644
index 0000000..4bcb916
--- /dev/null
+++ b/test/obb/CMakeLists.txt
@@ -0,0 +1,20 @@
+set(TEST_COMP_FLAGS "-DMESHDIR=${CMAKE_SOURCE_DIR}/MeshFiles/unittest -DSRCDIR=${CMAKE_CURRENT_SOURCE_DIR}")
+
+set( TESTS obb_test.cpp )
+
+foreach( fname ${TESTS} )
+  string( REPLACE ".cpp" "" tmp ${fname} )
+  string( REPLACE ".cc" "" base ${tmp} )
+  add_executable( ${base} ${CMAKE_SOURCE_DIR}/test/TestUtil.hpp ${fname})
+  set_target_properties( ${base} PROPERTIES COMPILE_FLAGS "${TEST_COMP_FLAGS} ${MOAB_DEFINES} -DTEST" )
+  target_link_libraries( ${base} MOAB )
+  add_test( ${base} ${EXECUTABLE_OUTPUT_PATH}/${base} )
+endforeach()
+
+add_executable( obb_time obb_time.cpp)
+set_target_properties( obb_time PROPERTIES COMPILE_FLAGS "${MOAB_DEFINES}" )
+target_link_libraries( obb_time MOAB )
+
+add_executable( obb_tree_tool obb_tree_tool.cpp)
+set_target_properties( obb_tree_tool PROPERTIES COMPILE_FLAGS "${MOAB_DEFINES}" )
+target_link_libraries( obb_tree_tool MOAB )

diff --git a/test/oldinc/CMakeLists.txt b/test/oldinc/CMakeLists.txt
new file mode 100644
index 0000000..df48128
--- /dev/null
+++ b/test/oldinc/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_executable( test_oldinc test_oldinc.cpp)
+set_target_properties( test_oldinc PROPERTIES COMPILE_FLAGS "${MOAB_DEFINES}" )
+target_link_libraries( test_oldinc MOAB )

diff --git a/test/perf/CMakeLists.txt b/test/perf/CMakeLists.txt
new file mode 100644
index 0000000..aea693f
--- /dev/null
+++ b/test/perf/CMakeLists.txt
@@ -0,0 +1,18 @@
+add_subdirectory(point_location)
+set( LIBS MOAB )
+set( TESTS perf.cpp
+           seqperf.cpp
+           adj_time.cpp
+           perftool.cpp )
+if(MOAB_BUILD_IMESH)
+  set(TESTS ${TESTS} tstt_perf_binding.cpp)
+  set(LIBS ${LIBS} iMesh)
+endif()
+
+foreach( fname ${TESTS} )
+  string( REPLACE ".cpp" "" tmp ${fname} )
+  string( REPLACE ".cc" "" base ${tmp} )
+  add_executable( ${base} ${CMAKE_SOURCE_DIR}/test/TestUtil.hpp ${fname})
+  set_target_properties( ${base} PROPERTIES COMPILE_FLAGS "${MOAB_DEFINES} -DIS_BUILDING_MB" )
+  target_link_libraries( ${base} ${LIBS} )
+endforeach()

diff --git a/test/perf/point_location/CMakeLists.txt b/test/perf/point_location/CMakeLists.txt
new file mode 100644
index 0000000..38c3dfe
--- /dev/null
+++ b/test/perf/point_location/CMakeLists.txt
@@ -0,0 +1,12 @@
+set( LIBS MOAB )
+set( TESTS point_location.cpp
+           tree_searching_perf.cpp
+           sploc_searching_perf.cpp )
+
+foreach( fname ${TESTS} )
+  string( REPLACE ".cpp" "" tmp ${fname} )
+  string( REPLACE ".cc" "" base ${tmp} )
+  add_executable( ${base} ${CMAKE_SOURCE_DIR}/test/TestUtil.hpp ${fname})
+  set_target_properties( ${base} PROPERTIES COMPILE_FLAGS "${MOAB_DEFINES} -DIS_BUILDING_MB" )
+  target_link_libraries( ${base} ${LIBS} )
+endforeach()

diff --git a/tools/dagmc/CMakeLists.txt b/tools/dagmc/CMakeLists.txt
index cffbfc6..f8a03f7 100644
--- a/tools/dagmc/CMakeLists.txt
+++ b/tools/dagmc/CMakeLists.txt
@@ -29,8 +29,12 @@ install(TARGETS dagmc_preproc RUNTIME DESTINATION bin
                               LIBRARY DESTINATION lib
                               ARCHIVE DESTINATION lib )
 
-add_executable( test_geom test_geom.cc )
-target_link_libraries( test_geom dagmc MOAB)
+if ( MOAB_ENABLE_TESTING )
+  add_executable( test_geom test_geom.cc )
+  set_target_properties( test_geom PROPERTIES COMPILE_FLAGS "${MOAB_DEFINES} -DTEST" )
+  target_link_libraries( test_geom dagmc MOAB)
+  add_test( test_geom ${EXECUTABLE_OUTPUT_PATH}/test_geom )
+endif()
 
 if ( MOAB_USE_CGM )
   target_link_libraries( dagmc ${CGM_LIBRARIES} )


https://bitbucket.org/fathomteam/moab/commits/c1c2be03f8cd/
Changeset:   c1c2be03f8cd
Branch:      None
User:        judajake
Date:        2014-01-07 22:07:45
Summary:     missed a cmake list file

Affected #:  1 file

diff --git a/test/dual/CMakeLists.txt b/test/dual/CMakeLists.txt
new file mode 100644
index 0000000..713e9cf
--- /dev/null
+++ b/test/dual/CMakeLists.txt
@@ -0,0 +1,5 @@
+file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/hex001.vtk DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
+add_executable( dual_test ${CMAKE_SOURCE_DIR}/test/TestUtil.hpp dual_test.cpp)
+set_target_properties( dual_test PROPERTIES COMPILE_FLAGS "${TEST_COMP_FLAGS} ${MOAB_DEFINES}" )
+target_link_libraries( dual_test MOAB )
+add_test( dual_test ${EXECUTABLE_OUTPUT_PATH}/dual_test ${CMAKE_CURRENT_BINARY_DIR}/hex001.vtk )


https://bitbucket.org/fathomteam/moab/commits/0e4bf969d382/
Changeset:   0e4bf969d382
Branch:      None
User:        judajake
Date:        2014-01-07 22:08:17
Summary:     missed a cmake list file

Affected #:  1 file

diff --git a/test/h5file/CMakeLists.txt b/test/h5file/CMakeLists.txt
new file mode 100644
index 0000000..b65653e
--- /dev/null
+++ b/test/h5file/CMakeLists.txt
@@ -0,0 +1,21 @@
+set( TESTS h5file_test.cpp
+           h5legacy.cpp
+           h5varlen.cpp
+           h5sets_test.cpp
+           h5regression.cpp
+           h5partial.cpp
+           h5portable.cpp )
+
+foreach( fname ${TESTS} )
+  string( REPLACE ".cpp" "" tmp ${fname} )
+  string( REPLACE ".cc" "" base ${tmp} )
+  add_executable( ${base} ${CMAKE_SOURCE_DIR}/test/TestUtil.hpp ${fname})
+  set_target_properties( ${base} PROPERTIES COMPILE_FLAGS "-DSRCDIR=${CMAKE_CURRENT_SOURCE_DIR} ${TEST_COMP_FLAGS} ${MOAB_DEFINES} -DTEST" )
+  target_link_libraries( ${base} MOAB )
+  add_test( ${base} ${EXECUTABLE_OUTPUT_PATH}/${base} )
+endforeach()
+
+add_executable( dump_sets dump_sets.c )
+set_target_properties( dump_sets PROPERTIES COMPILE_FLAGS "${MOAB_DEFINES}" )
+target_link_libraries( dump_sets MOAB ${MOAB_LIBS} )
+


https://bitbucket.org/fathomteam/moab/commits/dd0ceec21aac/
Changeset:   dd0ceec21aac
Branch:      None
User:        judajake
Date:        2014-01-07 22:57:27
Summary:     update find cgm

Affected #:  1 file

diff --git a/config/FindCGM.cmake b/config/FindCGM.cmake
index 1e31874..236ea7f 100644
--- a/config/FindCGM.cmake
+++ b/config/FindCGM.cmake
@@ -1,147 +1,137 @@
-# Find the common geometry module libraries
-if ( NOT CGM_SOURCE_DIR )
-  find_path( CGM_SOURCE_DIR
-    NAMES geom/CubitGeomConfigure.h.in
-    PATHS
-      ${CGM_INCLUDE_DIRECTORIES}
-  )
-endif ( NOT CGM_SOURCE_DIR )
+# FindCGM.cmake
+#
+# If you set the CGM_CFG CMake variable to point to a file named "cgm.make"
+# (produced by CGM as part of any build or install), then the script will
+# locate CGM assets for your package to use.
+#
+# This script defines the following CMake variables:
+#   CGM_FOUND         defined when CGM is located, false otherwise
+#   CGM_INCLUDE_DIRS  directories containing CGM headers
+#   CGM_DEFINES       preprocessor definitions you should add to source files
+#   CGM_LIBRARIES     paths to CGM library and its dependencies
+#
+# Note that this script does not produce CGM_VERSION as that information
+# is not available in the "cgm.make" configuration file that CGM creates.
 
-if ( NOT CGM_BINARY_DIR )
-  if ( CGM_LIBRARIES )
-    set( CGM_BUILD_SEARCH "" )
-    foreach ( LIB ${CGM_LIBRARIES} )
-      get_filename_component( PATH DIR ${LIB} )
-      set( CGM_BUILD_SEARCH "${CGM_BUILD_SEARCH};${DIR}/.." )
-    endforeach ( DIR )
-    set( DIR )
-  endif ( CGM_LIBRARIES )
-  find_path( CGM_BINARY_DIR
-    NAMES geom/CubitGeomConfigure.h
-    PATHS
-      ${CGM_BUILD_SEARCH}
-  )
-endif ( NOT CGM_BINARY_DIR )
+find_file(CGM_CFG cgm.make DOC "Path to cgm.make configuration file")
+if(CGM_CFG)
+  set(CGM_FOUND 1)
+  file(READ "${CGM_CFG}" CGM_CFG_DATA)
+  ##
+  ## Replace line continuations ('\' at EOL) so we don't have to parse them later
+  ##
+  string(REGEX REPLACE "\\\\\\\n" "" CGM_CFG_DATA "${CGM_CFG_DATA}")
 
-if ( NOT CGM_LIBRARIES )
-  set( CGM_LIBSEARCH
-    ${CGM_BINARY_DIR}/init
-    ${CGM_BINARY_DIR}/geom/virtual
-    ${CGM_BINARY_DIR}/geom/facetbool
-    ${CGM_BINARY_DIR}/geom/facet
-    ${CGM_BINARY_DIR}/geom/Cholla
-    ${CGM_BINARY_DIR}/geom
-    ${CGM_BINARY_DIR}/util
-    /usr/local/lib64
-    /usr/local/bin64
-    /usr/lib64
-    /usr/bin64
-    /usr/local/lib
-    /usr/local/bin
-    /usr/lib
-    /usr/bin
-  )
-  find_library( CGM_UTIL_LIBRARY
-    NAMES cubit_util
-    PATHS ${CGM_LIBSEARCH}
-  )
+  ##
+  ## Find include directories
+  ##
+  string(REGEX MATCHALL "CGM_INT_INCLUDE =[^\\\n]*" _CGM_INCS "${CGM_CFG_DATA}")
+  foreach(_CGM_INC ${_CGM_INCS})
+    # Only use include directories specified by the *last*
+    # occurrence of CGM_INT_INCLUDE in the config file:
+    unset(CGM_INCLUDE_DIRS)
 
-  find_library( CGM_GEOM_LIBRARY
-    NAMES cubit_geom
-    PATHS ${CGM_LIBSEARCH}
-  )
+    string(REGEX REPLACE "-I" ";-I" _CGM_INC "${_CGM_INC}")
+    foreach(_CGM_IDIR ${_CGM_INC})
+      if ("${_CGM_IDIR}" MATCHES "^-I.*")
+        string(REGEX REPLACE "-I" "" _CGM_IDIR "${_CGM_IDIR}")
+        string(STRIP "${_CGM_IDIR}" _CGM_IDIR)
+        list(APPEND CGM_INCLUDE_DIRS "${_CGM_IDIR}")
+      endif()
+    endforeach()
+    # Alternately, one might:
+    #list(APPEND CGM_INCLUDE_DIRS "${_CGM_INC}")
+  endforeach()
+  #message("CGM_INCLUDE_DIRS=\"${CGM_INCLUDE_DIRS}\"")
 
-  find_library( CGM_CHOLLA_LIBRARY
-    NAMES cholla
-    PATHS ${CGM_LIBSEARCH}
-  )
+  ##
+  ## Find preprocessor definitions
+  ##
+  string(REGEX MATCH "CGM_DEFINES =[^\\\n]*" CGM_DEFINES "${CGM_CFG_DATA}")
+  string(REGEX REPLACE "CGM_DEFINES = ([^\\\n]*)" "\\1" CGM_DEFINES "${CGM_DEFINES}")
 
-  find_library( CGM_FACET_LIBRARY
-    NAMES cubit_facet
-    PATHS ${CGM_LIBSEARCH}
-  )
+  ##
+  ## Find CGM library directory(-ies)
+  ##
+  string(REGEX MATCHALL "CGM_INT_LDFLAGS =[^\\\n]*" _CGM_LDIRS "${CGM_CFG_DATA}")
+  foreach(_CGM_LDIR ${_CGM_LDIRS})
+    set(CGM_LIB_DIRS)
+    string(REGEX REPLACE " -L" ";-L" _CGM_LDIR "${_CGM_LDIR}")
+    string(REGEX REPLACE "CGM_INT_LDFLAGS = ([^\\\n]*)" "\\1" _CGM_LDIR "${_CGM_LDIR}")
+    foreach(_CGM_LL ${_CGM_LDIR})
+      if("${_CGM_LL}" MATCHES "^-L.*")
+        string(REGEX REPLACE "-L" "" _CGM_LL "${_CGM_LL}")
+        string(STRIP "${_CGM_LL}" _CGM_LL)
+        list(APPEND CGM_LIB_DIRS "${_CGM_LL}")
+      endif()
+    endforeach()
+  endforeach()
 
-  find_library( CGM_FACETBOOL_LIBRARY
-    NAMES cubit_facetboolstub
-    PATHS ${CGM_LIBSEARCH}
-  )
+  ##
+  ## Now add dependent library directories to CGM_LIB_DIRS
+  ##
+  string(REGEX MATCH "CGM_LDFLAGS =[^\\\n]*" _CGM_LDIR "${CGM_CFG_DATA}")
+  string(REGEX REPLACE "CGM_LDFLAGS = ([^\\\n]*)" "\\1" _CGM_LDIR "${_CGM_LDIR}")
+  string(REGEX REPLACE " -L" ";-L" _CGM_LDIR "${_CGM_LDIR}")
+  set(_CGM_LDIRS)
+  foreach(_CGM_LL ${_CGM_LDIR})
+    if("${_CGM_LL}" MATCHES "^-L.*")
+      string(REGEX REPLACE "-L" "" _CGM_LL "${_CGM_LL}")
+      string(STRIP "${_CGM_LL}" _CGM_LL)
+      list(APPEND _CGM_LDIRS "${_CGM_LL}")
+    endif()
+  endforeach()
+  set(CGM_LIB_DIRS "${CGM_LIB_DIRS};${_CGM_LDIRS}")
+  #message("${CGM_LIB_DIRS}")
 
-  find_library( CGM_VIRTUAL_LIBRARY
-    NAMES cubit_virtual
-    PATHS ${CGM_LIBSEARCH}
-  )
+  ##
+  ## Find the CGM library and its dependencies
+  ##
+  string(REGEX MATCHALL "CGM_LIBS =[^\\\n]*" _CGM_LIBS "${CGM_CFG_DATA}")
+  string(REGEX MATCHALL "-l[^ \t\n]+" _CGM_LIBS "${_CGM_LIBS}")
+  foreach(_CGM_LIB ${_CGM_LIBS})
+    string(REGEX REPLACE "-l" "" _CGM_LIB "${_CGM_LIB}")
+    find_library(_CGM_LIB_LOC
+      NAME "${_CGM_LIB}"
+      # Cannot quote since it contains semicolons:
+      PATHS ${CGM_LIB_DIRS}
+      NO_DEFAULT_PATH
+      NO_CMAKE_ENVIRONMENT_PATH
+      NO_CMAKE_PATH
+      NO_SYSTEM_ENVIRONMENT_PATH
+      NO_CMAKE_SYSTEM_PATH
+      )
+    #message("Lib \"${_CGM_LIB}\" @ \"${_CGM_LIB_LOC}\" paths \"${CGM_LIB_DIRS}\"")
+    if (_CGM_LIB_LOC)
+      list(APPEND CGM_LIBRARIES "${_CGM_LIB_LOC}")
+      unset(_CGM_LIB_LOC CACHE)
+      unset(_CGM_LIB_LOC)
+    else()
+      message("Could not find ${_CGM_LIB} library (part of CGM)")
+      unset(CGM_FOUND)
+    endif()
+  endforeach()
+  #message("Libs ${CGM_LIBRARIES}")
 
-  find_library( CGM_INIT_LIBRARY
-    NAMES cgma_init
-    PATHS ${CGM_LIBSEARCH}
-  )
-endif ( NOT CGM_LIBRARIES )
 
-if ( CGM_SOURCE_DIR AND CGM_BINARY_DIR AND NOT CGM_INCLUDE_DIRECTORIES )
-  set( cubit_geom_SOURCE_DIR "${CGM_SOURCE_DIR}/geom" )
-  set( cubit_geom_BINARY_DIR "${CGM_BINARY_DIR}/geom" )
-  set( cubit_util_SOURCE_DIR "${CGM_SOURCE_DIR}/util" )
-  set( cubit_util_BINARY_DIR "${CGM_BINARY_DIR}/util" )
-  set( cgma_init_SOURCE_DIR "${CGM_SOURCE_DIR}/init" )
-  set( cgma_init_BINARY_DIR "${CGM_BINARY_DIR}/init" )
-  set( CGM_INCLUDE_DIRECTORIES
-    "${cubit_util_SOURCE_DIR}"
-    "${cubit_util_BINARY_DIR}"
-    "${cubit_geom_SOURCE_DIR}"
-    "${cubit_geom_SOURCE_DIR}/ACIS"
-    "${cubit_geom_SOURCE_DIR}/Cholla"
-    "${cubit_geom_SOURCE_DIR}/facet"
-    "${cubit_geom_SOURCE_DIR}/facetbool"
-    "${cubit_geom_SOURCE_DIR}/OCC"
-    "${cubit_geom_SOURCE_DIR}/parallel"
-    "${cubit_geom_SOURCE_DIR}/SolidWorks"
-    "${cubit_geom_SOURCE_DIR}/virtual"
-    "${cubit_geom_BINARY_DIR}"
-    "${cgma_init_SOURCE_DIR}"
-    "${cgma_init_BINARY_DIR}"
-    CACHE PATH "Paths to util/CubitUtilConfigure.h.in, util/CubitUtilConfigure.h, geom/CubitGeomConfigure.h.in, AND geom/CubitGeomConfigure.h files." FORCE
-  )
-endif ( CGM_SOURCE_DIR AND CGM_BINARY_DIR AND NOT CGM_INCLUDE_DIRECTORIES )
+  ##
+  ## Kill temporary variables
+  ##
+  unset(_CGM_INCS)
+  unset(_CGM_INC)
+  unset(_CGM_IDIR)
+  unset(_CGM_LDIRS)
+  unset(_CGM_LDIR)
+  unset(_CGM_LL)
+  unset(_CGM_LIBS)
+  unset(_CGM_LIB)
+  unset(_CGM_LIB_LOC)
+else()
+  unset(CGM_FOUND)
+endif()
 
-if ( CGM_UTIL_LIBRARY AND CGM_GEOM_LIBRARY AND CGM_INIT_LIBRARY AND NOT CGM_LIBRARIES )
-  # Link to libdl in case shared libraries are used.
-  set( CGM_LIBRARIES
-    "${CGM_INIT_LIBRARY}"
-    "${CGM_CHOLLA_LIBRARY}"
-    "${CGM_FACETBOOL_LIBRARY}"
-    "${CGM_FACET_LIBRARY}"
-    "${CGM_VIRTUAL_LIBRARY}"
-    "${CGM_GEOM_LIBRARY}"
-    "${CGM_UTIL_LIBRARY}"
-    dl
-    CACHE FILEPATH "Full paths to cubit_util AND cubit_geom libraries." FORCE
-  )
-endif ( CGM_UTIL_LIBRARY AND CGM_GEOM_LIBRARY AND CGM_INIT_LIBRARY AND NOT CGM_LIBRARIES )
-
-mark_as_advanced(
-  CGM_SOURCE_DIR
-  CGM_BINARY_DIR
-  CGM_INCLUDE_DIRECTORIES
-  CGM_LIBRARIES
-  CGM_UTIL_LIBRARY
-  CGM_GEOM_LIBRARY
-  CGM_INIT_LIBRARY
-  CGM_CHOLLA_LIBRARY
-  CGM_FACETBOOL_LIBRARY
-  CGM_FACET_LIBRARY
-  CGM_VIRTUAL_LIBRARY
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CGM
+  REQUIRED_VARS CGM_INCLUDE_DIRS CGM_LIBRARIES
+  VERSION_VAR CGM_VERSION
 )
-
-if ( NOT CGM_INCLUDE_DIRECTORIES OR NOT CGM_LIBRARIES )
-  set( CGM_INCLUDE_DIRECTORIES "" CACHE PATH "Paths to util/CubitUtilConfigure.h.in, util/CubitUtilConfigure.h, geom/CubitGeomConfigure.h.in, AND geom/CubitGeomConfigure.h files." )
-  set( CGM_LIBRARIES           "" CACHE PATH "Paths to cubit_util AND cubit_geom libraries." )
-  set( CGM_FOUND 0 )
-  if ( CGM_FIND_REQUIRED )
-    message( FATAL_ERROR "CGM is required. Please set CGM_INCLUDE_DIRECTORIES and CGM_LIBRARIES or set CGM_SOURCE_DIR and CGM_BINARY_DIR" )
-  endif ( CGM_FIND_REQUIRED )
-else ( NOT CGM_INCLUDE_DIRECTORIES OR NOT CGM_LIBRARIES )
-  set( CGM_FOUND 1 )
-endif ( NOT CGM_INCLUDE_DIRECTORIES OR NOT CGM_LIBRARIES )
-
-set( CGM_DEFINES "" CACHE STRING "The defines for CGM")
-


https://bitbucket.org/fathomteam/moab/commits/9fbe271fa77e/
Changeset:   9fbe271fa77e
Branch:      None
User:        vijaysm
Date:        2014-01-10 03:03:07
Summary:     Fixing errors in the CMake configuration for test executables and tools. MBCoupler tests and MOAB test still fail. Need to retest in different configurations to decipher the issue.

Affected #:  7 files

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6b18435..6afd143 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,7 +34,7 @@ project( MOAB )
   endif ( DEFINED PATCH_VERSION )
 
   set ( EXECUTABLE_OUTPUT_PATH ${MOAB_BINARY_DIR}/bin CACHE PATH "Path to executables" FORCE )
-  set ( LIBRARY_OUTPUT_PATH    ${MOAB_BINARY_DIR}/bin CACHE PATH "Path to libraries"   FORCE )
+  set ( LIBRARY_OUTPUT_PATH    ${MOAB_BINARY_DIR}/lib CACHE PATH "Path to libraries"   FORCE )
   mark_as_advanced(
     EXECUTABLE_OUTPUT_PATH
     LIBRARY_OUTPUT_PATH

diff --git a/itaps/imesh/CMakeLists.txt b/itaps/imesh/CMakeLists.txt
index e98c0b1..37ffcdc 100644
--- a/itaps/imesh/CMakeLists.txt
+++ b/itaps/imesh/CMakeLists.txt
@@ -19,6 +19,15 @@ ADD_CUSTOM_COMMAND(
   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh_extensions.h
   )
 ADD_CUSTOM_COMMAND(
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_extensions_protos.h
+  COMMAND ${CMAKE_COMMAND}
+          -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMeshP_extensions.h
+          -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMeshP_extensions_protos.h
+          -Dprefix:STRING=iMesh
+          -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh_extensions.h
+  )
+ADD_CUSTOM_COMMAND(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
   COMMAND ${CMAKE_COMMAND}
           -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMeshP.h
@@ -32,6 +41,7 @@ set ( MOAB_IMESH_SRCS
       iMesh_MOAB.cpp
       ${CMAKE_CURRENT_BINARY_DIR}/iMesh_protos.h
       ${CMAKE_CURRENT_BINARY_DIR}/iMesh_extensions_protos.h
+      ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_extensions_protos.h
       ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h )
 
 include_directories(
@@ -41,6 +51,7 @@ include_directories(
     ${MOAB_SOURCE_DIR}/src
     ${MOAB_SOURCE_DIR}/itaps
     ${MOAB_SOURCE_DIR}/itaps/imesh
+    ${MOAB_BINARY_DIR}/itaps/imesh
   )
 
 if ( MOAB_USE_HDF5 AND HDF5_FOUND )

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 4689130..cb5734c 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -9,11 +9,26 @@
     ${MOAB_SOURCE_DIR}/src/parallel
   )
 
+  add_custom_command(OUTPUT mb_big_test.g
+                     COMMAND /bin/zcat ${MOAB_SOURCE_DIR}/MeshFiles/unittest/mb_big_test.g.gz > mb_big_test.g
+                     DEPENDS ${MOAB_SOURCE_DIR}/MeshFiles/unittest/mb_big_test.g.gz
+                     )
+  add_custom_command(OUTPUT cell1.gen
+                     COMMAND /bin/zcat ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell1.gen.gz > cell1.gen
+                     DEPENDS ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell1.gen.gz
+                     )
+  add_custom_command(OUTPUT cell2.gen
+                     COMMAND /bin/zcat ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell2.gen.gz > cell2.gen
+                     DEPENDS ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell2.gen.gz
+                     )
+  
+  add_custom_target(moab_test_files DEPENDS mb_big_test.g cell1.gen cell2.gen)
+  set_source_files_properties( mBTest.cpp
+    COMPILE_FLAGS "-DSRCDIR=${CMAKE_CURRENT_SOURCE_DIR} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   add_executable( moab_test MBTest.cpp )
+  add_dependencies(moab_test moab_test_files)
   target_link_libraries( moab_test MOAB )
-  set_source_files_properties( mBTest.cpp
-    COMPILE_FLAGS "-DSRCDIR=${CMAKE_CURRENT_SOURCE_DIR}" )
-  add_test( TestMOAB ${EXECUTABLE_OUTPUT_PATH}/moab_test -nostress )
+  add_test( TestMOAB ${EXECUTABLE_OUTPUT_PATH}/moab_test )
   # FIXME: moab_test depends on: test/mb_big_test.g test/cell1.gen test/cell2.gen
 
   add_executable( tag_test TagTest.cpp )
@@ -23,36 +38,36 @@
   add_executable( seq_man_test TestTypeSequenceManager.cpp )
   target_link_libraries( seq_man_test MOAB )
   set_source_files_properties( TestTypeSequenceManager.cpp
-    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}" )
-   add_test( TestTypeSequenceManager ${EXECUTABLE_OUTPUT_PATH}/seq_man_test )
+    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
+  add_test( TestTypeSequenceManager ${EXECUTABLE_OUTPUT_PATH}/seq_man_test )
 
   add_executable( homxform_test ${MOAB_SOURCE_DIR}/src/HomXform.cpp )
   set_source_files_properties( ${MOAB_SOURCE_DIR}/src/HomXform.cpp
-    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
+    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   target_link_libraries( homxform_test MOAB )
   add_test( TestHomXform ${EXECUTABLE_OUTPUT_PATH}/homxform_test )
 
   add_executable( scdseq_test scdseq_test.cpp )
   set_source_files_properties( scdseq_test.cpp
-    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}" )
+    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   target_link_libraries( scdseq_test MOAB )
   add_test( TestSCDSeq ${EXECUTABLE_OUTPUT_PATH}/scdseq_test )
 
   add_executable( bsp_tree_test bsp_tree_test.cpp )
   set_source_files_properties( bsp_tree_test.cpp
-    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
+    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   target_link_libraries( bsp_tree_test MOAB )
   add_test( TestBSPTree ${EXECUTABLE_OUTPUT_PATH}/bsp_tree_test )
 
   add_executable( geomutiltests GeomUtilTests.cpp )
   set_source_files_properties( GeomUtilTests.cpp
-    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
+    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   target_link_libraries( geomutiltests MOAB )
   add_test( TestGeomUtil ${EXECUTABLE_OUTPUT_PATH}/geomutiltests )
 
   add_executable( range_test range_test.cpp )
   set_source_files_properties( range_test.cpp
-    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
+    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   target_link_libraries( range_test MOAB )
   add_test( TestRange ${EXECUTABLE_OUTPUT_PATH}/range_test )
 
@@ -61,7 +76,7 @@ if ( MOAB_USE_MPI AND MPI_FOUND )
   add_executable ( mbparallelcomm_test parallel/mbparallelcomm_test.cpp )
   target_link_libraries( mbparallelcomm_test MOAB )
   set_source_files_properties( parallel/mbparallelcomm_test.cpp
-    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}" )
+    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   add_test( TestParallelComm-BcastDelete
     ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
     ${EXECUTABLE_OUTPUT_PATH}/mbparallelcomm_test ${MPIEXEC_POSTFLAGS} 0 ${MOAB_SOURCE_DIR}/parallel/ptest.cub )
@@ -80,27 +95,27 @@ if ( MOAB_USE_MPI AND MPI_FOUND )
       ${HDF5_INCLUDE_DIR}
       ${MOAB_SOURCE_DIR}/src/io/mhdf/include
     )
+    set_source_files_properties( parallel/mhdf_parallel.c
+      COMPILE_FLAGS "-DTEST ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
     add_executable( mhdf_parallel parallel/mhdf_parallel.c )
-    target_link_libraries( mhdf_parallel MOAB MOABpar mhdf )
+    target_link_libraries( mhdf_parallel mhdf MOAB MOABpar )
     add_test( TestMHDFParallel ${EXECUTABLE_OUTPUT_PATH}/mhdf_parallel )
-    set_source_files_properties( parallel/mhdf_parallel.c
-      COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
   endif ( MOAB_USE_HDF )
 
+  set_source_files_properties( parallel/parallel_unit_tests.cpp
+    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   add_executable ( parallel_unit_tests parallel/parallel_unit_tests.cpp )
   target_link_libraries( parallel_unit_tests MOAB )
   add_test( TestParallel
     ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
-    ${EXECUTABLE_OUTPUT_PATH}/parallel_unit_tests ${MPIEXEC_POSTFLAGS} ${MOAB_SOURCE_DIR}/parallel/ptest.cub )
-  set_source_files_properties( parallel/parallel_unit_tests.cpp
-    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
-
+    ${EXECUTABLE_OUTPUT_PATH}/parallel_unit_tests ${MPIEXEC_POSTFLAGS} -p 2 ${MOAB_SOURCE_DIR}/MeshFiles/unittest/ptest.cub )
+  
+  set_source_files_properties( parallel/pcomm_serial.cpp
+    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   add_executable ( pcomm_serial parallel/pcomm_serial.cpp )
   target_link_libraries( pcomm_serial MOAB )
   add_test( TestPCommSerial
     ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${MPIEXEC_PREFLAGS}
-    ${EXECUTABLE_OUTPUT_PATH}/pcomm_serial ${MPIEXEC_POSTFLAGS} ${MOAB_SOURCE_DIR}/parallel/ptest.cub )
-  set_source_files_properties( parallel/pcomm_serial.cpp
-    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
+    ${EXECUTABLE_OUTPUT_PATH}/pcomm_serial ${MPIEXEC_POSTFLAGS} 1 ${MOAB_SOURCE_DIR}/MeshFiles/unittest/ptest.cub )
 
 endif ( MOAB_USE_MPI AND MPI_FOUND )

diff --git a/test/Makefile.am b/test/Makefile.am
index 631e126..f5605df 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -86,11 +86,11 @@ MOSTLYCLEANFILES = mb_write.g \
 range_test_SOURCES = range_test.cpp
 
 moab_test_SOURCES = MBTest.cpp
-moab_test_DEPENDENCIES = \
-	mb_big_test.g \
-	cell1.gen \
-	cell2.gen \
-	$(LDADD)
+#moab_test_DEPENDENCIES = \
+#	mb_big_test.g \
+#	cell1.gen \
+#	cell2.gen \
+#	$(LDADD)
 
 homxform_test_SOURCES = $(top_srcdir)/src/HomXform.cpp
 homxform_test_CPPFLAGS = -DTEST $(AM_CPPFLAGS) $(CPPFLAGS)

diff --git a/tools/mbcoupler/CMakeLists.txt b/tools/mbcoupler/CMakeLists.txt
index 019f939..5fd4438 100644
--- a/tools/mbcoupler/CMakeLists.txt
+++ b/tools/mbcoupler/CMakeLists.txt
@@ -5,6 +5,7 @@ include_directories(
     ${MOAB_SOURCE_DIR}/src/moab/point_locater/lotte
     ${MOAB_SOURCE_DIR}/itaps
     ${MOAB_SOURCE_DIR}/itaps/imesh
+    ${MOAB_BINARY_DIR}/itaps/imesh
     ${MOAB_BINARY_DIR}
     ${MOAB_BINARY_DIR}/src
     ${MOAB_BINARY_DIR}/src/parallel
@@ -35,13 +36,13 @@ if ( MOAB_USE_MPI )
   # Exercise the coupler and not just findpt:
   add_executable( mbcoupler_test mbcoupler_test.cpp )
   set_source_files_properties( mbcoupler_test.cpp
-    COMPILE_FLAGS "${MOAB_DEFINES}" )
+    COMPILE_FLAGS "${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   target_link_libraries( mbcoupler_test mbcoupler MOAB MOABpar )
   add_test( TestMBCoupler ${EXECUTABLE_OUTPUT_PATH}/mbcoupler_test )
 
   add_executable( ssn_test ssn_test.cpp )
   set_source_files_properties( ssn_test.cpp
-    COMPILE_FLAGS "${MOAB_DEFINES}" )
+    COMPILE_FLAGS "${MOAB_DEFINES} -DTEST -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   target_link_libraries( ssn_test mbcoupler MOAB MOABpar )
-  add_test( TestMBCoupler ${EXECUTABLE_OUTPUT_PATH}/ssn_test )
+  add_test( TestSSN ${EXECUTABLE_OUTPUT_PATH}/ssn_test )
 endif ( MOAB_USE_MPI )

diff --git a/tools/mbcoupler/Coupler.cpp b/tools/mbcoupler/Coupler.cpp
index 29dbb3d..2a5198a 100644
--- a/tools/mbcoupler/Coupler.cpp
+++ b/tools/mbcoupler/Coupler.cpp
@@ -746,24 +746,29 @@ ErrorCode Coupler::nat_param(double xyz[3],
       }
 
       if (etype == MBHEX) {
-        if (8==num_connect)
-        {
-          Element::LinearHex hexmap(coords_vert);
-          tmp_nat_coords = hexmap.ievaluate(CartVect(xyz), epsilon);
-          bool inside = hexmap.inside_nat_space(tmp_nat_coords, epsilon);
-          if (!inside)
-            continue;
-        }
-        else if (27==num_connect)
-        {
-          Element::QuadraticHex hexmap(coords_vert);
-          tmp_nat_coords = hexmap.ievaluate(CartVect(xyz), epsilon);
-          bool inside = hexmap.inside_nat_space(tmp_nat_coords, epsilon);
-          if (!inside)
+        try {
+          if (8==num_connect)
+          {
+            Element::LinearHex hexmap(coords_vert);
+            tmp_nat_coords = hexmap.ievaluate(CartVect(xyz), epsilon);
+            bool inside = hexmap.inside_nat_space(tmp_nat_coords, epsilon);
+            if (!inside)
+              continue;
+          }
+          else if (27==num_connect)
+          {
+            Element::QuadraticHex hexmap(coords_vert);
+            tmp_nat_coords = hexmap.ievaluate(CartVect(xyz), epsilon);
+            bool inside = hexmap.inside_nat_space(tmp_nat_coords, epsilon);
+            if (!inside)
+              continue;
+          }
+          else // TODO this case not treated yet, no interpolation
             continue;
         }
-        else // TODO this case not treated yet, no interpolation
+        catch (Element::Map::EvaluationError) {
           continue;
+        }
       }
       else if (etype == MBTET){
         Element::LinearTet tetmap(coords_vert);

diff --git a/tools/refiner/CMakeLists.txt b/tools/refiner/CMakeLists.txt
index 459e6f6..701d0cc 100644
--- a/tools/refiner/CMakeLists.txt
+++ b/tools/refiner/CMakeLists.txt
@@ -43,5 +43,5 @@ target_link_libraries( test_mesh_refiner MOAB MOABrefiner )
 add_test( TestMeshRefiner
   ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ${MPIEXEC_PREFLAGS}
   ${EXECUTABLE_OUTPUT_PATH}/test_mesh_refiner ${MPIEXEC_POSTFLAGS}
-  ${MOAB_SOURCE_DIR}/refiner/fourVolsBare.cub )
+  ${MOAB_SOURCE_DIR}/tools/refiner/fourVolsBare.cub )
 


https://bitbucket.org/fathomteam/moab/commits/05174f6b863c/
Changeset:   05174f6b863c
Branch:      None
User:        judajake
Date:        2014-01-14 00:41:13
Summary:     add missing includes for windows

Affected #:  1 file

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index b2d5a82..ad33a03 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -3,6 +3,12 @@ include_directories(
     ${CMAKE_CURRENT_SOURCE_DIR}
     ${CMAKE_SOURCE_DIR}/src
     ${CMAKE_SOURCE_DIR}/src/io
+    ${CMAKE_SOURCE_DIR}/src/oldinc
+    ${CMAKE_SOURCE_DIR}/src/LocalDiscretization
+    ${CMAKE_SOURCE_DIR}/itaps
+    ${CMAKE_BINARY_DIR}/itaps
+    ${CMAKE_SOURCE_DIR}/itaps/imesh
+    ${CMAKE_BINARY_DIR}/itaps/imesh
     ${CMAKE_SOURCE_DIR}/src/parallel )
 
 add_subdirectory(io)


https://bitbucket.org/fathomteam/moab/commits/6c6d2c056468/
Changeset:   6c6d2c056468
Branch:      None
User:        judajake
Date:        2014-01-14 00:44:28
Summary:     should only include when hdf is enabled

Affected #:  1 file

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index ad33a03..0b2b05c 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -13,7 +13,9 @@ include_directories(
 
 add_subdirectory(io)
 add_subdirectory(dual)
-add_subdirectory(h5file)
+if( MOAB_USE_HDF )
+  add_subdirectory(h5file)
+endif()
 add_subdirectory(obb)
 add_subdirectory(oldinc)
 add_subdirectory(perf)


https://bitbucket.org/fathomteam/moab/commits/8e849d04d534/
Changeset:   8e849d04d534
Branch:      None
User:        judajake
Date:        2014-01-14 02:10:49
Summary:     fix include for windows

Affected #:  1 file

diff --git a/test/h5file/CMakeLists.txt b/test/h5file/CMakeLists.txt
index b65653e..d6d4dd8 100644
--- a/test/h5file/CMakeLists.txt
+++ b/test/h5file/CMakeLists.txt
@@ -1,3 +1,4 @@
+include_directories(  ${CMAKE_SOURCE_DIR}/src/io/mhdf/include )
 set( TESTS h5file_test.cpp
            h5legacy.cpp
            h5varlen.cpp


https://bitbucket.org/fathomteam/moab/commits/66085ff76ab6/
Changeset:   66085ff76ab6
Branch:      None
User:        vijaysm
Date:        2014-01-14 04:04:29
Summary:     Merged master into cmake-fixes
Affected #:  7 files

diff --git a/config/compiler.m4 b/config/compiler.m4
index ce83a5f..4787100 100644
--- a/config/compiler.m4
+++ b/config/compiler.m4
@@ -548,6 +548,8 @@ case "$cc_compiler:$host_cpu" in
       bgq)
         FATHOM_CC_32BIT=-q32
         FATHOM_CC_64BIT=-q64
+	FATHOM_CC_SPECIAL=-qarch=qp
+	FATHOM_CXX_SPECIAL="-qarch=qp -qpic=large -qmaxmem=-1"
         AR="ar"
         NM="nm -B"
         ;;

diff --git a/src/SpatialLocator.cpp b/src/SpatialLocator.cpp
index f765ab9..36016c1 100644
--- a/src/SpatialLocator.cpp
+++ b/src/SpatialLocator.cpp
@@ -72,7 +72,7 @@ namespace moab
       locTable.enableWriteAccess();
 
         // pass storage directly into locate_points, since we know those arrays are contiguous
-      ErrorCode rval = locate_points(pos, num_points, locTable.vul_wr, locTable.vr_wr, NULL, rel_iter_tol, abs_iter_tol,
+      ErrorCode rval = locate_points(pos, num_points, (EntityHandle*)locTable.vul_wr, locTable.vr_wr, NULL, rel_iter_tol, abs_iter_tol,
                                      inside_tol);
       std::fill(locTable.vi_wr, locTable.vi_wr+num_points, 0);
       locTable.set_n(num_points);

diff --git a/tools/mbcslam/CslamUtils.cpp b/tools/mbcslam/CslamUtils.cpp
index e806d61..43668a6 100644
--- a/tools/mbcslam/CslamUtils.cpp
+++ b/tools/mbcslam/CslamUtils.cpp
@@ -906,16 +906,34 @@ void velocity_case1(CartVect & arrival_point, double t, CartVect & velo)
 //
 ErrorCode enforce_convexity(Interface * mb, EntityHandle lset, int my_rank)
 {
-  // look at each quad; compute all 4 angles; if one is reflex, break along that diagonal
+  // look at each polygon; compute all angles; if one is reflex, break that angle with
+  // the next triangle; put the 2 new polys in the set;
+  // still look at the next poly
   // replace it with 2 triangles, and remove from set;
   // it should work for all polygons / tested first for case 1, with dt 0.5 (too much deformation)
   // get all entities of dimension 2
   // then get the connectivity, etc
+
   Range inputRange;
   ErrorCode rval = mb->get_entities_by_dimension(lset, 2, inputRange);
   if (MB_SUCCESS != rval)
     return rval;
 
+  Tag corrTag=0;
+  EntityHandle dumH=0;
+  rval = mb->tag_get_handle(CORRTAGNAME,
+           1, MB_TYPE_HANDLE, corrTag,
+           MB_TAG_DENSE, &dumH);
+  if(rval==MB_TAG_NOT_FOUND)
+    corrTag = 0;
+
+  Tag gidTag;
+  rval = mb->tag_get_handle("GLOBAL_ID", 1, MB_TYPE_INTEGER,
+        gidTag, MB_TAG_DENSE);
+
+  if(rval!=MB_SUCCESS)
+    return rval;
+
   std::vector<double> coords;
   coords.resize(3*MAXEDGES); // at most 10 vertices per polygon
   // we should create a queue with new polygons that need processing for reflex angles
@@ -942,6 +960,17 @@ ErrorCode enforce_convexity(Interface * mb, EntityHandle lset, int my_rank)
     rval = mb->get_connectivity(eh, verts, num_nodes);
     if (MB_SUCCESS != rval)
       return rval;
+    EntityHandle corrHandle=0;
+    if (corrTag)
+    {
+      rval = mb->tag_get_data(corrTag, &eh, 1, &corrHandle);
+      if (MB_SUCCESS != rval)
+        return rval;
+    }
+    int gid=0;
+    rval = mb->tag_get_data(gidTag, &eh, 1, &gid);
+    if (MB_SUCCESS != rval)
+      return rval;
     coords.resize(3 * num_nodes);
     if (num_nodes < 4)
       continue; // if already triangles, don't bother
@@ -998,6 +1027,15 @@ ErrorCode enforce_convexity(Interface * mb, EntityHandle lset, int my_rank)
         rval = mb->add_entities(lset, &newElement, 1);
         if (MB_SUCCESS != rval)
           return rval;
+        if (corrTag)
+        {
+          rval = mb->tag_set_data(corrTag, &newElement, 1, &corrHandle);
+          if (MB_SUCCESS != rval)
+            return rval;
+        }
+        rval = mb->tag_set_data(gidTag, &newElement, 1, &gid);
+        if (MB_SUCCESS != rval)
+          return rval;
         if (num_nodes == 4)
         {
           // create another triangle
@@ -1017,6 +1055,15 @@ ErrorCode enforce_convexity(Interface * mb, EntityHandle lset, int my_rank)
         rval = mb->add_entities(lset, &newElement, 1);
         if (MB_SUCCESS != rval)
           return rval;
+        if (corrTag)
+        {
+          rval = mb->tag_set_data(corrTag, &newElement, 1, &corrHandle);
+          if (MB_SUCCESS != rval)
+            return rval;
+        }
+        rval = mb->tag_set_data(gidTag, &newElement, 1, &gid);
+         if (MB_SUCCESS != rval)
+           return rval;
         mb->remove_entities(lset, &eh, 1);
         brokenPolys++;
         /*std::cout<<"remove: " ;
@@ -1029,7 +1076,7 @@ ErrorCode enforce_convexity(Interface * mb, EntityHandle lset, int my_rank)
       }
     }
   }
-  std::cout << "on rank " << my_rank << " " <<  brokenPolys << " concave polygons were decomposed in convex ones \n";
+  std::cout << "on local process " << my_rank << " " <<  brokenPolys << " concave polygons were decomposed in convex ones \n";
   return MB_SUCCESS;
 }
 ErrorCode create_span_quads(Interface * mb, EntityHandle euler_set, int rank)

diff --git a/tools/mbcslam/Intx2Mesh.cpp b/tools/mbcslam/Intx2Mesh.cpp
index 625a442..99d7ca3 100644
--- a/tools/mbcslam/Intx2Mesh.cpp
+++ b/tools/mbcslam/Intx2Mesh.cpp
@@ -800,6 +800,12 @@ ErrorCode Intx2Mesh::create_departure_mesh_2nd_alg(EntityHandle & euler_set, Ent
       ERRORR(rval, "can't set global id tag on new el");
     }
   }
+  // order the remote cells tuple list, with the global id, because we will search in it
+  //remote_cells->print("remote_cells before sorting");
+  moab::TupleList::buffer sort_buffer;
+  sort_buffer.buffer_init(n);
+  remote_cells->sort(1, &sort_buffer);
+  sort_buffer.reset();
   return MB_SUCCESS;
 }
 

diff --git a/tools/mbcslam/create_dp.cpp b/tools/mbcslam/create_dp.cpp
index bd2459b..43e1735 100644
--- a/tools/mbcslam/create_dp.cpp
+++ b/tools/mbcslam/create_dp.cpp
@@ -185,10 +185,11 @@ int main(int argc, char **argv)
 
   if (argc < 3)
   {
-    std::cout << " usage: create_dp <input><output> -t <time>  -dt <delta_t> -h \n";
+    std::cout << " usage: create_dp <input><output> -t <time>  -dt <delta_t> [-skipdp] -f <field> -h \n";
     return 1;
   }
 
+  bool skip= false;
   double dt=0.1;
   double t=0.1; // corresponding to diffusion first step
 
@@ -208,9 +209,18 @@ int main(int argc, char **argv)
 
     if (!strcmp(argv[index], "-h"))
     {
-      std::cout << " usage: create_dp <input><output> -t <time>  -dt <delta_t> -h \n";
+      std::cout << " usage: create_dp <input><output> -t <time>  -dt <delta_t>  [-skipdp] -f <field>  -h \n";
       return 1;
     }
+    if (!strcmp(argv[index], "-f")) // delete partition sets
+    {
+      field_type = atoi(argv[++index]);
+    }
+
+    if (!strcmp(argv[index], "-skipdp") )
+    {
+      skip = true;
+    }
     index++;
   }
 
@@ -224,43 +234,50 @@ int main(int argc, char **argv)
   std::cout  << " -t " << t <<  " -dt " << dt << " input: " << input_mesh1 <<
       "  output: " << output << "\n";
 
-  Range verts;
-  rval = mb.get_entities_by_dimension(0, 0, verts);
-  if (MB_SUCCESS != rval)
-    return 1;
-
-  double *x_ptr, *y_ptr, *z_ptr;
-  int count;
-  rval = mb.coords_iterate(verts.begin(), verts.end(), x_ptr, y_ptr, z_ptr, count);
-  if (MB_SUCCESS != rval)
+  // skip if we need for DP (already existing)
+  if (skip)
+  {
+    std::cout<<" do not add DP tag \n";
+  }
+  else
+  {
+    Range verts;
+    rval = mb.get_entities_by_dimension(0, 0, verts);
+    if (MB_SUCCESS != rval)
       return 1;
-  assert(count == (int) verts.size()); // should end up with just one contiguous chunk of vertices
 
-  Tag tagh = 0;
-  std::string tag_name("DP");
-  rval = mb.tag_get_handle(tag_name.c_str(), 3, MB_TYPE_DOUBLE, tagh, MB_TAG_DENSE | MB_TAG_CREAT);
-  CHECK_ERR(rval);
-  void *data; // pointer to the LOC in memory, for each vertex
-  int count_tag;
+    double *x_ptr, *y_ptr, *z_ptr;
+    int count;
+    rval = mb.coords_iterate(verts.begin(), verts.end(), x_ptr, y_ptr, z_ptr, count);
+    if (MB_SUCCESS != rval)
+        return 1;
+    assert(count == (int) verts.size()); // should end up with just one contiguous chunk of vertices
 
-  rval = mb.tag_iterate(tagh, verts.begin(), verts.end(), count_tag, data);
-  CHECK_ERR(rval);
-  // here we are checking contiguity
-  assert(count_tag == (int) verts.size());
-  double * ptr_DP=(double*)data;
+    Tag tagh = 0;
+    std::string tag_name("DP");
+    rval = mb.tag_get_handle(tag_name.c_str(), 3, MB_TYPE_DOUBLE, tagh, MB_TAG_DENSE | MB_TAG_CREAT);
+    CHECK_ERR(rval);
+    void *data; // pointer to the LOC in memory, for each vertex
+    int count_tag;
 
-  for (int v = 0; v < count; v++) {
-     //EntityHandle v = verts[v];
-     CartVect pos( x_ptr[v], y_ptr[v] , z_ptr[v]);
-     CartVect newPos;
-     departure_point_case1(pos, t, dt, newPos);
-     ptr_DP[0]=newPos[0];
-     ptr_DP[1]=newPos[1];
-     ptr_DP[2]=newPos[2];
-     ptr_DP+=3; // increment to the next vertex
+    rval = mb.tag_iterate(tagh, verts.begin(), verts.end(), count_tag, data);
+    CHECK_ERR(rval);
+    // here we are checking contiguity
+    assert(count_tag == (int) verts.size());
+    double * ptr_DP=(double*)data;
+
+    for (int v = 0; v < count; v++) {
+       //EntityHandle v = verts[v];
+       CartVect pos( x_ptr[v], y_ptr[v] , z_ptr[v]);
+       CartVect newPos;
+       departure_point_case1(pos, t, dt, newPos);
+       ptr_DP[0]=newPos[0];
+       ptr_DP[1]=newPos[1];
+       ptr_DP[2]=newPos[2];
+       ptr_DP+=3; // increment to the next vertex
+    }
   }
 
-
   rval = add_field_value(mb);
 
   mb.write_file(output);

diff --git a/tools/mbcslam/intx_mpas.cpp b/tools/mbcslam/intx_mpas.cpp
index 570c97f..d737156 100644
--- a/tools/mbcslam/intx_mpas.cpp
+++ b/tools/mbcslam/intx_mpas.cpp
@@ -216,7 +216,7 @@ int main(int argc, char **argv)
   if (Verbose)
   {
     std::stringstream lagrIni;
-    lagrIni<<"def0" << rank<<".h5m";
+    lagrIni<<"lagr0" << rank<<".h5m";
     rval = mb.write_file(lagrIni.str().c_str(), 0, 0, &covering_lagr_set, 1);
   }
 
@@ -226,7 +226,7 @@ int main(int argc, char **argv)
   if (Verbose)
   {
     std::stringstream ste;
-    ste<<"lagr0" << rank<<".h5m";
+    ste<<"euler0" << rank<<".h5m";
     rval = mb.write_file(ste.str().c_str(), 0, 0, &euler_set, 1);
   }
 

diff --git a/tools/mbcslam/wrap_intx.cpp b/tools/mbcslam/wrap_intx.cpp
index b973acf..878a832 100644
--- a/tools/mbcslam/wrap_intx.cpp
+++ b/tools/mbcslam/wrap_intx.cpp
@@ -17,7 +17,7 @@
 using namespace moab;
 double radius = 1.;
 double gtol = 1.e-9;
-bool debug = false;
+bool debug = true;
 
 #ifdef __cplusplus
 extern "C" {
@@ -52,6 +52,10 @@ void update_tracer( iMesh_Instance instance, iBase_EntitySetHandle imesh_euler_s
     ERRORV(rval , "can't write covering set ");
   }
 
+  //
+  rval = enforce_convexity(mb, covering_lagr_set);
+  ERRORV(rval , "can't write covering set ");
+
   EntityHandle outputSet;
   rval = mb->create_meshset(MESHSET_SET, outputSet);
   ERRORV(rval , "can't create output set ");


https://bitbucket.org/fathomteam/moab/commits/0eea6144a25f/
Changeset:   0eea6144a25f
Branch:      None
User:        judajake
Date:        2014-02-28 19:19:21
Summary:     Merged fathomteam/moab into master
Affected #:  74 files

diff --git a/.gitignore b/.gitignore
index d842c2b..eb99939 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,10 +31,12 @@ doc/config.tex
 doc/dev.dox
 doc/user/*
 doc/user.dox
-examples/examples.make
 examples/DeformMeshRemap
 examples/DirectAccessNoHoles
+examples/DirectAccessNoHolesF90
 examples/DirectAccessWithHoles
+examples/examples.make
+examples/freem.mod
 examples/FileRead
 examples/GeomSetHierarchy
 examples/GetEntities
@@ -47,11 +49,14 @@ examples/itaps/ListSetsNTagsF90
 examples/itaps/TagIterateC
 examples/itaps/TagIterateF
 examples/KDTree
+examples/LloydRelaxation
 examples/ObbTree
+examples/point_in_elem_search
 examples/PushParMeshIntoMoabF90
 examples/ReduceExchangeTags
 examples/SetsNTags
 examples/SkinMesh
+examples/structuredmesh
 examples/StructuredMeshSimple
 examples/SurfArea
 examples/TestExodusII
@@ -80,7 +85,6 @@ itaps/imesh/ScdMeshF77
 itaps/imesh/ScdMeshF90
 itaps/imesh/testc_cbind
 *.la
-*.la
 *.lai
 lib
 lib/*
@@ -130,13 +134,11 @@ test/cropvol_test
 test/dual/dual_test
 test/elem_eval_test
 test/file_options_test
+test/*.h5m
 test/*.g
-test/*.g
-test/*.gen
 test/*.gen
 test/geom_util_test
 test/gttool_test
-test/gttool_test
 test/h5file/dump_sets
 test/h5file/h5legacy
 test/h5file/h5partial
@@ -154,7 +156,10 @@ test/io/*.g
 test/io/gmsh_test
 test/io/ideas_test
 test/io/nastran_test
+test/io/read_cgm_basic_test
+test/io/read_cgm_load_test
 test/io/read_cgm_test
+test/io/read_mpas_nc
 test/io/read_nc
 test/io/read_ucd_nc
 test/io/readutil_test
@@ -169,6 +174,7 @@ test/lloyd_smoother_test
 test/mbcn_test
 test/mbfacet_test
 test/mbground_test
+test/mergemesh_test
 test/mesh_set_test
 test/moab_test
 test/obb/obb_test
@@ -176,7 +182,6 @@ test/obb/obb_time
 test/obb/obb_tree_tool
 test/obb_test
 test/oldinc/test_oldinc
-test/read_mpas_nc
 test/parallel/*.h5m
 test/parallel/mbparallelcomm_test
 test/parallel/mhdf_parallel
@@ -188,6 +193,7 @@ test/parallel/parallel_unit_tests
 test/parallel/parallel_write_test
 test/parallel/par_coupler_test
 test/parallel/par_intx_sph
+test/parallel/par_spatial_locator_test
 test/parallel/parmerge
 test/parallel/partcheck
 test/parallel/pcomm_serial
@@ -208,6 +214,8 @@ test/perf/seqperf
 test/perf/tstt_perf_binding
 test/perf/point_location/elem_eval_time
 test/perf/point_location/point_location
+test/perf/point_location/sploc_searching_perf
+test/perf/point_location/tree_searching_perf
 test/range_test
 test/reorder_test
 test/scdseq_test
@@ -233,16 +241,25 @@ tools/mbconvert
 tools/mbcoupler/*.h5m
 tools/mbcoupler/*.g
 tools/mbcoupler/tests/
+tools/mbcslam/advection
 tools/mbcslam/case1_test
+tools/mbcslam/create_dp
+tools/mbcslam/cslam_par_test
+tools/mbcslam/diffusion
 tools/mbcslam/intersect1.h5m
 tools/mbcslam/intx1.vtk
+tools/mbcslam/intx_imesh
 tools/mbcslam/intx_in_plane_test
+tools/mbcslam/intx_mpas
 tools/mbcslam/intx_on_sphere_test
 tools/mbcslam/intx.vtk
 tools/mbcslam/lagr.h5m
+tools/mbcslam/lagrIni.h5m
 tools/mbcslam/spectral.vtk
 tools/mbcslam/spec_visu_test
 tools/mbcslam/spherical_area_test
+tools/mbcslam/polyWithEdges.vtk
+tools/mbcslam/proj1
 tools/mbdepth
 tools/mbgsets
 tools/mbmem

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/cube.sat b/MeshFiles/unittest/io/cube.sat
new file mode 100644
index 0000000..58fd508
--- /dev/null
+++ b/MeshFiles/unittest/io/cube.sat
@@ -0,0 +1,117 @@
+1900 0 1 0           
+10 Cubit 12.2 17 ACIS 19.0.2 Linux 24 Mon Jan  6 14:16:03 2014 
+1 9.9999999999999995e-07 1e-10 
+body $1 -1 -1 $-1 $2 $-1 $-1 T -5 -5 -5 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $0 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+lump $3 -1 -1 $-1 $-1 $4 $0 T -5 -5 -5 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+shell $-1 -1 -1 $-1 $-1 $-1 $5 $-1 $2 T -5 -5 -5 5 5 5 #
+face $6 -1 -1 $-1 $7 $8 $4 $-1 $9 forward single T -5 -5 5 5 5 5 F #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $5 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+face $10 -1 -1 $-1 $11 $12 $4 $-1 $13 reversed single T -5 -5 -5 5 5 -5 F #
+loop $-1 -1 -1 $-1 $-1 $14 $5 T -5 -5 5 5 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 0 0 5 0 0 1 1 0 0 forward_v I I I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $7 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+face $15 -1 -1 $-1 $16 $17 $4 $-1 $18 reversed single T -5 -5 -5 5 -5 5 F #
+loop $-1 -1 -1 $-1 $-1 $19 $7 T -5 -5 -5 5 5 -5 unknown #
+plane-surface $-1 -1 -1 $-1 0 0 -5 0 0 1 1 0 0 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $20 $21 $22 $23 forward $8 $-1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $11 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 3 #
+face $24 -1 -1 $-1 $25 $26 $4 $-1 $27 reversed single T -5 -5 -5 -5 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $28 $11 T -5 -5 -5 5 -5 5 unknown #
+plane-surface $-1 -1 -1 $-1 0 -5 0 0 1 -0 -0 0 1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $29 $30 $31 $32 forward $12 $-1 #
+coedge $-1 -1 -1 $-1 $33 $14 $34 $35 forward $8 $-1 #
+coedge $-1 -1 -1 $-1 $14 $33 $36 $37 forward $8 $-1 #
+coedge $-1 -1 -1 $-1 $38 $39 $14 $23 reversed $40 $-1 #
+edge $41 -1 -1 $-1 $42 -5 $43 5 $22 $44 forward @7 unknown T 5 -5 5 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $16 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 4 #
+face $45 -1 -1 $-1 $46 $47 $4 $-1 $48 reversed single T -5 5 -5 5 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $49 $16 T -5 -5 -5 -5 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 -5 0 0 1 0 0 0 0 -1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $50 $36 $51 $52 forward $17 $-1 #
+coedge $-1 -1 -1 $-1 $53 $19 $50 $54 forward $12 $-1 #
+coedge $-1 -1 -1 $-1 $19 $53 $55 $56 forward $12 $-1 #
+coedge $-1 -1 -1 $-1 $39 $38 $19 $32 reversed $40 $-1 #
+edge $57 -1 -1 $-1 $58 -5 $59 5 $31 $60 forward @7 unknown T 5 -5 -5 5 5 -5 #
+coedge $-1 -1 -1 $-1 $21 $20 $61 $62 forward $8 $-1 #
+coedge $-1 -1 -1 $-1 $63 $64 $20 $35 reversed $47 $-1 #
+edge $65 -1 -1 $-1 $43 -5 $66 5 $34 $67 forward @7 unknown T -5 5 5 5 5 5 #
+coedge $-1 -1 -1 $-1 $28 $68 $21 $37 reversed $17 $-1 #
+edge $69 -1 -1 $-1 $70 -5 $42 5 $36 $71 forward @7 unknown T -5 -5 5 5 -5 5 #
+coedge $-1 -1 -1 $-1 $31 $22 $68 $72 forward $40 $-1 #
+coedge $-1 -1 -1 $-1 $22 $31 $63 $73 reversed $40 $-1 #
+loop $-1 -1 -1 $-1 $-1 $38 $46 T 5 -5 -5 5 5 5 unknown #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $23 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+vertex $74 -1 -1 $-1 $23 $75 #
+vertex $76 -1 -1 $-1 $23 $77 #
+straight-curve $-1 -1 -1 $-1 5 0 5 0 1 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $25 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 5 #
+face $78 -1 -1 $-1 $-1 $40 $4 $-1 $79 reversed single T 5 -5 -5 5 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $63 $25 T -5 5 -5 5 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 0 5 0 0 -1 0 0 0 -1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $80 $61 $64 $81 forward $26 $-1 #
+coedge $-1 -1 -1 $-1 $68 $28 $29 $54 reversed $17 $-1 #
+coedge $-1 -1 -1 $-1 $61 $80 $28 $52 reversed $26 $-1 #
+edge $82 -1 -1 $-1 $70 -5 $83 5 $51 $84 forward @7 unknown T -5 -5 -5 -5 -5 5 #
+coedge $-1 -1 -1 $-1 $30 $29 $80 $85 forward $12 $-1 #
+edge $86 -1 -1 $-1 $59 -5 $83 5 $50 $87 forward @7 unknown T -5 -5 -5 5 -5 -5 #
+coedge $-1 -1 -1 $-1 $64 $63 $30 $56 reversed $47 $-1 #
+edge $88 -1 -1 $-1 $89 -5 $58 5 $55 $90 forward @7 unknown T -5 5 -5 5 5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $32 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 5 #
+vertex $91 -1 -1 $-1 $32 $92 #
+vertex $93 -1 -1 $-1 $72 $94 #
+straight-curve $-1 -1 -1 $-1 5 0 -5 0 -1 0 I I #
+coedge $-1 -1 -1 $-1 $49 $51 $33 $62 reversed $26 $-1 #
+edge $95 -1 -1 $-1 $66 -5 $70 5 $61 $96 forward @7 unknown T -5 -5 5 -5 5 5 #
+coedge $-1 -1 -1 $-1 $55 $34 $39 $73 forward $47 $-1 #
+coedge $-1 -1 -1 $-1 $34 $55 $49 $81 reversed $47 $-1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $35 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+vertex $97 -1 -1 $-1 $35 $98 #
+straight-curve $-1 -1 -1 $-1 0 5 5 -1 0 0 I I #
+coedge $-1 -1 -1 $-1 $36 $50 $38 $72 reversed $17 $-1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $37 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 4 #
+vertex $99 -1 -1 $-1 $62 $100 #
+straight-curve $-1 -1 -1 $-1 0 -5 5 1 0 0 I I #
+edge $101 -1 -1 $-1 $42 -5 $59 5 $38 $102 forward @7 unknown T 5 -5 -5 5 -5 5 #
+edge $103 -1 -1 $-1 $43 -5 $58 5 $39 $104 forward @7 unknown T 5 5 -5 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $42 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+point $-1 -1 -1 $-1 5 -5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $43 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+point $-1 -1 -1 $-1 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $46 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 6 #
+plane-surface $-1 -1 -1 $-1 5 0 0 -1 0 0 0 -0 1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $51 $49 $53 $85 reversed $26 $-1 #
+edge $105 -1 -1 $-1 $66 -5 $89 5 $64 $106 forward @7 unknown T -5 5 -5 -5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $52 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 9 #
+vertex $107 -1 -1 $-1 $85 $108 #
+straight-curve $-1 -1 -1 $-1 -5 -5 0 0 0 -1 I I #
+edge $109 -1 -1 $-1 $83 -5 $89 5 $80 $110 forward @7 unknown T -5 -5 -5 -5 5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $54 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 6 #
+straight-curve $-1 -1 -1 $-1 0 -5 -5 -1 0 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $56 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 8 #
+vertex $111 -1 -1 $-1 $56 $112 #
+straight-curve $-1 -1 -1 $-1 0 5 -5 1 0 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $58 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 5 #
+point $-1 -1 -1 $-1 5 5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $59 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 6 #
+point $-1 -1 -1 $-1 5 -5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $62 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 3 #
+straight-curve $-1 -1 -1 $-1 -5 0 5 0 -1 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $66 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 3 #
+point $-1 -1 -1 $-1 -5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $70 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 4 #
+point $-1 -1 -1 $-1 -5 -5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $72 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 10 #
+straight-curve $-1 -1 -1 $-1 5 -5 0 0 0 -1 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $73 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 12 #
+straight-curve $-1 -1 -1 $-1 5 5 0 0 0 -1 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $81 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 11 #
+straight-curve $-1 -1 -1 $-1 -5 5 0 0 0 -1 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $83 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 7 #
+point $-1 -1 -1 $-1 -5 -5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $85 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 7 #
+straight-curve $-1 -1 -1 $-1 -5 0 -5 0 1 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $89 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 8 #
+point $-1 -1 -1 $-1 -5 5 -5 #
+End-of-ACIS-data 
\ No newline at end of file

diff --git a/MeshFiles/unittest/io/cube.stp b/MeshFiles/unittest/io/cube.stp
new file mode 100644
index 0000000..c17645d
--- /dev/null
+++ b/MeshFiles/unittest/io/cube.stp
@@ -0,0 +1,185 @@
+ISO-10303-21;
+HEADER;
+FILE_DESCRIPTION(('STEP AP214'),'1');
+FILE_NAME('/home/iulian/source/MOABsource/MeshFiles/unittest/io/cube.stp','2014-02-11T15:06:47',(' '),(' '),'Spatial InterOp 3D',' ',' ');
+FILE_SCHEMA(('automotive_design'));
+ENDSEC;
+DATA;
+#1=PRODUCT_DEFINITION_CONTEXT('',#9,'design');
+#2=APPLICATION_PROTOCOL_DEFINITION('INTERNATIONAL STANDARD','automotive_design',1994,#9);
+#3=PRODUCT_CATEGORY_RELATIONSHIP('NONE','NONE',#10,#11);
+#4=SHAPE_DEFINITION_REPRESENTATION(#12,#13);
+#5= (GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#16))GLOBAL_UNIT_ASSIGNED_CONTEXT((#18,#19,#20))REPRESENTATION_CONTEXT('NONE','WORKSPACE'));
+#9=APPLICATION_CONTEXT(' ');
+#10=PRODUCT_CATEGORY('part','NONE');
+#11=PRODUCT_RELATED_PRODUCT_CATEGORY('detail',' ',(#22));
+#12=PRODUCT_DEFINITION_SHAPE('NONE','NONE',#23);
+#13=ADVANCED_BREP_SHAPE_REPRESENTATION('1',(#24,#25),#5);
+#16=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0E-06),#18,'','');
+#18= (CONVERSION_BASED_UNIT('MILLIMETRE',#28)LENGTH_UNIT()NAMED_UNIT(#31));
+#19= (NAMED_UNIT(#33)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#20= (NAMED_UNIT(#33)SOLID_ANGLE_UNIT()SI_UNIT($,.STERADIAN.));
+#22=PRODUCT('1','1','PART-1-DESC',(#39));
+#23=PRODUCT_DEFINITION('NONE','NONE',#40,#1);
+#24=MANIFOLD_SOLID_BREP('1',#41);
+#25=AXIS2_PLACEMENT_3D('',#42,#43,#44);
+#28=LENGTH_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0),#45);
+#31=DIMENSIONAL_EXPONENTS(1.0,0.0,0.0,0.0,0.0,0.0,0.0);
+#33=DIMENSIONAL_EXPONENTS(0.0,0.0,0.0,0.0,0.0,0.0,0.0);
+#39=PRODUCT_CONTEXT('',#9,'mechanical');
+#40=PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE(' ','NONE',#22,.NOT_KNOWN.);
+#41=CLOSED_SHELL('',(#46,#47,#48,#49,#50,#51));
+#42=CARTESIAN_POINT('',(0.0,0.0,0.0));
+#43=DIRECTION('',(0.0,0.0,1.0));
+#44=DIRECTION('',(1.0,0.0,0.0));
+#45= (NAMED_UNIT(#31)LENGTH_UNIT()SI_UNIT(.MILLI.,.METRE.));
+#46=ADVANCED_FACE('',(#53),#54,.T.);
+#47=ADVANCED_FACE('',(#55),#56,.F.);
+#48=ADVANCED_FACE('',(#57),#58,.F.);
+#49=ADVANCED_FACE('',(#59),#60,.F.);
+#50=ADVANCED_FACE('',(#61),#62,.F.);
+#51=ADVANCED_FACE('',(#63),#64,.F.);
+#53=FACE_OUTER_BOUND('',#65,.T.);
+#54=PLANE('',#66);
+#55=FACE_OUTER_BOUND('',#67,.T.);
+#56=PLANE('',#68);
+#57=FACE_OUTER_BOUND('',#69,.T.);
+#58=PLANE('',#70);
+#59=FACE_OUTER_BOUND('',#71,.T.);
+#60=PLANE('',#72);
+#61=FACE_OUTER_BOUND('',#73,.T.);
+#62=PLANE('',#74);
+#63=FACE_OUTER_BOUND('',#75,.T.);
+#64=PLANE('',#76);
+#65=EDGE_LOOP('',(#77,#78,#79,#80));
+#66=AXIS2_PLACEMENT_3D('',#81,#82,#83);
+#67=EDGE_LOOP('',(#84,#85,#86,#87));
+#68=AXIS2_PLACEMENT_3D('',#88,#89,#90);
+#69=EDGE_LOOP('',(#91,#92,#93,#94));
+#70=AXIS2_PLACEMENT_3D('',#95,#96,#97);
+#71=EDGE_LOOP('',(#98,#99,#100,#101));
+#72=AXIS2_PLACEMENT_3D('',#102,#103,#104);
+#73=EDGE_LOOP('',(#105,#106,#107,#108));
+#74=AXIS2_PLACEMENT_3D('',#109,#110,#111);
+#75=EDGE_LOOP('',(#112,#113,#114,#115));
+#76=AXIS2_PLACEMENT_3D('',#116,#117,#118);
+#77=ORIENTED_EDGE('',*,*,#119,.T.);
+#78=ORIENTED_EDGE('',*,*,#120,.T.);
+#79=ORIENTED_EDGE('',*,*,#121,.T.);
+#80=ORIENTED_EDGE('',*,*,#122,.T.);
+#81=CARTESIAN_POINT('',(0.0,0.0,5.0));
+#82=DIRECTION('',(0.0,0.0,1.0));
+#83=DIRECTION('',(1.0,0.0,0.0));
+#84=ORIENTED_EDGE('',*,*,#123,.T.);
+#85=ORIENTED_EDGE('',*,*,#124,.T.);
+#86=ORIENTED_EDGE('',*,*,#125,.T.);
+#87=ORIENTED_EDGE('',*,*,#126,.T.);
+#88=CARTESIAN_POINT('',(0.0,0.0,-5.0));
+#89=DIRECTION('',(0.0,0.0,1.0));
+#90=DIRECTION('',(1.0,0.0,0.0));
+#91=ORIENTED_EDGE('',*,*,#127,.T.);
+#92=ORIENTED_EDGE('',*,*,#124,.F.);
+#93=ORIENTED_EDGE('',*,*,#128,.F.);
+#94=ORIENTED_EDGE('',*,*,#122,.F.);
+#95=CARTESIAN_POINT('',(0.0,-5.0,0.0));
+#96=DIRECTION('',(0.0,1.0,-0.0));
+#97=DIRECTION('',(-0.0,0.0,1.0));
+#98=ORIENTED_EDGE('',*,*,#129,.T.);
+#99=ORIENTED_EDGE('',*,*,#125,.F.);
+#100=ORIENTED_EDGE('',*,*,#127,.F.);
+#101=ORIENTED_EDGE('',*,*,#121,.F.);
+#102=CARTESIAN_POINT('',(-5.0,0.0,0.0));
+#103=DIRECTION('',(1.0,0.0,0.0));
+#104=DIRECTION('',(0.0,0.0,-1.0));
+#105=ORIENTED_EDGE('',*,*,#130,.T.);
+#106=ORIENTED_EDGE('',*,*,#126,.F.);
+#107=ORIENTED_EDGE('',*,*,#129,.F.);
+#108=ORIENTED_EDGE('',*,*,#120,.F.);
+#109=CARTESIAN_POINT('',(0.0,5.0,0.0));
+#110=DIRECTION('',(0.0,-1.0,0.0));
+#111=DIRECTION('',(0.0,0.0,-1.0));
+#112=ORIENTED_EDGE('',*,*,#128,.T.);
+#113=ORIENTED_EDGE('',*,*,#123,.F.);
+#114=ORIENTED_EDGE('',*,*,#130,.F.);
+#115=ORIENTED_EDGE('',*,*,#119,.F.);
+#116=CARTESIAN_POINT('',(5.0,0.0,0.0));
+#117=DIRECTION('',(-1.0,0.0,0.0));
+#118=DIRECTION('',(0.0,-0.0,1.0));
+#119=EDGE_CURVE('',#131,#132,#133,.T.);
+#120=EDGE_CURVE('',#132,#134,#135,.T.);
+#121=EDGE_CURVE('',#134,#136,#137,.T.);
+#122=EDGE_CURVE('',#136,#131,#138,.T.);
+#123=EDGE_CURVE('',#139,#140,#141,.T.);
+#124=EDGE_CURVE('',#140,#142,#143,.T.);
+#125=EDGE_CURVE('',#142,#144,#145,.T.);
+#126=EDGE_CURVE('',#144,#139,#146,.T.);
+#127=EDGE_CURVE('',#136,#142,#147,.T.);
+#128=EDGE_CURVE('',#131,#140,#148,.T.);
+#129=EDGE_CURVE('',#134,#144,#149,.T.);
+#130=EDGE_CURVE('',#132,#139,#150,.T.);
+#131=VERTEX_POINT('',#151);
+#132=VERTEX_POINT('',#152);
+#133=LINE('',#153,#154);
+#134=VERTEX_POINT('',#155);
+#135=LINE('',#156,#157);
+#136=VERTEX_POINT('',#158);
+#137=LINE('',#159,#160);
+#138=LINE('',#161,#162);
+#139=VERTEX_POINT('',#163);
+#140=VERTEX_POINT('',#164);
+#141=LINE('',#165,#166);
+#142=VERTEX_POINT('',#167);
+#143=LINE('',#168,#169);
+#144=VERTEX_POINT('',#170);
+#145=LINE('',#171,#172);
+#146=LINE('',#173,#174);
+#147=LINE('',#175,#176);
+#148=LINE('',#177,#178);
+#149=LINE('',#179,#180);
+#150=LINE('',#181,#182);
+#151=CARTESIAN_POINT('',(5.0,-5.0,5.0));
+#152=CARTESIAN_POINT('',(5.0,5.0,5.0));
+#153=CARTESIAN_POINT('',(5.0,0.0,5.0));
+#154=VECTOR('',#183,1.0);
+#155=CARTESIAN_POINT('',(-5.0,5.0,5.0));
+#156=CARTESIAN_POINT('',(0.0,5.0,5.0));
+#157=VECTOR('',#184,1.0);
+#158=CARTESIAN_POINT('',(-5.0,-5.0,5.0));
+#159=CARTESIAN_POINT('',(-5.0,0.0,5.0));
+#160=VECTOR('',#185,1.0);
+#161=CARTESIAN_POINT('',(0.0,-5.0,5.0));
+#162=VECTOR('',#186,1.0);
+#163=CARTESIAN_POINT('',(5.0,5.0,-5.0));
+#164=CARTESIAN_POINT('',(5.0,-5.0,-5.0));
+#165=CARTESIAN_POINT('',(5.0,0.0,-5.0));
+#166=VECTOR('',#187,1.0);
+#167=CARTESIAN_POINT('',(-5.0,-5.0,-5.0));
+#168=CARTESIAN_POINT('',(0.0,-5.0,-5.0));
+#169=VECTOR('',#188,1.0);
+#170=CARTESIAN_POINT('',(-5.0,5.0,-5.0));
+#171=CARTESIAN_POINT('',(-5.0,0.0,-5.0));
+#172=VECTOR('',#189,1.0);
+#173=CARTESIAN_POINT('',(0.0,5.0,-5.0));
+#174=VECTOR('',#190,1.0);
+#175=CARTESIAN_POINT('',(-5.0,-5.0,0.0));
+#176=VECTOR('',#191,1.0);
+#177=CARTESIAN_POINT('',(5.0,-5.0,0.0));
+#178=VECTOR('',#192,1.0);
+#179=CARTESIAN_POINT('',(-5.0,5.0,0.0));
+#180=VECTOR('',#193,1.0);
+#181=CARTESIAN_POINT('',(5.0,5.0,0.0));
+#182=VECTOR('',#194,1.0);
+#183=DIRECTION('',(0.0,1.0,0.0));
+#184=DIRECTION('',(-1.0,0.0,0.0));
+#185=DIRECTION('',(0.0,-1.0,0.0));
+#186=DIRECTION('',(1.0,0.0,0.0));
+#187=DIRECTION('',(0.0,-1.0,0.0));
+#188=DIRECTION('',(-1.0,0.0,0.0));
+#189=DIRECTION('',(0.0,1.0,0.0));
+#190=DIRECTION('',(1.0,0.0,0.0));
+#191=DIRECTION('',(0.0,0.0,-1.0));
+#192=DIRECTION('',(0.0,0.0,-1.0));
+#193=DIRECTION('',(0.0,0.0,-1.0));
+#194=DIRECTION('',(0.0,0.0,-1.0));
+ENDSEC;
+END-ISO-10303-21;

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/CrystalRouterExample.cpp b/examples/CrystalRouterExample.cpp
new file mode 100644
index 0000000..83a1e7c
--- /dev/null
+++ b/examples/CrystalRouterExample.cpp
@@ -0,0 +1,188 @@
+/*
+ * This example will show one of the building blocks of parallel infrastructure in MOAB
+ * More exactly, if we have some homogeneous data to communicate from each processor to a list of other
+ * processors, how do we do it?
+ *
+ * introduce the TupleList and crystal router to MOAB users.
+ *
+ * This technology is used in resolving shared vertices / sets between partitions
+ * It is used in the mbcoupler for sending data (target points) to the proper processor, and communicate
+ *   back the results.
+ * Also, it is used to communicate departure mesh for intersection in parallel
+ *
+ *  It is a way of doing  MPI_gatheralltoallv(), when the communication matrix is sparse
+ *
+ *  It is assumed that every proc needs to communicate only with a few of the other processors.
+ *  If every processor needs to communicate with all other, then we will have to use paired isend and irecv, the
+ *  communication matrix is full
+ *
+ *  the example needs to be launched in parallel.
+ *  Every proc will build a list of tuples, that will be send to a few procs;
+ *  In general, we will send to num_comms tasks, and about num_tuples to each task
+ *  We vary num_comms and num_tuples for processor
+ *
+ *  we will send long ints of the form
+ *    100000 * send + 1000* rank +j, where j is the index of tuple
+ *
+ *  after routing, we verify we received
+ *    100000 * rank + 1000 * from
+ *
+ *    For some reportrank we also print the tuples.
+ *
+ *  after routing, we will see if we received, as expected. Should run on at least 2 processors.
+ *
+ * Note: We do not need a moab instance for this example
+ *
+ */
+
+/** @example CrystalRouterExample.cpp \n
+ * \brief generalized gather scatter using tuples \n
+ * <b>To run</b>: mpiexec -np <n> CrystalRouterExample -r [reportrank] -t [num_tuples] -n [num_comms] \n
+ *
+ */
+//
+#include "moab/ProcConfig.hpp"
+#include "moab/TupleList.hpp"
+#include "moab/ProgOptions.hpp"
+#include <time.h>
+#include <iostream>
+#include <sstream>
+
+const char BRIEF_DESC[] =
+    "Example of gather scatter with tuple lists \n";
+std::ostringstream LONG_DESC;
+
+using namespace moab;
+using namespace std;
+
+int main(int argc, char **argv)
+{
+  MPI_Init(&argc, &argv);
+
+  ProcConfig pc(MPI_COMM_WORLD);
+  int size = pc.proc_size();
+  int rank = pc.proc_rank();
+
+  // start copy
+  LONG_DESC << "This program does a gather scatter with a list of tuples. \n"
+          " It tries to see how much communication costs in terms of time and memory. \n"
+          << "It starts with creating a list of tuples to be sent from each processor, \n to a list of other processors.\n" <<
+          "The number of tuples and how many tasks to communicate to are controlled by input parameters.\n" <<
+          "After communication, we verify locally if we received what we expected. \n";
+  ProgOptions opts(LONG_DESC.str(), BRIEF_DESC);
+
+  // how many procs communicate to current proc, on average (we will vary that too)
+  int num_comms = 2;
+  opts.addOpt<int>("num_comms,n",
+       "each task will send to about num_comms other tasks some tuples (default 2)", &num_comms);
+
+  int num_tuples = 4;
+  opts.addOpt<int>("num_tuples,t",
+        "each task will send to some task about num_tuples tuples (default 4)", &num_tuples);
+
+  int reportrank = size+1;
+  opts.addOpt<int>("reporting_rank,r",
+      "this rank will report the tuples sent and the tuples received; it could be higher than num_procs, then no reporting"
+      ,&reportrank);
+
+  opts.parseCommandLine(argc, argv);
+
+
+
+
+  if (rank==reportrank || (reportrank>=size && rank == 0))
+  {
+    std::cout << " There are " << size << " tasks in example.\n";
+    std::cout<< " We will send groups of " << num_tuples << " from each task towards " <<
+        num_comms << " other tasks.\n";
+  }
+
+  // send some data from proc i to i+n/2, also to i +n/2+1 modulo n, where n is num procs
+
+  gs_data::crystal_data *cd = pc.crystal_router();
+
+  long total_n_tuples = num_comms*num_tuples;
+
+  // vary the number of tasks to send to, and the number of tuples to send
+  if (rank<size/2)
+    num_comms--;
+  else
+    num_comms++;
+
+  if (rank<size/3)
+    num_tuples*=2;
+  else if (rank>size-size/3)
+    num_tuples/=2;
+
+
+  TupleList tl;
+  // at most num_tuples* num_comms to send
+  // we do a preallocate with this; some tuples on some processors might need more memory, to be able
+  // to grow locally; Some tasks might receive more tuples though, and in the process, some might grow more than
+  // others. By doing these logP sends/receives, we do not grow local memory too much.
+  tl.initialize(1, 1, 0, 1, num_tuples*num_comms);
+  tl.enableWriteAccess();
+  // form num_tuples*num_comms tuples, send to various ranks
+  unsigned int n = tl.get_n();
+  for (int i=0; i<num_comms; i++)
+  {
+    int sendTo = rank+i*size/2+1;// spread out the send to, for a stress-like test
+    sendTo = sendTo%size;//
+    long intToSend = 1000*rank + 100000*sendTo;
+    for (int j=0; j<num_tuples; j++)
+    {
+      n = tl.get_n();
+      tl.vi_wr[n]= sendTo;
+      tl.vl_wr[n]= intToSend+j;
+      tl.vr_wr[n]= 10000.*rank+j;
+      tl.inc_n();
+    }
+  }
+
+  if (rank==reportrank)
+  {
+    std::cout << "rank " << rank << "\n";
+    tl.print(" before sending");
+  }
+
+  clock_t tt = clock();
+  // all communication happens here; no mpi calls for the user
+  ErrorCode rval = cd->gs_transfer(1,tl,0);
+
+  if (MB_SUCCESS!= rval)
+  {
+    std::cout << "error in tuple transfer\n";
+  }
+
+  double secs=0;
+  if (rank==reportrank || (reportrank>=size && rank == 0))
+  {
+    secs = (clock() - tt) / (double) CLOCKS_PER_SEC;
+  }
+  if (rank==reportrank)
+  {
+    std::cout << "rank " << rank << "\n";
+    tl.print(" after transfer");
+  }
+  // check that all tuples received have the form 10000* rank + 100*from
+  unsigned int received = tl.get_n();
+  for (int i=0; i<(int)received; i++)
+  {
+    int from = tl.vi_rd[i];
+    long valrec = tl.vl_rd[i];
+    int remainder = valrec -100000*rank -1000*from;
+    if (remainder < 0 || remainder >= num_tuples*4)
+      std::cout << " error: tuple " << i << " received at proc rank " << rank << " from proc " << from << " has value " <<
+         valrec << " remainder " <<  remainder << "\n";
+  }
+
+  if (rank==reportrank || (reportrank>=size && rank == 0))
+  {
+    std::cout << "communication of about "<<  total_n_tuples << " tuples/per proc took "
+        << secs  << " seconds" << std::endl;
+        tt = clock();
+  }
+  MPI_Finalize();
+
+  return 0;
+}

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/StructuredMeshSimple.cpp b/examples/StructuredMeshSimple.cpp
index 25aa08f..bc80ed8 100644
--- a/examples/StructuredMeshSimple.cpp
+++ b/examples/StructuredMeshSimple.cpp
@@ -17,7 +17,7 @@
  *      -# Get the coordinates of the vertices comprising that element
  *    -# Release the structured mesh interface and destroy the MOAB instance
  *
- * <b> To run: </b> ./structuredmesh [d [N] ] \n
+ * <b> To run: </b> ./StructuredMeshSimple [d [N] ] \n
  * (default values so can run w/ no user interaction)
  */
 
@@ -25,6 +25,9 @@
 #include "moab/ScdInterface.hpp"
 #include "moab/ProgOptions.hpp"
 #include "moab/CN.hpp"
+#ifdef USE_MPI
+#include "moab_mpi.h"
+#endif
 #include <iostream>
 #include <vector>
 
@@ -34,6 +37,10 @@ int main(int argc, char **argv)
 {
   int N = 10, dim = 3;
 
+#ifdef USE_MPI
+  MPI_Init(&argc, &argv);
+#endif
+
   ProgOptions opts;
   opts.addOpt<int>(std::string("dim,d"), std::string("Dimension of mesh (default=3)"),
                    &dim);
@@ -105,6 +112,10 @@ int main(int argc, char **argv)
     // 5. Release the structured mesh interface and destroy the MOAB instance
   mb->release_interface(scdiface); // tell MOAB we're done with the ScdInterface
   delete mb;
-  
+
+#ifdef USE_MPI
+  MPI_Finalize();
+#endif
+
   return 0;
 }

diff --git a/examples/makefile b/examples/makefile
index 6c1ed9a..41dc577 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -7,14 +7,14 @@ 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 StructuredMeshSimple DirectAccessWithHoles DirectAccessNoHoles 
-PAREXAMPLES = HelloParMOAB ReduceExchangeTags LloydRelaxation
-F90EXAMPLES = DirectAccessNoHolesF90 PushParMeshIntoMoabF90
+EXAMPLES = HelloMOAB GetEntities SetsNTags LoadPartial structuredmesh StructuredMeshSimple DirectAccessWithHoles DirectAccessNoHoles point_in_elem_search DeformMeshRemap
+PAREXAMPLES = HelloParMOAB ReduceExchangeTags LloydRelaxation CrystalRouterExample
 EXOIIEXAMPLES = TestExodusII
+F90EXAMPLES = DirectAccessNoHolesF90 PushParMeshIntoMoabF90
 
-default: ${EXAMPLES}
+default: ${EXAMPLES} ${PAREXAMPLES} ${EXOIIEXAMPLES} ${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
@@ -26,8 +26,14 @@ SetsNTags: SetsNTags.o ${MOAB_LIBDIR}/libMOAB.la
 LloydRelaxation: LloydRelaxation.o ${MOAB_LIBDIR}/libMOAB.la
 	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
 
-StructuredMeshSimple : StructuredMeshSimple.o ${MOAB_LIBDIR}/libMOAB.la
-	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK} 
+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
+	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
 
 DirectAccessWithHoles: DirectAccessWithHoles.o ${MOAB_LIBDIR}/libMOAB.la
 	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
@@ -38,11 +44,14 @@ 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} 
+	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
+
+CrystalRouterExample: CrystalRouterExample.o ${MOAB_LIBDIR}/libMOAB.la
+	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
 
 TestExodusII: TestExodusII.o ${MOAB_LIBDIR}/libMOAB.la
 	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
@@ -54,14 +63,14 @@ PushParMeshIntoMoabF90: PushParMeshIntoMoabF90.o
 	${MOAB_FC} -o $@ $< ${IMESH_LIBS}
 
 DeformMeshRemap: DeformMeshRemap.o ${MOAB_LIBDIR}/libMOAB.la
-	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK} -lmbcoupler ${MOAB_LIBS_LINK} 
+	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK} -lmbcoupler ${MOAB_LIBS_LINK}
 
 clean:
-	rm -rf *.o ${EXAMPLES} ${PAREXAMPLES} ${EXOIIEXAMPLES}
+	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/examples/point_in_elem_search.cpp b/examples/point_in_elem_search.cpp
index a917fa0..ddf3f03 100644
--- a/examples/point_in_elem_search.cpp
+++ b/examples/point_in_elem_search.cpp
@@ -27,7 +27,7 @@ int main(int argc, char **argv) {
 
   int num_queries = 1000000;
   
-  if (argc == 1) {
+  if (argc < 2 || argc > 3) {
     std::cout << "Usage: " << argv[0] << "<filename> [num_queries]" << std::endl;
     return 0;
   }
@@ -37,7 +37,7 @@ int main(int argc, char **argv) {
   moab::Core mb;
 
     // load the file
-  ErrorCode rval = mb.load_file(argv[argc-1]); ERR("Error loading file");
+  ErrorCode rval = mb.load_file(argv[1]); ERR("Error loading file");
   
     // get all 3d elements in the file
   Range elems;
@@ -53,20 +53,19 @@ int main(int argc, char **argv) {
   SpatialLocator sl(&mb, elems, &tree);
   
     // get the box extents
-  BoundBox box;
   CartVect box_extents, pos;
-  rval = sl.get_bounding_box(box); ERR("Problem getting tree bounding box");
+  BoundBox box = sl.local_box();
   box_extents = box.bMax - box.bMin;
   
     // query at random places in the tree
   CartVect params;
-  bool is_inside;
+  int is_inside = 0;
   int num_inside = 0;
   EntityHandle elem;
   for (int i = 0; i < num_queries; i++) {
     pos = box.bMin + 
         CartVect(box_extents[0]*.01*(rand()%100), box_extents[1]*.01*(rand()%100), box_extents[2]*.01*(rand()%100));
-    ErrorCode tmp_rval = sl.locate_point(pos.array(), elem, params.array(), 0.0, 0.0, &is_inside);
+    ErrorCode tmp_rval = sl.locate_point(pos.array(), elem, params.array(), &is_inside, 0.0, 0.0);
     if (MB_SUCCESS != tmp_rval) rval = tmp_rval;
     if (is_inside) num_inside++;
   }
@@ -78,9 +77,3 @@ int main(int argc, char **argv) {
   std::cout << "Queries inside box = " << num_inside << "/" << num_queries << " = " 
             << 100.0*((double)num_inside)/num_queries << "%" << std::endl;
 }
-
-    
-  
-  
-  
-

diff --git a/examples/structuredmesh.cpp b/examples/structuredmesh.cpp
index 017937d..0214c3e 100644
--- a/examples/structuredmesh.cpp
+++ b/examples/structuredmesh.cpp
@@ -26,9 +26,10 @@
 
 using namespace moab;
 
-int main(int argv, char **argv) 
+int main(int argc, char **argv) 
 {
-  int N;
+  argv[0] = argv[argc - argc]; // To remove the warnings about unused parameters
+  int I, J, K;
     // progoptions?
   std::cout << "Enter I, J, K... " << std::endl;
   std::cin >> I >> J >> K;

diff --git a/itaps/imesh/MOAB_iMeshP_unit_tests.cpp b/itaps/imesh/MOAB_iMeshP_unit_tests.cpp
index 96d659d..bc3d8e4 100644
--- a/itaps/imesh/MOAB_iMeshP_unit_tests.cpp
+++ b/itaps/imesh/MOAB_iMeshP_unit_tests.cpp
@@ -548,11 +548,11 @@ int create_mesh( const char* filename, int num_parts )
     // create vertices
   int vl_pos = 0;
   for (int i = 0; i <= num_cols; ++i) {
-    double coords[15] = { i, 0, 0,
-                          i, 1, 0,
-                          i, 2, 0,
-                          i, 3, 0,
-                          i, 4, 0 };
+    double coords[15] = { static_cast<double>(i), 0, 0,
+                          static_cast<double>(i), 1, 0,
+                          static_cast<double>(i), 2, 0,
+                          static_cast<double>(i), 3, 0,
+                          static_cast<double>(i), 4, 0 };
     iBase_EntityHandle* ptr = vertices[i];
     const int n = (num_full_cols == num_cols || i <= num_full_cols) ? 5 : 3;
     int junk1 = n, junk2 = n;

diff --git a/src/BVHTree.cpp b/src/BVHTree.cpp
index b65eae4..d54e24d 100644
--- a/src/BVHTree.cpp
+++ b/src/BVHTree.cpp
@@ -443,7 +443,7 @@ namespace moab
       const TreeNode &node = myTree[index];
       treeStats.nodesVisited++;
       CartVect params;
-      bool is_inside;
+      int is_inside;
       ErrorCode rval = MB_SUCCESS;
       if(node.dim == 3){
         treeStats.leavesVisited++;

diff --git a/src/LocalDiscretization/ElemEvaluator.cpp b/src/LocalDiscretization/ElemEvaluator.cpp
index 4ca3943..209cd11 100644
--- a/src/LocalDiscretization/ElemEvaluator.cpp
+++ b/src/LocalDiscretization/ElemEvaluator.cpp
@@ -18,7 +18,7 @@ namespace moab {
     ErrorCode EvalSet::evaluate_reverse(EvalFcn eval, JacobianFcn jacob, InsideFcn inside_f,
                                         const double *posn, const double *verts, const int nverts, 
                                         const int ndim, const double iter_tol, const double inside_tol, 
-                                        double *work, double *params, bool *inside) {
+                                        double *work, double *params, int *inside) {
         // TODO: should differentiate between epsilons used for
         // Newton Raphson iteration, and epsilons used for curved boundary geometry errors
         // right now, fix the tolerance used for NR
@@ -39,7 +39,7 @@ namespace moab {
         // residual is diff between old and new pos; need to minimize that
       CartVect res = new_pos - *cvposn;
       Matrix3 J;
-      bool dum, *tmp_inside = (inside ? inside : &dum);
+      int dum, *tmp_inside = (inside ? inside : &dum);
 
       int iters=0;
         // while |res| larger than tol
@@ -77,7 +77,7 @@ namespace moab {
       return MB_SUCCESS;
     }// Map::evaluate_reverse()
 
-    bool EvalSet::inside_function(const double *params, const int ndims, const double tol) 
+    int EvalSet::inside_function(const double *params, const int ndims, const double tol) 
     {
       if (params[0] >= -1-tol && params[0] <= 1+tol &&
           (ndims < 2 || (params[1] >= -1-tol && params[1] <= 1+tol)) &&
@@ -118,7 +118,7 @@ namespace moab {
                                                     const double inside_tol, EntityHandle &containing_ent, 
                                                     double *params, unsigned int *num_evals) 
     {
-      bool is_inside;
+      int is_inside;
       ErrorCode rval = MB_SUCCESS;
       unsigned int nevals = 0;
       Range::iterator i;

diff --git a/src/LocalDiscretization/LinearHex.cpp b/src/LocalDiscretization/LinearHex.cpp
index 5e730af..e9044a8 100644
--- a/src/LocalDiscretization/LinearHex.cpp
+++ b/src/LocalDiscretization/LinearHex.cpp
@@ -97,14 +97,14 @@ namespace moab
     ErrorCode LinearHex::reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins, 
                                         const double *posn, const double *verts, const int nverts, const int ndim,
                                         const double iter_tol, const double inside_tol, double *work, 
-                                        double *params, bool *is_inside)
+                                        double *params, int *is_inside)
     {
       assert(posn && verts);
       return EvalSet::evaluate_reverse(eval, jacob, ins, posn, verts, nverts, ndim, iter_tol, inside_tol, work, 
                                        params, is_inside);
     }
 
-    bool LinearHex::insideFcn(const double *params, const int ndim, const double tol)
+    int LinearHex::insideFcn(const double *params, const int ndim, const double tol)
     {
       return EvalSet::inside_function(params, ndim, tol);
     }

diff --git a/src/LocalDiscretization/LinearQuad.cpp b/src/LocalDiscretization/LinearQuad.cpp
index 63c9959..667bf0b 100644
--- a/src/LocalDiscretization/LinearQuad.cpp
+++ b/src/LocalDiscretization/LinearQuad.cpp
@@ -76,13 +76,13 @@ namespace moab
     ErrorCode LinearQuad::reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins, 
                                          const double *posn, const double *verts, const int nverts, const int ndim,
                                          const double iter_tol, const double inside_tol, double *work, 
-                                         double *params, bool *is_inside) 
+                                         double *params, int *is_inside) 
     {
       return EvalSet::evaluate_reverse(eval, jacob, ins, posn, verts, nverts, ndim, iter_tol, inside_tol, work, 
                                        params, is_inside);
     } 
 
-    bool LinearQuad::insideFcn(const double *params, const int ndim, const double tol) 
+    int LinearQuad::insideFcn(const double *params, const int ndim, const double tol) 
     {
       return EvalSet::inside_function(params, ndim, tol);
     }

diff --git a/src/LocalDiscretization/LinearTet.cpp b/src/LocalDiscretization/LinearTet.cpp
index 4965cfc..6d590e7 100644
--- a/src/LocalDiscretization/LinearTet.cpp
+++ b/src/LocalDiscretization/LinearTet.cpp
@@ -75,14 +75,14 @@ namespace moab
     ErrorCode LinearTet::reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins, 
                                         const double *posn, const double *verts, const int nverts, const int ndim,
                                         const double iter_tol, const double inside_tol, double *work, 
-                                        double *params, bool *is_inside) 
+                                        double *params, int *is_inside) 
     {
       assert(posn && verts);
       return evaluate_reverse(eval, jacob, ins, posn, verts, nverts, ndim, iter_tol, inside_tol, 
                               work, params, is_inside);
     } 
 
-    bool LinearTet::insideFcn(const double *params, const int , const double tol) 
+    int LinearTet::insideFcn(const double *params, const int , const double tol) 
     {
       return (params[0] >= -1.0-tol && params[1] >= -1.0-tol && params[2] >= -1.0-tol && 
               params[0] + params[1] + params[2] <= 1.0+tol);
@@ -92,7 +92,7 @@ namespace moab
     ErrorCode LinearTet::evaluate_reverse(EvalFcn eval, JacobianFcn jacob, InsideFcn inside_f,
                                           const double *posn, const double *verts, const int nverts, 
                                           const int ndim, const double iter_tol, const double inside_tol,
-                                          double *work, double *params, bool *inside) {
+                                          double *work, double *params, int *inside) {
         // TODO: should differentiate between epsilons used for
         // Newton Raphson iteration, and epsilons used for curved boundary geometry errors
         // right now, fix the tolerance used for NR

diff --git a/src/LocalDiscretization/LinearTri.cpp b/src/LocalDiscretization/LinearTri.cpp
index 8fe9d23..e6f7f1c 100644
--- a/src/LocalDiscretization/LinearTri.cpp
+++ b/src/LocalDiscretization/LinearTri.cpp
@@ -72,14 +72,14 @@ namespace moab
     ErrorCode LinearTri::reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins, 
                                         const double *posn, const double *verts, const int nverts, const int ndim,
                                         const double iter_tol, const double inside_tol, double *work, 
-                                        double *params, bool *is_inside) 
+                                        double *params, int *is_inside) 
     {
       assert(posn && verts);
       return evaluate_reverse(eval, jacob, ins, posn, verts, nverts, ndim, iter_tol, inside_tol, work, 
                               params, is_inside);
     } 
 
-    bool LinearTri::insideFcn(const double *params, const int , const double tol) 
+    int LinearTri::insideFcn(const double *params, const int , const double tol) 
     {
       return (params[0] >= -1.0-tol && params[1] >= -1.0-tol &&
               params[0] + params[1] <= 1.0+tol);
@@ -89,7 +89,7 @@ namespace moab
     ErrorCode LinearTri::evaluate_reverse(EvalFcn eval, JacobianFcn jacob, InsideFcn inside_f,
                                           const double *posn, const double *verts, const int nverts, 
                                           const int ndim, const double iter_tol, const double inside_tol,
-                                          double *work, double *params, bool *inside) {
+                                          double *work, double *params, int *inside) {
         // TODO: should differentiate between epsilons used for
         // Newton Raphson iteration, and epsilons used for curved boundary geometry errors
         // right now, fix the tolerance used for NR

diff --git a/src/LocalDiscretization/QuadraticHex.cpp b/src/LocalDiscretization/QuadraticHex.cpp
index 5c621f6..e8d2ad2 100644
--- a/src/LocalDiscretization/QuadraticHex.cpp
+++ b/src/LocalDiscretization/QuadraticHex.cpp
@@ -108,14 +108,14 @@ namespace moab
     ErrorCode QuadraticHex::reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins, 
                                            const double *posn, const double *verts, const int nverts, const int ndim,
                                            const double iter_tol, const double inside_tol, double *work, 
-                                           double *params, bool *is_inside) 
+                                           double *params, int *is_inside) 
     {
       assert(posn && verts);
       return EvalSet::evaluate_reverse(eval, jacob, ins, posn, verts, nverts, ndim, iter_tol, inside_tol, 
                                        work, params, is_inside);
     } 
 
-    bool QuadraticHex::insideFcn(const double *params, const int ndim, const double tol) 
+    int QuadraticHex::insideFcn(const double *params, const int ndim, const double tol) 
     {
       return EvalSet::inside_function(params, ndim, tol);
     }

diff --git a/src/LocalDiscretization/SpectralHex.cpp b/src/LocalDiscretization/SpectralHex.cpp
index 31f5391..be383fa 100644
--- a/src/LocalDiscretization/SpectralHex.cpp
+++ b/src/LocalDiscretization/SpectralHex.cpp
@@ -180,7 +180,7 @@ void SpectralHex::integrate_vector(const double *field_values, int num_tuples, d
     //std::cout << "volume: " << volume << "\n";
 }
 
-    bool SpectralHex::insideFcn(const double *params, const int ndim, const double tol) 
+    int SpectralHex::insideFcn(const double *params, const int ndim, const double tol) 
     {
       return EvalSet::inside(params, ndim, tol);
     }

diff --git a/src/LocalDiscretization/SpectralQuad.cpp b/src/LocalDiscretization/SpectralQuad.cpp
index 5c11d13..d7355e6 100644
--- a/src/LocalDiscretization/SpectralQuad.cpp
+++ b/src/LocalDiscretization/SpectralQuad.cpp
@@ -96,7 +96,7 @@ CartVect SpectralQuad::evalFcn(const double *params, const double *field, const
   // replicate the functionality of hex_findpt
 bool SpectralQuad::reverseEvalFcn(const double *posn, const double *verts, const int nverts, const int ndim,
                                   const double iter_tol, const double inside_tol, double *work, 
-                                  double *params, bool *is_inside)
+                                  double *params, int *is_inside)
 {
   params = init;
 
@@ -147,10 +147,10 @@ void SpectralQuad:: integrate_vector(const double *field, const double *verts, c
     // not implemented
 }
 
-    bool SpectralQuad::insideFcn(const double *params, const int ndim, const double tol) 
-    {
-      return EvalSet::inside(params, ndim, tol);
-    }
+int SpectralQuad::insideFcn(const double *params, const int ndim, const double tol) 
+{
+  return EvalSet::inside(params, ndim, tol);
+}
 
   // something we don't do for spectral hex; we do it here because
   //       we do not store the position of gl points in a tag yet

diff --git a/src/LocalDiscretization/moab/ElemEvaluator.hpp b/src/LocalDiscretization/moab/ElemEvaluator.hpp
index 29d1051..866388c 100644
--- a/src/LocalDiscretization/moab/ElemEvaluator.hpp
+++ b/src/LocalDiscretization/moab/ElemEvaluator.hpp
@@ -21,12 +21,12 @@ namespace moab {
 
     typedef ErrorCode (*InitFcn)(const double *verts, const int nverts, double *&work);
 
-    typedef bool (*InsideFcn)(const double *verts, const int ndims, const double tol);
+    typedef int (*InsideFcn)(const double *verts, const int ndims, const double tol);
 
     typedef ErrorCode (*ReverseEvalFcn)(EvalFcn eval, JacobianFcn jacob, InsideFcn ins, 
                                         const double *posn, const double *verts, const int nverts, const int ndim,
                                         const double iter_tol, const double inside_tol, 
-                                        double *work, double *params, bool *is_inside);
+                                        double *work, double *params, int *is_inside);
         
     class EvalSet
     {
@@ -78,9 +78,9 @@ namespace moab {
       static ErrorCode evaluate_reverse(EvalFcn eval, JacobianFcn jacob, InsideFcn inside_f,
                                         const double *posn, const double *verts, const int nverts, 
                                         const int ndim, const double iter_tol, const double inside_tol, 
-                                        double *work, double *params, bool *inside);
+                                        double *work, double *params, int *inside);
         /** \brief Common function that returns true if params is in [-1,1]^ndims */
-      static bool inside_function(const double *params, const int ndims, const double tol);
+      static int inside_function(const double *params, const int ndims, const double tol);
     };
 
         /** \brief Given an entity handle, get an appropriate eval set, based on type & #vertices */
@@ -141,7 +141,7 @@ namespace moab {
          *                  (in most cases, within [-1]*(dim)
          */
       ErrorCode reverse_eval(const double *posn, double iter_tol, double inside_tol, double *params, 
-                             bool *is_inside = NULL) const;
+                             int *is_inside = NULL) const;
         
         /** \brief Evaluate the jacobian of the cached entity at a given parametric location
          * \param params Parameters at which to evaluate jacobian
@@ -158,7 +158,7 @@ namespace moab {
          * \param params Parameters at which to query the element
          * \param tol Tolerance, usually 10^-6 or so
          */
-      bool inside(const double *params, const double tol) const;
+      int inside(const double *params, const double tol) const;
 
         /** \brief Given a list of entities, return the entity the point is in, or none
          * This function reverse-evaluates the entities, returning the first entity containing the point.
@@ -451,7 +451,7 @@ namespace moab {
     }
         
     inline ErrorCode ElemEvaluator::reverse_eval(const double *posn, const double iter_tol, const double inside_tol,
-                                                 double *params, bool *ins) const
+                                                 double *params, int *ins) const
     {
       assert(entHandle && MBMAXTYPE != entType);
       return (*evalSets[entType].reverseEvalFcn)(evalSets[entType].evalFcn, evalSets[entType].jacobianFcn, evalSets[entType].insideFcn,
@@ -493,7 +493,7 @@ namespace moab {
       else return find_containing_entity(entities, point, iter_tol, inside_tol, containing_ent, params, num_evals);
     }
         
-    inline bool ElemEvaluator::inside(const double *params, const double tol) const 
+    inline int ElemEvaluator::inside(const double *params, const double tol) const 
     {
       return (*evalSets[entType].insideFcn)(params, entDim, tol);
     }

diff --git a/src/LocalDiscretization/moab/LinearHex.hpp b/src/LocalDiscretization/moab/LinearHex.hpp
index 03ed33f..32d62f8 100644
--- a/src/LocalDiscretization/moab/LinearHex.hpp
+++ b/src/LocalDiscretization/moab/LinearHex.hpp
@@ -18,7 +18,7 @@ public:
   static ErrorCode reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins, 
                                   const double *posn, const double *verts, const int nverts, const int ndim,
                                   const double iter_tol, const double inside_tol, double *work, 
-                                  double *params, bool *is_inside);
+                                  double *params, int *is_inside);
         
     /** \brief Evaluate the jacobian at a specified parametric position */
   static ErrorCode jacobianFcn(const double *params, const double *verts, const int nverts, const int ndim, 
@@ -29,7 +29,7 @@ public:
                                 double *work, double *result);
 
         /** \brief Function that returns whether or not the parameters are inside the natural space of the element */
-  static bool insideFcn(const double *params, const int ndim, const double tol);
+  static int insideFcn(const double *params, const int ndim, const double tol);
   
   static EvalSet eval_set() 
       {

diff --git a/src/LocalDiscretization/moab/LinearQuad.hpp b/src/LocalDiscretization/moab/LinearQuad.hpp
index 2eb3027..897e3b4 100644
--- a/src/LocalDiscretization/moab/LinearQuad.hpp
+++ b/src/LocalDiscretization/moab/LinearQuad.hpp
@@ -18,7 +18,7 @@ public:
   static ErrorCode reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins, 
                                   const double *posn, const double *verts, const int nverts, const int ndim,
                                   const double iter_tol, const double inside_tol, double *work, 
-                                  double *params, bool *is_inside);
+                                  double *params, int *is_inside);
 
     /** \brief Evaluate the jacobian at a specified parametric position */
   static ErrorCode jacobianFcn(const double *params, const double *verts, const int nverts, const int ndim, 
@@ -29,7 +29,7 @@ public:
                                 double *work, double *result);
 
         /** \brief Function that returns whether or not the parameters are inside the natural space of the element */
-  static bool insideFcn(const double *params, const int ndim, const double tol);
+  static int insideFcn(const double *params, const int ndim, const double tol);
   
   static EvalSet eval_set() 
       {

diff --git a/src/LocalDiscretization/moab/LinearTet.hpp b/src/LocalDiscretization/moab/LinearTet.hpp
index f621b2f..713192a 100644
--- a/src/LocalDiscretization/moab/LinearTet.hpp
+++ b/src/LocalDiscretization/moab/LinearTet.hpp
@@ -18,7 +18,7 @@ public:
   static ErrorCode reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins, 
                                   const double *posn, const double *verts, const int nverts, const int ndim,
                                   const double iter_tol, const double inside_tol, double *work, 
-                                  double *params, bool *is_inside);
+                                  double *params, int *is_inside);
         
     /** \brief Evaluate the jacobian at a specified parametric position */
   static ErrorCode jacobianFcn(const double *params, const double *verts, const int nverts, const int ndim, 
@@ -32,12 +32,12 @@ public:
   static ErrorCode initFcn(const double *verts, const int nverts, double *&work);
       
         /** \brief Function that returns whether or not the parameters are inside the natural space of the element */
-  static bool insideFcn(const double *params, const int ndim, const double tol);
+  static int insideFcn(const double *params, const int ndim, const double tol);
   
   static ErrorCode evaluate_reverse(EvalFcn eval, JacobianFcn jacob, InsideFcn inside_f,
                                     const double *posn, const double *verts, const int nverts, 
                                     const int ndim, const double iter_tol, const double inside_tol, double *work, 
-                                    double *params, bool *inside);
+                                    double *params, int *inside);
 
   static EvalSet eval_set() 
       {

diff --git a/src/LocalDiscretization/moab/LinearTri.hpp b/src/LocalDiscretization/moab/LinearTri.hpp
index 93820a7..3ab4eca 100644
--- a/src/LocalDiscretization/moab/LinearTri.hpp
+++ b/src/LocalDiscretization/moab/LinearTri.hpp
@@ -18,7 +18,7 @@ public:
   static ErrorCode reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins, 
                                   const double *posn, const double *verts, const int nverts, const int ndim,
                                   const double iter_tol, const double inside_tol, double *work, 
-                                  double *params, bool *is_inside);
+                                  double *params, int *is_inside);
         
     /** \brief Evaluate the jacobian at a specified parametric position */
   static ErrorCode jacobianFcn(const double *params, const double *verts, const int nverts, const int ndim, 
@@ -32,12 +32,12 @@ public:
   static ErrorCode initFcn(const double *verts, const int nverts, double *&work);
       
         /** \brief Function that returns whether or not the parameters are inside the natural space of the element */
-  static bool insideFcn(const double *params, const int ndim, const double tol);
+  static int insideFcn(const double *params, const int ndim, const double tol);
   
   static ErrorCode evaluate_reverse(EvalFcn eval, JacobianFcn jacob, InsideFcn inside_f,
                                     const double *posn, const double *verts, const int nverts, 
                                     const int ndim, const double iter_tol, const double inside_tol, double *work, 
-                                    double *params, bool *inside);
+                                    double *params, int *inside);
 
   static EvalSet eval_set() 
       {

diff --git a/src/LocalDiscretization/moab/QuadraticHex.hpp b/src/LocalDiscretization/moab/QuadraticHex.hpp
index 0e5cfb8..ee0dcc8 100644
--- a/src/LocalDiscretization/moab/QuadraticHex.hpp
+++ b/src/LocalDiscretization/moab/QuadraticHex.hpp
@@ -18,7 +18,7 @@ public:
   static ErrorCode reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins, 
                                   const double *posn, const double *verts, const int nverts, const int ndim,
                                   const double iter_tol, const double inside_tol, double *work, 
-                                  double *params, bool *is_inside);
+                                  double *params, int *is_inside);
         
     /** \brief Evaluate the jacobian at a specified parametric position */
   static ErrorCode jacobianFcn(const double *params, const double *verts, const int nverts, const int ndim, 
@@ -29,7 +29,7 @@ public:
                                 double *work, double *result);
 
         /** \brief Function that returns whether or not the parameters are inside the natural space of the element */
-  static bool insideFcn(const double *params, const int ndim, const double tol);
+  static int insideFcn(const double *params, const int ndim, const double tol);
   
   static EvalSet eval_set() 
       {

diff --git a/src/LocalDiscretization/moab/SpectralHex.hpp b/src/LocalDiscretization/moab/SpectralHex.hpp
index 648cc70..9e60c63 100644
--- a/src/LocalDiscretization/moab/SpectralHex.hpp
+++ b/src/LocalDiscretization/moab/SpectralHex.hpp
@@ -20,7 +20,7 @@ public:
   static ErrorCode reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins, 
                                   const double *posn, const double *verts, const int nverts, const int ndim,
                                   const double iter_tol, const double inside_tol, double *work, 
-                                  double *params, bool *is_inside);
+                                  double *params, int *is_inside);
         
     /** \brief Evaluate the jacobian at a specified parametric position */
   static ErrorCode jacobianFcn(const double *params, const double *verts, const int nverts, const int ndim, 
@@ -34,7 +34,7 @@ public:
   static ErrorCode initFcn(const double *verts, const int nverts, double *&work);
       
         /** \brief Function that returns whether or not the parameters are inside the natural space of the element */
-  static bool insideFcn(const double *params, const int ndim, const double tol);
+  static int insideFcn(const double *params, const int ndim, const double tol);
   
   static EvalSet eval_set() 
       {

diff --git a/src/LocalDiscretization/moab/SpectralQuad.hpp b/src/LocalDiscretization/moab/SpectralQuad.hpp
index a72f9b4..4390d23 100644
--- a/src/LocalDiscretization/moab/SpectralQuad.hpp
+++ b/src/LocalDiscretization/moab/SpectralQuad.hpp
@@ -20,7 +20,7 @@ public:
   static ErrorCode reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins, 
                                   const double *posn, const double *verts, const int nverts, const int ndim,
                                   const double iter_tol, const double inside_tol, double *work, 
-                                  double *params, bool *is_inside);
+                                  double *params, int *is_inside);
         
     /** \brief Evaluate the jacobian at a specified parametric position */
   static ErrorCode jacobianFcn(const double *params, const double *verts, const int nverts, const int ndim, 
@@ -33,7 +33,7 @@ public:
   static ErrorCode initFcn(const double *verts, const int nverts, double *&work);
       
         /** \brief Function that returns whether or not the parameters are inside the natural space of the element */
-  static bool insideFcn(const double *params, const int ndim, const double tol);
+  static int insideFcn(const double *params, const int ndim, const double tol);
   
   static EvalSet eval_set() 
       {

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,

This diff is so big that we needed to truncate the remainder.

https://bitbucket.org/fathomteam/moab/commits/a329be8eebfe/
Changeset:   a329be8eebfe
Branch:      None
User:        judajake
Date:        2014-02-28 21:39:08
Summary:     Merge branch 'master' into initial_cmake

* master: (144 commits)
  Applied some minor changes to examples/makefile.
  There is a segmentation fault on load_file("MeshFiles/unittest/io/fv26x46x72.t.3.nc", NULL, "VARIABLE=US"). It turns out that some tags of ScdInterface class (e.g. __BOX_SET) might get deleted (e.g. by Core::clean_up_failed_read) before they are dereferenced later. These dangling tags should be reset to NULL so that they can be recreated upon request.
  fix distcheck failure cubit 14 file added to the EXTRA_DIST variable
  cubit 14 test for global id also, correct the path for tqdcfr test; maybe it should be moved to proper test folder.
  example to load partially a file, based on tagged sets
  Minor changes to structuredmesh and StructuredMeshSimple examples.
  Changes to eliminate requirement for MPI2, from Russ Whitesides (LLNL).
  another format change for cubit 14
  Fixed a problem with entities having the character '#' in their name, which messed up scanning of lines in the embedded ACIS file.
  enhance crystal router example
  add a crystal router example
  Applied some minor changes to examples/makefile and added a few more ignore items.
  Fixed some build errors of point_in_elem_search example (caused by recent merged spatial locator code).
  Fixed compilation errors of structuredmesh and StructuredMeshSimple examples.
  Adding a few more ignore items.
  valgrind find and typo in TupleList for intersection test, valgrind reported a memory leak that memory is cleaned in destructor now in TupleList, wrong size was used in reporting reallocation error
  Adding file to the to-be-removed list after tests.
  Fixing a bunch of warnings, mainly about narrowing conversions.
  Fixing errors turned up by make check.
  Enhanced the HOMME reader so that it can read a connectivity file directly, and updated unit test read_ucd_nc for this new feature. Note, a HOMME connectivity file normally has enough information to create the mesh, though some variables are not available (e.g. lev, time and T).
  ...

Conflicts:
	src/CMakeLists.txt
	src/parallel/CMakeLists.txt
	tools/CMakeLists.txt
	tools/dagmc/CMakeLists.txt
	tools/mbcoupler/CMakeLists.txt

Affected #:  138 files

diff --git a/.gitignore b/.gitignore
index 4e0534c..eb99939 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,30 +25,44 @@ config/test-driver
 configure
 .cproject
 *.cub
+cubit??.jou
 .deps
 doc/config.tex
 doc/dev.dox
 doc/user/*
 doc/user.dox
+examples/DeformMeshRemap
+examples/DirectAccessNoHoles
+examples/DirectAccessNoHolesF90
+examples/DirectAccessWithHoles
 examples/examples.make
+examples/freem.mod
 examples/FileRead
 examples/GeomSetHierarchy
 examples/GetEntities
 examples/*.h5m
-examples/HelloMoabPar
+examples/HelloMOAB
+examples/HelloParMOAB
 examples/itaps/FindConnectF
 examples/itaps/ListSetsNTagsCXX
 examples/itaps/ListSetsNTagsF90
 examples/itaps/TagIterateC
 examples/itaps/TagIterateF
 examples/KDTree
+examples/LloydRelaxation
 examples/ObbTree
+examples/point_in_elem_search
 examples/PushParMeshIntoMoabF90
 examples/ReduceExchangeTags
 examples/SetsNTags
 examples/SkinMesh
+examples/structuredmesh
+examples/StructuredMeshSimple
 examples/SurfArea
 examples/TestExodusII
+history??.jou
+hpctoolkit-*
+*.hpcstruct
 include
 include/*
 itaps/iBase_f.h
@@ -71,7 +85,6 @@ itaps/imesh/ScdMeshF77
 itaps/imesh/ScdMeshF90
 itaps/imesh/testc_cbind
 *.la
-*.la
 *.lai
 lib
 lib/*
@@ -121,13 +134,11 @@ test/cropvol_test
 test/dual/dual_test
 test/elem_eval_test
 test/file_options_test
-test/*.g
+test/*.h5m
 test/*.g
 test/*.gen
-test/*.gen
 test/geom_util_test
 test/gttool_test
-test/gttool_test
 test/h5file/dump_sets
 test/h5file/h5legacy
 test/h5file/h5partial
@@ -145,7 +156,10 @@ test/io/*.g
 test/io/gmsh_test
 test/io/ideas_test
 test/io/nastran_test
+test/io/read_cgm_basic_test
+test/io/read_cgm_load_test
 test/io/read_cgm_test
+test/io/read_mpas_nc
 test/io/read_nc
 test/io/read_ucd_nc
 test/io/readutil_test
@@ -156,9 +170,11 @@ test/io/vtk_test
 test/kd_tree_test
 test/kd_tree_time
 test/kd_tree_tool
+test/lloyd_smoother_test
 test/mbcn_test
 test/mbfacet_test
 test/mbground_test
+test/mergemesh_test
 test/mesh_set_test
 test/moab_test
 test/obb/obb_test
@@ -166,7 +182,6 @@ test/obb/obb_time
 test/obb/obb_tree_tool
 test/obb_test
 test/oldinc/test_oldinc
-test/read_mpas_nc
 test/parallel/*.h5m
 test/parallel/mbparallelcomm_test
 test/parallel/mhdf_parallel
@@ -178,6 +193,7 @@ test/parallel/parallel_unit_tests
 test/parallel/parallel_write_test
 test/parallel/par_coupler_test
 test/parallel/par_intx_sph
+test/parallel/par_spatial_locator_test
 test/parallel/parmerge
 test/parallel/partcheck
 test/parallel/pcomm_serial
@@ -198,6 +214,8 @@ test/perf/seqperf
 test/perf/tstt_perf_binding
 test/perf/point_location/elem_eval_time
 test/perf/point_location/point_location
+test/perf/point_location/sploc_searching_perf
+test/perf/point_location/tree_searching_perf
 test/range_test
 test/reorder_test
 test/scdseq_test
@@ -223,16 +241,25 @@ tools/mbconvert
 tools/mbcoupler/*.h5m
 tools/mbcoupler/*.g
 tools/mbcoupler/tests/
+tools/mbcslam/advection
 tools/mbcslam/case1_test
+tools/mbcslam/create_dp
+tools/mbcslam/cslam_par_test
+tools/mbcslam/diffusion
 tools/mbcslam/intersect1.h5m
 tools/mbcslam/intx1.vtk
+tools/mbcslam/intx_imesh
 tools/mbcslam/intx_in_plane_test
+tools/mbcslam/intx_mpas
 tools/mbcslam/intx_on_sphere_test
 tools/mbcslam/intx.vtk
 tools/mbcslam/lagr.h5m
+tools/mbcslam/lagrIni.h5m
 tools/mbcslam/spectral.vtk
 tools/mbcslam/spec_visu_test
 tools/mbcslam/spherical_area_test
+tools/mbcslam/polyWithEdges.vtk
+tools/mbcslam/proj1
 tools/mbdepth
 tools/mbgsets
 tools/mbmem

diff --git a/MeshFiles/unittest/Makefile.am b/MeshFiles/unittest/Makefile.am
index a1784ee..ab3e23e 100644
--- a/MeshFiles/unittest/Makefile.am
+++ b/MeshFiles/unittest/Makefile.am
@@ -33,5 +33,6 @@ EXTRA_DIST  = 125hex.g \
               poly14.txt \
               BedCrop2.h5m \
               mpas_p8.h5m \
-              Homme_2pt.h5m
+              Homme_2pt.h5m \
+              surfrandomtris-4part.h5m
 

diff --git a/MeshFiles/unittest/io/Makefile.am b/MeshFiles/unittest/io/Makefile.am
index b4077d0..3b767aa 100644
--- a/MeshFiles/unittest/io/Makefile.am
+++ b/MeshFiles/unittest/io/Makefile.am
@@ -5,8 +5,10 @@ EXTRA_DIST = HommeMapping.nc \
              camEul26x48x96.t3.nc \
              fv26x46x72.t.3.nc \
 	     cubtest12.cub \
+	     cubtest14.cub \
 	     cubtest.jou \
 	     dum.sat \
+	     dum.stp \
 	     gmsh2.msh \
 	     hex_2x2x2_ss.exo \
              ho_test.g \

diff --git a/MeshFiles/unittest/io/cube.sat b/MeshFiles/unittest/io/cube.sat
new file mode 100644
index 0000000..58fd508
--- /dev/null
+++ b/MeshFiles/unittest/io/cube.sat
@@ -0,0 +1,117 @@
+1900 0 1 0           
+10 Cubit 12.2 17 ACIS 19.0.2 Linux 24 Mon Jan  6 14:16:03 2014 
+1 9.9999999999999995e-07 1e-10 
+body $1 -1 -1 $-1 $2 $-1 $-1 T -5 -5 -5 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $0 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+lump $3 -1 -1 $-1 $-1 $4 $0 T -5 -5 -5 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+shell $-1 -1 -1 $-1 $-1 $-1 $5 $-1 $2 T -5 -5 -5 5 5 5 #
+face $6 -1 -1 $-1 $7 $8 $4 $-1 $9 forward single T -5 -5 5 5 5 5 F #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $5 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+face $10 -1 -1 $-1 $11 $12 $4 $-1 $13 reversed single T -5 -5 -5 5 5 -5 F #
+loop $-1 -1 -1 $-1 $-1 $14 $5 T -5 -5 5 5 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 0 0 5 0 0 1 1 0 0 forward_v I I I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $7 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+face $15 -1 -1 $-1 $16 $17 $4 $-1 $18 reversed single T -5 -5 -5 5 -5 5 F #
+loop $-1 -1 -1 $-1 $-1 $19 $7 T -5 -5 -5 5 5 -5 unknown #
+plane-surface $-1 -1 -1 $-1 0 0 -5 0 0 1 1 0 0 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $20 $21 $22 $23 forward $8 $-1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $11 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 3 #
+face $24 -1 -1 $-1 $25 $26 $4 $-1 $27 reversed single T -5 -5 -5 -5 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $28 $11 T -5 -5 -5 5 -5 5 unknown #
+plane-surface $-1 -1 -1 $-1 0 -5 0 0 1 -0 -0 0 1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $29 $30 $31 $32 forward $12 $-1 #
+coedge $-1 -1 -1 $-1 $33 $14 $34 $35 forward $8 $-1 #
+coedge $-1 -1 -1 $-1 $14 $33 $36 $37 forward $8 $-1 #
+coedge $-1 -1 -1 $-1 $38 $39 $14 $23 reversed $40 $-1 #
+edge $41 -1 -1 $-1 $42 -5 $43 5 $22 $44 forward @7 unknown T 5 -5 5 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $16 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 4 #
+face $45 -1 -1 $-1 $46 $47 $4 $-1 $48 reversed single T -5 5 -5 5 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $49 $16 T -5 -5 -5 -5 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 -5 0 0 1 0 0 0 0 -1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $50 $36 $51 $52 forward $17 $-1 #
+coedge $-1 -1 -1 $-1 $53 $19 $50 $54 forward $12 $-1 #
+coedge $-1 -1 -1 $-1 $19 $53 $55 $56 forward $12 $-1 #
+coedge $-1 -1 -1 $-1 $39 $38 $19 $32 reversed $40 $-1 #
+edge $57 -1 -1 $-1 $58 -5 $59 5 $31 $60 forward @7 unknown T 5 -5 -5 5 5 -5 #
+coedge $-1 -1 -1 $-1 $21 $20 $61 $62 forward $8 $-1 #
+coedge $-1 -1 -1 $-1 $63 $64 $20 $35 reversed $47 $-1 #
+edge $65 -1 -1 $-1 $43 -5 $66 5 $34 $67 forward @7 unknown T -5 5 5 5 5 5 #
+coedge $-1 -1 -1 $-1 $28 $68 $21 $37 reversed $17 $-1 #
+edge $69 -1 -1 $-1 $70 -5 $42 5 $36 $71 forward @7 unknown T -5 -5 5 5 -5 5 #
+coedge $-1 -1 -1 $-1 $31 $22 $68 $72 forward $40 $-1 #
+coedge $-1 -1 -1 $-1 $22 $31 $63 $73 reversed $40 $-1 #
+loop $-1 -1 -1 $-1 $-1 $38 $46 T 5 -5 -5 5 5 5 unknown #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $23 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+vertex $74 -1 -1 $-1 $23 $75 #
+vertex $76 -1 -1 $-1 $23 $77 #
+straight-curve $-1 -1 -1 $-1 5 0 5 0 1 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $25 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 5 #
+face $78 -1 -1 $-1 $-1 $40 $4 $-1 $79 reversed single T 5 -5 -5 5 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $63 $25 T -5 5 -5 5 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 0 5 0 0 -1 0 0 0 -1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $80 $61 $64 $81 forward $26 $-1 #
+coedge $-1 -1 -1 $-1 $68 $28 $29 $54 reversed $17 $-1 #
+coedge $-1 -1 -1 $-1 $61 $80 $28 $52 reversed $26 $-1 #
+edge $82 -1 -1 $-1 $70 -5 $83 5 $51 $84 forward @7 unknown T -5 -5 -5 -5 -5 5 #
+coedge $-1 -1 -1 $-1 $30 $29 $80 $85 forward $12 $-1 #
+edge $86 -1 -1 $-1 $59 -5 $83 5 $50 $87 forward @7 unknown T -5 -5 -5 5 -5 -5 #
+coedge $-1 -1 -1 $-1 $64 $63 $30 $56 reversed $47 $-1 #
+edge $88 -1 -1 $-1 $89 -5 $58 5 $55 $90 forward @7 unknown T -5 5 -5 5 5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $32 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 5 #
+vertex $91 -1 -1 $-1 $32 $92 #
+vertex $93 -1 -1 $-1 $72 $94 #
+straight-curve $-1 -1 -1 $-1 5 0 -5 0 -1 0 I I #
+coedge $-1 -1 -1 $-1 $49 $51 $33 $62 reversed $26 $-1 #
+edge $95 -1 -1 $-1 $66 -5 $70 5 $61 $96 forward @7 unknown T -5 -5 5 -5 5 5 #
+coedge $-1 -1 -1 $-1 $55 $34 $39 $73 forward $47 $-1 #
+coedge $-1 -1 -1 $-1 $34 $55 $49 $81 reversed $47 $-1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $35 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+vertex $97 -1 -1 $-1 $35 $98 #
+straight-curve $-1 -1 -1 $-1 0 5 5 -1 0 0 I I #
+coedge $-1 -1 -1 $-1 $36 $50 $38 $72 reversed $17 $-1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $37 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 4 #
+vertex $99 -1 -1 $-1 $62 $100 #
+straight-curve $-1 -1 -1 $-1 0 -5 5 1 0 0 I I #
+edge $101 -1 -1 $-1 $42 -5 $59 5 $38 $102 forward @7 unknown T 5 -5 -5 5 -5 5 #
+edge $103 -1 -1 $-1 $43 -5 $58 5 $39 $104 forward @7 unknown T 5 5 -5 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $42 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+point $-1 -1 -1 $-1 5 -5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $43 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+point $-1 -1 -1 $-1 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $46 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 6 #
+plane-surface $-1 -1 -1 $-1 5 0 0 -1 0 0 0 -0 1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $51 $49 $53 $85 reversed $26 $-1 #
+edge $105 -1 -1 $-1 $66 -5 $89 5 $64 $106 forward @7 unknown T -5 5 -5 -5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $52 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 9 #
+vertex $107 -1 -1 $-1 $85 $108 #
+straight-curve $-1 -1 -1 $-1 -5 -5 0 0 0 -1 I I #
+edge $109 -1 -1 $-1 $83 -5 $89 5 $80 $110 forward @7 unknown T -5 -5 -5 -5 5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $54 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 6 #
+straight-curve $-1 -1 -1 $-1 0 -5 -5 -1 0 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $56 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 8 #
+vertex $111 -1 -1 $-1 $56 $112 #
+straight-curve $-1 -1 -1 $-1 0 5 -5 1 0 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $58 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 5 #
+point $-1 -1 -1 $-1 5 5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $59 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 6 #
+point $-1 -1 -1 $-1 5 -5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $62 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 3 #
+straight-curve $-1 -1 -1 $-1 -5 0 5 0 -1 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $66 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 3 #
+point $-1 -1 -1 $-1 -5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $70 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 4 #
+point $-1 -1 -1 $-1 -5 -5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $72 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 10 #
+straight-curve $-1 -1 -1 $-1 5 -5 0 0 0 -1 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $73 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 12 #
+straight-curve $-1 -1 -1 $-1 5 5 0 0 0 -1 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $81 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 11 #
+straight-curve $-1 -1 -1 $-1 -5 5 0 0 0 -1 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $83 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 7 #
+point $-1 -1 -1 $-1 -5 -5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $85 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 7 #
+straight-curve $-1 -1 -1 $-1 -5 0 -5 0 1 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $-1 $-1 $89 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 8 #
+point $-1 -1 -1 $-1 -5 5 -5 #
+End-of-ACIS-data 
\ No newline at end of file

diff --git a/MeshFiles/unittest/io/cube.stp b/MeshFiles/unittest/io/cube.stp
new file mode 100644
index 0000000..c17645d
--- /dev/null
+++ b/MeshFiles/unittest/io/cube.stp
@@ -0,0 +1,185 @@
+ISO-10303-21;
+HEADER;
+FILE_DESCRIPTION(('STEP AP214'),'1');
+FILE_NAME('/home/iulian/source/MOABsource/MeshFiles/unittest/io/cube.stp','2014-02-11T15:06:47',(' '),(' '),'Spatial InterOp 3D',' ',' ');
+FILE_SCHEMA(('automotive_design'));
+ENDSEC;
+DATA;
+#1=PRODUCT_DEFINITION_CONTEXT('',#9,'design');
+#2=APPLICATION_PROTOCOL_DEFINITION('INTERNATIONAL STANDARD','automotive_design',1994,#9);
+#3=PRODUCT_CATEGORY_RELATIONSHIP('NONE','NONE',#10,#11);
+#4=SHAPE_DEFINITION_REPRESENTATION(#12,#13);
+#5= (GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#16))GLOBAL_UNIT_ASSIGNED_CONTEXT((#18,#19,#20))REPRESENTATION_CONTEXT('NONE','WORKSPACE'));
+#9=APPLICATION_CONTEXT(' ');
+#10=PRODUCT_CATEGORY('part','NONE');
+#11=PRODUCT_RELATED_PRODUCT_CATEGORY('detail',' ',(#22));
+#12=PRODUCT_DEFINITION_SHAPE('NONE','NONE',#23);
+#13=ADVANCED_BREP_SHAPE_REPRESENTATION('1',(#24,#25),#5);
+#16=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0E-06),#18,'','');
+#18= (CONVERSION_BASED_UNIT('MILLIMETRE',#28)LENGTH_UNIT()NAMED_UNIT(#31));
+#19= (NAMED_UNIT(#33)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#20= (NAMED_UNIT(#33)SOLID_ANGLE_UNIT()SI_UNIT($,.STERADIAN.));
+#22=PRODUCT('1','1','PART-1-DESC',(#39));
+#23=PRODUCT_DEFINITION('NONE','NONE',#40,#1);
+#24=MANIFOLD_SOLID_BREP('1',#41);
+#25=AXIS2_PLACEMENT_3D('',#42,#43,#44);
+#28=LENGTH_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0),#45);
+#31=DIMENSIONAL_EXPONENTS(1.0,0.0,0.0,0.0,0.0,0.0,0.0);
+#33=DIMENSIONAL_EXPONENTS(0.0,0.0,0.0,0.0,0.0,0.0,0.0);
+#39=PRODUCT_CONTEXT('',#9,'mechanical');
+#40=PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE(' ','NONE',#22,.NOT_KNOWN.);
+#41=CLOSED_SHELL('',(#46,#47,#48,#49,#50,#51));
+#42=CARTESIAN_POINT('',(0.0,0.0,0.0));
+#43=DIRECTION('',(0.0,0.0,1.0));
+#44=DIRECTION('',(1.0,0.0,0.0));
+#45= (NAMED_UNIT(#31)LENGTH_UNIT()SI_UNIT(.MILLI.,.METRE.));
+#46=ADVANCED_FACE('',(#53),#54,.T.);
+#47=ADVANCED_FACE('',(#55),#56,.F.);
+#48=ADVANCED_FACE('',(#57),#58,.F.);
+#49=ADVANCED_FACE('',(#59),#60,.F.);
+#50=ADVANCED_FACE('',(#61),#62,.F.);
+#51=ADVANCED_FACE('',(#63),#64,.F.);
+#53=FACE_OUTER_BOUND('',#65,.T.);
+#54=PLANE('',#66);
+#55=FACE_OUTER_BOUND('',#67,.T.);
+#56=PLANE('',#68);
+#57=FACE_OUTER_BOUND('',#69,.T.);
+#58=PLANE('',#70);
+#59=FACE_OUTER_BOUND('',#71,.T.);
+#60=PLANE('',#72);
+#61=FACE_OUTER_BOUND('',#73,.T.);
+#62=PLANE('',#74);
+#63=FACE_OUTER_BOUND('',#75,.T.);
+#64=PLANE('',#76);
+#65=EDGE_LOOP('',(#77,#78,#79,#80));
+#66=AXIS2_PLACEMENT_3D('',#81,#82,#83);
+#67=EDGE_LOOP('',(#84,#85,#86,#87));
+#68=AXIS2_PLACEMENT_3D('',#88,#89,#90);
+#69=EDGE_LOOP('',(#91,#92,#93,#94));
+#70=AXIS2_PLACEMENT_3D('',#95,#96,#97);
+#71=EDGE_LOOP('',(#98,#99,#100,#101));
+#72=AXIS2_PLACEMENT_3D('',#102,#103,#104);
+#73=EDGE_LOOP('',(#105,#106,#107,#108));
+#74=AXIS2_PLACEMENT_3D('',#109,#110,#111);
+#75=EDGE_LOOP('',(#112,#113,#114,#115));
+#76=AXIS2_PLACEMENT_3D('',#116,#117,#118);
+#77=ORIENTED_EDGE('',*,*,#119,.T.);
+#78=ORIENTED_EDGE('',*,*,#120,.T.);
+#79=ORIENTED_EDGE('',*,*,#121,.T.);
+#80=ORIENTED_EDGE('',*,*,#122,.T.);
+#81=CARTESIAN_POINT('',(0.0,0.0,5.0));
+#82=DIRECTION('',(0.0,0.0,1.0));
+#83=DIRECTION('',(1.0,0.0,0.0));
+#84=ORIENTED_EDGE('',*,*,#123,.T.);
+#85=ORIENTED_EDGE('',*,*,#124,.T.);
+#86=ORIENTED_EDGE('',*,*,#125,.T.);
+#87=ORIENTED_EDGE('',*,*,#126,.T.);
+#88=CARTESIAN_POINT('',(0.0,0.0,-5.0));
+#89=DIRECTION('',(0.0,0.0,1.0));
+#90=DIRECTION('',(1.0,0.0,0.0));
+#91=ORIENTED_EDGE('',*,*,#127,.T.);
+#92=ORIENTED_EDGE('',*,*,#124,.F.);
+#93=ORIENTED_EDGE('',*,*,#128,.F.);
+#94=ORIENTED_EDGE('',*,*,#122,.F.);
+#95=CARTESIAN_POINT('',(0.0,-5.0,0.0));
+#96=DIRECTION('',(0.0,1.0,-0.0));
+#97=DIRECTION('',(-0.0,0.0,1.0));
+#98=ORIENTED_EDGE('',*,*,#129,.T.);
+#99=ORIENTED_EDGE('',*,*,#125,.F.);
+#100=ORIENTED_EDGE('',*,*,#127,.F.);
+#101=ORIENTED_EDGE('',*,*,#121,.F.);
+#102=CARTESIAN_POINT('',(-5.0,0.0,0.0));
+#103=DIRECTION('',(1.0,0.0,0.0));
+#104=DIRECTION('',(0.0,0.0,-1.0));
+#105=ORIENTED_EDGE('',*,*,#130,.T.);
+#106=ORIENTED_EDGE('',*,*,#126,.F.);
+#107=ORIENTED_EDGE('',*,*,#129,.F.);
+#108=ORIENTED_EDGE('',*,*,#120,.F.);
+#109=CARTESIAN_POINT('',(0.0,5.0,0.0));
+#110=DIRECTION('',(0.0,-1.0,0.0));
+#111=DIRECTION('',(0.0,0.0,-1.0));
+#112=ORIENTED_EDGE('',*,*,#128,.T.);
+#113=ORIENTED_EDGE('',*,*,#123,.F.);
+#114=ORIENTED_EDGE('',*,*,#130,.F.);
+#115=ORIENTED_EDGE('',*,*,#119,.F.);
+#116=CARTESIAN_POINT('',(5.0,0.0,0.0));
+#117=DIRECTION('',(-1.0,0.0,0.0));
+#118=DIRECTION('',(0.0,-0.0,1.0));
+#119=EDGE_CURVE('',#131,#132,#133,.T.);
+#120=EDGE_CURVE('',#132,#134,#135,.T.);
+#121=EDGE_CURVE('',#134,#136,#137,.T.);
+#122=EDGE_CURVE('',#136,#131,#138,.T.);
+#123=EDGE_CURVE('',#139,#140,#141,.T.);
+#124=EDGE_CURVE('',#140,#142,#143,.T.);
+#125=EDGE_CURVE('',#142,#144,#145,.T.);
+#126=EDGE_CURVE('',#144,#139,#146,.T.);
+#127=EDGE_CURVE('',#136,#142,#147,.T.);
+#128=EDGE_CURVE('',#131,#140,#148,.T.);
+#129=EDGE_CURVE('',#134,#144,#149,.T.);
+#130=EDGE_CURVE('',#132,#139,#150,.T.);
+#131=VERTEX_POINT('',#151);
+#132=VERTEX_POINT('',#152);
+#133=LINE('',#153,#154);
+#134=VERTEX_POINT('',#155);
+#135=LINE('',#156,#157);
+#136=VERTEX_POINT('',#158);
+#137=LINE('',#159,#160);
+#138=LINE('',#161,#162);
+#139=VERTEX_POINT('',#163);
+#140=VERTEX_POINT('',#164);
+#141=LINE('',#165,#166);
+#142=VERTEX_POINT('',#167);
+#143=LINE('',#168,#169);
+#144=VERTEX_POINT('',#170);
+#145=LINE('',#171,#172);
+#146=LINE('',#173,#174);
+#147=LINE('',#175,#176);
+#148=LINE('',#177,#178);
+#149=LINE('',#179,#180);
+#150=LINE('',#181,#182);
+#151=CARTESIAN_POINT('',(5.0,-5.0,5.0));
+#152=CARTESIAN_POINT('',(5.0,5.0,5.0));
+#153=CARTESIAN_POINT('',(5.0,0.0,5.0));
+#154=VECTOR('',#183,1.0);
+#155=CARTESIAN_POINT('',(-5.0,5.0,5.0));
+#156=CARTESIAN_POINT('',(0.0,5.0,5.0));
+#157=VECTOR('',#184,1.0);
+#158=CARTESIAN_POINT('',(-5.0,-5.0,5.0));
+#159=CARTESIAN_POINT('',(-5.0,0.0,5.0));
+#160=VECTOR('',#185,1.0);
+#161=CARTESIAN_POINT('',(0.0,-5.0,5.0));
+#162=VECTOR('',#186,1.0);
+#163=CARTESIAN_POINT('',(5.0,5.0,-5.0));
+#164=CARTESIAN_POINT('',(5.0,-5.0,-5.0));
+#165=CARTESIAN_POINT('',(5.0,0.0,-5.0));
+#166=VECTOR('',#187,1.0);
+#167=CARTESIAN_POINT('',(-5.0,-5.0,-5.0));
+#168=CARTESIAN_POINT('',(0.0,-5.0,-5.0));
+#169=VECTOR('',#188,1.0);
+#170=CARTESIAN_POINT('',(-5.0,5.0,-5.0));
+#171=CARTESIAN_POINT('',(-5.0,0.0,-5.0));
+#172=VECTOR('',#189,1.0);
+#173=CARTESIAN_POINT('',(0.0,5.0,-5.0));
+#174=VECTOR('',#190,1.0);
+#175=CARTESIAN_POINT('',(-5.0,-5.0,0.0));
+#176=VECTOR('',#191,1.0);
+#177=CARTESIAN_POINT('',(5.0,-5.0,0.0));
+#178=VECTOR('',#192,1.0);
+#179=CARTESIAN_POINT('',(-5.0,5.0,0.0));
+#180=VECTOR('',#193,1.0);
+#181=CARTESIAN_POINT('',(5.0,5.0,0.0));
+#182=VECTOR('',#194,1.0);
+#183=DIRECTION('',(0.0,1.0,0.0));
+#184=DIRECTION('',(-1.0,0.0,0.0));
+#185=DIRECTION('',(0.0,-1.0,0.0));
+#186=DIRECTION('',(1.0,0.0,0.0));
+#187=DIRECTION('',(0.0,-1.0,0.0));
+#188=DIRECTION('',(-1.0,0.0,0.0));
+#189=DIRECTION('',(0.0,1.0,0.0));
+#190=DIRECTION('',(1.0,0.0,0.0));
+#191=DIRECTION('',(0.0,0.0,-1.0));
+#192=DIRECTION('',(0.0,0.0,-1.0));
+#193=DIRECTION('',(0.0,0.0,-1.0));
+#194=DIRECTION('',(0.0,0.0,-1.0));
+ENDSEC;
+END-ISO-10303-21;

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/compiler.m4 b/config/compiler.m4
index ce83a5f..4787100 100644
--- a/config/compiler.m4
+++ b/config/compiler.m4
@@ -548,6 +548,8 @@ case "$cc_compiler:$host_cpu" in
       bgq)
         FATHOM_CC_32BIT=-q32
         FATHOM_CC_64BIT=-q64
+	FATHOM_CC_SPECIAL=-qarch=qp
+	FATHOM_CXX_SPECIAL="-qarch=qp -qpic=large -qmaxmem=-1"
         AR="ar"
         NM="nm -B"
         ;;

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/doc/MetaData/metadata.h b/doc/MetaData/metadata.h
index 9bca8a6..1a26215 100644
--- a/doc/MetaData/metadata.h
+++ b/doc/MetaData/metadata.h
@@ -210,9 +210,11 @@ Create a gather set (associated with tag GATHER_SET) on one processor with the s
 
 <H3>no_mixed_elements </H3>
 
-Indicates that no mixed elements (e.g. pentagons and hexagons) should be created by the MPAS reader. If this option is used, a common parameter maxEdgesPerCell will be computed to be used across all
-processors (instead of the one reported in the MPAS file header, which is usually 10), and each cell is created with maxEdgesPerCell edges. Any cell that has less actual edges will be padded by duplicating
-the last vertex in the connectivity array. As a result, all created cells will be in one contiguous chunk.
+Indicates that no mixed elements (e.g. pentagons and hexagons) should be created by the MPAS reader. If this option is used, a common parameter maxEdgesPerCell will be computed to be used across all processors (instead of the one reported in the MPAS file header, which is usually 10), and each cell is created with maxEdgesPerCell edges. Any cell that has less actual edges will be padded by duplicating the last vertex in the connectivity array. As a result, all created cells will be in one contiguous chunk.
+
+<H3>no_edges </H3>
+
+Indicates that no edges should be created and no edge variables will be read. This option can be used when there is no need to read variables on edges. For a huge MPAS file with 65M cells, it can save more than 3GB MOAB internal storage for edge connectivity.
 
 \ref md-contents "Top"
 

diff --git a/doc/UG/moabUG.h b/doc/UG/moabUG.h
index 8f4a6be..4f86821 100644
--- a/doc/UG/moabUG.h
+++ b/doc/UG/moabUG.h
@@ -731,6 +731,11 @@ The options used to specify loading method, the data used to identify parts, and
 <td><gd.bd.nl[.ad]></td><td>Exchange ghost elements at shared inter-processor interfaces.  Ghost elements of dimension gd will be exchanged.  Ghost elements are chosen going through bd-dimensional interface entities.  Number of layers of ghost elements is specified in nl.  If ad is present, lower-dimensional entities bounding exchanged ghost entities will also be exchanged; allowed values for ad are 1 (exchange bounding edges), 2 (faces), or 3 (edges and faces).</td></tr>
+<td>PARALLEL_COMM</td>
+<td><id></td>
+<td>Use the ParallelComm with index <id>.  Index for a ParallelComm object can be checked with ParallelComm::get_id(), and a ParallelComm with a given index can be retrieved using ParallelComm::get_pcomm(id).</td>
+</tr>
+<tr><tr><td>CPUTIME</td><td>(none)</td>

diff --git a/doc/metadata_info.doc b/doc/metadata_info.doc
index a143f91..70d273a 100644
Binary files a/doc/metadata_info.doc and b/doc/metadata_info.doc differ

diff --git a/doc/metadata_info.pdf b/doc/metadata_info.pdf
index d86a470..144e5f8 100644
Binary files a/doc/metadata_info.pdf and b/doc/metadata_info.pdf differ

diff --git a/examples/CrystalRouterExample.cpp b/examples/CrystalRouterExample.cpp
new file mode 100644
index 0000000..83a1e7c
--- /dev/null
+++ b/examples/CrystalRouterExample.cpp
@@ -0,0 +1,188 @@
+/*
+ * This example will show one of the building blocks of parallel infrastructure in MOAB
+ * More exactly, if we have some homogeneous data to communicate from each processor to a list of other
+ * processors, how do we do it?
+ *
+ * introduce the TupleList and crystal router to MOAB users.
+ *
+ * This technology is used in resolving shared vertices / sets between partitions
+ * It is used in the mbcoupler for sending data (target points) to the proper processor, and communicate
+ *   back the results.
+ * Also, it is used to communicate departure mesh for intersection in parallel
+ *
+ *  It is a way of doing  MPI_gatheralltoallv(), when the communication matrix is sparse
+ *
+ *  It is assumed that every proc needs to communicate only with a few of the other processors.
+ *  If every processor needs to communicate with all other, then we will have to use paired isend and irecv, the
+ *  communication matrix is full
+ *
+ *  the example needs to be launched in parallel.
+ *  Every proc will build a list of tuples, that will be send to a few procs;
+ *  In general, we will send to num_comms tasks, and about num_tuples to each task
+ *  We vary num_comms and num_tuples for processor
+ *
+ *  we will send long ints of the form
+ *    100000 * send + 1000* rank +j, where j is the index of tuple
+ *
+ *  after routing, we verify we received
+ *    100000 * rank + 1000 * from
+ *
+ *    For some reportrank we also print the tuples.
+ *
+ *  after routing, we will see if we received, as expected. Should run on at least 2 processors.
+ *
+ * Note: We do not need a moab instance for this example
+ *
+ */
+
+/** @example CrystalRouterExample.cpp \n
+ * \brief generalized gather scatter using tuples \n
+ * <b>To run</b>: mpiexec -np <n> CrystalRouterExample -r [reportrank] -t [num_tuples] -n [num_comms] \n
+ *
+ */
+//
+#include "moab/ProcConfig.hpp"
+#include "moab/TupleList.hpp"
+#include "moab/ProgOptions.hpp"
+#include <time.h>
+#include <iostream>
+#include <sstream>
+
+const char BRIEF_DESC[] =
+    "Example of gather scatter with tuple lists \n";
+std::ostringstream LONG_DESC;
+
+using namespace moab;
+using namespace std;
+
+int main(int argc, char **argv)
+{
+  MPI_Init(&argc, &argv);
+
+  ProcConfig pc(MPI_COMM_WORLD);
+  int size = pc.proc_size();
+  int rank = pc.proc_rank();
+
+  // start copy
+  LONG_DESC << "This program does a gather scatter with a list of tuples. \n"
+          " It tries to see how much communication costs in terms of time and memory. \n"
+          << "It starts with creating a list of tuples to be sent from each processor, \n to a list of other processors.\n" <<
+          "The number of tuples and how many tasks to communicate to are controlled by input parameters.\n" <<
+          "After communication, we verify locally if we received what we expected. \n";
+  ProgOptions opts(LONG_DESC.str(), BRIEF_DESC);
+
+  // how many procs communicate to current proc, on average (we will vary that too)
+  int num_comms = 2;
+  opts.addOpt<int>("num_comms,n",
+       "each task will send to about num_comms other tasks some tuples (default 2)", &num_comms);
+
+  int num_tuples = 4;
+  opts.addOpt<int>("num_tuples,t",
+        "each task will send to some task about num_tuples tuples (default 4)", &num_tuples);
+
+  int reportrank = size+1;
+  opts.addOpt<int>("reporting_rank,r",
+      "this rank will report the tuples sent and the tuples received; it could be higher than num_procs, then no reporting"
+      ,&reportrank);
+
+  opts.parseCommandLine(argc, argv);
+
+
+
+
+  if (rank==reportrank || (reportrank>=size && rank == 0))
+  {
+    std::cout << " There are " << size << " tasks in example.\n";
+    std::cout<< " We will send groups of " << num_tuples << " from each task towards " <<
+        num_comms << " other tasks.\n";
+  }
+
+  // send some data from proc i to i+n/2, also to i +n/2+1 modulo n, where n is num procs
+
+  gs_data::crystal_data *cd = pc.crystal_router();
+
+  long total_n_tuples = num_comms*num_tuples;
+
+  // vary the number of tasks to send to, and the number of tuples to send
+  if (rank<size/2)
+    num_comms--;
+  else
+    num_comms++;
+
+  if (rank<size/3)
+    num_tuples*=2;
+  else if (rank>size-size/3)
+    num_tuples/=2;
+
+
+  TupleList tl;
+  // at most num_tuples* num_comms to send
+  // we do a preallocate with this; some tuples on some processors might need more memory, to be able
+  // to grow locally; Some tasks might receive more tuples though, and in the process, some might grow more than
+  // others. By doing these logP sends/receives, we do not grow local memory too much.
+  tl.initialize(1, 1, 0, 1, num_tuples*num_comms);
+  tl.enableWriteAccess();
+  // form num_tuples*num_comms tuples, send to various ranks
+  unsigned int n = tl.get_n();
+  for (int i=0; i<num_comms; i++)
+  {
+    int sendTo = rank+i*size/2+1;// spread out the send to, for a stress-like test
+    sendTo = sendTo%size;//
+    long intToSend = 1000*rank + 100000*sendTo;
+    for (int j=0; j<num_tuples; j++)
+    {
+      n = tl.get_n();
+      tl.vi_wr[n]= sendTo;
+      tl.vl_wr[n]= intToSend+j;
+      tl.vr_wr[n]= 10000.*rank+j;
+      tl.inc_n();
+    }
+  }
+
+  if (rank==reportrank)
+  {
+    std::cout << "rank " << rank << "\n";
+    tl.print(" before sending");
+  }
+
+  clock_t tt = clock();
+  // all communication happens here; no mpi calls for the user
+  ErrorCode rval = cd->gs_transfer(1,tl,0);
+
+  if (MB_SUCCESS!= rval)
+  {
+    std::cout << "error in tuple transfer\n";
+  }
+
+  double secs=0;
+  if (rank==reportrank || (reportrank>=size && rank == 0))
+  {
+    secs = (clock() - tt) / (double) CLOCKS_PER_SEC;
+  }
+  if (rank==reportrank)
+  {
+    std::cout << "rank " << rank << "\n";
+    tl.print(" after transfer");
+  }
+  // check that all tuples received have the form 10000* rank + 100*from
+  unsigned int received = tl.get_n();
+  for (int i=0; i<(int)received; i++)
+  {
+    int from = tl.vi_rd[i];
+    long valrec = tl.vl_rd[i];
+    int remainder = valrec -100000*rank -1000*from;
+    if (remainder < 0 || remainder >= num_tuples*4)
+      std::cout << " error: tuple " << i << " received at proc rank " << rank << " from proc " << from << " has value " <<
+         valrec << " remainder " <<  remainder << "\n";
+  }
+
+  if (rank==reportrank || (reportrank>=size && rank == 0))
+  {
+    std::cout << "communication of about "<<  total_n_tuples << " tuples/per proc took "
+        << secs  << " seconds" << std::endl;
+        tt = clock();
+  }
+  MPI_Finalize();
+
+  return 0;
+}

diff --git a/examples/DeformMeshRemap.cpp b/examples/DeformMeshRemap.cpp
new file mode 100644
index 0000000..5442d1d
--- /dev/null
+++ b/examples/DeformMeshRemap.cpp
@@ -0,0 +1,488 @@
+/** @example DeformMeshRemap.cpp
+ * Description: Account for mesh deformation of a solid due to structural mechanics\n
+ * In this example there are two meshes, a "master" and "slave" mesh.  In the master mesh,
+ * the solid material is deformed, to mimic what happens when a solid heats up and deforms.
+ * The fluid mesh is smoothed to account for those deformations, and tags on the fluid are
+ * remapped to those new positions.  Then mesh positions and state variables are transferred
+ * to the slave mesh, mimicing another mesh used by some other physics.
+ *
+ * To run: ./DeformMeshRemap [<master_meshfile><slave_meshfile>]\n
+ * (default values can run if users don't specify the mesh files)
+ */
+
+#include "moab/Core.hpp"
+#include "moab/Range.hpp"
+#include "moab/LloydSmoother.hpp"
+#include "moab/ProgOptions.hpp"
+#include "moab/BoundBox.hpp"
+#include "moab/SpatialLocator.hpp"
+#include "MBTagConventions.hpp"
+#include "DataCoupler.hpp"
+
+#ifdef USE_MPI
+#  include "moab/ParallelComm.hpp"
+#endif
+
+#include <iostream>
+#include <set>
+#include <sstream>
+#include <assert.h>
+
+using namespace moab;
+using namespace std;
+
+#ifndef MESH_DIR
+#define MESH_DIR "."
+#endif
+
+ErrorCode read_file(string &fname, EntityHandle &seth, 
+                    Range &solids, Range &solid_elems, Range &fluids, Range &fluid_elems);
+void deform_func(const BoundBox &bbox, double *xold, double *xnew);
+ErrorCode deform_master(Range &fluid_elems, Range &solid_elems, Tag &xnew);
+ErrorCode smooth_master(int dim, Tag xnew, EntityHandle &master, Range &fluids);
+ErrorCode write_to_coords(Range &elems, Tag tagh);
+
+const int SOLID_SETNO = 100, FLUID_SETNO = 200;
+
+Interface *mb;
+#define RR(a) if (MB_SUCCESS != rval) {cout << a << endl; return MB_FAILURE;}
+
+const bool debug = true;
+
+class DeformMeshRemap 
+{
+public:
+
+    //! enumerator for solid/fluid, master/slave
+  enum {MASTER=0, SLAVE, SOLID, FLUID};
+  
+    //! constructor
+    //! if master is NULL, the MOAB part is run in serial; 
+    //! if slave is NULL but the master isn't, the slave is copied from the master
+    //! Create communicators using moab::ParallelComm::get_pcomm
+  DeformMeshRemap(Interface *impl, ParallelComm *master = NULL, ParallelComm *slave = NULL);
+  
+    //! destructor
+  ~DeformMeshRemap();
+
+    //! execute the deformed mesh process
+  ErrorCode execute();
+  
+    //! add a set number
+  ErrorCode add_set_no(int fluid_or_solid, int set_no);
+  
+    //! remove a set number
+  ErrorCode remove_set_no(int fluid_or_solid, int set_no);
+  
+    //! get the set numbers
+  ErrorCode get_set_nos(int fluid_or_solid, std::set<int> &set_nos) const;
+
+    //! get the xNew tag handle
+  inline Tag x_new() const {return xNew;}
+
+    //! get the tag name
+  std::string x_new_name() const {return xNewName;}
+  
+    //! set the tag name
+  void x_new_name(const std::string &name) {xNewName = name;}
+
+    //! get/set the file name
+  std::string get_file_name(int m_or_s) const;
+  
+    //! get/set the file name
+  void set_file_name(int m_or_s, const std::string &name);
+  
+private:
+    //! apply a known deformation to the solid elements, putting the results in the xNew tag; also
+    //! write current coordinates to the xNew tag for fluid elements
+  ErrorCode deform_master(Range &fluid_elems, Range &solid_elems, const char *tag_name = NULL);
+
+    //! read a file and establish proper ranges
+  ErrorCode read_file(int m_or_s, string &fname, EntityHandle &seth);
+
+    //! write the input tag to the coordinates for the vertices in the input elems
+  ErrorCode write_to_coords(Range &elems, Tag tagh);
+
+    //! write the tag to the vertices, then save to the specified file
+  ErrorCode write_and_save(Range &ents, EntityHandle seth, Tag tagh, const char *filename);
+
+    //! moab interface
+  Interface *mbImpl;
+
+#ifdef USE_MPI
+    //! ParallelComm for master, slave meshes
+  ParallelComm *pcMaster, *pcSlave;
+#endif
+  
+    //! material set numbers for fluid materials
+  std::set<int> fluidSetNos;
+
+    //! material set numbers for solid materials
+  std::set<int> solidSetNos;
+
+    //! sets defining master/slave meshes
+  EntityHandle masterSet, slaveSet;
+
+    //! sets in master/slave meshes
+  Range fluidSets[2], solidSets[2];
+  
+    //! elements in master/slave meshes
+  Range fluidElems[2], solidElems[2];
+  
+    //! filenames for master/slave meshes
+  std::string masterFileName, slaveFileName;
+
+    //! tag used for new positions
+  Tag xNew;
+  
+    //! tag name used for new positions
+  std::string xNewName;
+};
+
+  //! add a set number
+inline ErrorCode DeformMeshRemap::add_set_no(int f_or_s, int set_no) 
+{
+  std::set<int> *this_set;
+  switch (f_or_s) {
+    case FLUID:
+        this_set = &fluidSetNos; break;
+    case SOLID:
+        this_set = &solidSetNos; break;
+    default:
+        assert(false && "f_or_s should be FLUID or SOLID.");
+        return MB_FAILURE;
+  }
+
+  this_set->insert(set_no);
+  
+  return MB_SUCCESS;
+}
+  
+  //! remove a set number
+inline ErrorCode DeformMeshRemap::remove_set_no(int f_or_s, int set_no) 
+{
+  std::set<int> *this_set;
+  switch (f_or_s) {
+    case FLUID:
+        this_set = &fluidSetNos; break;
+    case SOLID:
+        this_set = &solidSetNos; break;
+    default:
+        assert(false && "f_or_s should be FLUID or SOLID.");
+        return MB_FAILURE;
+  }
+  std::set<int>::iterator sit = this_set->find(set_no);
+  if (sit != this_set->end()) {
+    this_set->erase(*sit);
+    return MB_SUCCESS;
+  }
+
+  return MB_FAILURE;
+}
+  
+  //! get the set numbers
+inline ErrorCode DeformMeshRemap::get_set_nos(int f_or_s, std::set<int> &set_nos) const
+{
+  const std::set<int> *this_set;
+  switch (f_or_s) {
+    case FLUID:
+        this_set = &fluidSetNos; break;
+    case SOLID:
+        this_set = &solidSetNos; break;
+    default:
+        assert(false && "f_or_s should be FLUID or SOLID.");
+        return MB_FAILURE;
+  }
+
+  set_nos = *this_set;
+  
+  return MB_SUCCESS;
+}
+
+ErrorCode DeformMeshRemap::execute() 
+{
+    // read master/slave files and get fluid/solid material sets
+  ErrorCode rval = read_file(MASTER, masterFileName, masterSet);
+  if (MB_SUCCESS != rval) return rval;
+  
+  rval = read_file(SLAVE, slaveFileName, slaveSet);
+  if (MB_SUCCESS != rval) return rval;
+
+  Range src_elems = solidElems[MASTER];
+  src_elems.merge(fluidElems[MASTER]);
+    // locate slave vertices in master, orig coords; do this with a data coupler, so you can
+    // later interpolate
+  Range tgt_verts, tmp_range = solidElems[SLAVE];
+  tmp_range.merge(fluidElems[SLAVE]);
+  rval = mbImpl->get_adjacencies(tmp_range, 0, false, tgt_verts, Interface::UNION);
+  RR("Failed to get target verts.");
+  
+
+    // initialize data coupler on source elements
+  DataCoupler dc_master(mbImpl, NULL, src_elems, 0);
+  
+    // locate slave vertices, caching results in dc
+  rval = dc_master.locate_points(tgt_verts); RR("Point location of tgt verts failed.");
+  int num_located = dc_master.spatial_locator()->local_num_located();
+  if (num_located != (int)tgt_verts.size()) {
+    rval = MB_FAILURE;
+    std::cout << "Only " << num_located << " out of " << tgt_verts.size() << " target points successfully located." << std::endl;
+    return rval;
+  }
+
+    // deform the master's solid mesh, put results in a new tag
+  rval = deform_master(fluidElems[MASTER], solidElems[MASTER], "xnew"); RR("");
+
+  { // to isolate the lloyd smoother & delete when done
+
+      // smooth the master mesh
+    LloydSmoother ll(mbImpl, NULL, fluidElems[MASTER], xNew);
+    rval = ll.perform_smooth();
+    RR("Failed in lloyd smoothing.");
+    cout << "Lloyd smoothing required " << ll.num_its() << " iterations." << endl;
+  }
+  
+    // map new locations to slave
+    // interpolate xNew to slave points
+  rval = dc_master.interpolate((int)DataCoupler::VOLUME, "xnew"); RR("Failed to interpolate target solution.");
+
+    // transfer xNew to coords, for master and slave
+  rval = write_to_coords(fluidElems[MASTER], xNew); RR("Failed writing tag to master fluid verts.");
+  rval = write_to_coords(tgt_verts, xNew); RR("Failed writing tag to slave verts.");
+
+  if (debug) {
+    std::string str;
+#ifdef USE_MPI
+    if (pcMaster && pcMaster->size() > 1) 
+      str = "PARALLEL=WRITE_PART";
+#endif
+    rval = mbImpl->write_file("smoothed_master.vtk", NULL, str.c_str(), &masterSet, 1);
+#ifdef USE_MPI
+    str.clear();
+    if (pcSlave && pcSlave->size() > 1) 
+      str = "PARALLEL=WRITE_PART";
+#endif
+    rval = mbImpl->write_file("slave_interp.vtk", NULL, str.c_str(), &slaveSet, 1);
+  }
+
+  return MB_SUCCESS;
+}
+
+std::string DeformMeshRemap::get_file_name(int m_or_s) const
+{
+  switch (m_or_s) {
+    case MASTER:
+        return masterFileName;
+    case SLAVE:
+        return slaveFileName;
+    default:
+        assert(false && "m_or_s should be MASTER or SLAVE.");
+        return std::string();
+  }
+}
+  
+void DeformMeshRemap::set_file_name(int m_or_s, const std::string &name) 
+{
+  switch (m_or_s) {
+    case MASTER:
+        masterFileName = name; break;
+    case SLAVE:
+        slaveFileName = name; break;
+    default:
+        assert(false && "m_or_s should be MASTER or SLAVE.");
+  }
+}
+
+DeformMeshRemap::DeformMeshRemap(Interface *impl, ParallelComm *master, ParallelComm *slave)  
+        : mbImpl(impl), pcMaster(master), pcSlave(slave), masterSet(0), slaveSet(0), xNew(0), xNewName("xnew") 
+{
+  if (!pcSlave && pcMaster)
+    pcSlave = pcMaster;
+}
+  
+DeformMeshRemap::~DeformMeshRemap() 
+{
+    // delete the tag
+  mbImpl->tag_delete(xNew);
+}
+
+int main(int argc, char **argv) {
+
+  ErrorCode rval;
+
+  ProgOptions po("Deformed mesh options");
+  po.addOpt<std::string> ("master,m", "Specify the master meshfile name" );
+  po.addOpt<std::string> ("slave,s", "Specify the slave meshfile name" );
+  po.parseCommandLine(argc, argv);
+  std::string foo;
+  string masterf, slavef;
+  if(!po.getOpt("master", &masterf))
+    masterf = string(MESH_DIR) + string("/rodquad.g");
+  if(!po.getOpt("slave", &slavef))
+    slavef = string(MESH_DIR) + string("/rodtri.g");
+
+  mb = new Core();
+
+  DeformMeshRemap *dfr;
+#ifdef USE_MPI
+  ParallelComm *pc = new ParallelComm(mb, MPI_COMM_WORLD);
+  dfr = new DeformMeshRemap(mb, pc);
+#else  
+  dfr = new DeformMeshRemap(mb);
+#endif
+  dfr->set_file_name(DeformMeshRemap::MASTER, masterf);
+  dfr->set_file_name(DeformMeshRemap::SLAVE, slavef);
+  rval = dfr->add_set_no(DeformMeshRemap::SOLID, SOLID_SETNO); RR("Failed to add solid set no.");
+  rval = dfr->add_set_no(DeformMeshRemap::FLUID, FLUID_SETNO); RR("Failed to add fluid set no.");
+  
+  rval = dfr->execute();
+  
+  delete dfr;
+  delete mb;
+  
+  return rval;
+}
+
+ErrorCode DeformMeshRemap::write_and_save(Range &ents, EntityHandle seth, Tag tagh, const char *filename) 
+{
+  ErrorCode rval = write_to_coords(ents, tagh); RR("");
+  rval = mbImpl->write_file(filename, NULL, NULL, &seth, 1); RR("");
+  return rval;
+}
+  
+ErrorCode DeformMeshRemap::write_to_coords(Range &elems, Tag tagh) 
+{
+    // write the tag to coordinates
+  Range verts;
+  ErrorCode rval = mbImpl->get_adjacencies(elems, 0, false, verts, Interface::UNION);
+  RR("Failed to get adj vertices.");
+  std::vector<double> coords(3*verts.size());
+  rval = mbImpl->tag_get_data(tagh, verts, &coords[0]);
+  RR("Failed to get tag data.");
+  rval = mbImpl->set_coords(verts, &coords[0]);
+  RR("Failed to set coordinates.");
+  return MB_SUCCESS;
+}
+
+void deform_func(const BoundBox &bbox, double *xold, double *xnew) 
+{
+/*  Deformation function based on max delx and dely at top of rod
+    const double RODWIDTH = 0.2, RODHEIGHT = 0.5;
+    // function: origin is at middle base of rod, and is .5 high
+    // top of rod is (0,.55) on left and (.2,.6) on right
+  double delx = 0.5*RODWIDTH;
+  
+  double xfrac = (xold[0] + .5*RODWIDTH)/RODWIDTH, yfrac = xold[1]/RODHEIGHT;
+  xnew[0] = xold[0] + yfrac * delx;
+  xnew[1] = xold[1] + yfrac * (1.0 + xfrac) * 0.05;
+*/
+
+/* Deformation function based on fraction of bounding box dimension in each direction */
+  double frac = 0.01; // taken from approximate relative deformation from LLNL Diablo of XX09 assys
+  CartVect *xo = reinterpret_cast<CartVect*>(xold), *xn = reinterpret_cast<CartVect*>(xnew);
+  CartVect disp = frac * (*xo - bbox.bMin);
+  *xn = *xo + disp;
+}
+  
+ErrorCode DeformMeshRemap::deform_master(Range &fluid_elems, Range &solid_elems, const char *tag_name) 
+{
+    // deform elements with an analytic function
+
+    // create the tag
+  ErrorCode rval = mbImpl->tag_get_handle((tag_name ? tag_name : ""), 3, MB_TYPE_DOUBLE, xNew, MB_TAG_CREAT|MB_TAG_DENSE);
+  RR("Failed to create xnew tag.");
+  
+    // get all the vertices and coords in the fluid, set xnew to them
+  Range verts;
+  rval = mbImpl->get_adjacencies(fluid_elems, 0, false, verts, Interface::UNION);
+  RR("Failed to get vertices.");
+  std::vector<double> coords(3*verts.size(), 0.0);
+  rval = mbImpl->get_coords(verts, &coords[0]);
+  RR("Failed to get vertex coords.");
+  rval = mbImpl->tag_set_data(xNew, verts, &coords[0]);
+  RR("Failed to set xnew tag on fluid verts.");
+
+    // get the bounding box of the solid mesh
+  BoundBox bbox;
+  bbox.update(*mbImpl, solid_elems);
+  
+    // get all the vertices and coords in the solid
+  verts.clear();
+  rval = mbImpl->get_adjacencies(solid_elems, 0, false, verts, Interface::UNION);
+  RR("Failed to get vertices.");
+  coords.resize(3*verts.size(), 0.0);
+  rval = mbImpl->get_coords(verts, &coords[0]);
+  RR("Failed to get vertex coords.");
+  unsigned int num_verts = verts.size();
+  for (unsigned int i = 0; i < num_verts; i++)
+    deform_func(bbox, &coords[3*i], &coords[3*i]);
+    
+    // set the new tag to those coords
+  rval = mbImpl->tag_set_data(xNew, verts, &coords[0]);
+  RR("Failed to set tag data.");
+  
+  return MB_SUCCESS;
+}
+
+ErrorCode DeformMeshRemap::read_file(int m_or_s, string &fname, EntityHandle &seth)
+{
+    // create meshset
+  ErrorCode rval = mbImpl->create_meshset(0, seth);
+  RR("Couldn't create master/slave set.");
+  ostringstream ostr;
+#ifdef USE_MPI
+  ParallelComm *pc = (m_or_s == MASTER ? pcMaster : pcSlave);
+  if (pc && pc->size() > 1) {
+    if (debug) ostr << "DEBUG_IO=1;CPUTIME;";
+    ostr << "PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION;PARALLEL_RESOLVE_SHARED_ENTS;"
+         << "PARALLEL_GHOSTS=2.0.1;PARALLEL_COMM=" << pc->get_id();
+  }
+#endif  
+  rval = mbImpl->load_file(fname.c_str(), &seth, ostr.str().c_str());
+  RR("Couldn't load master/slave mesh.");
+
+    // get material sets for solid/fluid
+  Tag tagh;
+  rval = mbImpl->tag_get_handle(MATERIAL_SET_TAG_NAME, tagh); RR("Couldn't get material set tag name.");
+  for (std::set<int>::iterator sit = solidSetNos.begin(); sit != solidSetNos.end(); sit++) {
+    Range sets;
+    int set_no = *sit;
+    const void *setno_ptr = &set_no;
+    rval = mbImpl->get_entities_by_type_and_tag(seth, MBENTITYSET, &tagh, &setno_ptr, 1, sets);
+    if (sets.empty()) rval = MB_FAILURE;
+    RR("Couldn't get any solid sets.");
+    solidSets[m_or_s].merge(sets);
+  }
+
+    // get solid entities, and dimension
+  Range tmp_range;
+  for (Range::iterator rit = solidSets[m_or_s].begin(); rit != solidSets[m_or_s].end(); rit++) {
+    rval = mbImpl->get_entities_by_handle(*rit, tmp_range, true);
+    RR("Failed to get entities in solid.");
+  }
+  int dim = mbImpl->dimension_from_handle(*tmp_range.rbegin());
+  assert(dim > 0 && dim < 4);
+  
+  solidElems[m_or_s] = tmp_range.subset_by_dimension(dim);
+
+  for (std::set<int>::iterator sit = fluidSetNos.begin(); sit != fluidSetNos.end(); sit++) {
+    Range sets;
+    int set_no = *sit;
+    const void *setno_ptr = &set_no;
+    rval = mbImpl->get_entities_by_type_and_tag(seth, MBENTITYSET, &tagh, &setno_ptr, 1, sets);
+    if (sets.empty()) rval = MB_FAILURE;
+    RR("Couldn't get any fluid sets.");
+    fluidSets[m_or_s].merge(sets);
+  }
+
+    // get fluid entities, and dimension
+  tmp_range.clear();
+  for (Range::iterator rit = fluidSets[m_or_s].begin(); rit != fluidSets[m_or_s].end(); rit++) {
+    rval = mbImpl->get_entities_by_handle(*rit, tmp_range, true);
+    RR("Failed to get entities in fluid.");
+  }
+  
+  fluidElems[m_or_s] = tmp_range.subset_by_dimension(dim);
+  
+  return MB_SUCCESS;
+}

diff --git a/examples/LloydRelaxation.cpp b/examples/LloydRelaxation.cpp
index 0cf9d1e..34002cd 100644
--- a/examples/LloydRelaxation.cpp
+++ b/examples/LloydRelaxation.cpp
@@ -14,8 +14,10 @@
  * in the current directory (H5M format must be used since the file is written in parallel).
  */
 
-#include "moab/ParallelComm.hpp"
-#include "MBParallelConventions.h"
+#ifdef USE_MPI
+#  include "moab/ParallelComm.hpp"
+#  include "MBParallelConventions.h"
+#endif
 #include "moab/Core.hpp"
 #include "moab/Skinner.hpp"
 #include "moab/CN.hpp"
@@ -30,7 +32,7 @@ string test_file_name = string(MESH_DIR) + string("/surfrandomtris-4part.h5m");
 
 #define RC if (MB_SUCCESS != rval) return rval
 
-ErrorCode perform_lloyd_relaxation(ParallelComm *pc, Range &verts, Range &cells, Tag fixed, 
+ErrorCode perform_lloyd_relaxation(Interface *mb, Range &verts, Range &cells, Tag fixed, 
                                    int num_its, int report_its);
 
 int main(int argc, char **argv)
@@ -38,7 +40,9 @@ int main(int argc, char **argv)
   int num_its = 10;
   int report_its = 1;
 
+#ifdef USE_MPI
   MPI_Init(&argc, &argv);
+#endif
 
     // need option handling here for input filename
   if (argc > 1){
@@ -49,10 +53,13 @@ int main(int argc, char **argv)
   // get MOAB and ParallelComm instances
   Interface *mb = new Core;
   if (NULL == mb) return 1;
+  int nprocs = 1;
+  
+#ifdef USE_MPI
   // get the ParallelComm instance
-  ParallelComm* pcomm = new ParallelComm(mb, MPI_COMM_WORLD);
-  int nprocs = pcomm->size();
-
+  ParallelComm *pcomm = new ParallelComm(mb, MPI_COMM_WORLD);
+  nprocs = pcomm->size();
+#endif
   string options;
   if (nprocs > 1) // if reading in parallel, need to tell it how
     options = "PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION;PARALLEL_RESOLVE_SHARED_ENTS;PARALLEL_GHOSTS=2.0.1;DEBUG_IO=0;DEBUG_PIO=0";
@@ -76,34 +83,45 @@ int main(int argc, char **argv)
     // ok to mark non-owned skin vertices too, I won't move those anyway
     // use MOAB's skinner class to find the skin
   Skinner skinner(mb);
-  rval = skinner.find_skin(faces, true, skin_verts); RC; // 'true' param indicates we want vertices back, not faces
+  rval = skinner.find_skin(0, faces, true, skin_verts); RC; // 'true' param indicates we want vertices back, not faces
 
   std::vector<int> fix_tag(skin_verts.size(), 1); // initialized to 1 to indicate fixed
   rval = mb->tag_set_data(fixed, skin_verts, &fix_tag[0]); RC;
 
     // now perform the Lloyd relaxation
-  rval = perform_lloyd_relaxation(pcomm, verts, faces, fixed, num_its, report_its); RC;
+  rval = perform_lloyd_relaxation(mb, verts, faces, fixed, num_its, report_its); RC;
 
     // delete fixed tag, since we created it here
   rval = mb->tag_delete(fixed); RC;
   
     // output file, using parallel write
-  rval = mb->write_file("lloydfinal.h5m", NULL, "PARALLEL=WRITE_PART"); RC;
+
+#ifdef USE_MPI
+  options = "PARALLEL=WRITE_PART";
+#endif
+
+  rval = mb->write_file("lloydfinal.h5m", NULL, options.c_str()); RC;
 
     // delete MOAB instance
   delete mb;
   
+#ifdef USE_MPI
   MPI_Finalize();
+#endif
 
   return 0;
 }
 
-ErrorCode perform_lloyd_relaxation(ParallelComm *pcomm, Range &verts, Range &faces, Tag fixed, 
+ErrorCode perform_lloyd_relaxation(Interface *mb, Range &verts, Range &faces, Tag fixed, 
                                    int num_its, int report_its) 
 {
   ErrorCode rval;
-  Interface *mb = pcomm->get_moab();
-  int nprocs = pcomm->size();
+  int nprocs = 1;
+
+#ifdef USE_MPI
+  ParallelComm *pcomm = ParallelComm::get_pcomm(mb, 0);
+  nprocs = pcomm->size();
+#endif
   
     // perform Lloyd relaxation:
     // 1. setup: set vertex centroids from vertex coords; filter to owned verts; get fixed tags
@@ -120,8 +138,10 @@ ErrorCode perform_lloyd_relaxation(ParallelComm *pcomm, Range &verts, Range &fac
     // filter verts down to owned ones and get fixed tag for them
   Range owned_verts, shared_owned_verts;
   if (nprocs > 1) {
+#ifdef USE_MPI
     rval = pcomm->filter_pstatus(verts, PSTATUS_NOT_OWNED, PSTATUS_NOT, -1, &owned_verts);
     if (rval != MB_SUCCESS) return rval;
+#endif
   }
   else
     owned_verts = verts;
@@ -133,11 +153,13 @@ ErrorCode perform_lloyd_relaxation(ParallelComm *pcomm, Range &verts, Range &fac
   vcentroids.resize(3*owned_verts.size());
   rval = mb->tag_get_data(centroid, owned_verts, &vcentroids[0]); RC;
 
+#ifdef USE_MPI
     // get shared owned verts, for exchanging tags
   rval = pcomm->get_shared_entities(-1, shared_owned_verts, 0, false, true); RC;
     // workaround: if no shared owned verts, put a non-shared one in the list, to prevent exchanging tags
     // for all shared entities
   if (shared_owned_verts.empty()) shared_owned_verts.insert(*verts.begin());
+#endif
   
     // some declarations for later iterations
   std::vector<double> fcentroids(3*faces.size()); // fcentroids for face centroids
@@ -195,16 +217,22 @@ ErrorCode perform_lloyd_relaxation(ParallelComm *pcomm, Range &verts, Range &fac
 
     // 2c. exchange tags on owned verts
     if (nprocs > 1) {
+#ifdef USE_MPI
       rval = pcomm->exchange_tags(centroid, shared_owned_verts); RC;
+#endif
     }
 
 
     if (!(nit%report_its)) {
         // global reduce for maximum delta, then report it
       double global_max = mxdelta;
+      int myrank = 0;
+#ifdef USE_MPI
       if (nprocs > 1)
         MPI_Reduce(&mxdelta, &global_max, 1, MPI_DOUBLE, MPI_MAX, 0, pcomm->comm());
-      if (1 == nprocs || !pcomm->rank()) 
+      myrank = pcomm->rank();
+#endif
+      if (1 == nprocs || !myrank) 
         cout << "Max delta = " << global_max << endl;
     }
   }

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/PushParMeshIntoMoabF90.F90 b/examples/PushParMeshIntoMoabF90.F90
index 131d19c..2d5a0f4 100644
--- a/examples/PushParMeshIntoMoabF90.F90
+++ b/examples/PushParMeshIntoMoabF90.F90
@@ -16,6 +16,8 @@ program PushParMeshIntoMoab
   use ISO_C_BINDING
   implicit none
 
+#include "mpif.h"
+
 #ifdef USE_MPI
 #  include "iMeshP_f.h"
 #else
@@ -49,7 +51,7 @@ program PushParMeshIntoMoab
 #ifdef USE_MPI
   ! local variables for parallel runs
   iMeshP_PartitionHandle imeshp
-  integer MPI_COMM_WORLD
+!    integer MPI_COMM_WORLD
 #endif
 
   ! vertex positions, latlon coords, (lat, lon, lev), fortran ordering

diff --git a/examples/StructuredMeshSimple.cpp b/examples/StructuredMeshSimple.cpp
index 25aa08f..bc80ed8 100644
--- a/examples/StructuredMeshSimple.cpp
+++ b/examples/StructuredMeshSimple.cpp
@@ -17,7 +17,7 @@
  *      -# Get the coordinates of the vertices comprising that element
  *    -# Release the structured mesh interface and destroy the MOAB instance
  *
- * <b> To run: </b> ./structuredmesh [d [N] ] \n
+ * <b> To run: </b> ./StructuredMeshSimple [d [N] ] \n
  * (default values so can run w/ no user interaction)
  */
 
@@ -25,6 +25,9 @@
 #include "moab/ScdInterface.hpp"
 #include "moab/ProgOptions.hpp"
 #include "moab/CN.hpp"
+#ifdef USE_MPI
+#include "moab_mpi.h"
+#endif
 #include <iostream>
 #include <vector>
 
@@ -34,6 +37,10 @@ int main(int argc, char **argv)
 {
   int N = 10, dim = 3;
 
+#ifdef USE_MPI
+  MPI_Init(&argc, &argv);
+#endif
+
   ProgOptions opts;
   opts.addOpt<int>(std::string("dim,d"), std::string("Dimension of mesh (default=3)"),
                    &dim);
@@ -105,6 +112,10 @@ int main(int argc, char **argv)
     // 5. Release the structured mesh interface and destroy the MOAB instance
   mb->release_interface(scdiface); // tell MOAB we're done with the ScdInterface
   delete mb;
-  
+
+#ifdef USE_MPI
+  MPI_Finalize();
+#endif
+
   return 0;
 }

diff --git a/examples/makefile b/examples/makefile
index cd6339e..41dc577 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -4,61 +4,73 @@ include ${MOAB_DIR}/lib/iMesh-Defs.inc
 
 .SUFFIXES: .o .cpp .F90
 
-# MESH_DIR is the top-level MOAB source directory, used to locate mesh files that come with MOAB source
+# MESH_DIR is the directory containing mesh files that come with MOAB source
 MESH_DIR="../MeshFiles/unittest"
 
-EXAMPLES = HelloMOAB GetEntities SetsNTags StructuredMeshSimple DirectAccessWithHoles DirectAccessNoHoles 
-PAREXAMPLES = HelloParMOAB ReduceExchangeTags LloydRelaxation
-F90EXAMPLES = DirectAccessNoHolesF90 PushParMeshIntoMoabF90
+EXAMPLES = HelloMOAB GetEntities SetsNTags LoadPartial structuredmesh StructuredMeshSimple DirectAccessWithHoles DirectAccessNoHoles point_in_elem_search DeformMeshRemap
+PAREXAMPLES = HelloParMOAB ReduceExchangeTags LloydRelaxation CrystalRouterExample
 EXOIIEXAMPLES = TestExodusII
+F90EXAMPLES = DirectAccessNoHolesF90 PushParMeshIntoMoabF90
 
-default: ${EXAMPLES}
+default: ${EXAMPLES} ${PAREXAMPLES} ${EXOIIEXAMPLES} ${F90EXAMPLES}
 
-HelloMOAB : HelloMOAB.o
+HelloMOAB: HelloMOAB.o ${MOAB_LIBDIR}/libMOAB.la
 	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
 
-GetEntities: GetEntities.o
+GetEntities: GetEntities.o ${MOAB_LIBDIR}/libMOAB.la
 	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
 
-SetsNTags: SetsNTags.o
+SetsNTags: SetsNTags.o ${MOAB_LIBDIR}/libMOAB.la
 	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
 
-LloydRelaxation: LloydRelaxation.o
+LloydRelaxation: LloydRelaxation.o ${MOAB_LIBDIR}/libMOAB.la
+	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
+
+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_CXX} -o $@ $< ${MOAB_LIBS_LINK} 
+StructuredMeshSimple: StructuredMeshSimple.o ${MOAB_LIBDIR}/libMOAB.la
+	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
 
-DirectAccessWithHoles: DirectAccessWithHoles.o
+DirectAccessWithHoles: DirectAccessWithHoles.o ${MOAB_LIBDIR}/libMOAB.la
 	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
 
-DirectAccessNoHoles: DirectAccessNoHoles.o
+DirectAccessNoHoles: DirectAccessNoHoles.o ${MOAB_LIBDIR}/libMOAB.la
 	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
 
-DirectAccessNoHolesF90: DirectAccessNoHolesF90.o
-	${MOAB_CXX} -o $@ $< ${IMESH_LIBS}
+DirectAccessNoHolesF90: DirectAccessNoHolesF90.o ${MOAB_LIBDIR}/libMOAB.la
+	${MOAB_FC} -o $@ $< ${IMESH_LIBS}
 
-ReduceExchangeTags : ReduceExchangeTags.o
+ReduceExchangeTags: ReduceExchangeTags.o ${MOAB_LIBDIR}/libMOAB.la
 	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
 
-HelloParMOAB: HelloParMOAB.o
-	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK} 
+HelloParMOAB: HelloParMOAB.o ${MOAB_LIBDIR}/libMOAB.la
+	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
 
-TestExodusII: TestExodusII.o
+CrystalRouterExample: CrystalRouterExample.o ${MOAB_LIBDIR}/libMOAB.la
 	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
 
-point_in_elem_search: point_in_elem_search.o
+TestExodusII: TestExodusII.o ${MOAB_LIBDIR}/libMOAB.la
+	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
+
+point_in_elem_search: point_in_elem_search.o ${MOAB_LIBDIR}/libMOAB.la
 	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
 
 PushParMeshIntoMoabF90: PushParMeshIntoMoabF90.o
-	${MOAB_CXX} -o $@ $< ${IMESH_LIBS} -lgfortran -L/usr/lib/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl 
+	${MOAB_FC} -o $@ $< ${IMESH_LIBS}
+
+DeformMeshRemap: DeformMeshRemap.o ${MOAB_LIBDIR}/libMOAB.la
+	${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK} -lmbcoupler ${MOAB_LIBS_LINK}
 
 clean:
-	rm -rf *.o ${EXAMPLES} ${PAREXAMPLES} ${EXOIIEXAMPLES}
+	rm -rf *.o *.mod *.h5m ${EXAMPLES} ${PAREXAMPLES} ${EXOIIEXAMPLES} ${F90EXAMPLES}
 
-.cpp.o :
-	${MOAB_CXX} ${CXXFLAGS} ${MOAB_CXXFLAGS} ${MOAB_INCLUDES} -DMESH_DIR=\"${MESH_DIR}\" -c $<
+.cpp.o:
+	${MOAB_CXX} ${CXXFLAGS} ${MOAB_CXXFLAGS} ${MOAB_CPPFLAGS} ${MOAB_INCLUDES} -DMESH_DIR=\"${MESH_DIR}\" -c $<
 
-.F90.o :
-	${IMESH_FC} ${FCFLAGS} ${IMESH_FCFLAGS} ${IMESH_INCLUDES} ${IMESH_FCDEFS} -DMESH_DIR=\"${MESH_DIR}\" -c $<
+.F90.o:
+	${IMESH_FC} ${FCFLAGS} ${IMESH_FCFLAGS} ${MOAB_CPPFLAGS} ${IMESH_INCLUDES} ${IMESH_FCDEFS} -DMESH_DIR=\"${MESH_DIR}\" -c $<
 

diff --git a/examples/point_in_elem_search.cpp b/examples/point_in_elem_search.cpp
index a917fa0..ddf3f03 100644
--- a/examples/point_in_elem_search.cpp
+++ b/examples/point_in_elem_search.cpp
@@ -27,7 +27,7 @@ int main(int argc, char **argv) {
 
   int num_queries = 1000000;
   
-  if (argc == 1) {
+  if (argc < 2 || argc > 3) {
     std::cout << "Usage: " << argv[0] << "<filename> [num_queries]" << std::endl;
     return 0;
   }
@@ -37,7 +37,7 @@ int main(int argc, char **argv) {
   moab::Core mb;
 
     // load the file
-  ErrorCode rval = mb.load_file(argv[argc-1]); ERR("Error loading file");
+  ErrorCode rval = mb.load_file(argv[1]); ERR("Error loading file");
   
     // get all 3d elements in the file
   Range elems;
@@ -53,20 +53,19 @@ int main(int argc, char **argv) {
   SpatialLocator sl(&mb, elems, &tree);
   
     // get the box extents
-  BoundBox box;
   CartVect box_extents, pos;
-  rval = sl.get_bounding_box(box); ERR("Problem getting tree bounding box");
+  BoundBox box = sl.local_box();
   box_extents = box.bMax - box.bMin;
   
     // query at random places in the tree
   CartVect params;
-  bool is_inside;
+  int is_inside = 0;
   int num_inside = 0;
   EntityHandle elem;
   for (int i = 0; i < num_queries; i++) {
     pos = box.bMin + 
         CartVect(box_extents[0]*.01*(rand()%100), box_extents[1]*.01*(rand()%100), box_extents[2]*.01*(rand()%100));
-    ErrorCode tmp_rval = sl.locate_point(pos.array(), elem, params.array(), 0.0, 0.0, &is_inside);
+    ErrorCode tmp_rval = sl.locate_point(pos.array(), elem, params.array(), &is_inside, 0.0, 0.0);
     if (MB_SUCCESS != tmp_rval) rval = tmp_rval;
     if (is_inside) num_inside++;
   }
@@ -78,9 +77,3 @@ int main(int argc, char **argv) {
   std::cout << "Queries inside box = " << num_inside << "/" << num_queries << " = " 
             << 100.0*((double)num_inside)/num_queries << "%" << std::endl;
 }
-
-    
-  
-  
-  
-

diff --git a/examples/structuredmesh.cpp b/examples/structuredmesh.cpp
index 017937d..0214c3e 100644
--- a/examples/structuredmesh.cpp
+++ b/examples/structuredmesh.cpp
@@ -26,9 +26,10 @@
 
 using namespace moab;
 
-int main(int argv, char **argv) 
+int main(int argc, char **argv) 
 {
-  int N;
+  argv[0] = argv[argc - argc]; // To remove the warnings about unused parameters
+  int I, J, K;
     // progoptions?
   std::cout << "Enter I, J, K... " << std::endl;
   std::cin >> I >> J >> K;

This diff is so big that we needed to truncate the remainder.

https://bitbucket.org/fathomteam/moab/commits/bd9e85063e75/
Changeset:   bd9e85063e75
Branch:      None
User:        judajake
Date:        2014-02-28 21:41:36
Summary:     remove unneeded dead code

Affected #:  1 file

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 537e591..649a4c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,9 +3,6 @@ cmake_policy( SET CMP0003 NEW )
 cmake_policy(SET CMP0020 NEW)
 project( MOAB )
 
-# Always build tests
-#enable_testing()
-
 #Add our Cmake directory to the module search path
 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/config ${CMAKE_MODULE_PATH})
 


https://bitbucket.org/fathomteam/moab/commits/cacf7699c00f/
Changeset:   cacf7699c00f
Branch:      None
User:        vijaysm
Date:        2014-05-08 06:38:18
Summary:     Merging origin/cmake-fixes to upstream/master

Affected #:  6 files

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6b18435..6afd143 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,7 +34,7 @@ project( MOAB )
   endif ( DEFINED PATCH_VERSION )
 
   set ( EXECUTABLE_OUTPUT_PATH ${MOAB_BINARY_DIR}/bin CACHE PATH "Path to executables" FORCE )
-  set ( LIBRARY_OUTPUT_PATH    ${MOAB_BINARY_DIR}/bin CACHE PATH "Path to libraries"   FORCE )
+  set ( LIBRARY_OUTPUT_PATH    ${MOAB_BINARY_DIR}/lib CACHE PATH "Path to libraries"   FORCE )
   mark_as_advanced(
     EXECUTABLE_OUTPUT_PATH
     LIBRARY_OUTPUT_PATH

diff --git a/itaps/imesh/CMakeLists.txt b/itaps/imesh/CMakeLists.txt
index e98c0b1..37ffcdc 100644
--- a/itaps/imesh/CMakeLists.txt
+++ b/itaps/imesh/CMakeLists.txt
@@ -19,6 +19,15 @@ ADD_CUSTOM_COMMAND(
   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh_extensions.h
   )
 ADD_CUSTOM_COMMAND(
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_extensions_protos.h
+  COMMAND ${CMAKE_COMMAND}
+          -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMeshP_extensions.h
+          -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMeshP_extensions_protos.h
+          -Dprefix:STRING=iMesh
+          -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh_extensions.h
+  )
+ADD_CUSTOM_COMMAND(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
   COMMAND ${CMAKE_COMMAND}
           -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMeshP.h
@@ -32,6 +41,7 @@ set ( MOAB_IMESH_SRCS
       iMesh_MOAB.cpp
       ${CMAKE_CURRENT_BINARY_DIR}/iMesh_protos.h
       ${CMAKE_CURRENT_BINARY_DIR}/iMesh_extensions_protos.h
+      ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_extensions_protos.h
       ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h )
 
 include_directories(
@@ -41,6 +51,7 @@ include_directories(
     ${MOAB_SOURCE_DIR}/src
     ${MOAB_SOURCE_DIR}/itaps
     ${MOAB_SOURCE_DIR}/itaps/imesh
+    ${MOAB_BINARY_DIR}/itaps/imesh
   )
 
 if ( MOAB_USE_HDF5 AND HDF5_FOUND )

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 4689130..cb5734c 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -9,11 +9,26 @@
     ${MOAB_SOURCE_DIR}/src/parallel
   )
 
+  add_custom_command(OUTPUT mb_big_test.g
+                     COMMAND /bin/zcat ${MOAB_SOURCE_DIR}/MeshFiles/unittest/mb_big_test.g.gz > mb_big_test.g
+                     DEPENDS ${MOAB_SOURCE_DIR}/MeshFiles/unittest/mb_big_test.g.gz
+                     )
+  add_custom_command(OUTPUT cell1.gen
+                     COMMAND /bin/zcat ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell1.gen.gz > cell1.gen
+                     DEPENDS ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell1.gen.gz
+                     )
+  add_custom_command(OUTPUT cell2.gen
+                     COMMAND /bin/zcat ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell2.gen.gz > cell2.gen
+                     DEPENDS ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell2.gen.gz
+                     )
+  
+  add_custom_target(moab_test_files DEPENDS mb_big_test.g cell1.gen cell2.gen)
+  set_source_files_properties( mBTest.cpp
+    COMPILE_FLAGS "-DSRCDIR=${CMAKE_CURRENT_SOURCE_DIR} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   add_executable( moab_test MBTest.cpp )
+  add_dependencies(moab_test moab_test_files)
   target_link_libraries( moab_test MOAB )
-  set_source_files_properties( mBTest.cpp
-    COMPILE_FLAGS "-DSRCDIR=${CMAKE_CURRENT_SOURCE_DIR}" )
-  add_test( TestMOAB ${EXECUTABLE_OUTPUT_PATH}/moab_test -nostress )
+  add_test( TestMOAB ${EXECUTABLE_OUTPUT_PATH}/moab_test )
   # FIXME: moab_test depends on: test/mb_big_test.g test/cell1.gen test/cell2.gen
 
   add_executable( tag_test TagTest.cpp )
@@ -23,36 +38,36 @@
   add_executable( seq_man_test TestTypeSequenceManager.cpp )
   target_link_libraries( seq_man_test MOAB )
   set_source_files_properties( TestTypeSequenceManager.cpp
-    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}" )
-   add_test( TestTypeSequenceManager ${EXECUTABLE_OUTPUT_PATH}/seq_man_test )
+    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
+  add_test( TestTypeSequenceManager ${EXECUTABLE_OUTPUT_PATH}/seq_man_test )
 
   add_executable( homxform_test ${MOAB_SOURCE_DIR}/src/HomXform.cpp )
   set_source_files_properties( ${MOAB_SOURCE_DIR}/src/HomXform.cpp
-    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
+    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   target_link_libraries( homxform_test MOAB )
   add_test( TestHomXform ${EXECUTABLE_OUTPUT_PATH}/homxform_test )
 
   add_executable( scdseq_test scdseq_test.cpp )
   set_source_files_properties( scdseq_test.cpp
-    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}" )
+    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   target_link_libraries( scdseq_test MOAB )
   add_test( TestSCDSeq ${EXECUTABLE_OUTPUT_PATH}/scdseq_test )
 
   add_executable( bsp_tree_test bsp_tree_test.cpp )
   set_source_files_properties( bsp_tree_test.cpp
-    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
+    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   target_link_libraries( bsp_tree_test MOAB )
   add_test( TestBSPTree ${EXECUTABLE_OUTPUT_PATH}/bsp_tree_test )
 
   add_executable( geomutiltests GeomUtilTests.cpp )
   set_source_files_properties( GeomUtilTests.cpp
-    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
+    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   target_link_libraries( geomutiltests MOAB )
   add_test( TestGeomUtil ${EXECUTABLE_OUTPUT_PATH}/geomutiltests )
 
   add_executable( range_test range_test.cpp )
   set_source_files_properties( range_test.cpp
-    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
+    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   target_link_libraries( range_test MOAB )
   add_test( TestRange ${EXECUTABLE_OUTPUT_PATH}/range_test )
 
@@ -61,7 +76,7 @@ if ( MOAB_USE_MPI AND MPI_FOUND )
   add_executable ( mbparallelcomm_test parallel/mbparallelcomm_test.cpp )
   target_link_libraries( mbparallelcomm_test MOAB )
   set_source_files_properties( parallel/mbparallelcomm_test.cpp
-    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}" )
+    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   add_test( TestParallelComm-BcastDelete
     ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
     ${EXECUTABLE_OUTPUT_PATH}/mbparallelcomm_test ${MPIEXEC_POSTFLAGS} 0 ${MOAB_SOURCE_DIR}/parallel/ptest.cub )
@@ -80,27 +95,27 @@ if ( MOAB_USE_MPI AND MPI_FOUND )
       ${HDF5_INCLUDE_DIR}
       ${MOAB_SOURCE_DIR}/src/io/mhdf/include
     )
+    set_source_files_properties( parallel/mhdf_parallel.c
+      COMPILE_FLAGS "-DTEST ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
     add_executable( mhdf_parallel parallel/mhdf_parallel.c )
-    target_link_libraries( mhdf_parallel MOAB MOABpar mhdf )
+    target_link_libraries( mhdf_parallel mhdf MOAB MOABpar )
     add_test( TestMHDFParallel ${EXECUTABLE_OUTPUT_PATH}/mhdf_parallel )
-    set_source_files_properties( parallel/mhdf_parallel.c
-      COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
   endif ( MOAB_USE_HDF )
 
+  set_source_files_properties( parallel/parallel_unit_tests.cpp
+    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   add_executable ( parallel_unit_tests parallel/parallel_unit_tests.cpp )
   target_link_libraries( parallel_unit_tests MOAB )
   add_test( TestParallel
     ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
-    ${EXECUTABLE_OUTPUT_PATH}/parallel_unit_tests ${MPIEXEC_POSTFLAGS} ${MOAB_SOURCE_DIR}/parallel/ptest.cub )
-  set_source_files_properties( parallel/parallel_unit_tests.cpp
-    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
-
+    ${EXECUTABLE_OUTPUT_PATH}/parallel_unit_tests ${MPIEXEC_POSTFLAGS} -p 2 ${MOAB_SOURCE_DIR}/MeshFiles/unittest/ptest.cub )
+  
+  set_source_files_properties( parallel/pcomm_serial.cpp
+    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   add_executable ( pcomm_serial parallel/pcomm_serial.cpp )
   target_link_libraries( pcomm_serial MOAB )
   add_test( TestPCommSerial
     ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${MPIEXEC_PREFLAGS}
-    ${EXECUTABLE_OUTPUT_PATH}/pcomm_serial ${MPIEXEC_POSTFLAGS} ${MOAB_SOURCE_DIR}/parallel/ptest.cub )
-  set_source_files_properties( parallel/pcomm_serial.cpp
-    COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
+    ${EXECUTABLE_OUTPUT_PATH}/pcomm_serial ${MPIEXEC_POSTFLAGS} 1 ${MOAB_SOURCE_DIR}/MeshFiles/unittest/ptest.cub )
 
 endif ( MOAB_USE_MPI AND MPI_FOUND )

diff --git a/test/Makefile.am b/test/Makefile.am
index c31ac87..24de658 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -86,11 +86,11 @@ MOSTLYCLEANFILES = mb_write.g \
 range_test_SOURCES = range_test.cpp
 
 moab_test_SOURCES = MBTest.cpp
-moab_test_DEPENDENCIES = \
-	mb_big_test.g \
-	cell1.gen \
-	cell2.gen \
-	$(LDADD)
+#moab_test_DEPENDENCIES = \
+#	mb_big_test.g \
+#	cell1.gen \
+#	cell2.gen \
+#	$(LDADD)
 
 homxform_test_SOURCES = $(top_srcdir)/src/HomXform.cpp
 homxform_test_CPPFLAGS = -DTEST $(AM_CPPFLAGS) $(CPPFLAGS)

diff --git a/tools/mbcoupler/CMakeLists.txt b/tools/mbcoupler/CMakeLists.txt
index 019f939..5fd4438 100644
--- a/tools/mbcoupler/CMakeLists.txt
+++ b/tools/mbcoupler/CMakeLists.txt
@@ -5,6 +5,7 @@ include_directories(
     ${MOAB_SOURCE_DIR}/src/moab/point_locater/lotte
     ${MOAB_SOURCE_DIR}/itaps
     ${MOAB_SOURCE_DIR}/itaps/imesh
+    ${MOAB_BINARY_DIR}/itaps/imesh
     ${MOAB_BINARY_DIR}
     ${MOAB_BINARY_DIR}/src
     ${MOAB_BINARY_DIR}/src/parallel
@@ -35,13 +36,13 @@ if ( MOAB_USE_MPI )
   # Exercise the coupler and not just findpt:
   add_executable( mbcoupler_test mbcoupler_test.cpp )
   set_source_files_properties( mbcoupler_test.cpp
-    COMPILE_FLAGS "${MOAB_DEFINES}" )
+    COMPILE_FLAGS "${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   target_link_libraries( mbcoupler_test mbcoupler MOAB MOABpar )
   add_test( TestMBCoupler ${EXECUTABLE_OUTPUT_PATH}/mbcoupler_test )
 
   add_executable( ssn_test ssn_test.cpp )
   set_source_files_properties( ssn_test.cpp
-    COMPILE_FLAGS "${MOAB_DEFINES}" )
+    COMPILE_FLAGS "${MOAB_DEFINES} -DTEST -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
   target_link_libraries( ssn_test mbcoupler MOAB MOABpar )
-  add_test( TestMBCoupler ${EXECUTABLE_OUTPUT_PATH}/ssn_test )
+  add_test( TestSSN ${EXECUTABLE_OUTPUT_PATH}/ssn_test )
 endif ( MOAB_USE_MPI )

diff --git a/tools/refiner/CMakeLists.txt b/tools/refiner/CMakeLists.txt
index 459e6f6..701d0cc 100644
--- a/tools/refiner/CMakeLists.txt
+++ b/tools/refiner/CMakeLists.txt
@@ -43,5 +43,5 @@ target_link_libraries( test_mesh_refiner MOAB MOABrefiner )
 add_test( TestMeshRefiner
   ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ${MPIEXEC_PREFLAGS}
   ${EXECUTABLE_OUTPUT_PATH}/test_mesh_refiner ${MPIEXEC_POSTFLAGS}
-  ${MOAB_SOURCE_DIR}/refiner/fourVolsBare.cub )
+  ${MOAB_SOURCE_DIR}/tools/refiner/fourVolsBare.cub )
 


https://bitbucket.org/fathomteam/moab/commits/c099bb300618/
Changeset:   c099bb300618
Branch:      None
User:        vijaysm
Date:        2014-05-08 06:42:23
Summary:     Adding HDF5 and NetCDF CMake configuration fixes

Affected #:  2 files

diff --git a/config/FindHDF5.cmake b/config/FindHDF5.cmake
index f14395f..e4d8a35 100644
--- a/config/FindHDF5.cmake
+++ b/config/FindHDF5.cmake
@@ -1,23 +1,79 @@
 #
 # Find the native HDF5 includes and library
 #
-# HDF5_INCLUDE_DIR - where to find H5public.h, etc.
+# HDF5_INCLUDES    - where to find hdf5.h, H5public.h, etc.
 # HDF5_LIBRARIES   - List of fully qualified libraries to link against when using hdf5.
 # HDF5_FOUND       - Do not attempt to use hdf5 if "no" or undefined.
 
-FIND_PATH(HDF5_INCLUDE_DIR H5public.h
+set( HDF5_DIR "" CACHE PATH "Path to search for HDF5 header and library files" )
+set (HDF5_FOUND NO CACHE INTERNAL "Found HDF5 components successfully." )
+
+FIND_PATH(HDF5_INCLUDE_DIR
+  NAMES hdf5.h H5public.h
+  PATHS ${HDF5_DIR}/include
   /usr/local/include
   /usr/include
+  /opt/local/include
 )
 
-FIND_LIBRARY(HDF5_LIBRARY hdf5
-  /usr/local/lib
-  /usr/lib
+FIND_LIBRARY(HDF5_BASE_LIBRARY hdf5
+  PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
+)
+FIND_LIBRARY(HDF5_HLBASE_LIBRARY hdf5_hl
+  PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
 )
 
-IF(HDF5_INCLUDE_DIR)
-  IF(HDF5_LIBRARY)
-    SET( HDF5_LIBRARIES ${HDF5_LIBRARY} )
-    SET( HDF5_FOUND "YES" )
-  ENDIF(HDF5_LIBRARY)
-ENDIF(HDF5_INCLUDE_DIR)
+IF (NOT HDF5_FOUND)
+  IF (HDF5_INCLUDE_DIR AND HDF5_BASE_LIBRARY)
+    FIND_LIBRARY(HDF5_CXX_LIBRARY hdf5_cxx
+      PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
+    )
+    FIND_LIBRARY(HDF5_HLCXX_LIBRARY hdf5_hl_cxx
+      PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
+    )
+    FIND_LIBRARY(HDF5_FORT_LIBRARY hdf5_fortran
+      PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
+    )
+    FIND_LIBRARY(HDF5_HLFORT_LIBRARY
+      NAMES hdf5hl_fortran hdf5_hl_fortran
+      PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
+    )
+    SET( HDF5_INCLUDES "-I${HDF5_INCLUDE_DIR}" )
+    if (HDF5_FORT_LIBRARY)
+      FIND_PATH(HDF5_FORT_INCLUDE_DIR
+        NAMES hdf5.mod
+        PATHS ${HDF5_DIR}/include
+        ${HDF5_DIR}/include/fortran
+        /usr/local/include
+        /usr/include
+        /opt/local/include
+      )
+      if (HDF5_FORT_INCLUDE_DIR AND NOT ${HDF5_FORT_INCLUDE_DIR} STREQUAL ${HDF5_INCLUDE_DIR})
+        SET( HDF5_INCLUDES "${HDF5_INCLUDES} -I${HDF5_FORT_INCLUDE_DIR}" )
+      endif (HDF5_FORT_INCLUDE_DIR AND NOT ${HDF5_FORT_INCLUDE_DIR} STREQUAL ${HDF5_INCLUDE_DIR})
+      unset(HDF5_FORT_INCLUDE_DIR CACHE)
+    endif (HDF5_FORT_LIBRARY)
+    # Add the libraries based on availability
+    foreach (VARIANT CXX FORT BASE )
+      if (HDF5_HL${VARIANT}_LIBRARY)
+        list(APPEND HDF5_LIBRARIES ${HDF5_HL${VARIANT}_LIBRARY})
+      endif (HDF5_HL${VARIANT}_LIBRARY)
+      if (HDF5_${VARIANT}_LIBRARY)
+        list(APPEND HDF5_LIBRARIES ${HDF5_${VARIANT}_LIBRARY})
+      endif (HDF5_${VARIANT}_LIBRARY)
+      unset(HDF5_HL${VARIANT}_LIBRARY CACHE)
+      unset(HDF5_${VARIANT}_LIBRARY CACHE)
+    endforeach()
+    SET( HDF5_FOUND YES )
+    message (STATUS "---   HDF5 Configuration ::")
+    message (STATUS "        INCLUDES  : ${HDF5_INCLUDES}")
+    message (STATUS "        LIBRARIES : ${HDF5_LIBRARIES}")
+  ELSE (HDF5_INCLUDE_DIR AND HDF5_BASE_LIBRARY)
+    set( HDF5_FOUND NO )
+    message("finding HDF5 failed, please try to set the var HDF5_DIR")
+  ENDIF(HDF5_INCLUDE_DIR AND HDF5_BASE_LIBRARY)
+ENDIF (NOT HDF5_FOUND)
+
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (HDF5 "HDF5 not found, check environment variables HDF5_DIR"
+  HDF5_DIR HDF5_INCLUDES HDF5_LIBRARIES)

diff --git a/config/FindNetCDF.cmake b/config/FindNetCDF.cmake
index f9e655c..e0e988c 100644
--- a/config/FindNetCDF.cmake
+++ b/config/FindNetCDF.cmake
@@ -1,75 +1,85 @@
 #
 # Find NetCDF include directories and libraries
 #
-# NetCDF_INCLUDE_DIRECTORIES - where to find netcdf.h
+# NetCDF_INCLUDES            - list of include paths to find netcdf.h
 # NetCDF_LIBRARIES           - list of libraries to link against when using NetCDF
 # NetCDF_FOUND               - Do not attempt to use NetCDF if "no", "0", or undefined.
 
-set( NetCDF_PREFIX "" CACHE PATH "Path to search for NetCDF header and library files" )
+set (NetCDF_DIR "" CACHE PATH "Path to search for NetCDF header and library files" )
+set (NetCDF_FOUND NO CACHE INTERNAL "Found NetCDF components successfully." )
 
-find_path( NetCDF_INCLUDE_DIRECTORIES netcdf.h
+find_path( NetCDF_INCLUDE_DIR netcdf.h
+  ${NetCDF_DIR}
+  ${NetCDF_DIR}/include
   /usr/local/include
   /usr/include
 )
 
 find_library( NetCDF_C_LIBRARY
   NAMES netcdf
-  ${NetCDF_PREFIX}
-  ${NetCDF_PREFIX}/lib64
-  ${NetCDF_PREFIX}/lib
+  HINTS ${NetCDF_DIR}
+  ${NetCDF_DIR}/lib64
+  ${NetCDF_DIR}/lib
   /usr/local/lib64
   /usr/lib64
-  /usr/lib64/netcdf-3
+  /usr/lib64/netcdf
   /usr/local/lib
   /usr/lib
-  /usr/lib/netcdf-3
+  /usr/lib/netcdf
 )
 
 find_library( NetCDF_CXX_LIBRARY
   NAMES netcdf_c++
-  ${NetCDF_PREFIX}
-  ${NetCDF_PREFIX}/lib64
-  ${NetCDF_PREFIX}/lib
+  HINTS ${NetCDF_DIR}
+  ${NetCDF_DIR}/lib64
+  ${NetCDF_DIR}/lib
   /usr/local/lib64
   /usr/lib64
-  /usr/lib64/netcdf-3
+  /usr/lib64/netcdf
   /usr/local/lib
   /usr/lib
-  /usr/lib/netcdf-3
+  /usr/lib/netcdf
 )
 
 find_library( NetCDF_FORTRAN_LIBRARY
   NAMES netcdf_g77 netcdf_ifc netcdf_x86_64
-  ${NetCDF_PREFIX}
-  ${NetCDF_PREFIX}/lib64
-  ${NetCDF_PREFIX}/lib
+  HINTS ${NetCDF_DIR}
+  ${NetCDF_DIR}/lib64
+  ${NetCDF_DIR}/lib
   /usr/local/lib64
   /usr/lib64
-  /usr/lib64/netcdf-3
+  /usr/lib64/netcdf
   /usr/local/lib
   /usr/lib
-  /usr/lib/netcdf-3
+  /usr/lib/netcdf
 )
 
-set( NetCDF_LIBRARIES
-  ${NetCDF_C_LIBRARY}
-  ${NetCDF_CXX_LIBRARY}
-)
-
-set( NetCDF_FORTRAN_LIBRARIES
-  ${NetCDF_FORTRAN_LIBRARY}
-)
-
-if ( NetCDF_INCLUDE_DIRECTORIES AND NetCDF_LIBRARIES )
-  set( NetCDF_FOUND 1 )
-else ( NetCDF_INCLUDE_DIRECTORIES AND NetCDF_LIBRARIES )
-  set( NetCDF_FOUND 0 )
-endif ( NetCDF_INCLUDE_DIRECTORIES AND NetCDF_LIBRARIES )
+IF (NOT NetCDF_FOUND)
+  if ( NetCDF_INCLUDE_DIR AND NetCDF_C_LIBRARY )
+    set( NetCDF_FOUND YES )
+    set(NetCDF_INCLUDES "-I${NetCDF_INCLUDE_DIR}")
+    set(NetCDF_LIBRARIES ${NetCDF_C_LIBRARY})
+    if ( NetCDF_CXX_LIBRARY )
+      set(NetCDF_LIBRARIES ${NetCDF_LIBRARIES} ${NetCDF_CXX_LIBRARY})
+    endif ( NetCDF_CXX_LIBRARY )
+    if ( NetCDF_FORTRAN_LIBRARY )
+      set(NetCDF_LIBRARIES ${NetCDF_LIBRARIES} ${NetCDF_FORTRAN_LIBRARY})
+    endif ( NetCDF_FORTRAN_LIBRARY )
+    message (STATUS "---   NetCDF Configuration ::")
+    message (STATUS "        INCLUDES  : ${NetCDF_INCLUDES}")
+    message (STATUS "        LIBRARIES : ${NetCDF_LIBRARIES}")
+  else ( NetCDF_INCLUDE_DIR AND NetCDF_C_LIBRARY )
+    set( NetCDF_FOUND NO )
+    message("finding NetCDF failed, please try to set the var NetCDF_DIR")
+  endif ( NetCDF_INCLUDE_DIR AND NetCDF_C_LIBRARY )
+ENDIF (NOT NetCDF_FOUND)
 
 mark_as_advanced(
-  NetCDF_PREFIX
-  NetCDF_INCLUDE_DIRECTORIES
-  NetCDF_C_LIBRARY
-  NetCDF_CXX_LIBRARY
-  NetCDF_FORTRAN_LIBRARY
+  NetCDF_DIR
+  NetCDF_INCLUDES
+  NetCDF_LIBRARIES
 )
+
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (NetCDF "NetCDF not found, check environment variables NetCDF_DIR"
+  NetCDF_DIR NetCDF_INCLUDES NetCDF_LIBRARIES)


https://bitbucket.org/fathomteam/moab/commits/13601b405122/
Changeset:   13601b405122
Branch:      None
User:        judajake
Date:        2014-05-12 20:08:47
Summary:     Merge branch 'cmake-additions' into initial_cmake

* cmake-additions: (227 commits)
  Adding HDF5 and NetCDF CMake configuration fixes
  Updated some comments for NC writer.
  Refactored NC writer code to separate writing of set variables (including used coordinates) and non-set variables.
  advection should compile without cgm stdc++ libraies were missing, if compiled just with mpif90 need to understand better the dependencies for linking moab / imesh with fortran90 code
  zoltan partition for gcrm
  add a zoltan test partition for gcrm
  add a parallel read test for gcrm
  edge indexing error for GCRM correct all edge indices, not only half
  more changes in jeff's fork
  some changes for jeff's fork
  For non-coordinate variable "double xtime(Time)" of MPAS, treat it as a set variable with time steps.
  For structured grids like CAM_EUL or CAM_FV, we should create COORDS tag only once after the mesh is created.
  first go at converting MPAS reader to GCRM
  Applied TIMESTEP write option to NC writer.
  Cleaned up some code for NC writer.
  Updated unit test write_nc. One major change is that we no longer use NC reader to check the output files.
  Minor updates for unit test write_nc.
  append error when build with netcdf only
  Updated unit test write_nc for serial MOAB, which failed with "PARALLEL option not valid, this instance compiled for serial execution".
  filter out not owned entities, for writing
  ...

Conflicts:
	CMakeLists.txt
	itaps/imesh/CMakeLists.txt
	src/CMakeLists.txt
	test/CMakeLists.txt
	tools/mbcoupler/CMakeLists.txt

Affected #:  100 files

diff --git a/.gitignore b/.gitignore
index eb99939..d686ffa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,14 +31,13 @@ doc/config.tex
 doc/dev.dox
 doc/user/*
 doc/user.dox
+examples/CrystalRouterExample
 examples/DeformMeshRemap
 examples/DirectAccessNoHoles
 examples/DirectAccessNoHolesF90
 examples/DirectAccessWithHoles
 examples/examples.make
 examples/freem.mod
-examples/FileRead
-examples/GeomSetHierarchy
 examples/GetEntities
 examples/*.h5m
 examples/HelloMOAB
@@ -48,17 +47,14 @@ examples/itaps/ListSetsNTagsCXX
 examples/itaps/ListSetsNTagsF90
 examples/itaps/TagIterateC
 examples/itaps/TagIterateF
-examples/KDTree
 examples/LloydRelaxation
-examples/ObbTree
+examples/LoadPartial
 examples/point_in_elem_search
 examples/PushParMeshIntoMoabF90
 examples/ReduceExchangeTags
 examples/SetsNTags
-examples/SkinMesh
 examples/structuredmesh
 examples/StructuredMeshSimple
-examples/SurfArea
 examples/TestExodusII
 history??.jou
 hpctoolkit-*
@@ -131,6 +127,9 @@ test/bsp_tree_test
 test/CMakeLists.txt
 test/coords_connect_iterate
 test/cropvol_test
+test/dagmc/dagmc_pointinvol_test
+test/dagmc/dagmc_rayfire_test
+test/dagmc/dagmc_simple_test
 test/dual/dual_test
 test/elem_eval_test
 test/file_options_test
@@ -156,9 +155,12 @@ test/io/*.g
 test/io/gmsh_test
 test/io/ideas_test
 test/io/nastran_test
+test/io/*.nc
 test/io/read_cgm_basic_test
+test/io/read_cgm_connectivity_test
+test/io/read_cgm_group_test
 test/io/read_cgm_load_test
-test/io/read_cgm_test
+test/io/read_cgm_senses_test
 test/io/read_mpas_nc
 test/io/read_nc
 test/io/read_ucd_nc
@@ -167,6 +169,7 @@ test/io/smf_test
 test/io/stl_test
 test/io/tqdcfr
 test/io/vtk_test
+test/io/write_nc
 test/kd_tree_test
 test/kd_tree_time
 test/kd_tree_tool
@@ -186,6 +189,7 @@ test/parallel/*.h5m
 test/parallel/mbparallelcomm_test
 test/parallel/mhdf_parallel
 test/parallel/mpastrvpart
+test/parallel/*.nc
 test/parallel/par_coupler_test
 test/parallel/par_intx_sph
 test/parallel/parallel_hdf5_test
@@ -205,6 +209,7 @@ test/parallel/structured3
 test/parallel/uber_parallel_test
 test/parallel/ucdtrvpart
 test/parallel/*.vtk
+test/parallel/write_nc_par
 test/perf/adj_time
 test/perf/perf
 test/perf/perftool

diff --git a/MeshFiles/unittest/Makefile.am b/MeshFiles/unittest/Makefile.am
index ab3e23e..bc4f522 100644
--- a/MeshFiles/unittest/Makefile.am
+++ b/MeshFiles/unittest/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = io
+SUBDIRS = io dagmc iGeom
 
 EXTRA_DIST  = 125hex.g \
               16_unmerged_hex.h5m \

diff --git a/MeshFiles/unittest/dagmc/Makefile.am b/MeshFiles/unittest/dagmc/Makefile.am
new file mode 100644
index 0000000..0643ad9
--- /dev/null
+++ b/MeshFiles/unittest/dagmc/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST =  test_geom.h5m

diff --git a/MeshFiles/unittest/dagmc/test_geom.h5m b/MeshFiles/unittest/dagmc/test_geom.h5m
new file mode 100644
index 0000000..18e1d36
Binary files /dev/null and b/MeshFiles/unittest/dagmc/test_geom.h5m differ

diff --git a/MeshFiles/unittest/iGeom/Makefile.am b/MeshFiles/unittest/iGeom/Makefile.am
new file mode 100644
index 0000000..203b676
--- /dev/null
+++ b/MeshFiles/unittest/iGeom/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST = shell.h5m

diff --git a/MeshFiles/unittest/io/cylcube.sat b/MeshFiles/unittest/io/cylcube.sat
new file mode 100644
index 0000000..0b65976
--- /dev/null
+++ b/MeshFiles/unittest/io/cylcube.sat
@@ -0,0 +1,202 @@
+1900 0 2 0           
+10 Cubit 12.2 17 ACIS 19.0.2 Linux 24 Thu Feb  6 08:36:54 2014 
+1 9.9999999999999995e-07 1e-10 
+body $2 -1 -1 $-1 $3 $-1 $4 T 25 -5 -5 35 5 5 #
+body $5 -1 -1 $-1 $6 $-1 $-1 T -5 -5 -5 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $7 $-1 $0 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+lump $8 -1 -1 $-1 $-1 $9 $0 T 25 -5 -5 35 5 5 #
+transform $-1 -1 1 0 0 0 1 0 0 0 1 0 0 0 1 no_rotate no_reflect no_shear #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $10 $-1 $1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+lump $11 -1 -1 $-1 $-1 $12 $1 T -5 -5 -5 5 5 5 #
+simple-snl-attrib $-1 -1 $-1 $2 $0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 1 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $13 $-1 $3 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+shell $-1 -1 -1 $-1 $-1 $-1 $14 $-1 $3 T 25 -5 -5 35 5 5 #
+simple-snl-attrib $-1 -1 $-1 $5 $1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 2 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $15 $-1 $6 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+shell $-1 -1 -1 $-1 $-1 $-1 $16 $-1 $6 T -5 -5 -5 5 5 5 #
+simple-snl-attrib $-1 -1 $17 $8 $3 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 1 -2147483648 -1 #
+face $18 -1 -1 $-1 $19 $20 $9 $-1 $21 forward single T 25 -5 5 35 5 5 F #
+simple-snl-attrib $-1 -1 $22 $11 $6 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 2 -2147483648 -1 #
+face $23 -1 -1 $-1 $24 $25 $12 $-1 $26 forward single T -5 -5 -5 5 5 5 F #
+simple-snl-attrib $-1 -1 $27 $13 $3 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 2 @5 GROUP @7 Group 2 0 7 1 2 618932362 0 0 0 0 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $28 $-1 $14 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+face $29 -1 -1 $-1 $30 $31 $9 $-1 $32 reversed single T 25 -5 -5 35 5 -5 F #
+loop $-1 -1 -1 $-1 $-1 $33 $14 T 25 -5 5 35 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 30 0 5 0 0 1 1 0 0 forward_v I I I I #
+simple-snl-attrib $-1 -1 $34 $15 $6 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 2 @5 GROUP @7 Group 3 0 7 1 3 885205176 0 0 0 0 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $35 $-1 $16 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 7 #
+face $36 -1 -1 $-1 $37 $38 $12 $-1 $39 forward single T -5 -5 -5 5 5 -5 F #
+loop $-1 -1 -1 $-1 $40 $41 $16 T -5 -5 -5 5 5 -5 unknown #
+cone-surface $-1 -1 -1 $-1 0 0 0 0 0 1 5 0 0 1 I I 0 1 5 forward I I I I #
+simple-snl-attrib $-1 -1 $-1 $17 $3 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 7 @16 GRAPHICS_OPTIONS @14 geometry color @10 mesh color @19 geometry visibility @15 mesh visibility @11 render mode @11 transparent 0 6 4 4 1 1 0 0 #
+simple-snl-attrib $-1 -1 $42 $18 $14 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 1 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $43 $-1 $19 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+face $44 -1 -1 $-1 $45 $46 $9 $-1 $47 reversed single T 25 -5 -5 35 -5 5 F #
+loop $-1 -1 -1 $-1 $-1 $48 $19 T 25 -5 -5 35 5 -5 unknown #
+plane-surface $-1 -1 -1 $-1 30 0 -5 0 0 1 1 0 0 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $49 $50 $51 $52 forward $20 $-1 #
+simple-snl-attrib $-1 -1 $-1 $22 $6 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 7 @16 GRAPHICS_OPTIONS @14 geometry color @10 mesh color @19 geometry visibility @15 mesh visibility @11 render mode @11 transparent 0 6 5 5 1 1 0 0 #
+simple-snl-attrib $-1 -1 $53 $23 $16 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 7 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $54 $-1 $24 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 8 #
+face $55 -1 -1 $-1 $-1 $56 $12 $-1 $57 forward single T -5 -5 5 5 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $58 $24 T -5 -5 -5 5 5 -5 unknown #
+plane-surface $-1 -1 -1 $-1 0 0 -5 0 0 -1 -1 0 0 forward_v I I I I #
+loop $-1 -1 -1 $-1 $-1 $59 $16 T -5 -5 5 5 5 5 unknown #
+coedge $-1 -1 -1 $-1 $41 $41 $58 $60 reversed $25 $-1 #
+simple-snl-attrib $-1 -1 $-1 $28 $14 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+simple-snl-attrib $-1 -1 $61 $29 $19 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 2 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $62 $-1 $30 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 3 #
+face $63 -1 -1 $-1 $64 $65 $9 $-1 $66 reversed single T 25 -5 -5 25 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $67 $30 T 25 -5 -5 35 -5 5 unknown #
+plane-surface $-1 -1 -1 $-1 30 -5 0 0 1 0 0 0 1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $68 $69 $70 $71 forward $31 $-1 #
+coedge $-1 -1 -1 $-1 $72 $33 $73 $74 forward $20 $-1 #
+coedge $-1 -1 -1 $-1 $33 $72 $75 $76 forward $20 $-1 #
+coedge $-1 -1 -1 $-1 $77 $78 $33 $52 reversed $79 $-1 #
+edge $80 -1 -1 $-1 $81 -5 $82 5 $51 $83 forward @7 unknown T 35 -5 5 35 5 5 #
+simple-snl-attrib $-1 -1 $-1 $35 $16 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+simple-snl-attrib $-1 -1 $84 $36 $24 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 8 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $85 $-1 $37 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 9 #
+loop $-1 -1 -1 $-1 $-1 $86 $37 T -5 -5 5 5 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 0 0 5 0 0 1 1 0 0 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $58 $58 $41 $60 forward $38 $-1 #
+coedge $-1 -1 -1 $-1 $59 $59 $86 $87 reversed $40 $-1 #
+edge $88 -1 -1 $-1 $89 0 $89 6.2831853071795862 $58 $90 forward @7 unknown T -5 -5 -5 5 5 -5 #
+simple-snl-attrib $-1 -1 $-1 $43 $19 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+simple-snl-attrib $-1 -1 $91 $44 $30 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 3 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $92 $-1 $45 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 4 #
+face $93 -1 -1 $-1 $94 $95 $9 $-1 $96 reversed single T 25 5 -5 35 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $97 $45 T 25 -5 -5 25 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 25 0 0 1 0 0 0 0 -1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $98 $75 $99 $100 forward $46 $-1 #
+coedge $-1 -1 -1 $-1 $101 $48 $98 $102 forward $31 $-1 #
+coedge $-1 -1 -1 $-1 $48 $101 $103 $104 forward $31 $-1 #
+coedge $-1 -1 -1 $-1 $78 $77 $48 $71 reversed $79 $-1 #
+edge $105 -1 -1 $-1 $106 -5 $107 5 $70 $108 forward @7 unknown T 35 -5 -5 35 5 -5 #
+coedge $-1 -1 -1 $-1 $50 $49 $109 $110 forward $20 $-1 #
+coedge $-1 -1 -1 $-1 $111 $112 $49 $74 reversed $95 $-1 #
+edge $113 -1 -1 $-1 $82 -5 $114 5 $73 $115 forward @7 unknown T 25 5 5 35 5 5 #
+coedge $-1 -1 -1 $-1 $67 $116 $50 $76 reversed $46 $-1 #
+edge $117 -1 -1 $-1 $118 -5 $81 5 $75 $119 forward @7 unknown T 25 -5 5 35 -5 5 #
+coedge $-1 -1 -1 $-1 $70 $51 $116 $120 forward $79 $-1 #
+coedge $-1 -1 -1 $-1 $51 $70 $111 $121 reversed $79 $-1 #
+loop $-1 -1 -1 $-1 $-1 $77 $94 T 35 -5 -5 35 5 5 unknown #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $122 $-1 $52 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+vertex $123 -1 -1 $-1 $52 $124 #
+vertex $125 -1 -1 $-1 $52 $126 #
+straight-curve $-1 -1 -1 $-1 35 0 5 0 1 0 I I #
+simple-snl-attrib $-1 -1 $-1 $54 $24 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+simple-snl-attrib $-1 -1 $127 $55 $37 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 9 -2147483648 -1 #
+coedge $-1 -1 -1 $-1 $86 $86 $59 $87 forward $56 $-1 #
+edge $128 -1 -1 $-1 $129 0 $129 6.2831853071795862 $86 $130 forward @7 unknown T -5 -5 5 5 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $131 $-1 $60 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 13 #
+vertex $132 -1 -1 $-1 $60 $133 #
+ellipse-curve $-1 -1 -1 $-1 0 0 -5 0 0 -1 5 0 0 1 I I #
+simple-snl-attrib $-1 -1 $-1 $62 $30 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+simple-snl-attrib $-1 -1 $134 $63 $45 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 4 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $135 $-1 $64 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 5 #
+face $136 -1 -1 $-1 $-1 $79 $9 $-1 $137 reversed single T 35 -5 -5 35 5 5 F #
+loop $-1 -1 -1 $-1 $-1 $111 $64 T 25 5 -5 35 5 5 unknown #
+plane-surface $-1 -1 -1 $-1 30 5 0 0 -1 0 0 0 -1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $138 $109 $112 $139 forward $65 $-1 #
+coedge $-1 -1 -1 $-1 $116 $67 $68 $102 reversed $46 $-1 #
+coedge $-1 -1 -1 $-1 $109 $138 $67 $100 reversed $65 $-1 #
+edge $140 -1 -1 $-1 $118 -5 $141 5 $99 $142 forward @7 unknown T 25 -5 -5 25 -5 5 #
+coedge $-1 -1 -1 $-1 $69 $68 $138 $143 forward $31 $-1 #
+edge $144 -1 -1 $-1 $107 -5 $141 5 $98 $145 forward @7 unknown T 25 -5 -5 35 -5 -5 #
+coedge $-1 -1 -1 $-1 $112 $111 $69 $104 reversed $95 $-1 #
+edge $146 -1 -1 $-1 $147 -5 $106 5 $103 $148 forward @7 unknown T 25 5 -5 35 5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $149 $-1 $71 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 5 #
+vertex $150 -1 -1 $-1 $71 $151 #
+vertex $152 -1 -1 $-1 $120 $153 #
+straight-curve $-1 -1 -1 $-1 35 0 -5 0 -1 0 I I #
+coedge $-1 -1 -1 $-1 $97 $99 $72 $110 reversed $65 $-1 #
+edge $154 -1 -1 $-1 $114 -5 $118 5 $109 $155 forward @7 unknown T 25 -5 5 25 5 5 #
+coedge $-1 -1 -1 $-1 $103 $73 $78 $121 forward $95 $-1 #
+coedge $-1 -1 -1 $-1 $73 $103 $97 $139 reversed $95 $-1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $156 $-1 $74 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+vertex $157 -1 -1 $-1 $74 $158 #
+straight-curve $-1 -1 -1 $-1 30 5 5 -1 0 0 I I #
+coedge $-1 -1 -1 $-1 $75 $98 $77 $120 reversed $46 $-1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $159 $-1 $76 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 4 #
+vertex $160 -1 -1 $-1 $110 $161 #
+straight-curve $-1 -1 -1 $-1 30 -5 5 1 0 0 I I #
+edge $162 -1 -1 $-1 $81 -5 $107 5 $77 $163 forward @7 unknown T 35 -5 -5 35 -5 5 #
+edge $164 -1 -1 $-1 $82 -5 $106 5 $78 $165 forward @7 unknown T 35 5 -5 35 5 5 #
+simple-snl-attrib $-1 -1 $-1 $80 $52 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 1 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $166 $-1 $81 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 1 #
+point $-1 -1 -1 $-1 35 -5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $167 $-1 $82 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 2 #
+point $-1 -1 -1 $-1 35 5 5 #
+simple-snl-attrib $-1 -1 $-1 $85 $37 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $168 $-1 $87 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 14 #
+vertex $169 -1 -1 $-1 $87 $170 #
+ellipse-curve $-1 -1 -1 $-1 0 0 5 0 0 1 5 0 0 1 I I #
+simple-snl-attrib $-1 -1 $-1 $88 $60 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 13 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $171 $-1 $89 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 9 #
+point $-1 -1 -1 $-1 5 0 -5 #
+simple-snl-attrib $-1 -1 $-1 $92 $45 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+simple-snl-attrib $-1 -1 $172 $93 $64 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 5 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $173 $-1 $94 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 6 #
+plane-surface $-1 -1 -1 $-1 35 0 0 -1 0 0 0 0 1 forward_v I I I I #
+coedge $-1 -1 -1 $-1 $99 $97 $101 $143 reversed $65 $-1 #
+edge $174 -1 -1 $-1 $114 -5 $147 5 $112 $175 forward @7 unknown T 25 5 -5 25 5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $176 $-1 $100 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 9 #
+vertex $177 -1 -1 $-1 $143 $178 #
+straight-curve $-1 -1 -1 $-1 25 -5 0 0 0 -1 I I #
+edge $179 -1 -1 $-1 $141 -5 $147 5 $138 $180 forward @7 unknown T 25 -5 -5 25 5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $181 $-1 $102 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 6 #
+straight-curve $-1 -1 -1 $-1 30 -5 -5 -1 0 0 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $182 $-1 $104 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 8 #
+vertex $183 -1 -1 $-1 $104 $184 #
+straight-curve $-1 -1 -1 $-1 30 5 -5 1 0 0 I I #
+simple-snl-attrib $-1 -1 $-1 $105 $71 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 5 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $185 $-1 $106 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 5 #
+point $-1 -1 -1 $-1 35 5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $186 $-1 $107 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 6 #
+point $-1 -1 -1 $-1 35 -5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $187 $-1 $110 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 3 #
+straight-curve $-1 -1 -1 $-1 25 0 5 0 -1 0 I I #
+simple-snl-attrib $-1 -1 $-1 $113 $74 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 2 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $188 $-1 $114 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 3 #
+point $-1 -1 -1 $-1 25 5 5 #
+simple-snl-attrib $-1 -1 $-1 $117 $76 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 4 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $189 $-1 $118 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 4 #
+point $-1 -1 -1 $-1 25 -5 5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $190 $-1 $120 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 10 #
+straight-curve $-1 -1 -1 $-1 35 -5 0 0 0 -1 I I #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $191 $-1 $121 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 12 #
+straight-curve $-1 -1 -1 $-1 35 5 0 0 0 -1 I I #
+simple-snl-attrib $-1 -1 $-1 $123 $81 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 1 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $125 $82 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 2 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $128 $87 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 14 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $192 $-1 $129 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 10 #
+point $-1 -1 -1 $-1 5 0 5 #
+simple-snl-attrib $-1 -1 $-1 $132 $89 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 9 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $135 $64 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+simple-snl-attrib $-1 -1 $193 $136 $94 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 6 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $194 $-1 $139 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 11 #
+straight-curve $-1 -1 -1 $-1 25 5 0 0 0 -1 I I #
+simple-snl-attrib $-1 -1 $-1 $140 $100 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 9 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $195 $-1 $141 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 7 #
+point $-1 -1 -1 $-1 25 -5 -5 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $196 $-1 $143 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 7 #
+straight-curve $-1 -1 -1 $-1 25 0 -5 0 1 0 I I #
+simple-snl-attrib $-1 -1 $-1 $144 $102 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 6 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $146 $104 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 8 -2147483648 -1 #
+integer_attrib-name_attrib-gen-attrib $-1 -1 $197 $-1 $147 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 @8 CUBIT_ID 8 #
+point $-1 -1 -1 $-1 25 5 -5 #
+simple-snl-attrib $-1 -1 $-1 $150 $106 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 5 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $152 $107 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 6 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $154 $110 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 3 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $157 $114 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 3 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $160 $118 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 4 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $162 $120 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 10 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $164 $121 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 12 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $169 $129 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 10 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $173 $94 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 3 @13 MESH_INTERVAL @4 LIMP @4 LIMP 2 1 0 5 1 0 0 1 1 #
+simple-snl-attrib $-1 -1 $-1 $174 $139 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 11 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $177 $141 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 7 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $179 $143 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 7 -2147483648 -1 #
+simple-snl-attrib $-1 -1 $-1 $183 $147 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 @17 NEW_SIMPLE_ATTRIB 1 @9 ENTITY_ID 0 3 8 -2147483648 -1 #
+End-of-ACIS-data 
\ No newline at end of file

diff --git a/MeshFiles/unittest/io/cylcube.stp b/MeshFiles/unittest/io/cylcube.stp
new file mode 100644
index 0000000..bc4ec64
--- /dev/null
+++ b/MeshFiles/unittest/io/cylcube.stp
@@ -0,0 +1,290 @@
+ISO-10303-21;
+HEADER;
+FILE_DESCRIPTION(('STEP AP214'),'1');
+FILE_NAME('/home/user/cylcube.stp','2014-02-15T18:13:39',(' '),(' '),'Spatial InterOp 3D',' ',' ');
+FILE_SCHEMA(('automotive_design'));
+ENDSEC;
+DATA;
+#1=PRODUCT_DEFINITION_CONTEXT('',#13,'design');
+#2=APPLICATION_PROTOCOL_DEFINITION('INTERNATIONAL STANDARD','automotive_design',1994,#13);
+#3=PRODUCT_CATEGORY_RELATIONSHIP('NONE','NONE',#14,#15);
+#4=SHAPE_DEFINITION_REPRESENTATION(#16,#17);
+#5=PRODUCT_DEFINITION_CONTEXT('',#18,'design');
+#6=APPLICATION_PROTOCOL_DEFINITION('INTERNATIONAL STANDARD','automotive_design',1994,#18);
+#7=PRODUCT_CATEGORY_RELATIONSHIP('NONE','NONE',#19,#20);
+#8=SHAPE_DEFINITION_REPRESENTATION(#21,#22);
+#9= (GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#25))GLOBAL_UNIT_ASSIGNED_CONTEXT((#27,#28,#29))REPRESENTATION_CONTEXT('NONE','WORKSPACE'));
+#13=APPLICATION_CONTEXT(' ');
+#14=PRODUCT_CATEGORY('part','NONE');
+#15=PRODUCT_RELATED_PRODUCT_CATEGORY('detail',' ',(#31));
+#16=PRODUCT_DEFINITION_SHAPE('NONE','NONE',#32);
+#17=ADVANCED_BREP_SHAPE_REPRESENTATION('1',(#33,#34),#9);
+#18=APPLICATION_CONTEXT(' ');
+#19=PRODUCT_CATEGORY('part','NONE');
+#20=PRODUCT_RELATED_PRODUCT_CATEGORY('detail',' ',(#35));
+#21=PRODUCT_DEFINITION_SHAPE('NONE','NONE',#36);
+#22=ADVANCED_BREP_SHAPE_REPRESENTATION('2',(#37,#38),#9);
+#25=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0E-06),#27,'','');
+#27= (CONVERSION_BASED_UNIT('MILLIMETRE',#41)LENGTH_UNIT()NAMED_UNIT(#44));
+#28= (NAMED_UNIT(#46)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#29= (NAMED_UNIT(#46)SOLID_ANGLE_UNIT()SI_UNIT($,.STERADIAN.));
+#31=PRODUCT('1','1','PART-1-DESC',(#52));
+#32=PRODUCT_DEFINITION('NONE','NONE',#53,#1);
+#33=MANIFOLD_SOLID_BREP('1',#54);
+#34=AXIS2_PLACEMENT_3D('',#55,#56,#57);
+#35=PRODUCT('2','2','PART-2-DESC',(#58));
+#36=PRODUCT_DEFINITION('NONE','NONE',#59,#5);
+#37=MANIFOLD_SOLID_BREP('2',#60);
+#38=AXIS2_PLACEMENT_3D('',#61,#62,#63);
+#41=LENGTH_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0),#64);
+#44=DIMENSIONAL_EXPONENTS(1.0,0.0,0.0,0.0,0.0,0.0,0.0);
+#46=DIMENSIONAL_EXPONENTS(0.0,0.0,0.0,0.0,0.0,0.0,0.0);
+#52=PRODUCT_CONTEXT('',#13,'mechanical');
+#53=PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE(' ','NONE',#31,.NOT_KNOWN.);
+#54=CLOSED_SHELL('',(#65,#66,#67,#68,#69,#70));
+#55=CARTESIAN_POINT('',(0.0,0.0,0.0));
+#56=DIRECTION('',(0.0,0.0,1.0));
+#57=DIRECTION('',(1.0,0.0,0.0));
+#58=PRODUCT_CONTEXT('',#18,'mechanical');
+#59=PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE(' ','NONE',#35,.NOT_KNOWN.);
+#60=CLOSED_SHELL('',(#71,#72,#73,#74));
+#61=CARTESIAN_POINT('',(0.0,0.0,0.0));
+#62=DIRECTION('',(0.0,0.0,1.0));
+#63=DIRECTION('',(1.0,0.0,0.0));
+#64= (NAMED_UNIT(#44)LENGTH_UNIT()SI_UNIT(.MILLI.,.METRE.));
+#65=ADVANCED_FACE('',(#76),#77,.T.);
+#66=ADVANCED_FACE('',(#78),#79,.F.);
+#67=ADVANCED_FACE('',(#80),#81,.F.);
+#68=ADVANCED_FACE('',(#82),#83,.F.);
+#69=ADVANCED_FACE('',(#84),#85,.F.);
+#70=ADVANCED_FACE('',(#86),#87,.F.);
+#71=ADVANCED_FACE('',(#88),#89,.T.);
+#72=ADVANCED_FACE('',(#90),#91,.T.);
+#73=ADVANCED_FACE('',(#92),#93,.T.);
+#74=ADVANCED_FACE('',(#94),#95,.T.);
+#76=FACE_OUTER_BOUND('',#96,.T.);
+#77=PLANE('',#97);
+#78=FACE_OUTER_BOUND('',#98,.T.);
+#79=PLANE('',#99);
+#80=FACE_OUTER_BOUND('',#100,.T.);
+#81=PLANE('',#101);
+#82=FACE_OUTER_BOUND('',#102,.T.);
+#83=PLANE('',#103);
+#84=FACE_OUTER_BOUND('',#104,.T.);
+#85=PLANE('',#105);
+#86=FACE_OUTER_BOUND('',#106,.T.);
+#87=PLANE('',#107);
+#88=FACE_OUTER_BOUND('',#108,.T.);
+#89=CYLINDRICAL_SURFACE('',#109,5.0);
+#90=FACE_OUTER_BOUND('',#110,.T.);
+#91=CYLINDRICAL_SURFACE('',#111,5.0);
+#92=FACE_OUTER_BOUND('',#112,.T.);
+#93=PLANE('',#113);
+#94=FACE_OUTER_BOUND('',#114,.T.);
+#95=PLANE('',#115);
+#96=EDGE_LOOP('',(#116,#117,#118,#119));
+#97=AXIS2_PLACEMENT_3D('',#120,#121,#122);
+#98=EDGE_LOOP('',(#123,#124,#125,#126));
+#99=AXIS2_PLACEMENT_3D('',#127,#128,#129);
+#100=EDGE_LOOP('',(#130,#131,#132,#133));
+#101=AXIS2_PLACEMENT_3D('',#134,#135,#136);
+#102=EDGE_LOOP('',(#137,#138,#139,#140));
+#103=AXIS2_PLACEMENT_3D('',#141,#142,#143);
+#104=EDGE_LOOP('',(#144,#145,#146,#147));
+#105=AXIS2_PLACEMENT_3D('',#148,#149,#150);
+#106=EDGE_LOOP('',(#151,#152,#153,#154));
+#107=AXIS2_PLACEMENT_3D('',#155,#156,#157);
+#108=EDGE_LOOP('',(#158,#159,#160,#161));
+#109=AXIS2_PLACEMENT_3D('',#162,#163,#164);
+#110=EDGE_LOOP('',(#165,#166,#167,#168));
+#111=AXIS2_PLACEMENT_3D('',#169,#170,#171);
+#112=EDGE_LOOP('',(#172,#173));
+#113=AXIS2_PLACEMENT_3D('',#174,#175,#176);
+#114=EDGE_LOOP('',(#177,#178));
+#115=AXIS2_PLACEMENT_3D('',#179,#180,#181);
+#116=ORIENTED_EDGE('',*,*,#182,.T.);
+#117=ORIENTED_EDGE('',*,*,#183,.T.);
+#118=ORIENTED_EDGE('',*,*,#184,.T.);
+#119=ORIENTED_EDGE('',*,*,#185,.T.);
+#120=CARTESIAN_POINT('',(30.0,0.0,5.0));
+#121=DIRECTION('',(0.0,0.0,1.0));
+#122=DIRECTION('',(1.0,0.0,0.0));
+#123=ORIENTED_EDGE('',*,*,#186,.T.);
+#124=ORIENTED_EDGE('',*,*,#187,.T.);
+#125=ORIENTED_EDGE('',*,*,#188,.T.);
+#126=ORIENTED_EDGE('',*,*,#189,.T.);
+#127=CARTESIAN_POINT('',(30.0,0.0,-5.0));
+#128=DIRECTION('',(0.0,0.0,1.0));
+#129=DIRECTION('',(1.0,0.0,0.0));
+#130=ORIENTED_EDGE('',*,*,#190,.T.);
+#131=ORIENTED_EDGE('',*,*,#187,.F.);
+#132=ORIENTED_EDGE('',*,*,#191,.F.);
+#133=ORIENTED_EDGE('',*,*,#185,.F.);
+#134=CARTESIAN_POINT('',(30.0,-5.0,0.0));
+#135=DIRECTION('',(0.0,1.0,0.0));
+#136=DIRECTION('',(0.0,0.0,1.0));
+#137=ORIENTED_EDGE('',*,*,#192,.T.);
+#138=ORIENTED_EDGE('',*,*,#188,.F.);
+#139=ORIENTED_EDGE('',*,*,#190,.F.);
+#140=ORIENTED_EDGE('',*,*,#184,.F.);
+#141=CARTESIAN_POINT('',(25.0,0.0,0.0));
+#142=DIRECTION('',(1.0,0.0,0.0));
+#143=DIRECTION('',(0.0,0.0,-1.0));
+#144=ORIENTED_EDGE('',*,*,#193,.T.);
+#145=ORIENTED_EDGE('',*,*,#189,.F.);
+#146=ORIENTED_EDGE('',*,*,#192,.F.);
+#147=ORIENTED_EDGE('',*,*,#183,.F.);
+#148=CARTESIAN_POINT('',(30.0,5.0,0.0));
+#149=DIRECTION('',(0.0,-1.0,0.0));
+#150=DIRECTION('',(0.0,0.0,-1.0));
+#151=ORIENTED_EDGE('',*,*,#191,.T.);
+#152=ORIENTED_EDGE('',*,*,#186,.F.);
+#153=ORIENTED_EDGE('',*,*,#193,.F.);
+#154=ORIENTED_EDGE('',*,*,#182,.F.);
+#155=CARTESIAN_POINT('',(35.0,0.0,0.0));
+#156=DIRECTION('',(-1.0,0.0,0.0));
+#157=DIRECTION('',(0.0,0.0,1.0));
+#158=ORIENTED_EDGE('',*,*,#194,.F.);
+#159=ORIENTED_EDGE('',*,*,#195,.F.);
+#160=ORIENTED_EDGE('',*,*,#196,.F.);
+#161=ORIENTED_EDGE('',*,*,#197,.F.);
+#162=CARTESIAN_POINT('',(0.0,0.0,0.0));
+#163=DIRECTION('',(0.0,0.0,1.0));
+#164=DIRECTION('',(1.0,0.0,0.0));
+#165=ORIENTED_EDGE('',*,*,#194,.T.);
+#166=ORIENTED_EDGE('',*,*,#198,.F.);
+#167=ORIENTED_EDGE('',*,*,#196,.T.);
+#168=ORIENTED_EDGE('',*,*,#199,.F.);
+#169=CARTESIAN_POINT('',(0.0,0.0,0.0));
+#170=DIRECTION('',(0.0,0.0,1.0));
+#171=DIRECTION('',(1.0,0.0,0.0));
+#172=ORIENTED_EDGE('',*,*,#199,.T.);
+#173=ORIENTED_EDGE('',*,*,#195,.T.);
+#174=CARTESIAN_POINT('',(0.0,0.0,-5.0));
+#175=DIRECTION('',(0.0,0.0,-1.0));
+#176=DIRECTION('',(-1.0,0.0,0.0));
+#177=ORIENTED_EDGE('',*,*,#197,.T.);
+#178=ORIENTED_EDGE('',*,*,#198,.T.);
+#179=CARTESIAN_POINT('',(0.0,0.0,5.0));
+#180=DIRECTION('',(0.0,0.0,1.0));
+#181=DIRECTION('',(1.0,0.0,0.0));
+#182=EDGE_CURVE('',#200,#201,#202,.T.);
+#183=EDGE_CURVE('',#201,#203,#204,.T.);
+#184=EDGE_CURVE('',#203,#205,#206,.T.);
+#185=EDGE_CURVE('',#205,#200,#207,.T.);
+#186=EDGE_CURVE('',#208,#209,#210,.T.);
+#187=EDGE_CURVE('',#209,#211,#212,.T.);
+#188=EDGE_CURVE('',#211,#213,#214,.T.);
+#189=EDGE_CURVE('',#213,#208,#215,.T.);
+#190=EDGE_CURVE('',#205,#211,#216,.T.);
+#191=EDGE_CURVE('',#200,#209,#217,.T.);
+#192=EDGE_CURVE('',#203,#213,#218,.T.);
+#193=EDGE_CURVE('',#201,#208,#219,.T.);
+#194=EDGE_CURVE('',#220,#221,#222,.T.);
+#195=EDGE_CURVE('',#223,#220,#224,.T.);
+#196=EDGE_CURVE('',#225,#223,#226,.T.);
+#197=EDGE_CURVE('',#221,#225,#227,.T.);
+#198=EDGE_CURVE('',#225,#221,#228,.T.);
+#199=EDGE_CURVE('',#220,#223,#229,.T.);
+#200=VERTEX_POINT('',#230);
+#201=VERTEX_POINT('',#231);
+#202=LINE('',#232,#233);
+#203=VERTEX_POINT('',#234);
+#204=LINE('',#235,#236);
+#205=VERTEX_POINT('',#237);
+#206=LINE('',#238,#239);
+#207=LINE('',#240,#241);
+#208=VERTEX_POINT('',#242);
+#209=VERTEX_POINT('',#243);
+#210=LINE('',#244,#245);
+#211=VERTEX_POINT('',#246);
+#212=LINE('',#247,#248);
+#213=VERTEX_POINT('',#249);
+#214=LINE('',#250,#251);
+#215=LINE('',#252,#253);
+#216=LINE('',#254,#255);
+#217=LINE('',#256,#257);
+#218=LINE('',#258,#259);
+#219=LINE('',#260,#261);
+#220=VERTEX_POINT('',#262);
+#221=VERTEX_POINT('',#263);
+#222=LINE('',#264,#265);
+#223=VERTEX_POINT('',#266);
+#224=CIRCLE('',#267,5.0);
+#225=VERTEX_POINT('',#268);
+#226=LINE('',#269,#270);
+#227=CIRCLE('',#271,5.0);
+#228=CIRCLE('',#272,5.0);
+#229=CIRCLE('',#273,5.0);
+#230=CARTESIAN_POINT('',(35.0,-5.0,5.0));
+#231=CARTESIAN_POINT('',(35.0,5.0,5.0));
+#232=CARTESIAN_POINT('',(35.0,0.0,5.0));
+#233=VECTOR('',#274,1.0);
+#234=CARTESIAN_POINT('',(25.0,5.0,5.0));
+#235=CARTESIAN_POINT('',(30.0,5.0,5.0));
+#236=VECTOR('',#275,1.0);
+#237=CARTESIAN_POINT('',(25.0,-5.0,5.0));
+#238=CARTESIAN_POINT('',(25.0,0.0,5.0));
+#239=VECTOR('',#276,1.0);
+#240=CARTESIAN_POINT('',(30.0,-5.0,5.0));
+#241=VECTOR('',#277,1.0);
+#242=CARTESIAN_POINT('',(35.0,5.0,-5.0));
+#243=CARTESIAN_POINT('',(35.0,-5.0,-5.0));
+#244=CARTESIAN_POINT('',(35.0,0.0,-5.0));
+#245=VECTOR('',#278,1.0);
+#246=CARTESIAN_POINT('',(25.0,-5.0,-5.0));
+#247=CARTESIAN_POINT('',(30.0,-5.0,-5.0));
+#248=VECTOR('',#279,1.0);
+#249=CARTESIAN_POINT('',(25.0,5.0,-5.0));
+#250=CARTESIAN_POINT('',(25.0,0.0,-5.0));
+#251=VECTOR('',#280,1.0);
+#252=CARTESIAN_POINT('',(30.0,5.0,-5.0));
+#253=VECTOR('',#281,1.0);
+#254=CARTESIAN_POINT('',(25.0,-5.0,0.0));
+#255=VECTOR('',#282,1.0);
+#256=CARTESIAN_POINT('',(35.0,-5.0,0.0));
+#257=VECTOR('',#283,1.0);
+#258=CARTESIAN_POINT('',(25.0,5.0,0.0));
+#259=VECTOR('',#284,1.0);
+#260=CARTESIAN_POINT('',(35.0,5.0,0.0));
+#261=VECTOR('',#285,1.0);
+#262=CARTESIAN_POINT('',(5.0,0.0,-5.0));
+#263=CARTESIAN_POINT('',(5.0,0.0,5.0));
+#264=CARTESIAN_POINT('',(5.0,-6.12303176911189E-16,0.0));
+#265=VECTOR('',#286,1.0);
+#266=CARTESIAN_POINT('',(-5.0,6.12303176911189E-16,-5.0));
+#267=AXIS2_PLACEMENT_3D('',#287,#288,#289);
+#268=CARTESIAN_POINT('',(-5.0,6.12303176911189E-16,5.0));
+#269=CARTESIAN_POINT('',(-5.0,6.12303176911189E-16,0.0));
+#270=VECTOR('',#290,1.0);
+#271=AXIS2_PLACEMENT_3D('',#291,#292,#293);
+#272=AXIS2_PLACEMENT_3D('',#294,#295,#296);
+#273=AXIS2_PLACEMENT_3D('',#297,#298,#299);
+#274=DIRECTION('',(0.0,1.0,0.0));
+#275=DIRECTION('',(-1.0,0.0,0.0));
+#276=DIRECTION('',(0.0,-1.0,0.0));
+#277=DIRECTION('',(1.0,0.0,0.0));
+#278=DIRECTION('',(0.0,-1.0,0.0));
+#279=DIRECTION('',(-1.0,0.0,0.0));
+#280=DIRECTION('',(0.0,1.0,0.0));
+#281=DIRECTION('',(1.0,0.0,0.0));
+#282=DIRECTION('',(0.0,0.0,-1.0));
+#283=DIRECTION('',(0.0,0.0,-1.0));
+#284=DIRECTION('',(0.0,0.0,-1.0));
+#285=DIRECTION('',(0.0,0.0,-1.0));
+#286=DIRECTION('',(0.0,0.0,1.0));
+#287=CARTESIAN_POINT('',(0.0,0.0,-5.0));
+#288=DIRECTION('',(0.0,0.0,-1.0));
+#289=DIRECTION('',(1.0,0.0,0.0));
+#290=DIRECTION('',(-0.0,-0.0,-1.0));
+#291=CARTESIAN_POINT('',(0.0,0.0,5.0));
+#292=DIRECTION('',(0.0,0.0,1.0));
+#293=DIRECTION('',(1.0,0.0,0.0));
+#294=CARTESIAN_POINT('',(0.0,0.0,5.0));
+#295=DIRECTION('',(0.0,0.0,1.0));
+#296=DIRECTION('',(1.0,0.0,0.0));
+#297=CARTESIAN_POINT('',(0.0,0.0,-5.0));
+#298=DIRECTION('',(0.0,0.0,-1.0));
+#299=DIRECTION('',(1.0,0.0,0.0));
+ENDSEC;
+END-ISO-10303-21;

diff --git a/MeshFiles/unittest/io/gcrm_r3.nc b/MeshFiles/unittest/io/gcrm_r3.nc
new file mode 100644
index 0000000..6d1b8d2
Binary files /dev/null and b/MeshFiles/unittest/io/gcrm_r3.nc differ

diff --git a/config/FindHDF5.cmake b/config/FindHDF5.cmake
index f14395f..e4d8a35 100644
--- a/config/FindHDF5.cmake
+++ b/config/FindHDF5.cmake
@@ -1,23 +1,79 @@
 #
 # Find the native HDF5 includes and library
 #
-# HDF5_INCLUDE_DIR - where to find H5public.h, etc.
+# HDF5_INCLUDES    - where to find hdf5.h, H5public.h, etc.
 # HDF5_LIBRARIES   - List of fully qualified libraries to link against when using hdf5.
 # HDF5_FOUND       - Do not attempt to use hdf5 if "no" or undefined.
 
-FIND_PATH(HDF5_INCLUDE_DIR H5public.h
+set( HDF5_DIR "" CACHE PATH "Path to search for HDF5 header and library files" )
+set (HDF5_FOUND NO CACHE INTERNAL "Found HDF5 components successfully." )
+
+FIND_PATH(HDF5_INCLUDE_DIR
+  NAMES hdf5.h H5public.h
+  PATHS ${HDF5_DIR}/include
   /usr/local/include
   /usr/include
+  /opt/local/include
 )
 
-FIND_LIBRARY(HDF5_LIBRARY hdf5
-  /usr/local/lib
-  /usr/lib
+FIND_LIBRARY(HDF5_BASE_LIBRARY hdf5
+  PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
+)
+FIND_LIBRARY(HDF5_HLBASE_LIBRARY hdf5_hl
+  PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
 )
 
-IF(HDF5_INCLUDE_DIR)
-  IF(HDF5_LIBRARY)
-    SET( HDF5_LIBRARIES ${HDF5_LIBRARY} )
-    SET( HDF5_FOUND "YES" )
-  ENDIF(HDF5_LIBRARY)
-ENDIF(HDF5_INCLUDE_DIR)
+IF (NOT HDF5_FOUND)
+  IF (HDF5_INCLUDE_DIR AND HDF5_BASE_LIBRARY)
+    FIND_LIBRARY(HDF5_CXX_LIBRARY hdf5_cxx
+      PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
+    )
+    FIND_LIBRARY(HDF5_HLCXX_LIBRARY hdf5_hl_cxx
+      PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
+    )
+    FIND_LIBRARY(HDF5_FORT_LIBRARY hdf5_fortran
+      PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
+    )
+    FIND_LIBRARY(HDF5_HLFORT_LIBRARY
+      NAMES hdf5hl_fortran hdf5_hl_fortran
+      PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
+    )
+    SET( HDF5_INCLUDES "-I${HDF5_INCLUDE_DIR}" )
+    if (HDF5_FORT_LIBRARY)
+      FIND_PATH(HDF5_FORT_INCLUDE_DIR
+        NAMES hdf5.mod
+        PATHS ${HDF5_DIR}/include
+        ${HDF5_DIR}/include/fortran
+        /usr/local/include
+        /usr/include
+        /opt/local/include
+      )
+      if (HDF5_FORT_INCLUDE_DIR AND NOT ${HDF5_FORT_INCLUDE_DIR} STREQUAL ${HDF5_INCLUDE_DIR})
+        SET( HDF5_INCLUDES "${HDF5_INCLUDES} -I${HDF5_FORT_INCLUDE_DIR}" )
+      endif (HDF5_FORT_INCLUDE_DIR AND NOT ${HDF5_FORT_INCLUDE_DIR} STREQUAL ${HDF5_INCLUDE_DIR})
+      unset(HDF5_FORT_INCLUDE_DIR CACHE)
+    endif (HDF5_FORT_LIBRARY)
+    # Add the libraries based on availability
+    foreach (VARIANT CXX FORT BASE )
+      if (HDF5_HL${VARIANT}_LIBRARY)
+        list(APPEND HDF5_LIBRARIES ${HDF5_HL${VARIANT}_LIBRARY})
+      endif (HDF5_HL${VARIANT}_LIBRARY)
+      if (HDF5_${VARIANT}_LIBRARY)
+        list(APPEND HDF5_LIBRARIES ${HDF5_${VARIANT}_LIBRARY})
+      endif (HDF5_${VARIANT}_LIBRARY)
+      unset(HDF5_HL${VARIANT}_LIBRARY CACHE)
+      unset(HDF5_${VARIANT}_LIBRARY CACHE)
+    endforeach()
+    SET( HDF5_FOUND YES )
+    message (STATUS "---   HDF5 Configuration ::")
+    message (STATUS "        INCLUDES  : ${HDF5_INCLUDES}")
+    message (STATUS "        LIBRARIES : ${HDF5_LIBRARIES}")
+  ELSE (HDF5_INCLUDE_DIR AND HDF5_BASE_LIBRARY)
+    set( HDF5_FOUND NO )
+    message("finding HDF5 failed, please try to set the var HDF5_DIR")
+  ENDIF(HDF5_INCLUDE_DIR AND HDF5_BASE_LIBRARY)
+ENDIF (NOT HDF5_FOUND)
+
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (HDF5 "HDF5 not found, check environment variables HDF5_DIR"
+  HDF5_DIR HDF5_INCLUDES HDF5_LIBRARIES)

diff --git a/config/FindNetCDF.cmake b/config/FindNetCDF.cmake
index f9e655c..e0e988c 100644
--- a/config/FindNetCDF.cmake
+++ b/config/FindNetCDF.cmake
@@ -1,75 +1,85 @@
 #
 # Find NetCDF include directories and libraries
 #
-# NetCDF_INCLUDE_DIRECTORIES - where to find netcdf.h
+# NetCDF_INCLUDES            - list of include paths to find netcdf.h
 # NetCDF_LIBRARIES           - list of libraries to link against when using NetCDF
 # NetCDF_FOUND               - Do not attempt to use NetCDF if "no", "0", or undefined.
 
-set( NetCDF_PREFIX "" CACHE PATH "Path to search for NetCDF header and library files" )
+set (NetCDF_DIR "" CACHE PATH "Path to search for NetCDF header and library files" )
+set (NetCDF_FOUND NO CACHE INTERNAL "Found NetCDF components successfully." )
 
-find_path( NetCDF_INCLUDE_DIRECTORIES netcdf.h
+find_path( NetCDF_INCLUDE_DIR netcdf.h
+  ${NetCDF_DIR}
+  ${NetCDF_DIR}/include
   /usr/local/include
   /usr/include
 )
 
 find_library( NetCDF_C_LIBRARY
   NAMES netcdf
-  ${NetCDF_PREFIX}
-  ${NetCDF_PREFIX}/lib64
-  ${NetCDF_PREFIX}/lib
+  HINTS ${NetCDF_DIR}
+  ${NetCDF_DIR}/lib64
+  ${NetCDF_DIR}/lib
   /usr/local/lib64
   /usr/lib64
-  /usr/lib64/netcdf-3
+  /usr/lib64/netcdf
   /usr/local/lib
   /usr/lib
-  /usr/lib/netcdf-3
+  /usr/lib/netcdf
 )
 
 find_library( NetCDF_CXX_LIBRARY
   NAMES netcdf_c++
-  ${NetCDF_PREFIX}
-  ${NetCDF_PREFIX}/lib64
-  ${NetCDF_PREFIX}/lib
+  HINTS ${NetCDF_DIR}
+  ${NetCDF_DIR}/lib64
+  ${NetCDF_DIR}/lib
   /usr/local/lib64
   /usr/lib64
-  /usr/lib64/netcdf-3
+  /usr/lib64/netcdf
   /usr/local/lib
   /usr/lib
-  /usr/lib/netcdf-3
+  /usr/lib/netcdf
 )
 
 find_library( NetCDF_FORTRAN_LIBRARY
   NAMES netcdf_g77 netcdf_ifc netcdf_x86_64
-  ${NetCDF_PREFIX}
-  ${NetCDF_PREFIX}/lib64
-  ${NetCDF_PREFIX}/lib
+  HINTS ${NetCDF_DIR}
+  ${NetCDF_DIR}/lib64
+  ${NetCDF_DIR}/lib
   /usr/local/lib64
   /usr/lib64
-  /usr/lib64/netcdf-3
+  /usr/lib64/netcdf
   /usr/local/lib
   /usr/lib
-  /usr/lib/netcdf-3
+  /usr/lib/netcdf
 )
 
-set( NetCDF_LIBRARIES
-  ${NetCDF_C_LIBRARY}
-  ${NetCDF_CXX_LIBRARY}
-)
-
-set( NetCDF_FORTRAN_LIBRARIES
-  ${NetCDF_FORTRAN_LIBRARY}
-)
-
-if ( NetCDF_INCLUDE_DIRECTORIES AND NetCDF_LIBRARIES )
-  set( NetCDF_FOUND 1 )
-else ( NetCDF_INCLUDE_DIRECTORIES AND NetCDF_LIBRARIES )
-  set( NetCDF_FOUND 0 )
-endif ( NetCDF_INCLUDE_DIRECTORIES AND NetCDF_LIBRARIES )
+IF (NOT NetCDF_FOUND)
+  if ( NetCDF_INCLUDE_DIR AND NetCDF_C_LIBRARY )
+    set( NetCDF_FOUND YES )
+    set(NetCDF_INCLUDES "-I${NetCDF_INCLUDE_DIR}")
+    set(NetCDF_LIBRARIES ${NetCDF_C_LIBRARY})
+    if ( NetCDF_CXX_LIBRARY )
+      set(NetCDF_LIBRARIES ${NetCDF_LIBRARIES} ${NetCDF_CXX_LIBRARY})
+    endif ( NetCDF_CXX_LIBRARY )
+    if ( NetCDF_FORTRAN_LIBRARY )
+      set(NetCDF_LIBRARIES ${NetCDF_LIBRARIES} ${NetCDF_FORTRAN_LIBRARY})
+    endif ( NetCDF_FORTRAN_LIBRARY )
+    message (STATUS "---   NetCDF Configuration ::")
+    message (STATUS "        INCLUDES  : ${NetCDF_INCLUDES}")
+    message (STATUS "        LIBRARIES : ${NetCDF_LIBRARIES}")
+  else ( NetCDF_INCLUDE_DIR AND NetCDF_C_LIBRARY )
+    set( NetCDF_FOUND NO )
+    message("finding NetCDF failed, please try to set the var NetCDF_DIR")
+  endif ( NetCDF_INCLUDE_DIR AND NetCDF_C_LIBRARY )
+ENDIF (NOT NetCDF_FOUND)
 
 mark_as_advanced(
-  NetCDF_PREFIX
-  NetCDF_INCLUDE_DIRECTORIES
-  NetCDF_C_LIBRARY
-  NetCDF_CXX_LIBRARY
-  NetCDF_FORTRAN_LIBRARY
+  NetCDF_DIR
+  NetCDF_INCLUDES
+  NetCDF_LIBRARIES
 )
+
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (NetCDF "NetCDF not found, check environment variables NetCDF_DIR"
+  NetCDF_DIR NetCDF_INCLUDES NetCDF_LIBRARIES)

diff --git a/configure.ac b/configure.ac
index 82bf72b..83d8ea5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1223,6 +1223,7 @@ AC_CONFIG_FILES([Makefile
                  src/parallel/Makefile
                  src/oldinc/Makefile
                  test/Makefile
+		 test/dagmc/Makefile
                  test/h5file/Makefile
                  test/dual/Makefile
                  test/obb/Makefile
@@ -1254,6 +1255,8 @@ AC_CONFIG_FILES([Makefile
                  MeshFiles/Makefile
                  MeshFiles/unittest/Makefile
                  MeshFiles/unittest/io/Makefile
+                 MeshFiles/unittest/iGeom/Makefile
+                 MeshFiles/unittest/dagmc/Makefile
                  ])
 AC_CONFIG_COMMANDS([src/MOAB_FCDefs.h],
   [sed -e "s/FC_FUNC/MOAB_FC_FUNC/" src/FCDefs.h >src/MOAB_FCDefs.h])

diff --git a/examples/DeformMeshRemap.cpp b/examples/DeformMeshRemap.cpp
index 5442d1d..55dac45 100644
--- a/examples/DeformMeshRemap.cpp
+++ b/examples/DeformMeshRemap.cpp
@@ -12,6 +12,7 @@
 
 #include "moab/Core.hpp"
 #include "moab/Range.hpp"
+#include "moab/Skinner.hpp"
 #include "moab/LloydSmoother.hpp"
 #include "moab/ProgOptions.hpp"
 #include "moab/BoundBox.hpp"
@@ -19,6 +20,10 @@
 #include "MBTagConventions.hpp"
 #include "DataCoupler.hpp"
 
+#define IS_BUILDING_MB
+#include "moab/Error.hpp"
+#undef IS_BUILDING_MB
+
 #ifdef USE_MPI
 #  include "moab/ParallelComm.hpp"
 #endif
@@ -69,13 +74,13 @@ public:
   ErrorCode execute();
   
     //! add a set number
-  ErrorCode add_set_no(int fluid_or_solid, int set_no);
+  ErrorCode add_set_no(int m_or_s, int fluid_or_solid, int set_no);
   
     //! remove a set number
-  ErrorCode remove_set_no(int fluid_or_solid, int set_no);
+  ErrorCode remove_set_no(int m_or_s, int fluid_or_solid, int set_no);
   
     //! get the set numbers
-  ErrorCode get_set_nos(int fluid_or_solid, std::set<int> &set_nos) const;
+  ErrorCode get_set_nos(int m_or_s, int fluid_or_solid, std::set<int> &set_nos) const;
 
     //! get the xNew tag handle
   inline Tag x_new() const {return xNew;}
@@ -91,6 +96,10 @@ public:
   
     //! get/set the file name
   void set_file_name(int m_or_s, const std::string &name);
+
+    //! get/set the x displacement tag names
+  std::string xdisp_name(int idx = 0);
+  void xdisp_name(const std::string &nm, int idx = 0);
   
 private:
     //! apply a known deformation to the solid elements, putting the results in the xNew tag; also
@@ -101,24 +110,32 @@ private:
   ErrorCode read_file(int m_or_s, string &fname, EntityHandle &seth);
 
     //! write the input tag to the coordinates for the vertices in the input elems
-  ErrorCode write_to_coords(Range &elems, Tag tagh);
+    //! if non-zero tmp_tag is input, save coords to tmp_tag before over-writing with tag value
+  ErrorCode write_to_coords(Range &elems, Tag tagh, Tag tmp_tag = 0);
 
     //! write the tag to the vertices, then save to the specified file
-  ErrorCode write_and_save(Range &ents, EntityHandle seth, Tag tagh, const char *filename);
+    //! if restore_coords is true, coords are restored to their initial state after file is written
+  ErrorCode write_and_save(Range &ents, EntityHandle seth, Tag tagh, const char *filename,
+                           bool restore_coords = false);
 
+    //! find fluid/solid sets from complement of solid/fluid sets 
+  ErrorCode find_other_sets(int m_or_s, EntityHandle file_set);
+  
     //! moab interface
   Interface *mbImpl;
 
+  Error *mError;
+  
 #ifdef USE_MPI
     //! ParallelComm for master, slave meshes
   ParallelComm *pcMaster, *pcSlave;
 #endif
   
-    //! material set numbers for fluid materials
-  std::set<int> fluidSetNos;
+    //! material set numbers for fluid materials, for master/slave
+  std::set<int> fluidSetNos[2];
 
-    //! material set numbers for solid materials
-  std::set<int> solidSetNos;
+    //! material set numbers for solid materials, for master/slave
+  std::set<int> solidSetNos[2];
 
     //! sets defining master/slave meshes
   EntityHandle masterSet, slaveSet;
@@ -132,22 +149,31 @@ private:
     //! filenames for master/slave meshes
   std::string masterFileName, slaveFileName;
 
+    //! tag from file, might be 3
+  Tag xDisp[3];
+
     //! tag used for new positions
   Tag xNew;
   
+    //! tag name used to read disps from file
+  std::string xDispNames[3];
+  
     //! tag name used for new positions
   std::string xNewName;
 };
 
   //! add a set number
-inline ErrorCode DeformMeshRemap::add_set_no(int f_or_s, int set_no) 
+inline ErrorCode DeformMeshRemap::add_set_no(int m_or_s, int f_or_s, int set_no) 
 {
   std::set<int> *this_set;
+  assert ((m_or_s == MASTER || m_or_s == SLAVE) && "m_or_s should be MASTER or SLAVE.");
+  if (m_or_s != MASTER && m_or_s != SLAVE) return MB_INDEX_OUT_OF_RANGE;
+  
   switch (f_or_s) {
     case FLUID:
-        this_set = &fluidSetNos; break;
+        this_set = &fluidSetNos[m_or_s]; break;
     case SOLID:
-        this_set = &solidSetNos; break;
+        this_set = &solidSetNos[m_or_s]; break;
     default:
         assert(false && "f_or_s should be FLUID or SOLID.");
         return MB_FAILURE;
@@ -159,14 +185,16 @@ inline ErrorCode DeformMeshRemap::add_set_no(int f_or_s, int set_no)
 }
   
   //! remove a set number
-inline ErrorCode DeformMeshRemap::remove_set_no(int f_or_s, int set_no) 
+inline ErrorCode DeformMeshRemap::remove_set_no(int m_or_s, int f_or_s, int set_no) 
 {
   std::set<int> *this_set;
+  assert ((m_or_s == MASTER || m_or_s == SLAVE) && "m_or_s should be MASTER or SLAVE.");
+  if (m_or_s != MASTER && m_or_s != SLAVE) return MB_INDEX_OUT_OF_RANGE;
   switch (f_or_s) {
     case FLUID:
-        this_set = &fluidSetNos; break;
+        this_set = &fluidSetNos[m_or_s]; break;
     case SOLID:
-        this_set = &solidSetNos; break;
+        this_set = &solidSetNos[m_or_s]; break;
     default:
         assert(false && "f_or_s should be FLUID or SOLID.");
         return MB_FAILURE;
@@ -181,14 +209,16 @@ inline ErrorCode DeformMeshRemap::remove_set_no(int f_or_s, int set_no)
 }
   
   //! get the set numbers
-inline ErrorCode DeformMeshRemap::get_set_nos(int f_or_s, std::set<int> &set_nos) const
+inline ErrorCode DeformMeshRemap::get_set_nos(int m_or_s, int f_or_s, std::set<int> &set_nos) const
 {
   const std::set<int> *this_set;
+  assert ((m_or_s == MASTER || m_or_s == SLAVE) && "m_or_s should be MASTER or SLAVE.");
+  if (m_or_s != MASTER && m_or_s != SLAVE) return MB_INDEX_OUT_OF_RANGE;
   switch (f_or_s) {
     case FLUID:
-        this_set = &fluidSetNos; break;
+        this_set = &fluidSetNos[m_or_s]; break;
     case SOLID:
-        this_set = &solidSetNos; break;
+        this_set = &solidSetNos[m_or_s]; break;
     default:
         assert(false && "f_or_s should be FLUID or SOLID.");
         return MB_FAILURE;
@@ -199,56 +229,108 @@ inline ErrorCode DeformMeshRemap::get_set_nos(int f_or_s, std::set<int> &set_nos
   return MB_SUCCESS;
 }
 
+inline std::string DeformMeshRemap::xdisp_name(int idx) 
+{
+  return xDispNames[idx];
+}
+
+void DeformMeshRemap::xdisp_name(const std::string &nm, int idx) 
+{
+  xDispNames[idx] = nm;
+}
+
 ErrorCode DeformMeshRemap::execute() 
 {
     // read master/slave files and get fluid/solid material sets
   ErrorCode rval = read_file(MASTER, masterFileName, masterSet);
   if (MB_SUCCESS != rval) return rval;
-  
-  rval = read_file(SLAVE, slaveFileName, slaveSet);
-  if (MB_SUCCESS != rval) return rval;
 
+  if (solidSetNos[MASTER].empty() || fluidSetNos[MASTER].empty()) {
+    rval = find_other_sets(MASTER, masterSet); RR("Failed to find other sets in master mesh.");
+  }
+
+  bool have_slave = !(slaveFileName == "none");
+  if (have_slave) {
+    rval = read_file(SLAVE, slaveFileName, slaveSet);
+    if (MB_SUCCESS != rval) return rval;
+
+    if (solidSetNos[SLAVE].empty() || fluidSetNos[SLAVE].empty()) {
+      rval = find_other_sets(SLAVE, slaveSet); RR("Failed to find other sets in slave mesh.");
+    }
+  }
+ 
+  if (debug) std::cout << "Constructing data coupler/search tree on master mesh..." << std::endl;
+  
   Range src_elems = solidElems[MASTER];
   src_elems.merge(fluidElems[MASTER]);
-    // locate slave vertices in master, orig coords; do this with a data coupler, so you can
-    // later interpolate
-  Range tgt_verts, tmp_range = solidElems[SLAVE];
-  tmp_range.merge(fluidElems[SLAVE]);
-  rval = mbImpl->get_adjacencies(tmp_range, 0, false, tgt_verts, Interface::UNION);
-  RR("Failed to get target verts.");
-  
 
     // initialize data coupler on source elements
-  DataCoupler dc_master(mbImpl, NULL, src_elems, 0);
-  
-    // locate slave vertices, caching results in dc
-  rval = dc_master.locate_points(tgt_verts); RR("Point location of tgt verts failed.");
-  int num_located = dc_master.spatial_locator()->local_num_located();
-  if (num_located != (int)tgt_verts.size()) {
-    rval = MB_FAILURE;
-    std::cout << "Only " << num_located << " out of " << tgt_verts.size() << " target points successfully located." << std::endl;
-    return rval;
+  DataCoupler dc_master(mbImpl, src_elems, 0, NULL);
+
+  Range tgt_verts;
+  if (have_slave) {
+      // locate slave vertices in master, orig coords; do this with a data coupler, so you can
+      // later interpolate
+    Range tmp_range = solidElems[SLAVE];
+    tmp_range.merge(fluidElems[SLAVE]);
+    rval = mbImpl->get_adjacencies(tmp_range, 0, false, tgt_verts, Interface::UNION);
+    RR("Failed to get target verts.");
+
+      // locate slave vertices, caching results in dc
+    if (debug) std::cout << "Locating slave vertices in master mesh..." << std::endl;
+    rval = dc_master.locate_points(tgt_verts); RR("Point location of tgt verts failed.");
+    int num_located = dc_master.spatial_locator()->local_num_located();
+    if (num_located != (int)tgt_verts.size()) {
+      rval = MB_FAILURE;
+      std::cout << "Only " << num_located << " out of " << tgt_verts.size() << " target points successfully located." << std::endl;
+      return rval;
+    }
   }
-
+  
     // deform the master's solid mesh, put results in a new tag
+  if (debug) std::cout << "Deforming fluid elements in master mesh..." << std::endl;
   rval = deform_master(fluidElems[MASTER], solidElems[MASTER], "xnew"); RR("");
 
   { // to isolate the lloyd smoother & delete when done
+    if (debug) {
+        // output the skin of smoothed elems, as a check
+        // get the skin; get facets, because we might need to filter on shared entities
+      Skinner skinner(mbImpl);
+      Range skin;
+      rval = skinner.find_skin(0, fluidElems[MASTER], false, skin); RR("Unable to find skin.");
+      EntityHandle skin_set;
+      std::cout << "Writing skin_mesh.g and fluid_mesh.g." << std::endl;
+      rval = mbImpl->create_meshset(MESHSET_SET, skin_set); RR("Failed to create skin set.");
+      rval = mbImpl->add_entities(skin_set, skin); RR("Failed to add skin entities to set.");
+      rval = mbImpl->write_file("skin_mesh.vtk", NULL, NULL, &skin_set, 1); RR("Failure to write skin set.");
+      rval = mbImpl->remove_entities(skin_set, skin); RR("Failed to remove skin entities from set.");
+      rval = mbImpl->add_entities(skin_set, fluidElems[MASTER]); RR("Failed to add fluid entities to set.");
+      rval = mbImpl->write_file("fluid_mesh.vtk", NULL, NULL, &skin_set, 1); RR("Failure to write fluid set.");
+      rval = mbImpl->delete_entities(&skin_set, 1); RR("Failed to delete skin set.");
+    }
 
       // smooth the master mesh
+    if (debug) std::cout << "Smoothing fluid elements in master mesh..." << std::endl;
     LloydSmoother ll(mbImpl, NULL, fluidElems[MASTER], xNew);
     rval = ll.perform_smooth();
     RR("Failed in lloyd smoothing.");
     cout << "Lloyd smoothing required " << ll.num_its() << " iterations." << endl;
   }
-  
-    // map new locations to slave
-    // interpolate xNew to slave points
-  rval = dc_master.interpolate((int)DataCoupler::VOLUME, "xnew"); RR("Failed to interpolate target solution.");
 
-    // transfer xNew to coords, for master and slave
+    // transfer xNew to coords, for master
+  if (debug) std::cout << "Transferring coords tag to vertex coordinates in master mesh..." << std::endl;
+  rval = write_to_coords(solidElems[MASTER], xNew); RR("Failed writing tag to master fluid verts.");
   rval = write_to_coords(fluidElems[MASTER], xNew); RR("Failed writing tag to master fluid verts.");
-  rval = write_to_coords(tgt_verts, xNew); RR("Failed writing tag to slave verts.");
+
+  if (have_slave) {
+      // map new locations to slave
+      // interpolate xNew to slave points
+    if (debug) std::cout << "Interpolating new coordinates to slave vertices..." << std::endl;
+    rval = dc_master.interpolate((int)DataCoupler::VOLUME, "xnew"); RR("Failed to interpolate target solution.");
+      // transfer xNew to coords, for slave
+    if (debug) std::cout << "Transferring coords tag to vertex coordinates in slave mesh..." << std::endl;
+    rval = write_to_coords(tgt_verts, xNew); RR("Failed writing tag to slave verts.");
+  }
 
   if (debug) {
     std::string str;
@@ -256,14 +338,22 @@ ErrorCode DeformMeshRemap::execute()
     if (pcMaster && pcMaster->size() > 1) 
       str = "PARALLEL=WRITE_PART";
 #endif
-    rval = mbImpl->write_file("smoothed_master.vtk", NULL, str.c_str(), &masterSet, 1);
+    if (debug) std::cout << "Writing smoothed_master.h5m..." << std::endl;
+    rval = mbImpl->write_file("smoothed_master.h5m", NULL, str.c_str(), &masterSet, 1);
+
+    if (have_slave) {
 #ifdef USE_MPI
-    str.clear();
-    if (pcSlave && pcSlave->size() > 1) 
-      str = "PARALLEL=WRITE_PART";
+      str.clear();
+      if (pcSlave && pcSlave->size() > 1) 
+        str = "PARALLEL=WRITE_PART";
 #endif
-    rval = mbImpl->write_file("slave_interp.vtk", NULL, str.c_str(), &slaveSet, 1);
-  }
+      if (debug) std::cout << "Writing slave_interp.h5m..." << std::endl;
+      rval = mbImpl->write_file("slave_interp.h5m", NULL, str.c_str(), &slaveSet, 1);
+    } // if have_slave
+  } // if debug
+
+  if (debug) 
+    dc_master.spatial_locator()->get_tree()->tree_stats().print();
 
   return MB_SUCCESS;
 }
@@ -296,14 +386,16 @@ void DeformMeshRemap::set_file_name(int m_or_s, const std::string &name)
 DeformMeshRemap::DeformMeshRemap(Interface *impl, ParallelComm *master, ParallelComm *slave)  
         : mbImpl(impl), pcMaster(master), pcSlave(slave), masterSet(0), slaveSet(0), xNew(0), xNewName("xnew") 
 {
+  mbImpl->query_interface(mError);
+  xDisp[0] = xDisp[1] = xDisp[2] = 0;
+
   if (!pcSlave && pcMaster)
     pcSlave = pcMaster;
 }
   
 DeformMeshRemap::~DeformMeshRemap() 
 {
-    // delete the tag
-  mbImpl->tag_delete(xNew);
+  mbImpl->release_interface(mError);
 }
 
 int main(int argc, char **argv) {
@@ -312,14 +404,16 @@ int main(int argc, char **argv) {
 
   ProgOptions po("Deformed mesh options");
   po.addOpt<std::string> ("master,m", "Specify the master meshfile name" );
-  po.addOpt<std::string> ("slave,s", "Specify the slave meshfile name" );
+  po.addOpt<std::string> ("worker,w", "Specify the slave/worker meshfile name, or 'none' (no quotes) if master only" );
+  po.addOpt<std::string> ("d1,", "Tag name for displacement x or xyz" );
+  po.addOpt<std::string> ("d2,", "Tag name for displacement y" );
+  po.addOpt<std::string> ("d3,", "Tag name for displacement z" );
+  po.addOpt<int> ("fm,", "Specify master fluid material set number(s). If none specified, fluid sets derived from complement of solid sets.");
+  po.addOpt<int> ("fs,", "Specify master solid material set number(s). If none specified, solid sets derived from complement of fluid sets.");
+  po.addOpt<int> ("sm,", "Specify slave fluid material set number(s). If none specified, fluid sets derived from complement of solid sets.");
+  po.addOpt<int> ("ss,", "Specify slave solid material set number(s). If none specified, solid sets derived from complement of fluid sets.");
+  
   po.parseCommandLine(argc, argv);
-  std::string foo;
-  string masterf, slavef;
-  if(!po.getOpt("master", &masterf))
-    masterf = string(MESH_DIR) + string("/rodquad.g");
-  if(!po.getOpt("slave", &slavef))
-    slavef = string(MESH_DIR) + string("/rodtri.g");
 
   mb = new Core();
 
@@ -330,10 +424,46 @@ int main(int argc, char **argv) {
 #else  
   dfr = new DeformMeshRemap(mb);
 #endif
+
+
+  std::string masterf, slavef;
+  if(!po.getOpt("master", &masterf))
+    masterf = string(MESH_DIR) + string("/rodquad.g");
   dfr->set_file_name(DeformMeshRemap::MASTER, masterf);
+
+  if(!po.getOpt("worker", &slavef))
+    slavef = string(MESH_DIR) + string("/rodtri.g");
   dfr->set_file_name(DeformMeshRemap::SLAVE, slavef);
-  rval = dfr->add_set_no(DeformMeshRemap::SOLID, SOLID_SETNO); RR("Failed to add solid set no.");
-  rval = dfr->add_set_no(DeformMeshRemap::FLUID, FLUID_SETNO); RR("Failed to add fluid set no.");
+  if (slavef.empty()) {
+    std::cerr << "Empty slave file name; if no slave, use filename 'none' (no quotes)." << std::endl;
+    return 1;
+  }
+
+  std::vector<int> set_nos;
+  po.getOptAllArgs("fm", set_nos);
+  for (std::vector<int>::iterator vit = set_nos.begin(); vit != set_nos.end(); vit++) 
+    dfr->add_set_no(DeformMeshRemap::MASTER, DeformMeshRemap::FLUID, *vit);
+  set_nos.clear();
+  
+  po.getOptAllArgs("fs", set_nos);
+  for (std::vector<int>::iterator vit = set_nos.begin(); vit != set_nos.end(); vit++) 
+    dfr->add_set_no(DeformMeshRemap::SLAVE, DeformMeshRemap::FLUID, *vit);
+  set_nos.clear();
+  
+  po.getOptAllArgs("sm", set_nos);
+  for (std::vector<int>::iterator vit = set_nos.begin(); vit != set_nos.end(); vit++) 
+    dfr->add_set_no(DeformMeshRemap::MASTER, DeformMeshRemap::SOLID, *vit);
+
+  po.getOptAllArgs("ss", set_nos);
+  for (std::vector<int>::iterator vit = set_nos.begin(); vit != set_nos.end(); vit++) 
+    dfr->add_set_no(DeformMeshRemap::SLAVE, DeformMeshRemap::SOLID, *vit);
+
+  std::string tnames[3];
+  po.getOpt("d1", &tnames[0]);
+  po.getOpt("d2", &tnames[1]);
+  po.getOpt("d3", &tnames[2]);
+  for (int i = 0; i < 3; i++) 
+    if (!tnames[i].empty()) dfr->xdisp_name(tnames[i], i);
   
   rval = dfr->execute();
   
@@ -343,20 +473,38 @@ int main(int argc, char **argv) {
   return rval;
 }
 
-ErrorCode DeformMeshRemap::write_and_save(Range &ents, EntityHandle seth, Tag tagh, const char *filename) 
+ErrorCode DeformMeshRemap::write_and_save(Range &ents, EntityHandle seth, Tag tagh, const char *filename,
+                                          bool restore_coords) 
 {
-  ErrorCode rval = write_to_coords(ents, tagh); RR("");
+  Tag tmp_tag = 0;
+  ErrorCode rval;
+  if (restore_coords)
+    rval = mbImpl->tag_get_handle("", 3, MB_TYPE_DOUBLE, tmp_tag, MB_TAG_CREAT|MB_TAG_DENSE);
+
+  rval = write_to_coords(ents, tagh, tmp_tag); RR("");
   rval = mbImpl->write_file(filename, NULL, NULL, &seth, 1); RR("");
+  if (restore_coords) {
+    rval = write_to_coords(ents, tmp_tag); RR("");
+    rval = mbImpl->tag_delete(tmp_tag);
+  }
+  
   return rval;
 }
   
-ErrorCode DeformMeshRemap::write_to_coords(Range &elems, Tag tagh) 
+ErrorCode DeformMeshRemap::write_to_coords(Range &elems, Tag tagh, Tag tmp_tag) 
 {
     // write the tag to coordinates
   Range verts;
   ErrorCode rval = mbImpl->get_adjacencies(elems, 0, false, verts, Interface::UNION);
   RR("Failed to get adj vertices.");
   std::vector<double> coords(3*verts.size());
+
+  if (tmp_tag) {
+      // save the coords to tmp_tag first
+    rval = mbImpl->get_coords(verts, &coords[0]); RR("Failed to get tmp copy of coords.");
+    rval = mbImpl->tag_set_data(tmp_tag, verts, &coords[0]); RR("Failed to save tmp copy of coords.");
+  }
+  
   rval = mbImpl->tag_get_data(tagh, verts, &coords[0]);
   RR("Failed to get tag data.");
   rval = mbImpl->set_coords(verts, &coords[0]);
@@ -376,7 +524,6 @@ void deform_func(const BoundBox &bbox, double *xold, double *xnew)
   xnew[0] = xold[0] + yfrac * delx;
   xnew[1] = xold[1] + yfrac * (1.0 + xfrac) * 0.05;
 */
-
 /* Deformation function based on fraction of bounding box dimension in each direction */
   double frac = 0.01; // taken from approximate relative deformation from LLNL Diablo of XX09 assys
   CartVect *xo = reinterpret_cast<CartVect*>(xold), *xn = reinterpret_cast<CartVect*>(xnew);
@@ -387,40 +534,95 @@ void deform_func(const BoundBox &bbox, double *xold, double *xnew)
 ErrorCode DeformMeshRemap::deform_master(Range &fluid_elems, Range &solid_elems, const char *tag_name) 
 {
     // deform elements with an analytic function
+  ErrorCode rval;
 
-    // create the tag
-  ErrorCode rval = mbImpl->tag_get_handle((tag_name ? tag_name : ""), 3, MB_TYPE_DOUBLE, xNew, MB_TAG_CREAT|MB_TAG_DENSE);
-  RR("Failed to create xnew tag.");
-  
-    // get all the vertices and coords in the fluid, set xnew to them
-  Range verts;
-  rval = mbImpl->get_adjacencies(fluid_elems, 0, false, verts, Interface::UNION);
+    // get all the vertices and coords in the solid
+  Range solid_verts, fluid_verts;
+  rval = mbImpl->get_adjacencies(solid_elems, 0, false, solid_verts, Interface::UNION);
   RR("Failed to get vertices.");
-  std::vector<double> coords(3*verts.size(), 0.0);
-  rval = mbImpl->get_coords(verts, &coords[0]);
+  std::vector<double> coords(3*solid_verts.size()), new_coords(3*solid_verts.size());
+  rval = mbImpl->get_coords(solid_verts, &coords[0]);
   RR("Failed to get vertex coords.");
-  rval = mbImpl->tag_set_data(xNew, verts, &coords[0]);
-  RR("Failed to set xnew tag on fluid verts.");
+  unsigned int num_verts = solid_verts.size();
+
+    // get or create the tag
+  if (!xDispNames[0].empty() && !xDispNames[1].empty() && !xDispNames[2].empty()) {
+      // 3 tags, specifying xyz individual data, integrate into one tag
+    rval = mbImpl->tag_get_handle((tag_name ? tag_name : ""), 3, MB_TYPE_DOUBLE, xNew, MB_TAG_CREAT|MB_TAG_DENSE);
+    RR("Failed to create xnew tag.");
+    std::vector<double> disps(num_verts);
+    for (int i = 0; i < 3; i++) {
+      rval = mbImpl->tag_get_handle(xDispNames[0].c_str(), 1, MB_TYPE_DOUBLE, xDisp[i]);
+      RR("Failed to get xDisp tag.");
+      rval = mbImpl->tag_get_data(xDisp[i], solid_verts, &disps[0]);
+      RR("Failed to get xDisp tag values.");
+      for (unsigned int j = 0; j < num_verts; j++)
+        new_coords[3*j+i] = coords[3*j+i] + disps[j];
+    }
+  }
+  else if (!xDispNames[0].empty()) {
+    rval = mbImpl->tag_get_handle(xDispNames[0].c_str(), 3, MB_TYPE_DOUBLE, xDisp[0]);
+    RR("Failed to get first xDisp tag.");
+    xNew = xDisp[0];
+    std::vector<double> disps(3*num_verts);
+    rval = mbImpl->tag_get_data(xDisp[0], solid_verts, &disps[0]);
+    for (unsigned int j = 0; j < 3*num_verts; j++)
+      new_coords[j] = coords[j] + disps[j];
+  }
+  else {
+      // get the bounding box of the solid mesh
+    BoundBox bbox;
+    bbox.update(*mbImpl, solid_elems);
+  
+    for (unsigned int j = 0; j < num_verts; j++)
+      deform_func(bbox, &coords[3*j], &new_coords[3*j]);
+  }
 
-    // get the bounding box of the solid mesh
-  BoundBox bbox;
-  bbox.update(*mbImpl, solid_elems);
+  if (debug) {
+    double len = 0.0;
+    for (unsigned int i = 0; i < num_verts; i++) {
+      CartVect dx = CartVect(&new_coords[3*i]) - CartVect(&coords[3*i]);
+      double tmp_len = dx.length_squared();
+      if (tmp_len > len) len = tmp_len;
+    }
+    Range tmp_elems(fluid_elems);
+    tmp_elems.merge(solid_elems);
+    BoundBox box;
+    box.update(*mbImpl, tmp_elems);
+    double max_len = std::max(box.bMax[2]-box.bMin[2], std::max(box.bMax[1]-box.bMin[1], box.bMax[0]-box.bMin[0]));
+    
+    std::cout << "Max displacement = " << len << " (" << 100.0 * len / max_len << "% of max box length)" << std::endl;
+  }
   
-    // get all the vertices and coords in the solid
-  verts.clear();
-  rval = mbImpl->get_adjacencies(solid_elems, 0, false, verts, Interface::UNION);
-  RR("Failed to get vertices.");
-  coords.resize(3*verts.size(), 0.0);
-  rval = mbImpl->get_coords(verts, &coords[0]);
-  RR("Failed to get vertex coords.");
-  unsigned int num_verts = verts.size();
-  for (unsigned int i = 0; i < num_verts; i++)
-    deform_func(bbox, &coords[3*i], &coords[3*i]);
+  if (!xNew) {
+    rval = mbImpl->tag_get_handle((tag_name ? tag_name : ""), 3, MB_TYPE_DOUBLE, 
+                                  xDisp[0], MB_TAG_CREAT|MB_TAG_DENSE);
+    RR("Failed to get xNew tag.");
+    xNew = xDisp[0];
+  }
     
     // set the new tag to those coords
-  rval = mbImpl->tag_set_data(xNew, verts, &coords[0]);
+  rval = mbImpl->tag_set_data(xNew, solid_verts, &new_coords[0]);
   RR("Failed to set tag data.");
   
+    // get all the vertices and coords in the fluid, set xnew to them
+  rval = mbImpl->get_adjacencies(fluid_elems, 0, false, fluid_verts, Interface::UNION);
+  RR("Failed to get vertices.");
+  fluid_verts = subtract(fluid_verts, solid_verts);
+  
+  if (coords.size() < 3*fluid_verts.size()) coords.resize(3*fluid_verts.size());
+  rval = mbImpl->get_coords(fluid_verts, &coords[0]);
+  RR("Failed to get vertex coords.");
+  rval = mbImpl->tag_set_data(xNew, fluid_verts, &coords[0]);
+  RR("Failed to set xnew tag on fluid verts.");
+ 
+  if (debug) {
+      // save deformed mesh coords to new file for visualizing
+    Range tmp_range(fluidElems[MASTER]);
+    tmp_range.merge(solidElems[MASTER]);
+    rval = write_and_save(tmp_range, masterSet, xNew, "deformed_master.h5m", true); RR("");
+  }
+    
   return MB_SUCCESS;
 }
 
@@ -441,17 +643,22 @@ ErrorCode DeformMeshRemap::read_file(int m_or_s, string &fname, EntityHandle &se
   rval = mbImpl->load_file(fname.c_str(), &seth, ostr.str().c_str());
   RR("Couldn't load master/slave mesh.");
 
+  if (*solidSetNos[m_or_s].begin() == -1 || *fluidSetNos[m_or_s].begin() == -1) return MB_SUCCESS;
+  
     // get material sets for solid/fluid
   Tag tagh;
   rval = mbImpl->tag_get_handle(MATERIAL_SET_TAG_NAME, tagh); RR("Couldn't get material set tag name.");
-  for (std::set<int>::iterator sit = solidSetNos.begin(); sit != solidSetNos.end(); sit++) {
+  for (std::set<int>::iterator sit = solidSetNos[m_or_s].begin(); sit != solidSetNos[m_or_s].end(); sit++) {
     Range sets;
     int set_no = *sit;
     const void *setno_ptr = &set_no;
-    rval = mbImpl->get_entities_by_type_and_tag(seth, MBENTITYSET, &tagh, &setno_ptr, 1, sets);
-    if (sets.empty()) rval = MB_FAILURE;
-    RR("Couldn't get any solid sets.");
-    solidSets[m_or_s].merge(sets);
+    ErrorCode tmp_rval = mbImpl->get_entities_by_type_and_tag(seth, MBENTITYSET, &tagh, &setno_ptr, 1, sets);
+    if (sets.empty() || MB_SUCCESS != tmp_rval) {
+      rval = MB_FAILURE;
+      mError->set_last_error("Couldn't find solid set #%d.\n", *sit);
+    }
+    else
+      solidSets[m_or_s].merge(sets);
   }
 
     // get solid entities, and dimension
@@ -460,19 +667,26 @@ ErrorCode DeformMeshRemap::read_file(int m_or_s, string &fname, EntityHandle &se
     rval = mbImpl->get_entities_by_handle(*rit, tmp_range, true);
     RR("Failed to get entities in solid.");
   }
-  int dim = mbImpl->dimension_from_handle(*tmp_range.rbegin());
-  assert(dim > 0 && dim < 4);
-  
-  solidElems[m_or_s] = tmp_range.subset_by_dimension(dim);
+  if (!tmp_range.empty()) {
+    int dim = mbImpl->dimension_from_handle(*tmp_range.rbegin());
+    assert(dim > 0 && dim < 4);
+    solidElems[m_or_s] = tmp_range.subset_by_dimension(dim);
+  }
+
+  if (debug)
+    std::cout << "Read " << solidElems[m_or_s].size() << " solid elements from " << solidSets[m_or_s].size() << " sets in " << (m_or_s == MASTER ? "master" : "slave") << " mesh." << std::endl;    
 
-  for (std::set<int>::iterator sit = fluidSetNos.begin(); sit != fluidSetNos.end(); sit++) {
+  for (std::set<int>::iterator sit = fluidSetNos[m_or_s].begin(); sit != fluidSetNos[m_or_s].end(); sit++) {
     Range sets;
     int set_no = *sit;
     const void *setno_ptr = &set_no;
-    rval = mbImpl->get_entities_by_type_and_tag(seth, MBENTITYSET, &tagh, &setno_ptr, 1, sets);
-    if (sets.empty()) rval = MB_FAILURE;
-    RR("Couldn't get any fluid sets.");
-    fluidSets[m_or_s].merge(sets);
+    ErrorCode tmp_rval = mbImpl->get_entities_by_type_and_tag(seth, MBENTITYSET, &tagh, &setno_ptr, 1, sets);
+    if (sets.empty() || MB_SUCCESS != tmp_rval) {
+      rval = MB_FAILURE;
+      mError->set_last_error("Couldn't find fluid set #%d.\n", *sit);
+    }
+    else
+      fluidSets[m_or_s].merge(sets);
   }
 
     // get fluid entities, and dimension
@@ -481,8 +695,66 @@ ErrorCode DeformMeshRemap::read_file(int m_or_s, string &fname, EntityHandle &se
     rval = mbImpl->get_entities_by_handle(*rit, tmp_range, true);
     RR("Failed to get entities in fluid.");
   }
+  if (!tmp_range.empty()) {
+    int dim = mbImpl->dimension_from_handle(*tmp_range.rbegin());
+    assert(dim > 0 && dim < 4);
+    fluidElems[m_or_s] = tmp_range.subset_by_dimension(dim);
+  }
+  
+  if (debug)
+    std::cout << "Read " << fluidElems[m_or_s].size() << " fluid elements from " << fluidSets[m_or_s].size() << " sets in " << (m_or_s == MASTER ? "master" : "slave") << " mesh." << std::endl;
+
+  return rval;
+}
+
+ErrorCode DeformMeshRemap::find_other_sets(int m_or_s, EntityHandle file_set) 
+{
+    // solid or fluid sets are missing; find the other
+  Range *filled_sets = NULL, *unfilled_sets = NULL, *unfilled_elems = NULL;
+  
+  if (fluidSets[m_or_s].empty() && !solidSets[m_or_s].empty()) {
+    unfilled_sets = &fluidSets[m_or_s];
+    filled_sets = &solidSets[m_or_s];
+    unfilled_elems = &fluidElems[m_or_s];
+    if (debug)
+      std::cout << "Finding unspecified fluid elements in " << (m_or_s == MASTER ? "master" : "slave") << " mesh...";
+  }
+  else if (!fluidSets[m_or_s].empty() && solidSets[m_or_s].empty()) {
+    filled_sets = &fluidSets[m_or_s];
+    unfilled_sets = &solidSets[m_or_s];
+    unfilled_elems = &solidElems[m_or_s];
+    if (debug)
+      std::cout << "Finding unspecified solid elements in " << (m_or_s == MASTER ? "master" : "slave") << " mesh...";
+  }
   
-  fluidElems[m_or_s] = tmp_range.subset_by_dimension(dim);
+    // ok, we know the filled sets, now fill the unfilled sets, and the elems from those
+  Tag tagh;
+  ErrorCode rval = mbImpl->tag_get_handle(MATERIAL_SET_TAG_NAME, tagh); RR("Couldn't get material set tag name.");
+  Range matsets;
+  rval = mbImpl->get_entities_by_type_and_tag(file_set, MBENTITYSET, &tagh, NULL, 1, matsets);
+  if (matsets.empty()) rval = MB_FAILURE;
+  RR("Couldn't get any material sets.");
+  *unfilled_sets = subtract(matsets, *filled_sets);
+  if (unfilled_sets->empty()) {
+    rval = MB_FAILURE;
+    RR("Failed to find any unfilled material sets.");
+  }
+  Range tmp_range;
+  for (Range::iterator rit = unfilled_sets->begin(); rit != unfilled_sets->end(); rit++) {
+    rval = mbImpl->get_entities_by_handle(*rit, tmp_range, true);
+    RR("Failed to get entities in unfilled set.");
+  }
+  int dim = mbImpl->dimension_from_handle(*tmp_range.rbegin());
+  assert(dim > 0 && dim < 4);  
+  *unfilled_elems = tmp_range.subset_by_dimension(dim);
+  if (unfilled_elems->empty()) {
+    rval = MB_FAILURE;
+    RR("Failed to find any unfilled set entities.");
+  }
+
+  if (debug) 
+    std::cout << "found " << unfilled_sets->size() << " sets and " << unfilled_elems->size() << " elements." << std::endl;
   
   return MB_SUCCESS;
 }
+

diff --git a/itaps/imesh/CMakeLists.txt b/itaps/imesh/CMakeLists.txt
index 0a0a95f..9ee02bc 100644
--- a/itaps/imesh/CMakeLists.txt
+++ b/itaps/imesh/CMakeLists.txt
@@ -33,6 +33,14 @@ set ( MOAB_IMESH_LIB_INCLUDES
 if ( MOAB_USE_MPI )
   include_directories( ${CMAKE_SOURCE_DIR}/src/parallel )
   ADD_CUSTOM_COMMAND(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_extensions_protos.h
+    COMMAND ${CMAKE_COMMAND}
+            -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMeshP_extensions.h
+            -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMeshP_extensions_protos.h
+            -Dprefix:STRING=iMesh
+            -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
+    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh_extensions.h)
+  ADD_CUSTOM_COMMAND(
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
     COMMAND ${CMAKE_COMMAND}
             -DDEF:STRING=MOAB
@@ -41,7 +49,6 @@ if ( MOAB_USE_MPI )
             -Dprefix:STRING=iMeshP
             -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
     DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMeshP.h )
-
   set(MOAB_IMESH_SRCS ${MOAB_IMESH_SRCS}
                       iMeshP_MOAB.cpp)
   set(MOAB_IMESH_LIB_INCLUDES
@@ -54,6 +61,7 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
                      ${CMAKE_BINARY_DIR}/src
                      ${CMAKE_SOURCE_DIR}/src
                      ${CMAKE_SOURCE_DIR}/itaps
+                     ${CMAKE_BINARY_DIR}/itaps
                      ${CMAKE_SOURCE_DIR}/itaps/imesh )
 
 if ( MOAB_USE_HDF5 AND HDF5_FOUND )

diff --git a/src/AdaptiveKDTree.cpp b/src/AdaptiveKDTree.cpp
index 1324c30..4b104b4 100644
--- a/src/AdaptiveKDTree.cpp
+++ b/src/AdaptiveKDTree.cpp
@@ -176,7 +176,6 @@ namespace moab {
         else {
           rval = iter.step();
           if (MB_ENTITY_NOT_FOUND == rval) {
-            treeStats.reset();
             rval = treeStats.compute_stats(mbImpl, myRoot);
             treeStats.initTime = cp.time_elapsed();
             return rval;  // at end
@@ -799,7 +798,7 @@ namespace moab {
                                             double& t_enter, 
                                             double& t_exit ) const
     {
-      treeTool->treeStats.leafObjectTests++;
+      treeTool->treeStats.traversalLeafObjectTests++;
       return GeomUtil::ray_box_intersect( CartVect(box_min()),
                                           CartVect(box_max()),
                                           CartVect(ray_point),
@@ -807,8 +806,7 @@ namespace moab {
                                           t_enter, t_exit );
     }
 
-    static ErrorCode intersect_children_with_elems(
-        AdaptiveKDTree* tool,
+    ErrorCode AdaptiveKDTree::intersect_children_with_elems(
         const Range& elems,
         AdaptiveKDTree::Plane plane,
         double eps,
@@ -823,15 +821,16 @@ namespace moab {
       right_tris.clear();
       both_tris.clear();
       CartVect coords[16];
-      Interface *const moab = tool->moab();
   
         // get extents of boxes for left and right sides
-      CartVect right_min( box_min ), left_max( box_max );
-      right_min[plane.norm] = left_max[plane.norm] = plane.coord;
-      const CartVect left_cen = 0.5*(left_max + box_min);
-      const CartVect left_dim = 0.5*(left_max - box_min);
-      const CartVect right_cen = 0.5*(box_max + right_min);
-      const CartVect right_dim = 0.5*(box_max - right_min);
+      BoundBox left_box(box_min, box_max), right_box(box_min, box_max);
+      right_box.bMin = box_min;
+      left_box.bMax = box_max;
+      right_box.bMin[plane.norm] = left_box.bMax[plane.norm] = plane.coord;
+      const CartVect left_cen = 0.5*(left_box.bMax + box_min);
+      const CartVect left_dim = 0.5*(left_box.bMax - box_min);
+      const CartVect right_cen = 0.5*(box_max + right_box.bMin);
+      const CartVect right_dim = 0.5*(box_max - right_box.bMin);
       const CartVect dim = box_max - box_min;
       const double max_tol = std::max(dim[0], std::max(dim[1], dim[2]))/10;
   
@@ -851,8 +850,8 @@ namespace moab {
   
         // vertices
       for (i = elems.begin(); i != elem_begin; ++i) {
-        tool->tree_stats().leafObjectTests++;
-        rval = moab->get_coords( &*i, 1, coords[0].array() );
+        tree_stats().constructLeafObjectTests++;
+        rval = moab()->get_coords( &*i, 1, coords[0].array() );
         if (MB_SUCCESS != rval)
           return rval;
     
@@ -873,13 +872,13 @@ namespace moab {
         // non-polyhedron elements
       std::vector<EntityHandle> dum_vector;
       for (i = elem_begin; i != poly_begin; ++i) {
-        tool->tree_stats().leafObjectTests++;
-        rval = moab->get_connectivity( *i, conn, count, true, &dum_vector);
+        tree_stats().constructLeafObjectTests++;
+        rval = moab()->get_connectivity( *i, conn, count, true, &dum_vector);
         if (MB_SUCCESS != rval) 
           return rval;
         if (count > (int)(sizeof(coords)/sizeof(coords[0])))
           return MB_FAILURE;
-        rval = moab->get_coords( &conn[0], count, coords[0].array() );
+        rval = moab()->get_coords( &conn[0], count, coords[0].array() );
         if (MB_SUCCESS != rval) return rval;
     
         bool lo = false, ro = false;
@@ -894,12 +893,16 @@ namespace moab {
           // identified that leaf, then we're done.  If triangle is on both
           // sides of plane, do more precise test to ensure that it is really
           // in both.
+//        BoundBox box;
+//        box.update(*moab(), *i);
         if (lo && ro) {
           double tol = eps;
           lo = ro = false;
           while (!lo && !ro && tol <= max_tol) {
-            lo = GeomUtil::box_elem_overlap( coords, TYPE_FROM_HANDLE(*i), left_cen, left_dim+CartVect(tol) );
-            ro = GeomUtil::box_elem_overlap( coords, TYPE_FROM_HANDLE(*i),right_cen,right_dim+CartVect(tol) );
+            tree_stats().boxElemTests+= 2;
+            lo = GeomUtil::box_elem_overlap( coords, TYPE_FROM_HANDLE(*i), left_cen, left_dim+CartVect(tol));
+            ro = GeomUtil::box_elem_overlap( coords, TYPE_FROM_HANDLE(*i), right_cen, right_dim+CartVect(tol));
+            
             tol *= 10.0;
           }
         }
@@ -913,20 +916,20 @@ namespace moab {
   
         // polyhedra
       for (i = poly_begin; i != set_begin; ++i) {
-        tool->tree_stats().leafObjectTests++;
-        rval = moab->get_connectivity( *i, conn, count, true );
+        tree_stats().constructLeafObjectTests++;
+        rval = moab()->get_connectivity( *i, conn, count, true );
         if (MB_SUCCESS != rval) 
           return rval;
       
           // just check the bounding box of the polyhedron
         bool lo = false, ro = false;
         for (int j = 0; j < count; ++j) {
-          rval = moab->get_connectivity( conn[j], conn2, count2, true );
+          rval = moab()->get_connectivity( conn[j], conn2, count2, true );
           if (MB_SUCCESS != rval)
             return rval;
       
           for (int k = 0; k < count2; ++k) {
-            rval = moab->get_coords( conn2 + k, 1, coords[0].array() );
+            rval = moab()->get_coords( conn2 + k, 1, coords[0].array() );
             if (MB_SUCCESS != rval)
               return rval;
             if (coords[0][plane.norm] <= plane.coord)
@@ -947,8 +950,8 @@ namespace moab {
         // sets
       BoundBox tbox;
       for (i = set_begin; i != elems.end(); ++i) {
-        tool->tree_stats().leafObjectTests++;
-        rval = tbox.update(*tool->moab(), *i);
+        tree_stats().constructLeafObjectTests++;
+        rval = tbox.update(*moab(), *i);
         if (MB_SUCCESS != rval)
           return rval;
     
@@ -1005,8 +1008,7 @@ namespace moab {
           AdaptiveKDTree::Plane plane = { box_min[axis] + (p/(1.0+plane_count)) * diff[axis], axis };
           Range left, right, both;
           double val;
-          r = intersect_children_with_elems( iter.tool(),
-                                             entities, plane, eps,
+          r = intersect_children_with_elems( entities, plane, eps,
                                              box_min, box_max,
                                              left, right, both, 
                                              val );
@@ -1057,32 +1059,38 @@ namespace moab {
       if (MB_SUCCESS != r)
         return r;
 
-      tmp_data.resize( vertices.size() );
+      unsigned int nverts = vertices.size();
+      tmp_data.resize( 3*nverts);
+      r = iter.tool()->moab()->get_coords( vertices, &tmp_data[0], &tmp_data[nverts], &tmp_data[2*nverts] );
+      if (MB_SUCCESS != r)
+        return r;
+  
       for (int axis = 0; axis < 3; ++axis) {
         int plane_count = num_planes;
+
+          // if num_planes results in width < eps, reset the plane count
         if ((num_planes+1)*eps >= diff[axis])
           plane_count = (int)(diff[axis] / eps) - 1;
 
-        double *ptrs[] = { 0, 0, 0 };
-        ptrs[axis] = &tmp_data[0];
-        r = iter.tool()->moab()->get_coords( vertices, ptrs[0], ptrs[1], ptrs[2] );
-        if (MB_SUCCESS != r)
-          return r;
-  
         for (int p = 1; p <= plane_count; ++p) {
+
+            // coord of this plane on axis
           double coord = box_min[axis] + (p/(1.0+plane_count)) * diff[axis];
-          double closest_coord = tmp_data[0];
-          for (unsigned i = 1; i < tmp_data.size(); ++i) 
-            if (fabs(coord-tmp_data[i]) < fabs(coord-closest_coord))
-              closest_coord = tmp_data[i];
+
+            // find closest vertex coordinate to this plane position
+          unsigned int istrt = axis*nverts;
+          double closest_coord = tmp_data[istrt];
+          for (unsigned i = 1; i < nverts; ++i) 
+            if (fabs(coord-tmp_data[istrt+i]) < fabs(coord-closest_coord))
+              closest_coord = tmp_data[istrt+i];
           if (closest_coord - box_min[axis] <= eps || box_max[axis] - closest_coord <= eps)
             continue;
           
+            // seprate elems into left/right/both, and compute separating metric
           AdaptiveKDTree::Plane plane = { closest_coord, axis };
           Range left, right, both;
           double val;
-          r = intersect_children_with_elems( iter.tool(),
-                                             entities, plane, eps,
+          r = intersect_children_with_elems( entities, plane, eps,
                                              box_min, box_max,
                                              left, right, both, 
                                              val );
@@ -1160,8 +1168,7 @@ namespace moab {
           AdaptiveKDTree::Plane plane = { *citer, axis };
           Range left, right, both;
           double val;
-          r = intersect_children_with_elems( iter.tool(),
-                                             entities, plane, eps,
+          r = intersect_children_with_elems( entities, plane, eps,
                                              box_min, box_max,
                                              left, right, both, 
                                              val );
@@ -1276,8 +1283,7 @@ namespace moab {
           AdaptiveKDTree::Plane plane = { coords[indices[p]], axis };
           Range left, right, both;
           double val;
-          r = intersect_children_with_elems( iter.tool(),
-                                             entities, plane, eps,
+          r = intersect_children_with_elems( entities, plane, eps,
                                              box_min, box_max,
                                              left, right, both, 
                                              val );
@@ -1348,7 +1354,7 @@ namespace moab {
       treeStats.leavesVisited++;
       if (myEval && params) {
         rval = myEval->find_containing_entity(node, point, iter_tol, inside_tol,
-                                              leaf_out, params->array(), &treeStats.leafObjectTests);
+                                              leaf_out, params->array(), &treeStats.traversalLeafObjectTests);
         if (MB_SUCCESS != rval) return rval;
       }
       else 
@@ -1488,7 +1494,7 @@ namespace moab {
             EntityHandle ent;
             CartVect params;
             rval = myEval->find_containing_entity(node.handle, from_point, iter_tol, inside_tol,
-                                                  ent, params.array(), &treeStats.leafObjectTests);
+                                                  ent, params.array(), &treeStats.traversalLeafObjectTests);
             if (MB_SUCCESS != rval) return rval;
             else if (ent) {
               result_list.push_back(ent);

This diff is so big that we needed to truncate the remainder.

https://bitbucket.org/fathomteam/moab/commits/506ee035b4b2/
Changeset:   506ee035b4b2
Branch:      None
User:        vijaysm
Date:        2014-06-05 19:51:29
Summary:     Add support for PNetCDF and Zoltan

Signed-off-by: Jacob Becker <jacob.becker at kitware.com>

Affected #:  1 file

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 649a4c1..0fce05a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,6 +65,8 @@ option ( MOAB_USE_CGNS       "Should build with CGNS support?"                 O
 option ( MOAB_USE_MPI        "Should MOAB be compiled with MPI support?"       OFF )
 option ( MOAB_USE_HDF        "Include HDF I/O in the build?"                   OFF )
 option ( MOAB_USE_NETCDF     "Include NetCDF support (ExodusII) in the build?" OFF )
+option ( MOAB_USE_PNETCDF     "Include parallel NetCDF support (ExodusII) in the build?" OFF )
+option ( MOAB_USE_ZOLTAN     "Include Zoltan support for partitioning algorithms?" OFF )
 option ( MOAB_ENABLE_TESTING "Enable Testing"                                  ON  )
 option ( MOAB_FORCE_64_BIT_HANDLES "Force MBEntityHandle to be 64 bits (uint64_t)" OFF )
 option ( MOAB_FORCE_32_BIT_HANDLES "Force MBEntityHandle to be 32 bits (uint32_t)" OFF )
@@ -139,8 +141,8 @@ endif ( MOAB_USE_MPI )
 if ( MOAB_USE_NETCDF )
   find_package( NetCDF REQUIRED )
   set( MOAB_DEFINES "-DNETCDF_FILE ${MOAB_DEFINES}" )
-  include_directories( ${NetCDF_INCLUDE_DIRECTORIES} )
-  set( MOAB_LIBS ${MOAB_LIBS} ${NetCDF_LIBRARIES} )
+  include_directories( ${NetCDF_INCLUDES} ${PNetCDF_INCLUDES} )
+  set( MOAB_LIBS ${MOAB_LIBS} ${NetCDF_LIBRARIES} ${PNetCDF_LIBRARIES} )
 endif ( MOAB_USE_NETCDF )
 
 if ( MOAB_USE_HDF )


https://bitbucket.org/fathomteam/moab/commits/9765d28ad333/
Changeset:   9765d28ad333
Branch:      None
User:        vijaysm
Date:        2014-06-05 19:51:40
Summary:     Update HDF5 to also search for math, compression and dynamic loading libraries. FindNetCDF updated to include searching for PNetCDF includes and libraries also.

Signed-off-by: Jacob Becker <jacob.becker at kitware.com>

Affected #:  2 files

diff --git a/config/FindHDF5.cmake b/config/FindHDF5.cmake
index e4d8a35..179eeba 100644
--- a/config/FindHDF5.cmake
+++ b/config/FindHDF5.cmake
@@ -15,7 +15,15 @@ FIND_PATH(HDF5_INCLUDE_DIR
   /usr/include
   /opt/local/include
 )
-
+FIND_LIBRARY(HDF5_D1 dl
+  PATHS /usr/local/lib /usr/lib /opt/local/lib
+)
+FIND_LIBRARY(HDF5_D2 m
+  PATHS /usr/local/lib /usr/lib /opt/local/lib
+)
+FIND_LIBRARY(HDF5_D3 z
+  PATHS /usr/local/lib /usr/lib /opt/local/lib
+)
 FIND_LIBRARY(HDF5_BASE_LIBRARY hdf5
   PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
 )
@@ -38,7 +46,7 @@ IF (NOT HDF5_FOUND)
       NAMES hdf5hl_fortran hdf5_hl_fortran
       PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
     )
-    SET( HDF5_INCLUDES "-I${HDF5_INCLUDE_DIR}" )
+    SET( HDF5_INCLUDES "${HDF5_INCLUDE_DIR}" )
     if (HDF5_FORT_LIBRARY)
       FIND_PATH(HDF5_FORT_INCLUDE_DIR
         NAMES hdf5.mod
@@ -49,7 +57,7 @@ IF (NOT HDF5_FOUND)
         /opt/local/include
       )
       if (HDF5_FORT_INCLUDE_DIR AND NOT ${HDF5_FORT_INCLUDE_DIR} STREQUAL ${HDF5_INCLUDE_DIR})
-        SET( HDF5_INCLUDES "${HDF5_INCLUDES} -I${HDF5_FORT_INCLUDE_DIR}" )
+        SET( HDF5_INCLUDES "${HDF5_INCLUDES} ${HDF5_FORT_INCLUDE_DIR}" )
       endif (HDF5_FORT_INCLUDE_DIR AND NOT ${HDF5_FORT_INCLUDE_DIR} STREQUAL ${HDF5_INCLUDE_DIR})
       unset(HDF5_FORT_INCLUDE_DIR CACHE)
     endif (HDF5_FORT_LIBRARY)
@@ -64,6 +72,7 @@ IF (NOT HDF5_FOUND)
       unset(HDF5_HL${VARIANT}_LIBRARY CACHE)
       unset(HDF5_${VARIANT}_LIBRARY CACHE)
     endforeach()
+    list(APPEND HDF5_LIBRARIES ${HDF5_D1} ${HDF5_D2} ${HDF5_D3})
     SET( HDF5_FOUND YES )
     message (STATUS "---   HDF5 Configuration ::")
     message (STATUS "        INCLUDES  : ${HDF5_INCLUDES}")

diff --git a/config/FindNetCDF.cmake b/config/FindNetCDF.cmake
index e0e988c..68d6cd4 100644
--- a/config/FindNetCDF.cmake
+++ b/config/FindNetCDF.cmake
@@ -57,7 +57,7 @@ find_library( NetCDF_FORTRAN_LIBRARY
 IF (NOT NetCDF_FOUND)
   if ( NetCDF_INCLUDE_DIR AND NetCDF_C_LIBRARY )
     set( NetCDF_FOUND YES )
-    set(NetCDF_INCLUDES "-I${NetCDF_INCLUDE_DIR}")
+    set(NetCDF_INCLUDES "${NetCDF_INCLUDE_DIR}")
     set(NetCDF_LIBRARIES ${NetCDF_C_LIBRARY})
     if ( NetCDF_CXX_LIBRARY )
       set(NetCDF_LIBRARIES ${NetCDF_LIBRARIES} ${NetCDF_CXX_LIBRARY})
@@ -80,6 +80,51 @@ mark_as_advanced(
   NetCDF_LIBRARIES
 )
 
+IF (MOAB_USE_MPI)
+  set (PNetCDF_DIR "" CACHE PATH "Path to search for parallel NetCDF header and library files" )
+  set (PNetCDF_FOUND NO CACHE INTERNAL "Found parallel NetCDF components successfully." )
+
+  find_path( PNetCDF_INCLUDES pnetcdf.h
+    ${PNetCDF_DIR}
+    ${PNetCDF_DIR}/include
+    /usr/local/include
+    /usr/include
+  )
+
+  find_library( PNetCDF_LIBRARIES
+    NAMES pnetcdf
+    HINTS ${PNetCDF_DIR}
+    ${PNetCDF_DIR}/lib64
+    ${PNetCDF_DIR}/lib
+    /usr/local/lib64
+    /usr/lib64
+    /usr/lib64/pnetcdf
+    /usr/local/lib
+    /usr/lib
+    /usr/lib/pnetcdf
+  )
+
+  IF (NOT PNetCDF_FOUND)
+    if ( PNetCDF_INCLUDES AND PNetCDF_LIBRARIES )
+      set( PNetCDF_FOUND YES )
+      message (STATUS "---   PNetCDF Configuration ::")
+      message (STATUS "        INCLUDES  : ${PNetCDF_INCLUDES}")
+      message (STATUS "        LIBRARIES : ${PNetCDF_LIBRARIES}")
+    else ( PNetCDF_INCLUDES AND PNetCDF_LIBRARIES )
+      set( NetCDF_FOUND NO )
+      message("finding PNetCDF failed, please try to set the var PNetCDF_DIR")
+    endif ( PNetCDF_INCLUDES AND PNetCDF_LIBRARIES )
+  ENDIF (NOT PNetCDF_FOUND)
+
+  mark_as_advanced(
+    PNetCDF_DIR
+    PNetCDF_INCLUDES
+    PNetCDF_LIBRARIES
+  )
+ENDIF()
+
 include (FindPackageHandleStandardArgs)
 find_package_handle_standard_args (NetCDF "NetCDF not found, check environment variables NetCDF_DIR"
   NetCDF_DIR NetCDF_INCLUDES NetCDF_LIBRARIES)
+find_package_handle_standard_args (PNetCDF "PNetCDF not found, check environment variables PNetCDF_DIR"
+  PNetCDF_DIR PNetCDF_INCLUDES PNetCDF_LIBRARIES)


https://bitbucket.org/fathomteam/moab/commits/1b407e551e64/
Changeset:   1b407e551e64
Branch:      None
User:        vijaysm
Date:        2014-06-05 19:51:49
Summary:     Export iMeshP_extensions_protos and fix includes

Signed-off-by: Jacob Becker <jacob.becker at kitware.com>

Affected #:  1 file

diff --git a/itaps/imesh/CMakeLists.txt b/itaps/imesh/CMakeLists.txt
index 9ee02bc..204ce93 100644
--- a/itaps/imesh/CMakeLists.txt
+++ b/itaps/imesh/CMakeLists.txt
@@ -31,7 +31,8 @@ set ( MOAB_IMESH_LIB_INCLUDES
           MBiMesh.hpp )
 
 if ( MOAB_USE_MPI )
-  include_directories( ${CMAKE_SOURCE_DIR}/src/parallel )
+  include_directories( ${CMAKE_SOURCE_DIR}/src/parallel
+                       ${CMAKE_BINARY_DIR}/src/parallel)
   ADD_CUSTOM_COMMAND(
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_extensions_protos.h
     COMMAND ${CMAKE_COMMAND}
@@ -53,7 +54,8 @@ if ( MOAB_USE_MPI )
                       iMeshP_MOAB.cpp)
   set(MOAB_IMESH_LIB_INCLUDES
           ${MOAB_IMESH_LIB_INCLUDES}
-          ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h )
+          ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
+          ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_extensions_protos.h )
 endif()
 
 include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
@@ -61,8 +63,7 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
                      ${CMAKE_BINARY_DIR}/src
                      ${CMAKE_SOURCE_DIR}/src
                      ${CMAKE_SOURCE_DIR}/itaps
-                     ${CMAKE_BINARY_DIR}/itaps
-                     ${CMAKE_SOURCE_DIR}/itaps/imesh )
+                     ${CMAKE_BINARY_DIR}/itaps )
 
 if ( MOAB_USE_HDF5 AND HDF5_FOUND )
   include_directories( ${HDF5_INCLUDE_DIRECTORIES}


https://bitbucket.org/fathomteam/moab/commits/2c254c49e8df/
Changeset:   2c254c49e8df
Branch:      None
User:        vijaysm
Date:        2014-06-05 19:52:01
Summary:     More updates for include paths

Signed-off-by: Jacob Becker <jacob.becker at kitware.com>

Affected #:  2 files

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index fbd3dec..3532774 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -9,7 +9,8 @@ include_directories(
     ${CMAKE_BINARY_DIR}/itaps
     ${CMAKE_SOURCE_DIR}/itaps/imesh
     ${CMAKE_BINARY_DIR}/itaps/imesh
-    ${CMAKE_SOURCE_DIR}/src/parallel )
+    ${CMAKE_SOURCE_DIR}/src/parallel
+    ${CMAKE_BINARY_DIR}/src/parallel )
 
 add_subdirectory(io)
 add_subdirectory(dual)
@@ -166,7 +167,7 @@ if ( MOAB_USE_MPI AND MPI_FOUND )
     set_source_files_properties( parallel/mhdf_parallel.c
       COMPILE_FLAGS "-DTEST ${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
     add_executable( mhdf_parallel parallel/mhdf_parallel.c )
-    target_link_libraries( mhdf_parallel mhdf MOAB MOABpar )
+    target_link_libraries( mhdf_parallel MOAB MOABpar )
     add_test( TestMHDFParallel ${EXECUTABLE_OUTPUT_PATH}/mhdf_parallel )
   endif ( MOAB_USE_HDF )
 

diff --git a/tools/mbcoupler/CMakeLists.txt b/tools/mbcoupler/CMakeLists.txt
index 824f4b1..d17f676 100644
--- a/tools/mbcoupler/CMakeLists.txt
+++ b/tools/mbcoupler/CMakeLists.txt
@@ -5,6 +5,7 @@ include_directories(
     ${CMAKE_SOURCE_DIR}/src/moab/point_locater/lotte
     ${CMAKE_SOURCE_DIR}/itaps
     ${CMAKE_SOURCE_DIR}/itaps/imesh
+    ${CMAKE_BINARY_DIR}/itaps/imesh
     ${CMAKE_SOURCE_DIR}
     ${CMAKE_SOURCE_DIR}/src
     ${CMAKE_SOURCE_DIR}/src/parallel


https://bitbucket.org/fathomteam/moab/commits/f6c3eb0d25d6/
Changeset:   f6c3eb0d25d6
Branch:      None
User:        vijaysm
Date:        2014-06-05 19:52:11
Summary:     Update all missing sources, add necessary linkage and include flags

Signed-off-by: Jacob Becker <jacob.becker at kitware.com>

Affected #:  3 files

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a93d4e6..92f4200 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,7 +2,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
                     ${CMAKE_CURRENT_BINARY_DIR}
                     parallel
                     LocalDiscretization
-                    io io/mhdf )
+                    io io/mhdf
+                    ${MOAB_BINARY_DIR}/src/parallel )
 
 if(MOAB_USE_MPI AND MPI_FOUND)
   add_subdirectory(parallel)
@@ -22,7 +23,6 @@ string( REGEX REPLACE "#undef" "#cmakedefine" outstring2 "${infile2}" )
 file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp.in" "${outstring2}")
 configure_file(${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp)
 
-
 #generate the Version.h file
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/moab/Version.h.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/moab/Version.h" @ONLY)
 
@@ -41,6 +41,19 @@ ADD_CUSTOM_COMMAND(
           -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/MBCN.h )
 
+if( MOAB_USE_HDF )
+  include_directories(${HDF5_INCLUDES})
+  set( MOAB_HDF_LIBS ${HDF5_LIBRARIES} )
+endif()
+if( MOAB_USE_NETCDF )
+  include_directories(${NetCDF_INCLUDES})
+  if ( MOAB_USE_MPI )
+    set( MOAB_NETCDF_LIBS ${PNetCDF_LIBRARIES} ${NetCDF_LIBRARIES} )
+  else ( MOAB_USE_MPI )
+    set( MOAB_NETCDF_LIBS ${NetCDF_LIBRARIES} )
+  endif ( MOAB_USE_MPI )
+endif()
+
 set(MOAB_LIB_SOURCES
         AdaptiveKDTree.cpp
         AEntityFactory.hpp AEntityFactory.cpp

diff --git a/src/io/CMakeLists.txt b/src/io/CMakeLists.txt
index b21d6c7..4f5be2c 100644
--- a/src/io/CMakeLists.txt
+++ b/src/io/CMakeLists.txt
@@ -1,5 +1,7 @@
 include_directories( ${MOAB_SOURCE_DIR}/src/io
-                     ${MOAB_SOURCE_DIR}/src/mhdf )
+                     ${MOAB_SOURCE_DIR}/src/mhdf
+                     ${MOAB_BINARY_DIR}/src/parallel
+                    )
 set( MOABIO_LIBS )
 set( MOABIO_DEFINES "-DIS_BUILDING_MB" )
 set( MOABIO_INSTALL_HEADERS moab/ExoIIInterface.hpp )
@@ -39,22 +41,27 @@ if( MOAB_USE_NETCDF )
           WriteNCDF.hpp     WriteNCDF.cpp
           WriteSLAC.hpp     WriteSLAC.cpp
           ReadNC.hpp        ReadNC.cpp
+          WriteNC.hpp       WriteNC.cpp
           NCHelper.hpp      NCHelper.cpp
+          NCWriteHelper.hpp NCWriteHelper.cpp
           NCHelperEuler.hpp NCHelperEuler.cpp
+          NCWriteEuler.hpp  NCWriteEuler.cpp
           NCHelperFV.hpp    NCHelperFV.cpp
+          NCWriteFV.hpp     NCWriteFV.cpp
           NCHelperGCRM.hpp  NCHelperGCRM.cpp
+          NCWriteGCRM.hpp   NCWriteGCRM.cpp
           NCHelperHOMME.hpp NCHelperHOMME.cpp
-          NCHelperMPAS.hpp  NCHelperMPAS.cpp )
+          NCWriteHOMME.hpp  NCWriteHOMME.cpp
+          NCHelperMPAS.hpp  NCHelperMPAS.cpp
+          NCWriteMPAS.hpp   NCWriteMPAS.cpp )
   set( MOABIO_LIBS ${MOABIO_LIBS} ${NetCDF_LIBRARIES} )
-elseif( MOAB_USE_PNETCDF )
-  set( MOAB_NETCDF_SRCS
-          ReadNC.hpp        ReadNC.cpp
-          NCHelper.hpp      NCHelper.cpp
-          NCHelperEuler.hpp NCHelperEuler.cpp
-          NCHelperFV.hpp    NCHelperFV.cpp
-          NCHelperHOMME.hpp NCHelperHOMME.cpp
-          NCHelperMPAS.hpp  NCHelperMPAS.cpp )
-endif()
+  include_directories(${NetCDF_INCLUDES})
+  # check for PNetCDF dependencies also
+  if( MOAB_USE_PNETCDF )
+    set( MOABIO_LIBS ${MOABIO_LIBS} ${PNetCDF_LIBRARIES} )
+    include_directories(${PNetCDF_INCLUDES})
+  endif( MOAB_USE_PNETCDF )
+endif( MOAB_USE_NETCDF )
 
 if ( MOAB_USE_CGNS )
   set( MOAB_CGNS_SRCS ReadCGNS.hpp ReadCGNS.cpp
@@ -71,6 +78,7 @@ if( MOAB_USE_HDF )
           WriteHDF5.cpp WriteHDF5.hpp )
   set( MDHF_OBJ $<TARGET_OBJECTS:mhdf> PARENT_SCOPE )
   set( MOABIO_LIBS ${MOABIO_LIBS} ${HDF5_LIBRARIES} )
+  include_directories(${HDF5_INCLUDES})
   check_function_exists( H5Pset_fapl_mpio MOAB_HDF_HAVE_PARALLEL )
 endif()
 

diff --git a/src/parallel/CMakeLists.txt b/src/parallel/CMakeLists.txt
index 776f287..11278bc 100644
--- a/src/parallel/CMakeLists.txt
+++ b/src/parallel/CMakeLists.txt
@@ -8,6 +8,9 @@ set( moab_PARALLEL_SRCS
   gs.cpp
 )
 
+#generate the moab_mpi_config.h file
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/moab_mpi_config.h.in "${CMAKE_CURRENT_BINARY_DIR}/moab_mpi_config.h" @ONLY)
+
 set(moab_PARALLEL_INSTALL_HDRS moab/gs.hpp
                                moab_mpi.h
                                moab_mpi_config.h
@@ -20,6 +23,7 @@ set(moab_PARALLEL_INSTALL_HDRS moab/gs.hpp
 include_directories(
     ${MOAB_SOURCE_DIR}/src
     ${MOAB_SOURCE_DIR}/src/parallel
+    ${CMAKE_CURRENT_BINARY_DIR}
   )
 
 if ( MOAB_USE_HDF AND MOAB_HDF_HAVE_PARALLEL )


https://bitbucket.org/fathomteam/moab/commits/cf6b59beadef/
Changeset:   cf6b59beadef
Branch:      None
User:        judajake
Date:        2014-06-05 19:57:41
Summary:     use config if there, find debug names

Conflicts:
	config/FindHDF5.cmake

Affected #:  1 file

diff --git a/config/FindHDF5.cmake b/config/FindHDF5.cmake
index 179eeba..2c5974b 100644
--- a/config/FindHDF5.cmake
+++ b/config/FindHDF5.cmake
@@ -8,6 +8,10 @@
 set( HDF5_DIR "" CACHE PATH "Path to search for HDF5 header and library files" )
 set (HDF5_FOUND NO CACHE INTERNAL "Found HDF5 components successfully." )
 
+if(EXISTS "${HDF5_DIR}/share/cmake/hdf5/hdf5-config.cmake")
+  include(${HDF5_DIR}/share/cmake/hdf5/hdf5-config.cmake)
+else()
+
 FIND_PATH(HDF5_INCLUDE_DIR
   NAMES hdf5.h H5public.h
   PATHS ${HDF5_DIR}/include
@@ -15,6 +19,7 @@ FIND_PATH(HDF5_INCLUDE_DIR
   /usr/include
   /opt/local/include
 )
+
 FIND_LIBRARY(HDF5_D1 dl
   PATHS /usr/local/lib /usr/lib /opt/local/lib
 )
@@ -24,10 +29,12 @@ FIND_LIBRARY(HDF5_D2 m
 FIND_LIBRARY(HDF5_D3 z
   PATHS /usr/local/lib /usr/lib /opt/local/lib
 )
-FIND_LIBRARY(HDF5_BASE_LIBRARY hdf5
+FIND_LIBRARY(HDF5_BASE_LIBRARY hdf5 hdf5d
+
+FIND_LIBRARY(HDF5_BASE_LIBRARY NAMES hdf5 hdf5d
   PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
 )
-FIND_LIBRARY(HDF5_HLBASE_LIBRARY hdf5_hl
+FIND_LIBRARY(HDF5_HLBASE_LIBRARY hdf5_hl hdf5_hld
   PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
 )
 
@@ -86,3 +93,8 @@ ENDIF (NOT HDF5_FOUND)
 include (FindPackageHandleStandardArgs)
 find_package_handle_standard_args (HDF5 "HDF5 not found, check environment variables HDF5_DIR"
   HDF5_DIR HDF5_INCLUDES HDF5_LIBRARIES)
+  include(FindPackageHandleStandardArgs)
+
+#now we create fake targets to be used
+include(${HDF5_DIR}/share/cmake/hdf5/hdf5-targets.cmake)
+endif()


https://bitbucket.org/fathomteam/moab/commits/696175b7695c/
Changeset:   696175b7695c
Branch:      None
User:        judajake
Date:        2014-06-05 19:58:18
Summary:     Disable test when imesh is off.  Config iBase_f.h

Affected #:  3 files

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0fce05a..4cc72b9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,6 +71,9 @@ option ( MOAB_ENABLE_TESTING "Enable Testing"                                  O
 option ( MOAB_FORCE_64_BIT_HANDLES "Force MBEntityHandle to be 64 bits (uint64_t)" OFF )
 option ( MOAB_FORCE_32_BIT_HANDLES "Force MBEntityHandle to be 32 bits (uint32_t)" OFF )
 
+option ( ENABLE_IMESH        "Should build IMESH?"       OFF )
+option ( ENABLE_IGEOM        "Should build IGEOM?"       OFF )
+
 mark_as_advanced(
     MOAB_FORCE_64_BIT_HANDLES
     MOAB_FORCE_32_BIT_HANDLES

diff --git a/itaps/CMakeLists.txt b/itaps/CMakeLists.txt
index 3bf949a..8a98744 100644
--- a/itaps/CMakeLists.txt
+++ b/itaps/CMakeLists.txt
@@ -1,7 +1,10 @@
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-set( BASE_INCLUDE_HEADERS iBase.h iBase_f.h)
-option ( ENABLE_IMESH        "Should build IMESH?"       OFF )
-option ( ENABLE_IGEOM        "Should build IGEOM?"       OFF )
+
+set( SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P} )
+
+configure_file(iBase_f.h.in "${CMAKE_CURRENT_BINARY_DIR}/iBase_f.h" @ONLY)
+
+set( BASE_INCLUDE_HEADERS iBase.h ${CMAKE_CURRENT_BINARY_DIR}/iBase_f.h)
 
 if(ENABLE_IMESH )
   add_subdirectory(imesh)
@@ -11,4 +14,5 @@ if(ENABLE_IGEOM )
   add_subdirectory(igeom)
 endif()
 
-install(FILES ${BASE_INCLUDE_HEADERS} DESTINATION include)
+include(AutoconfHeader)
+moab_install_headers(${BASE_INCLUDE_HEADERS})
\ No newline at end of file

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 3532774..13a1f91 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -126,19 +126,21 @@ target_link_libraries( xform_test MOAB )
 add_test( xform_test ${EXECUTABLE_OUTPUT_PATH}/xform_test )
 
 #add imesh tests
-set( TESTS MOAB_iMesh_unit_tests.cpp
-           MOAB_iMesh_extensions_tests.cpp )
-if(MOAB_USE_MPI)
+if(ENABLE_IMESH)
+  set( TESTS MOAB_iMesh_unit_tests.cpp
+             MOAB_iMesh_extensions_tests.cpp )
+  if(MOAB_USE_MPI)
     set(TESTS ${TESTS} MOAB_iMeshP_unit_tests.cpp )
-endif()
-foreach( fname ${TESTS} )
+  endif()
+  foreach( fname ${TESTS} )
     string( REPLACE ".cpp" "" tmp ${fname} )
     string( REPLACE ".cc" "" base ${tmp} )
     add_executable( ${base} ${CMAKE_SOURCE_DIR}/test/TestUtil.hpp ${CMAKE_SOURCE_DIR}/itaps/imesh/${fname})
     set_target_properties( ${base} PROPERTIES COMPILE_FLAGS "-DSRCDIR=${CMAKE_SOURCE_DIR}/itaps/imesh/ -DMESHDIR=${CMAKE_SOURCE_DIR}/MeshFiles/unittest ${MOAB_DEFINES} -DTEST" )
     target_link_libraries( ${base} MOAB iMesh)
     add_test( ${base} ${EXECUTABLE_OUTPUT_PATH}/${base} )
-endforeach()
+  endforeach()
+endif()
 
 if ( MOAB_USE_MPI AND MPI_FOUND )
 


https://bitbucket.org/fathomteam/moab/commits/b92e7f852b71/
Changeset:   b92e7f852b71
Branch:      None
User:        judajake
Date:        2014-06-05 19:58:34
Summary:     fix install location

Affected #:  2 files

diff --git a/itaps/CMakeLists.txt b/itaps/CMakeLists.txt
index 8a98744..70978bb 100644
--- a/itaps/CMakeLists.txt
+++ b/itaps/CMakeLists.txt
@@ -14,5 +14,4 @@ if(ENABLE_IGEOM )
   add_subdirectory(igeom)
 endif()
 
-include(AutoconfHeader)
-moab_install_headers(${BASE_INCLUDE_HEADERS})
\ No newline at end of file
+install(FILES ${BASE_INCLUDE_HEADERS} DESTINATION include )

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 92f4200..a02bbf7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -149,7 +149,6 @@ set( MOAB_INSTALL_HEADERS
         moab/HigherOrderFactory.hpp
         moab/HomXform.hpp
         moab/EntityType.hpp
-        ${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp
         moab/FBEngine.hpp
         moab/FileOptions.hpp
         moab/FindPtFuncs.h
@@ -191,10 +190,13 @@ set( MOAB_INSTALL_HEADERS
         moab/WriterIface.hpp
         MBEntityType.h
         MBCN.h
-        ${CMAKE_CURRENT_BINARY_DIR}/MOAB_FCDefs.h
-        ${CMAKE_CURRENT_BINARY_DIR}/MBCN_protos.h
         MBTagConventions.hpp )
-        
+
+set( MOAB_GENERATED_INSTALL_HEADERS
+     ${CMAKE_CURRENT_BINARY_DIR}/MOAB_FCDefs.h
+     ${CMAKE_CURRENT_BINARY_DIR}/MBCN_protos.h
+     ${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp )
+
 if( CGM_FOUND )
   set( MOAB_CGM_LIBS ${CGM_LIBRARIES} )
 endif()
@@ -219,3 +221,8 @@ install(TARGETS MOAB EXPORT MOABTargets
 set( MOAB_INSTALL_TARGETS ${MOAB_INSTALL_TARGETS} MOAB)
 include(AutoconfHeader)
 moab_install_headers(${MOAB_INSTALL_HEADERS})
+foreach (header ${MOAB_GENERATED_INSTALL_HEADERS})
+    STRING(REGEX REPLACE "^${CMAKE_CURRENT_BINARY_DIR}/" "" relative ${header})
+    string(REGEX MATCH "(.*)/" DIR ${relative})
+    install(FILES ${header} DESTINATION include/${DIR})
+endforeach()


https://bitbucket.org/fathomteam/moab/commits/f8ea159d6e9f/
Changeset:   f8ea159d6e9f
Branch:      None
User:        judajake
Date:        2014-06-05 20:50:42
Summary:     missed adding the variable

Affected #:  1 file

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a02bbf7..c47a780 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -207,7 +207,7 @@ if (MBZOLTAN_ENABLE AND ZOLTAN_FOUND)
   set( MOAB_INSTALL_HEADERS ${MOAB_INSTALL_HEADERS}
           ${CMAKE_SOURCE_DIR}/tools/mbzoltan/MBZoltan.hpp )
 endif()
-add_library( MOAB ${MOAB_LIB_SOURCES} ${MOAB_INSTALL_HEADERS}
+add_library( MOAB ${MOAB_LIB_SOURCES} ${MOAB_INSTALL_HEADERS} ${MOAB_GENERATED_INSTALL_HEADERS}
                   $<TARGET_OBJECTS:moabio> 
                   $<TARGET_OBJECTS:moab_loc_discr> 
                   ${MDHF_OBJ} )


https://bitbucket.org/fathomteam/moab/commits/32dfc84f8176/
Changeset:   32dfc84f8176
Branch:      None
User:        judajake
Date:        2014-06-05 21:02:54
Summary:     only include targests if exist

Affected #:  1 file

diff --git a/config/FindHDF5.cmake b/config/FindHDF5.cmake
index 2c5974b..c3bb76d 100644
--- a/config/FindHDF5.cmake
+++ b/config/FindHDF5.cmake
@@ -93,8 +93,10 @@ ENDIF (NOT HDF5_FOUND)
 include (FindPackageHandleStandardArgs)
 find_package_handle_standard_args (HDF5 "HDF5 not found, check environment variables HDF5_DIR"
   HDF5_DIR HDF5_INCLUDES HDF5_LIBRARIES)
-  include(FindPackageHandleStandardArgs)
 
 #now we create fake targets to be used
-include(${HDF5_DIR}/share/cmake/hdf5/hdf5-targets.cmake)
+if(EXISTS ${HDF5_DIR}/share/cmake/hdf5/hdf5-targets.cmake)
+  include(${HDF5_DIR}/share/cmake/hdf5/hdf5-targets.cmake)
+endif()
+
 endif()


https://bitbucket.org/fathomteam/moab/commits/4365f833a2e6/
Changeset:   4365f833a2e6
Branch:      None
User:        judajake
Date:        2014-06-05 21:23:20
Summary:     missing paren

Affected #:  1 file

diff --git a/config/FindHDF5.cmake b/config/FindHDF5.cmake
index c3bb76d..150c6d6 100644
--- a/config/FindHDF5.cmake
+++ b/config/FindHDF5.cmake
@@ -29,7 +29,7 @@ FIND_LIBRARY(HDF5_D2 m
 FIND_LIBRARY(HDF5_D3 z
   PATHS /usr/local/lib /usr/lib /opt/local/lib
 )
-FIND_LIBRARY(HDF5_BASE_LIBRARY hdf5 hdf5d
+FIND_LIBRARY(HDF5_BASE_LIBRARY hdf5 hdf5d)
 
 FIND_LIBRARY(HDF5_BASE_LIBRARY NAMES hdf5 hdf5d
   PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
@@ -99,4 +99,4 @@ if(EXISTS ${HDF5_DIR}/share/cmake/hdf5/hdf5-targets.cmake)
   include(${HDF5_DIR}/share/cmake/hdf5/hdf5-targets.cmake)
 endif()
 
-endif()
+endif(EXISTS "${HDF5_DIR}/share/cmake/hdf5/hdf5-config.cmake")


https://bitbucket.org/fathomteam/moab/commits/f4581cbc393f/
Changeset:   f4581cbc393f
Branch:      None
User:        judajake
Date:        2014-06-05 22:29:13
Summary:     find zcat

Affected #:  1 file

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 13a1f91..2f93db8 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -71,25 +71,29 @@ set_target_properties( Test_MBMeshSet PROPERTIES COMPILE_FLAGS "${TEST_COMP_FLAG
 target_link_libraries( Test_MBMeshSet MOAB )
 add_test( Test_MBMeshSet ${EXECUTABLE_OUTPUT_PATH}/Test_MBMeshSet )
 
-add_custom_command( OUTPUT mb_big_test.g
-                    COMMAND /bin/zcat ${MOAB_SOURCE_DIR}/MeshFiles/unittest/mb_big_test.g.gz > mb_big_test.g
-                    DEPENDS ${MOAB_SOURCE_DIR}/MeshFiles/unittest/mb_big_test.g.gz )
-add_custom_command( OUTPUT cell1.gen
-                    COMMAND /bin/zcat ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell1.gen.gz > cell1.gen
-                    DEPENDS ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell1.gen.gz )
-add_custom_command( OUTPUT cell2.gen
-                    COMMAND /bin/zcat ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell2.gen.gz > cell2.gen
-                    DEPENDS ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell2.gen.gz)
+find_program( ZCAT_EXE NAMES ZCAT zcat PATHS /bin /usr/bin )
+
+if(ZCAT_EXE)
+  add_custom_command( OUTPUT mb_big_test.g
+                      COMMAND ${ZCAT_EXE} ${MOAB_SOURCE_DIR}/MeshFiles/unittest/mb_big_test.g.gz > mb_big_test.g
+                      DEPENDS ${MOAB_SOURCE_DIR}/MeshFiles/unittest/mb_big_test.g.gz )
+  add_custom_command( OUTPUT cell1.gen
+                      COMMAND ${ZCAT_EXE} ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell1.gen.gz > cell1.gen
+                      DEPENDS ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell1.gen.gz )
+  add_custom_command( OUTPUT cell2.gen
+                      COMMAND ${ZCAT_EXE} ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell2.gen.gz > cell2.gen
+                      DEPENDS ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell2.gen.gz)
                     
-add_custom_target(moab_test_files DEPENDS mb_big_test.g cell1.gen cell2.gen)
-
-#MBTest.cpp:
-set_source_files_properties( MBTest.cpp
-                             COMPILE_FLAGS "-DSRCDIR=${CMAKE_CURRENT_SOURCE_DIR} ${TEST_COMP_FLAGS}" )
-add_executable( moab_test MBTest.cpp )
-target_link_libraries( moab_test MOAB )
-add_dependencies(moab_test moab_test_files)
-add_test( TestMOAB ${EXECUTABLE_OUTPUT_PATH}/moab_test )
+  add_custom_target(moab_test_files DEPENDS mb_big_test.g cell1.gen cell2.gen)
+
+  #MBTest.cpp:
+  set_source_files_properties( MBTest.cpp
+                               COMPILE_FLAGS "-DSRCDIR=${CMAKE_CURRENT_SOURCE_DIR} ${TEST_COMP_FLAGS}" )
+  add_executable( moab_test MBTest.cpp )
+  target_link_libraries( moab_test MOAB )
+  add_dependencies(moab_test moab_test_files)
+  add_test( TestMOAB ${EXECUTABLE_OUTPUT_PATH}/moab_test )
+endif()
 
 add_executable( var_len_test_no_template VarLenTagTest.cpp )
 set_source_files_properties( ${CMAKE_SOURCE_DIR}/src/VarLenTagTest.cpp


https://bitbucket.org/fathomteam/moab/commits/5aea21bed63d/
Changeset:   5aea21bed63d
Branch:      None
User:        judajake
Date:        2014-06-05 22:29:35
Summary:     fix zcat for mac

Affected #:  1 file

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 2f93db8..62a7720 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -71,17 +71,17 @@ set_target_properties( Test_MBMeshSet PROPERTIES COMPILE_FLAGS "${TEST_COMP_FLAG
 target_link_libraries( Test_MBMeshSet MOAB )
 add_test( Test_MBMeshSet ${EXECUTABLE_OUTPUT_PATH}/Test_MBMeshSet )
 
-find_program( ZCAT_EXE NAMES ZCAT zcat PATHS /bin /usr/bin )
+find_program( ZCAT_EXE NAMES zcap ZCAT PATHS /bin /usr/bin )
 
 if(ZCAT_EXE)
   add_custom_command( OUTPUT mb_big_test.g
-                      COMMAND ${ZCAT_EXE} ${MOAB_SOURCE_DIR}/MeshFiles/unittest/mb_big_test.g.gz > mb_big_test.g
+                      COMMAND ${ZCAT_EXE} < ${MOAB_SOURCE_DIR}/MeshFiles/unittest/mb_big_test.g.gz > mb_big_test.g
                       DEPENDS ${MOAB_SOURCE_DIR}/MeshFiles/unittest/mb_big_test.g.gz )
   add_custom_command( OUTPUT cell1.gen
-                      COMMAND ${ZCAT_EXE} ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell1.gen.gz > cell1.gen
+                      COMMAND ${ZCAT_EXE} < ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell1.gen.gz > cell1.gen
                       DEPENDS ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell1.gen.gz )
   add_custom_command( OUTPUT cell2.gen
-                      COMMAND ${ZCAT_EXE} ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell2.gen.gz > cell2.gen
+                      COMMAND ${ZCAT_EXE} < ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell2.gen.gz > cell2.gen
                       DEPENDS ${MOAB_SOURCE_DIR}/MeshFiles/unittest/cell2.gen.gz)
                     
   add_custom_target(moab_test_files DEPENDS mb_big_test.g cell1.gen cell2.gen)


https://bitbucket.org/fathomteam/moab/commits/a83977fba7ea/
Changeset:   a83977fba7ea
Branch:      None
User:        vijaysm
Date:        2014-06-06 16:52:25
Summary:     Refactoring FindHDF5 and cleaning up

Signed-off-by: Jacob Becker <jacob.becker at kitware.com>

Affected #:  1 file

diff --git a/config/FindHDF5.cmake b/config/FindHDF5.cmake
index 150c6d6..e26ce95 100644
--- a/config/FindHDF5.cmake
+++ b/config/FindHDF5.cmake
@@ -20,15 +20,13 @@ FIND_PATH(HDF5_INCLUDE_DIR
   /opt/local/include
 )
 
-FIND_LIBRARY(HDF5_D1 dl
-  PATHS /usr/local/lib /usr/lib /opt/local/lib
-)
-FIND_LIBRARY(HDF5_D2 m
-  PATHS /usr/local/lib /usr/lib /opt/local/lib
-)
-FIND_LIBRARY(HDF5_D3 z
-  PATHS /usr/local/lib /usr/lib /opt/local/lib
-)
+foreach (VARIANT dl m z )
+  FIND_LIBRARY(hdf5_deplibs_${VARIANT} ${VARIANT}
+    PATHS /lib /usr/local/lib /usr/lib /opt/local/lib
+  )
+  list(APPEND HDF5_DEP_LIBRARIES ${hdf5_deplibs_${VARIANT}})
+endforeach()
+
 FIND_LIBRARY(HDF5_BASE_LIBRARY hdf5 hdf5d)
 
 FIND_LIBRARY(HDF5_BASE_LIBRARY NAMES hdf5 hdf5d
@@ -79,7 +77,7 @@ IF (NOT HDF5_FOUND)
       unset(HDF5_HL${VARIANT}_LIBRARY CACHE)
       unset(HDF5_${VARIANT}_LIBRARY CACHE)
     endforeach()
-    list(APPEND HDF5_LIBRARIES ${HDF5_D1} ${HDF5_D2} ${HDF5_D3})
+    list(APPEND HDF5_LIBRARIES ${HDF5_DEP_LIBRARIES})
     SET( HDF5_FOUND YES )
     message (STATUS "---   HDF5 Configuration ::")
     message (STATUS "        INCLUDES  : ${HDF5_INCLUDES}")


https://bitbucket.org/fathomteam/moab/commits/82f703c6fac6/
Changeset:   82f703c6fac6
Branch:      None
User:        vijaysm
Date:        2014-06-06 16:52:56
Summary:     Adding a helper cmake script to validate include and lib paths

Signed-off-by: Jacob Becker <jacob.becker at kitware.com>

Affected #:  1 file

diff --git a/config/ResolveCompilerPaths.cmake b/config/ResolveCompilerPaths.cmake
new file mode 100644
index 0000000..259dd99
--- /dev/null
+++ b/config/ResolveCompilerPaths.cmake
@@ -0,0 +1,99 @@
+# ResolveCompilerPaths - this module defines two macros
+#
+# RESOLVE_LIBRARIES (XXX_LIBRARIES LINK_LINE)
+#  This macro is intended to be used by FindXXX.cmake modules.
+#  It parses a compiler link line and resolves all libraries
+#  (-lfoo) using the library path contexts (-L/path) in scope.
+#  The result in XXX_LIBRARIES is the list of fully resolved libs.
+#  Example:
+#
+#    RESOLVE_LIBRARIES (FOO_LIBRARIES "-L/A -la -L/B -lb -lc -ld")
+#
+#  will be resolved to
+#
+#    FOO_LIBRARIES:STRING="/A/liba.so;/B/libb.so;/A/libc.so;/usr/lib/libd.so"
+#
+#  if the filesystem looks like
+#
+#    /A:       liba.so         libc.so
+#    /B:       liba.so libb.so
+#    /usr/lib: liba.so libb.so libc.so libd.so
+#
+#  and /usr/lib is a system directory.
+#
+#  Note: If RESOLVE_LIBRARIES() resolves a link line differently from
+#  the native linker, there is a bug in this macro (please report it).
+#
+# RESOLVE_INCLUDES (XXX_INCLUDES INCLUDE_LINE)
+#  This macro is intended to be used by FindXXX.cmake modules.
+#  It parses a compile line and resolves all includes
+#  (-I/path/to/include) to a list of directories.  Other flags are ignored.
+#  Example:
+#
+#    RESOLVE_INCLUDES (FOO_INCLUDES "-I/A -DBAR='\"irrelevant -I/string here\"' -I/B")
+#
+#  will be resolved to
+#
+#    FOO_INCLUDES:STRING="/A;/B"
+#
+#  assuming both directories exist.
+#  Note: as currently implemented, the -I/string will be picked up mistakenly (cry, cry)
+
+macro (RESOLVE_LIBRARIES LIBS LINK_LINE)
+  string (REGEX MATCHALL "((-L|-l|-Wl)([^\" ]+|\"[^\"]+\")|/[^\" ]+(a|so|dylib|dll))" _all_tokens "${LINK_LINE}")
+  set (_libs_found)
+  set (_directory_list)
+  foreach (token ${_all_tokens})
+    # message ("Resolving token = ${token}")
+    if (token MATCHES "-L([^\" ]+|\"[^\"]+\")")
+      # If it's a library path, add it to the list
+      string (REGEX REPLACE "^-L" "" token ${token})
+      string (REGEX REPLACE "//" "/" token ${token})
+      list (APPEND _directory_list ${token})
+      #message ("Resolved token with directory = ${token}")
+    elseif (token MATCHES "^(-l([^\" ]+|\"[^\"]+\")|/[^\" ]+(a|so|dylib|dll))")
+      # It's a library, resolve the path by looking in the list and then (by default) in system directories
+      string (REGEX REPLACE "^-l" "" token ${token})
+      set (_root)
+      if (token MATCHES "^/")	# We have an absolute path, add root to the search path
+	set (_root "/")
+      endif (token MATCHES "^/")
+      set (_lib "NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+      find_library (_lib ${token} HINTS ${_directory_list} ${_root})
+      #message ("Resolving shared library with directory = ${_lib}")
+      if (_lib)
+	string (REPLACE "//" "/" _lib ${_lib})
+        list (APPEND _libs_found ${_lib})
+      else (_lib)
+        message (STATUS "Unable to find library ${token}")
+        #message ("Unable to find library ${token}")
+      endif (_lib)
+    endif (token MATCHES "-L([^\" ]+|\"[^\"]+\")")
+  endforeach (token)
+  set (_lib "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE)
+  # only the LAST occurence of each library is required since there should be no circular dependencies
+  if (_libs_found)
+    list (REVERSE _libs_found)
+    list (REMOVE_DUPLICATES _libs_found)
+    list (REVERSE _libs_found)
+  endif (_libs_found)
+  set (${LIBS} "${_libs_found}")
+endmacro (RESOLVE_LIBRARIES)
+
+macro (RESOLVE_INCLUDES INCS COMPILE_LINE)
+  string (REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" _all_tokens "${COMPILE_LINE}")
+  set (_incs_found)
+  foreach (token ${_all_tokens})
+    string (REGEX REPLACE "^-I" "" token ${token})
+    string (REGEX REPLACE "//" "/" token ${token})
+    if (EXISTS ${token})
+      list (APPEND _incs_found ${token})
+    else (EXISTS ${token})
+      message (STATUS "Include directory ${token} does not exist")
+    endif (EXISTS ${token})
+  endforeach (token)
+  if (_incs_found)
+    list (REMOVE_DUPLICATES _incs_found)
+  endif(_incs_found)
+  set (${INCS} "${_incs_found}")
+endmacro (RESOLVE_INCLUDES)


https://bitbucket.org/fathomteam/moab/commits/08e2ad65bf48/
Changeset:   08e2ad65bf48
Branch:      None
User:        vijaysm
Date:        2014-06-06 16:53:22
Summary:     Add the necessary CMake script to find Zoltan configuration (configured with PTScotch, Scotch, Parmetis, Metis) so that mbpart can be compiled and linked with all necessary dependencies seamlessly.

Signed-off-by: Jacob Becker <jacob.becker at kitware.com>

Affected #:  4 files

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4cc72b9..21fe792 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,7 +65,7 @@ option ( MOAB_USE_CGNS       "Should build with CGNS support?"                 O
 option ( MOAB_USE_MPI        "Should MOAB be compiled with MPI support?"       OFF )
 option ( MOAB_USE_HDF        "Include HDF I/O in the build?"                   OFF )
 option ( MOAB_USE_NETCDF     "Include NetCDF support (ExodusII) in the build?" OFF )
-option ( MOAB_USE_PNETCDF     "Include parallel NetCDF support (ExodusII) in the build?" OFF )
+option ( MOAB_USE_PNETCDF    "Include parallel NetCDF support (ExodusII) in the build?" OFF )
 option ( MOAB_USE_ZOLTAN     "Include Zoltan support for partitioning algorithms?" OFF )
 option ( MOAB_ENABLE_TESTING "Enable Testing"                                  ON  )
 option ( MOAB_FORCE_64_BIT_HANDLES "Force MBEntityHandle to be 64 bits (uint64_t)" OFF )
@@ -159,6 +159,10 @@ if ( MOAB_USE_ZLIB )
   find_package( ZLIB REQUIRED )
 endif ( )
 
+if ( MOAB_USE_ZOLTAN )
+  find_package( Zoltan REQUIRED )
+endif ( )
+
 if ( MOAB_USE_CGM )
    find_package( CGM REQUIRED )
    set( MOAB_DEFINES "${CGM_DEFINES} -DCGM ${MOAB_DEFINES}" )

diff --git a/config/FindZoltan.cmake b/config/FindZoltan.cmake
new file mode 100644
index 0000000..8c6b259
--- /dev/null
+++ b/config/FindZoltan.cmake
@@ -0,0 +1,91 @@
+#
+# Find Zoltan include directories and libraries
+#
+# Zoltan_INCLUDES            - list of include paths to find netcdf.h
+# Zoltan_LIBRARIES           - list of libraries to link against when using Zoltan
+# Zoltan_FOUND               - Do not attempt to use Zoltan if "no", "0", or undefined.
+
+set (Zoltan_DIR "" CACHE PATH "Path to search for Zoltan header and library files" )
+set (Zoltan_FOUND NO CACHE INTERNAL "Found Zoltan components successfully." )
+
+find_path( Zoltan_INCLUDE_DIR zoltan.h
+  ${Zoltan_DIR}
+  ${Zoltan_DIR}/include
+  /usr/local/include
+  /usr/include
+)
+
+find_library( Zoltan_LIBRARY
+  NAMES zoltan
+  HINTS ${Zoltan_DIR}
+  ${Zoltan_DIR}/lib64
+  ${Zoltan_DIR}/lib
+  /usr/local/lib64
+  /usr/lib64
+  /usr/lib64/zoltan
+  /usr/local/lib
+  /usr/lib
+  /usr/lib/zoltan
+)
+
+
+macro (Zoltan_GET_VARIABLE makefile name var)
+  set (${var} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
+  execute_process (COMMAND ${CMAKE_BUILD_TOOL} -f ${${makefile}} show VARIABLE=${name}
+    OUTPUT_VARIABLE ${var}
+    RESULT_VARIABLE zoltan_return)
+endmacro (Zoltan_GET_VARIABLE)
+
+macro (Zoltan_GET_ALL_VARIABLES)
+  if (NOT zoltan_config_current)
+    # A temporary makefile to probe this Zoltan components's configuration
+    # The current inspection is based on Zoltan-3.6 installation
+    set (zoltan_config_makefile "${CMAKE_CURRENT_BINARY_DIR}/Makefile.zoltan")
+    file (WRITE ${zoltan_config_makefile}
+      "## This file was autogenerated by FindZoltan.cmake
+include ${Zoltan_INCLUDE_DIR}/Makefile.export.zoltan
+include ${Zoltan_INCLUDE_DIR}/Makefile.export.zoltan.macros
+show :
+	- at echo -n \${\${VARIABLE}}")
+    Zoltan_GET_VARIABLE (zoltan_config_makefile ZOLTAN_CPPFLAGS    zoltan_extra_cppflags)
+    Zoltan_GET_VARIABLE (zoltan_config_makefile ZOLTAN_EXTRA_LIBS  zoltan_extra_libs)
+    Zoltan_GET_VARIABLE (zoltan_config_makefile ZOLTAN_LDFLAGS     zoltan_ldflags)
+    
+    file (REMOVE ${zoltan_config_makefile})
+    SET(tmp_incs "-I${Zoltan_INCLUDE_DIR} ${zoltan_extra_cppflags}")
+    resolve_includes(Zoltan_INCLUDES ${tmp_incs})
+    SET(tmp_libs "${Zoltan_LIBRARY} ${zoltan_ldflags} ${zoltan_extra_libs}")
+    resolve_libraries (Zoltan_LIBRARIES "${tmp_libs}")
+  endif ()
+endmacro (Zoltan_GET_ALL_VARIABLES)
+
+
+IF (NOT Zoltan_FOUND)
+  if ( Zoltan_INCLUDE_DIR AND Zoltan_LIBRARY )
+    set( Zoltan_FOUND YES )
+    if(EXISTS ${Zoltan_INCLUDE_DIR}/Makefile.export.zoltan)
+      include (ResolveCompilerPaths)
+      Zoltan_GET_ALL_VARIABLES()
+    else(EXISTS ${Zoltan_INCLUDE_DIR}/Makefile.export.zoltan)
+      SET(Zoltan_INCLUDES ${Zoltan_INCLUDE_DIR})
+      SET(Zoltan_LIBRARIES ${Zoltan_LIBRARY})
+    endif(EXISTS ${Zoltan_INCLUDE_DIR}/Makefile.export.zoltan)
+    message (STATUS "---   Zoltan Configuration ::")
+    message (STATUS "        INCLUDES  : ${Zoltan_INCLUDES}")
+    message (STATUS "        LIBRARIES : ${Zoltan_LIBRARIES}")
+  else ( Zoltan_INCLUDE_DIR AND Zoltan_LIBRARY )
+    set( Zoltan_FOUND NO )
+    message("finding Zoltan failed, please try to set the var Zoltan_DIR")
+  endif ( Zoltan_INCLUDE_DIR AND Zoltan_LIBRARY )
+ENDIF (NOT Zoltan_FOUND)
+
+mark_as_advanced(
+  Zoltan_DIR
+  Zoltan_INCLUDES
+  Zoltan_LIBRARIES
+)
+
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (Zoltan "Zoltan not found, check environment variables Zoltan_DIR"
+  Zoltan_DIR Zoltan_INCLUDES Zoltan_LIBRARIES)
+

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c47a780..d7b1506 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -201,17 +201,19 @@ if( CGM_FOUND )
   set( MOAB_CGM_LIBS ${CGM_LIBRARIES} )
 endif()
 
-if (MBZOLTAN_ENABLE AND ZOLTAN_FOUND)
+if (MOAB_USE_ZOLTAN)
   set( MOAB_LIB_SOURCES ${MOAB_LIB_SOURCES}
           ${CMAKE_SOURCE_DIR}/tools/mbzoltan/MBZoltan.cpp )
   set( MOAB_INSTALL_HEADERS ${MOAB_INSTALL_HEADERS}
           ${CMAKE_SOURCE_DIR}/tools/mbzoltan/MBZoltan.hpp )
+  include_directories( ${Zoltan_INCLUDES} )
+  list(APPEND MOAB_DEP_LIBRARIES ${Zoltan_LIBRARIES})
 endif()
 add_library( MOAB ${MOAB_LIB_SOURCES} ${MOAB_INSTALL_HEADERS} ${MOAB_GENERATED_INSTALL_HEADERS}
                   $<TARGET_OBJECTS:moabio> 
                   $<TARGET_OBJECTS:moab_loc_discr> 
                   ${MDHF_OBJ} )
-target_link_libraries( MOAB ${MOAB_MPI} ${MOAB_LIBS} ${MOAB_CGM_LIBS} )
+target_link_libraries( MOAB ${MOAB_MPI} ${MOAB_DEP_LIBRARIES} ${MOAB_LIBS} ${MOAB_CGM_LIBS} )
 set_target_properties( MOAB PROPERTIES COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}")
 
 install(TARGETS MOAB EXPORT MOABTargets

diff --git a/tools/mbzoltan/CMakeLists.txt b/tools/mbzoltan/CMakeLists.txt
new file mode 100644
index 0000000..93328ab
--- /dev/null
+++ b/tools/mbzoltan/CMakeLists.txt
@@ -0,0 +1,17 @@
+include_directories(
+    ${CMAKE_CURRENT_SOURCE_DIR}
+    ${CMAKE_SOURCE_DIR}/src
+    ${CMAKE_SOURCE_DIR}/src/parallel
+    ${CMAKE_BINARY_DIR}/src
+    ${CMAKE_BINARY_DIR}/src/parallel
+    ${Zoltan_INCLUDES}
+)
+
+if ( MOAB_USE_ZOLTAN )
+  # Build the mbpart executable
+  add_executable( mbpart mbpart.cpp )
+  set_source_files_properties( mbpart.cpp
+    COMPILE_FLAGS "${MOAB_DEFINES} -DMESHDIR=${MOAB_SOURCE_DIR}/MeshFiles/unittest" )
+  target_link_libraries( mbpart MOAB MOABpar ${Zoltan_LIBRARIES} )
+
+endif ( MOAB_USE_ZOLTAN )


https://bitbucket.org/fathomteam/moab/commits/0f48b4aa58d3/
Changeset:   0f48b4aa58d3
Branch:      None
User:        vijaysm
Date:        2014-06-06 16:54:36
Summary:     Add helpful warning when PNetCDF is compiled without MPI enabled

Signed-off-by: Jacob Becker <jacob.becker at kitware.com>

Affected #:  1 file

diff --git a/config/FindNetCDF.cmake b/config/FindNetCDF.cmake
index 68d6cd4..bcb8be3 100644
--- a/config/FindNetCDF.cmake
+++ b/config/FindNetCDF.cmake
@@ -121,6 +121,8 @@ IF (MOAB_USE_MPI)
     PNetCDF_INCLUDES
     PNetCDF_LIBRARIES
   )
+ELSE (MOAB_USE_MPI)
+  message (STATUS "Not configuring with PNetCDF since MPI installation not specified")
 ENDIF()
 
 include (FindPackageHandleStandardArgs)


https://bitbucket.org/fathomteam/moab/commits/38bff766e6b9/
Changeset:   38bff766e6b9
Branch:      None
User:        vijaysm
Date:        2014-06-06 16:54:58
Summary:     Check whether iMesh is enabled before compiling MBCoupler

Signed-off-by: Jacob Becker <jacob.becker at kitware.com>

Affected #:  1 file

diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index c83cc78..761855a 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -127,7 +127,7 @@ if ( MOAB_BUILD_QVDUAL )
 endif( )
 
 # MBCoupler
-if ( MOAB_USE_MPI AND MPI_FOUND AND MOAB_BUILD_MBCOUPLER )
+if ( ENABLE_IMESH AND MOAB_USE_MPI AND MPI_FOUND AND MOAB_BUILD_MBCOUPLER )
   add_subdirectory( mbcoupler )
 endif ( )
 


https://bitbucket.org/fathomteam/moab/commits/e2d6a2d4548f/
Changeset:   e2d6a2d4548f
Branch:      None
User:        judajake
Date:        2014-06-06 16:56:49
Summary:     export hdf5

Affected #:  1 file

diff --git a/MOABConfig.new.cmake.in b/MOABConfig.new.cmake.in
index 0031a83..5b96610 100644
--- a/MOABConfig.new.cmake.in
+++ b/MOABConfig.new.cmake.in
@@ -10,6 +10,8 @@
 
 set(MOAB_FOUND 1)
 
+set(MOAB_USE_HDF @MOAB_USE_HDF@)
+
 # Compiler flags used by MOAB
 
 set(MOAB_CXXFLAGS "@CXXFLAGS@ @AM_CXXFLAGS@")
@@ -23,5 +25,11 @@ if(NOT TARGET MOAB AND NOT MOAB_BINARY_DIR)
   include("${MOAB_CMAKE_DIR}/MOABTargets.cmake")
 endif()
 
-set(MOAB_INCLUDE_DIRS "%CMAKE_INSTALL_PREFIX%/include")
+if(MOAB_USE_HDF)
+  if(EXISTS "@HDF5_DIR@/share/cmake/hdf5/hdf5-config.cmake")
+    include(@HDF5_DIR@/share/cmake/hdf5/hdf5-config.cmake)
+  endif()
+endif()
+
+set(MOAB_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include")
 set(MOAB_LIBRARIES MOAB)


https://bitbucket.org/fathomteam/moab/commits/5122f59108a9/
Changeset:   5122f59108a9
Branch:      None
User:        judajake
Date:        2014-06-09 22:31:56
Summary:     added a timeout for tests

Affected #:  1 file

diff --git a/test/h5file/CMakeLists.txt b/test/h5file/CMakeLists.txt
index d6d4dd8..1c0b70b 100644
--- a/test/h5file/CMakeLists.txt
+++ b/test/h5file/CMakeLists.txt
@@ -14,6 +14,7 @@ foreach( fname ${TESTS} )
   set_target_properties( ${base} PROPERTIES COMPILE_FLAGS "-DSRCDIR=${CMAKE_CURRENT_SOURCE_DIR} ${TEST_COMP_FLAGS} ${MOAB_DEFINES} -DTEST" )
   target_link_libraries( ${base} MOAB )
   add_test( ${base} ${EXECUTABLE_OUTPUT_PATH}/${base} )
+  set_tests_properties ( ${base} PROPERTIES TIMEOUT 120)
 endforeach()
 
 add_executable( dump_sets dump_sets.c )


https://bitbucket.org/fathomteam/moab/commits/606cfce2c8f5/
Changeset:   606cfce2c8f5
Branch:      master
User:        vijaysm
Date:        2014-06-12 06:23:42
Summary:     Merged in judajake/moab/initial_cmake (pull request #20)

An initial version of improved cmake-ifcation.
Affected #:  33 files

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6b18435..21fe792 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,135 +1,214 @@
-# check if we are using MPI - reset compilers accordingly
-if ( MOAB_USE_MPI )
-  SET(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER})
-  SET(CMAKE_C_COMPILER ${MPI_C_COMPILER})
-endif ( MOAB_USE_MPI )
-
+cmake_minimum_required( VERSION 2.8.12 )
+cmake_policy( SET CMP0003 NEW )
+cmake_policy(SET CMP0020 NEW)
 project( MOAB )
 
-  cmake_minimum_required( VERSION 2.4 )
-  if ( COMMAND cmake_policy )
-    cmake_policy( SET CMP0003 NEW )
-  endif ( COMMAND cmake_policy )
-  # Always build tests
-  enable_testing()
-
-  list (APPEND CMAKE_MODULE_PATH "${MOAB_SOURCE_DIR}/config")
-  include (config/GetAcInitVersion.cmake)
-
-  # enable_language( Fortran )
-
-  get_ac_init_version()
-  set ( MOAB_VERSION_MAJOR  "${MAJOR_VERSION}"  )
-  set ( MOAB_VERSION_MINOR  "${MINOR_VERSION}"  )
-  set ( MOAB_VERSION        "${VERSION_STRING}" )
-  set ( MOAB_VERSION_STRING "${VERSION_STRING}" )
-  if ( DEFINED PATCH_VERSION )
-    set ( MOAB_VERSION_PATCH "${PATCH_VERSION}" )
-  else ( DEFINED PATCH_VERSION )
-    if ( MOAB_VERSION_MINOR EQUAL 99 )
-      set ( MOAB_VERSION_STRING "${MOAB_VERSION_STRING} (alpha)" )
-    else ( MOAB_VERSION_MINOR EQUAL 99 )
-      set ( MOAB_VERSION_STRING "${MOAB_VERSION_STRING} (beta)" )
-    endif ( MOAB_VERSION_MINOR EQUAL 99 )
-  endif ( DEFINED PATCH_VERSION )
-
-  set ( EXECUTABLE_OUTPUT_PATH ${MOAB_BINARY_DIR}/bin CACHE PATH "Path to executables" FORCE )
-  set ( LIBRARY_OUTPUT_PATH    ${MOAB_BINARY_DIR}/bin CACHE PATH "Path to libraries"   FORCE )
-  mark_as_advanced(
-    EXECUTABLE_OUTPUT_PATH
-    LIBRARY_OUTPUT_PATH
-  )
-
-  # Compiler defines... this should really be in a config file.
-  set( MOAB_DEFINES "" )
-
-  include ( CheckIncludeFile )
-  include ( CheckFunctionExists )
-  include ( CheckTypeSize )
-
-  # Shared libraries
-  option ( BUILD_SHARED_LIBS "Should shared or static libraries be created?" ON )
-
-  # HANDLE SIZE
-  option ( MOAB_FORCE_64_BIT_HANDLES "Force MBEntityHandle to be 64 bits (uint64_t)" OFF )
-  option ( MOAB_FORCE_32_BIT_HANDLES "Force MBEntityHandle to be 32 bits (uint32_t)" OFF )
-  mark_as_advanced(
+#Add our Cmake directory to the module search path
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/config ${CMAKE_MODULE_PATH})
+
+################################################################################
+# Set up version info
+################################################################################
+include (config/GetAcInitVersion.cmake)
+get_ac_init_version()
+set ( MOAB_VERSION_MAJOR  "${MAJOR_VERSION}"  )
+set ( MOAB_VERSION_MINOR  "${MINOR_VERSION}"  )
+set ( MOAB_VERSION        "${VERSION_STRING}" )
+set ( MOAB_VERSION_STRING "${VERSION_STRING}" )
+if ( DEFINED PATCH_VERSION )
+  set ( MOAB_VERSION_PATCH "${PATCH_VERSION}" )
+else ( DEFINED PATCH_VERSION )
+  if ( MOAB_VERSION_MINOR EQUAL 99 )
+    set ( MOAB_VERSION_STRING "${MOAB_VERSION_STRING} (alpha)" )
+  else ( MOAB_VERSION_MINOR EQUAL 99 )
+    set ( MOAB_VERSION_STRING "${MOAB_VERSION_STRING} (beta)" )
+  endif ( MOAB_VERSION_MINOR EQUAL 99 )
+endif ( DEFINED PATCH_VERSION )
+
+################################################################################
+# Install Related Settings
+################################################################################
+
+## Set the directory where the binaries will be stored
+set( EXECUTABLE_OUTPUT_PATH
+  ${PROJECT_BINARY_DIR}/bin
+  CACHE PATH
+  "Directory where all executable will be stored"
+)
+
+## Set the directory where the libraries will be stored
+set( LIBRARY_OUTPUT_PATH
+  ${PROJECT_BINARY_DIR}/lib
+  CACHE PATH
+  "Directory where all the libraries will be stored"
+)
+mark_as_advanced(
+  EXECUTABLE_OUTPUT_PATH
+  LIBRARY_OUTPUT_PATH)
+
+include ( CheckIncludeFile )
+include ( CheckFunctionExists )
+include ( CheckTypeSize )
+
+# Compiler defines... this should really be in a config file.
+set( MOAB_DEFINES "" )
+set( MOAB_LIBS )
+set( MOAB_INSTALL_TARGETS )
+
+################################################################################
+# Options that the user controls
+################################################################################
+option ( BUILD_SHARED_LIBS   "Should shared or static libraries be created?"   ON  )
+option ( MOAB_USE_SZIP       "Should build with szip support?"                 OFF )
+option ( MOAB_USE_CGM        "Should build with CGM support?"                  OFF )
+option ( MOAB_USE_CGNS       "Should build with CGNS support?"                 OFF )
+option ( MOAB_USE_MPI        "Should MOAB be compiled with MPI support?"       OFF )
+option ( MOAB_USE_HDF        "Include HDF I/O in the build?"                   OFF )
+option ( MOAB_USE_NETCDF     "Include NetCDF support (ExodusII) in the build?" OFF )
+option ( MOAB_USE_PNETCDF    "Include parallel NetCDF support (ExodusII) in the build?" OFF )
+option ( MOAB_USE_ZOLTAN     "Include Zoltan support for partitioning algorithms?" OFF )
+option ( MOAB_ENABLE_TESTING "Enable Testing"                                  ON  )
+option ( MOAB_FORCE_64_BIT_HANDLES "Force MBEntityHandle to be 64 bits (uint64_t)" OFF )
+option ( MOAB_FORCE_32_BIT_HANDLES "Force MBEntityHandle to be 32 bits (uint32_t)" OFF )
+
+option ( ENABLE_IMESH        "Should build IMESH?"       OFF )
+option ( ENABLE_IGEOM        "Should build IGEOM?"       OFF )
+
+mark_as_advanced(
     MOAB_FORCE_64_BIT_HANDLES
     MOAB_FORCE_32_BIT_HANDLES
   )
 
-  if ( MOAB_FORCE_64_BIT_HANDLES AND MOAB_FORCE_32_BIT_HANDLES )
-    message( FATAL_ERROR
+
+################################################################################
+# Check for system include files
+################################################################################
+check_include_file( inttypes.h   MOAB_HAVE_INTTYPES_H )
+check_include_file( stdint.h     MOAB_HAVE_STDINT_H )
+check_include_file( stddef.h     MOAB_HAVE_STDDEF_H )
+check_include_file( stdlib.h     MOAB_HAVE_STDLIB_H )
+check_include_file( sys/types.h  MOAB_HAVE_SYS_TYPES_H )
+check_type_size( size_t SIZE_T)
+check_type_size( ptrdiff_t PTRDIFF_T )
+set( MOAB_HAVE_SIZE_T ${HAVE_SIZE_T} )
+set( MOAB_HAVE_PTRDIFF_T ${HAVE_PTRDIFF_T} )
+set( HAVE_SYS_TYPES_H ${MOAB_HAVE_SYS_TYPES_H} )
+set( HAVE_STDDEF_H    ${MOAB_HAVE_STDDEF_H} )
+set( HAVE_STDINT_H    ${MOAB_HAVE_STDINT_H} )
+set( HAVE_INTTYPES_H    ${MOAB_HAVE_INTTYPES_H} )
+set( HAVE_STDLIB_H    ${MOAB_HAVE_STDLIB_H} )
+check_include_file( memory.h     HAVE_MEMORY_H )
+
+################################################################################
+# Interger size Related Settings
+################################################################################
+if ( MOAB_FORCE_64_BIT_HANDLES AND MOAB_FORCE_32_BIT_HANDLES )
+  message( FATAL_ERROR
       "You may not turn both MOAB_FORCE_64_BIT_HANDLES and MOAB_FORCE_32_BIT_HANDLES on. Turn one off to continue."
     )
-  endif ( MOAB_FORCE_64_BIT_HANDLES AND MOAB_FORCE_32_BIT_HANDLES )
-
-  check_include_file( inttypes.h   MOAB_HAVE_INTTYPES_H )
-  check_include_file( stdint.h     MOAB_HAVE_STDINT_H )
-  check_include_file( stddef.h     MOAB_HAVE_STDDEF_H )
-  check_include_file( stdlib.h     MOAB_HAVE_STDLIB_H )
-  check_include_file( sys/types.h  MOAB_HAVE_SYS_TYPES_H )
-  set( HAVE_SYS_TYPES_H ${MOAB_HAVE_SYS_TYPES_H} )
-  set( HAVE_STDDEF_H    ${MOAB_HAVE_STDDEF_H} )
-  set( HAVE_STDINT_H    ${MOAB_HAVE_STDINT_H} )
-  set( HAVE_INTTYPES_H    ${MOAB_HAVE_INTTYPES_H} )
-  set( HAVE_STDLIB_H    ${MOAB_HAVE_STDLIB_H} )
-  check_include_file( memory.h     HAVE_MEMORY_H )
-
-  if ( NOT MOAB_FORCE_64_BIT_HANDLES AND NOT MOAB_FORCE_32_BIT_HANDLES )
-    if ( MOAB_HAVE_INTTYPES_H )
-      set ( CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};inttypes.h" )
-    endif ( MOAB_HAVE_INTTYPES_H )
-    if ( MOAB_HAVE_STDLIB_H )
-      set ( CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};stdlib.h" )
-      #set ( CHECK_TYPE_SIZE_PREMAIN "${CHECK_TYPE_SIZE_PREMAIN}\n#include <stdlib.h>\n" )
-    endif ( MOAB_HAVE_STDLIB_H )
-    check_type_size(  size_t       HAVE_SIZE_T )
-    check_type_size(  ptrdiff_t    HAVE_PTRDIFF_T )
-    set ( MOAB_HAVE_SIZE_T ${HAVE_SIZE_T} )
-    set ( MOAB_HAVE_PTRDIFF_T ${HAVE_PTRDIFF_T} )
-  endif ( NOT MOAB_FORCE_64_BIT_HANDLES AND NOT MOAB_FORCE_32_BIT_HANDLES )
-
-  try_compile( TEMPLATE_DEFS_INCLUDED ${MOAB_BINARY_DIR} ${MOAB_SOURCE_DIR}/config/TemplateSpecialization.cxx OUTPUT_VARIABLE BLORT )
-  if ( TEMPLATE_DEFS_INCLUDED )
-    set ( MOAB_DEFINES "${MOAB_DEFINES} -DTEMPLATE_DEFS_INCLUDED" )
-  endif ( TEMPLATE_DEFS_INCLUDED )
-
-  # find Verdict
-  find_package( verdict REQUIRED )
-
-  # Build options
-  option ( MOAB_USE_MPI    "Should MOAB be compiled with MPI support?"       OFF )
-  option ( MOAB_USE_HDF    "Include HDF I/O in the build?"                   OFF )
-  option ( MOAB_USE_NETCDF "Include NetCDF support (ExodusII) in the build?" OFF )
-
-  # iMesh
-  option ( MOAB_BUILD_IMESH        "Build the iMesh interface?"           ON )
-
-  # check for MPI package
-  if ( MOAB_USE_MPI )
-    find_package( MPI )
-    # CMake FindMPI script is sorely lacking:
-    if ( MPI_LIBRARY AND MPI_INCLUDE_PATH )
-      set( MPI_FOUND 1 )
-    endif ( MPI_LIBRARY AND MPI_INCLUDE_PATH )
-
-    if ( MPI_FOUND )
-      set ( MOAB_DEFINES "${MOAB_DEFINES} -DUSE_MPI" )
-    endif ( MPI_FOUND )
-  endif ( MOAB_USE_MPI )
-
-  if ( MOAB_USE_NETCDF )
-    find_package( NetCDF )
-  endif ( MOAB_USE_NETCDF )
-
-  if ( MOAB_USE_HDF )
-    # HDF5
-    find_package( HDF5 )
-  endif ( MOAB_USE_HDF )
-
-  add_subdirectory( src )
-  add_subdirectory( itaps/imesh )
-  add_subdirectory( tools )
-  add_subdirectory( test )
+endif ( MOAB_FORCE_64_BIT_HANDLES AND MOAB_FORCE_32_BIT_HANDLES )
+
+if ( NOT MOAB_FORCE_64_BIT_HANDLES AND NOT MOAB_FORCE_32_BIT_HANDLES )
+  if ( MOAB_HAVE_INTTYPES_H )
+    set ( CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};inttypes.h" )
+  endif ( MOAB_HAVE_INTTYPES_H )
+  if ( MOAB_HAVE_STDLIB_H )
+    set ( CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES};stdlib.h" )
+    #set ( CHECK_TYPE_SIZE_PREMAIN "${CHECK_TYPE_SIZE_PREMAIN}\n#include <stdlib.h>\n" )
+  endif ( MOAB_HAVE_STDLIB_H )
+  check_type_size(  size_t       HAVE_SIZE_T )
+  check_type_size(  ptrdiff_t    HAVE_PTRDIFF_T )
+  set ( MOAB_HAVE_SIZE_T ${HAVE_SIZE_T} )
+  set ( MOAB_HAVE_PTRDIFF_T ${HAVE_PTRDIFF_T} )
+endif ( NOT MOAB_FORCE_64_BIT_HANDLES AND NOT MOAB_FORCE_32_BIT_HANDLES )
+
+
+################################################################################
+# Find packages
+################################################################################
+find_package( verdict REQUIRED )
+
+# check for MPI package
+if ( MOAB_USE_MPI )
+  find_package( MPI REQUIRED )
+  # CMake FindMPI script is sorely lacking:
+  if ( MPI_LIBRARY AND MPI_INCLUDE_PATH )
+    set( MPI_FOUND 1 )
+  endif ( MPI_LIBRARY AND MPI_INCLUDE_PATH )
+
+  if ( MPI_FOUND )
+    set ( MOAB_DEFINES "${MOAB_DEFINES} -DUSE_MPI" )
+  endif ( MPI_FOUND )
+endif ( MOAB_USE_MPI )
 
+if ( MOAB_USE_NETCDF )
+  find_package( NetCDF REQUIRED )
+  set( MOAB_DEFINES "-DNETCDF_FILE ${MOAB_DEFINES}" )
+  include_directories( ${NetCDF_INCLUDES} ${PNetCDF_INCLUDES} )
+  set( MOAB_LIBS ${MOAB_LIBS} ${NetCDF_LIBRARIES} ${PNetCDF_LIBRARIES} )
+endif ( MOAB_USE_NETCDF )
+
+if ( MOAB_USE_HDF )
+  find_package( HDF5 REQUIRED )
+  set( MOAB_DEFINES "-DHDF5_FILE ${MOAB_DEFINES}" )
+  set( MOAB_LIBS ${MOAB_LIBS} ${HDF5_LIBRARIES} )
+  include_directories( ${HDF5_INCLUDE_DIR} src/io/mhdf/include )
+endif ( MOAB_USE_HDF )
+
+if ( MOAB_USE_ZLIB )
+  find_package( ZLIB REQUIRED )
+endif ( )
+
+if ( MOAB_USE_ZOLTAN )
+  find_package( Zoltan REQUIRED )
+endif ( )
+
+if ( MOAB_USE_CGM )
+   find_package( CGM REQUIRED )
+   set( MOAB_DEFINES "${CGM_DEFINES} -DCGM ${MOAB_DEFINES}" )
+endif ()
+
+if (MOAB_USE_CGNS)
+  set( MOABIO_LIBS ${MOABIO_LIBS} ${CGNS_LIBRARIES} )
+endif()
+
+################################################################################
+# Add Directories
+################################################################################
+add_subdirectory( src )
+add_subdirectory( itaps )
+add_subdirectory( tools )
+
+################################################################################
+# Testing Related Settings
+################################################################################
+#turn on ctest if we want testing
+if ( MOAB_ENABLE_TESTING )
+  enable_testing()
+  add_subdirectory( test )
+endif()
+
+###############################################################################
+#
+###############################################################################
+export(TARGETS ${MOAB_INSTALL_TARGETS}
+              FILE "${PROJECT_BINARY_DIR}/MOABTargets.cmake")
+install(EXPORT MOABTargets DESTINATION lib)
+
+################################################################################
+# Generate the MOABConfig.cmake file
+################################################################################
+set(CXX ${CMAKE_CXX_COMPILER})
+set(CC ${CMAKE_C_COMPILER})
+set(F77 "" )
+set(FC "")
+set(CXXFLAGS ${MOAB_DEFINES})
+set(AM_CXXFLAGS)
+set(CFLAGS ${MOAB_DEFINES})
+set(AM_CFLAGS)
+set(MOAB_FFLAGS)
+set(AM_FFLAGS)
+
+configure_file(MOABConfig.new.cmake.in
+  "${PROJECT_BINARY_DIR}/MOABConfig.cmake" @ONLY)
+install( FILES "${PROJECT_BINARY_DIR}/MOABConfig.cmake" DESTINATION lib )

diff --git a/MOABConfig.new.cmake.in b/MOABConfig.new.cmake.in
new file mode 100644
index 0000000..5b96610
--- /dev/null
+++ b/MOABConfig.new.cmake.in
@@ -0,0 +1,35 @@
+# Config file for MOAB; use the CMake find_package() function to pull this into
+# your own CMakeLists.txt file.
+#
+# This file defines the following variables:
+# MOAB_FOUND        - boolean indicating that MOAB is found
+# MOAB_INCLUDE_DIRS - include directories from which to pick up MOAB includes
+# MOAB_LIBRARIES    - libraries need to link to MOAB; use this in target_link_libraries for MOAB-dependent targets
+# MOAB_CXX, MOAB_CC, MOAB_F77, MOAB_FC - compilers used to compile MOAB
+# MOAB_CXXFLAGS, MOAB_CCFLAGS, MOAB_FFLAGS, MOAB_FCFLAGS - compiler flags used to compile MOAB; possibly need to use these in add_definitions or CMAKE_<LANG>_FLAGS_<MODE> 
+
+set(MOAB_FOUND 1)
+
+set(MOAB_USE_HDF @MOAB_USE_HDF@)
+
+# Compiler flags used by MOAB
+
+set(MOAB_CXXFLAGS "@CXXFLAGS@ @AM_CXXFLAGS@")
+set(MOAB_CFLAGS "@CFLAGS@ @AM_CFLAGS@")
+set(MOAB_FORTRAN_FLAGS "@MOAB_FFLAGS@ @AM_FFLAGS@")
+
+# Library and include defs
+get_filename_component(MOAB_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+if(NOT TARGET MOAB AND NOT MOAB_BINARY_DIR)
+  include("${MOAB_CMAKE_DIR}/MOABTargets.cmake")
+endif()
+
+if(MOAB_USE_HDF)
+  if(EXISTS "@HDF5_DIR@/share/cmake/hdf5/hdf5-config.cmake")
+    include(@HDF5_DIR@/share/cmake/hdf5/hdf5-config.cmake)
+  endif()
+endif()
+
+set(MOAB_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include")
+set(MOAB_LIBRARIES MOAB)

diff --git a/config/AutoconfHeader.cmake b/config/AutoconfHeader.cmake
index 360f2b8..1d83ee8 100644
--- a/config/AutoconfHeader.cmake
+++ b/config/AutoconfHeader.cmake
@@ -27,3 +27,10 @@ else ( EXISTS "${OUTFILE}" )
 endif ( EXISTS "${OUTFILE}" )
 
 endmacro( autoconf_header )
+
+macro( moab_install_headers )
+  foreach (header ${ARGV})
+    string(REGEX MATCH "(.*)/" DIR ${header})
+    install(FILES ${header} DESTINATION include/${DIR})
+  endforeach()
+endmacro(moab_install_headers)

diff --git a/config/FindCGM.cmake b/config/FindCGM.cmake
index 5bc833e..236ea7f 100644
--- a/config/FindCGM.cmake
+++ b/config/FindCGM.cmake
@@ -1,146 +1,137 @@
-# Find the common geometry module libraries
+# FindCGM.cmake
+#
+# If you set the CGM_CFG CMake variable to point to a file named "cgm.make"
+# (produced by CGM as part of any build or install), then the script will
+# locate CGM assets for your package to use.
+#
+# This script defines the following CMake variables:
+#   CGM_FOUND         defined when CGM is located, false otherwise
+#   CGM_INCLUDE_DIRS  directories containing CGM headers
+#   CGM_DEFINES       preprocessor definitions you should add to source files
+#   CGM_LIBRARIES     paths to CGM library and its dependencies
+#
+# Note that this script does not produce CGM_VERSION as that information
+# is not available in the "cgm.make" configuration file that CGM creates.
 
-if ( NOT CGM_SOURCE_DIR )
-  find_path( CGM_SOURCE_DIR
-    NAMES geom/CubitGeomConfigure.h.in
-    PATHS
-      ${CGM_INCLUDE_DIRECTORIES}
-  )
-endif ( NOT CGM_SOURCE_DIR )
+find_file(CGM_CFG cgm.make DOC "Path to cgm.make configuration file")
+if(CGM_CFG)
+  set(CGM_FOUND 1)
+  file(READ "${CGM_CFG}" CGM_CFG_DATA)
+  ##
+  ## Replace line continuations ('\' at EOL) so we don't have to parse them later
+  ##
+  string(REGEX REPLACE "\\\\\\\n" "" CGM_CFG_DATA "${CGM_CFG_DATA}")
 
-if ( NOT CGM_BINARY_DIR )
-  if ( CGM_LIBRARIES )
-    set( CGM_BUILD_SEARCH "" )
-    foreach ( LIB ${CGM_LIBRARIES} )
-      get_filename_component( PATH DIR ${LIB} )
-      set( CGM_BUILD_SEARCH "${CGM_BUILD_SEARCH};${DIR}/.." )
-    endforeach ( DIR )
-    set( DIR )
-  endif ( CGM_LIBRARIES )
-  find_path( CGM_BINARY_DIR
-    NAMES geom/CubitGeomConfigure.h
-    PATHS
-      ${CGM_BUILD_SEARCH}
-  )
-endif ( NOT CGM_BINARY_DIR )
+  ##
+  ## Find include directories
+  ##
+  string(REGEX MATCHALL "CGM_INT_INCLUDE =[^\\\n]*" _CGM_INCS "${CGM_CFG_DATA}")
+  foreach(_CGM_INC ${_CGM_INCS})
+    # Only use include directories specified by the *last*
+    # occurrence of CGM_INT_INCLUDE in the config file:
+    unset(CGM_INCLUDE_DIRS)
 
-if ( NOT CGM_LIBRARIES )
-  set( CGM_LIBSEARCH
-    ${CGM_BINARY_DIR}/init
-    ${CGM_BINARY_DIR}/geom/virtual
-    ${CGM_BINARY_DIR}/geom/facetbool
-    ${CGM_BINARY_DIR}/geom/facet
-    ${CGM_BINARY_DIR}/geom/Cholla
-    ${CGM_BINARY_DIR}/geom
-    ${CGM_BINARY_DIR}/util
-    /usr/local/lib64
-    /usr/local/bin64
-    /usr/lib64
-    /usr/bin64
-    /usr/local/lib
-    /usr/local/bin
-    /usr/lib
-    /usr/bin
-  )
-  find_library( CGM_UTIL_LIBRARY
-    NAMES cubit_util
-    PATHS ${CGM_LIBSEARCH}
-  )
+    string(REGEX REPLACE "-I" ";-I" _CGM_INC "${_CGM_INC}")
+    foreach(_CGM_IDIR ${_CGM_INC})
+      if ("${_CGM_IDIR}" MATCHES "^-I.*")
+        string(REGEX REPLACE "-I" "" _CGM_IDIR "${_CGM_IDIR}")
+        string(STRIP "${_CGM_IDIR}" _CGM_IDIR)
+        list(APPEND CGM_INCLUDE_DIRS "${_CGM_IDIR}")
+      endif()
+    endforeach()
+    # Alternately, one might:
+    #list(APPEND CGM_INCLUDE_DIRS "${_CGM_INC}")
+  endforeach()
+  #message("CGM_INCLUDE_DIRS=\"${CGM_INCLUDE_DIRS}\"")
 
-  find_library( CGM_GEOM_LIBRARY
-    NAMES cubit_geom
-    PATHS ${CGM_LIBSEARCH}
-  )
+  ##
+  ## Find preprocessor definitions
+  ##
+  string(REGEX MATCH "CGM_DEFINES =[^\\\n]*" CGM_DEFINES "${CGM_CFG_DATA}")
+  string(REGEX REPLACE "CGM_DEFINES = ([^\\\n]*)" "\\1" CGM_DEFINES "${CGM_DEFINES}")
 
-  find_library( CGM_CHOLLA_LIBRARY
-    NAMES cholla
-    PATHS ${CGM_LIBSEARCH}
-  )
+  ##
+  ## Find CGM library directory(-ies)
+  ##
+  string(REGEX MATCHALL "CGM_INT_LDFLAGS =[^\\\n]*" _CGM_LDIRS "${CGM_CFG_DATA}")
+  foreach(_CGM_LDIR ${_CGM_LDIRS})
+    set(CGM_LIB_DIRS)
+    string(REGEX REPLACE " -L" ";-L" _CGM_LDIR "${_CGM_LDIR}")
+    string(REGEX REPLACE "CGM_INT_LDFLAGS = ([^\\\n]*)" "\\1" _CGM_LDIR "${_CGM_LDIR}")
+    foreach(_CGM_LL ${_CGM_LDIR})
+      if("${_CGM_LL}" MATCHES "^-L.*")
+        string(REGEX REPLACE "-L" "" _CGM_LL "${_CGM_LL}")
+        string(STRIP "${_CGM_LL}" _CGM_LL)
+        list(APPEND CGM_LIB_DIRS "${_CGM_LL}")
+      endif()
+    endforeach()
+  endforeach()
 
-  find_library( CGM_FACET_LIBRARY
-    NAMES cubit_facet
-    PATHS ${CGM_LIBSEARCH}
-  )
+  ##
+  ## Now add dependent library directories to CGM_LIB_DIRS
+  ##
+  string(REGEX MATCH "CGM_LDFLAGS =[^\\\n]*" _CGM_LDIR "${CGM_CFG_DATA}")
+  string(REGEX REPLACE "CGM_LDFLAGS = ([^\\\n]*)" "\\1" _CGM_LDIR "${_CGM_LDIR}")
+  string(REGEX REPLACE " -L" ";-L" _CGM_LDIR "${_CGM_LDIR}")
+  set(_CGM_LDIRS)
+  foreach(_CGM_LL ${_CGM_LDIR})
+    if("${_CGM_LL}" MATCHES "^-L.*")
+      string(REGEX REPLACE "-L" "" _CGM_LL "${_CGM_LL}")
+      string(STRIP "${_CGM_LL}" _CGM_LL)
+      list(APPEND _CGM_LDIRS "${_CGM_LL}")
+    endif()
+  endforeach()
+  set(CGM_LIB_DIRS "${CGM_LIB_DIRS};${_CGM_LDIRS}")
+  #message("${CGM_LIB_DIRS}")
 
-  find_library( CGM_FACETBOOL_LIBRARY
-    NAMES cubit_facetboolstub
-    PATHS ${CGM_LIBSEARCH}
-  )
+  ##
+  ## Find the CGM library and its dependencies
+  ##
+  string(REGEX MATCHALL "CGM_LIBS =[^\\\n]*" _CGM_LIBS "${CGM_CFG_DATA}")
+  string(REGEX MATCHALL "-l[^ \t\n]+" _CGM_LIBS "${_CGM_LIBS}")
+  foreach(_CGM_LIB ${_CGM_LIBS})
+    string(REGEX REPLACE "-l" "" _CGM_LIB "${_CGM_LIB}")
+    find_library(_CGM_LIB_LOC
+      NAME "${_CGM_LIB}"
+      # Cannot quote since it contains semicolons:
+      PATHS ${CGM_LIB_DIRS}
+      NO_DEFAULT_PATH
+      NO_CMAKE_ENVIRONMENT_PATH
+      NO_CMAKE_PATH
+      NO_SYSTEM_ENVIRONMENT_PATH
+      NO_CMAKE_SYSTEM_PATH
+      )
+    #message("Lib \"${_CGM_LIB}\" @ \"${_CGM_LIB_LOC}\" paths \"${CGM_LIB_DIRS}\"")
+    if (_CGM_LIB_LOC)
+      list(APPEND CGM_LIBRARIES "${_CGM_LIB_LOC}")
+      unset(_CGM_LIB_LOC CACHE)
+      unset(_CGM_LIB_LOC)
+    else()
+      message("Could not find ${_CGM_LIB} library (part of CGM)")
+      unset(CGM_FOUND)
+    endif()
+  endforeach()
+  #message("Libs ${CGM_LIBRARIES}")
 
-  find_library( CGM_VIRTUAL_LIBRARY
-    NAMES cubit_virtual
-    PATHS ${CGM_LIBSEARCH}
-  )
 
-  find_library( CGM_INIT_LIBRARY
-    NAMES cgma_init
-    PATHS ${CGM_LIBSEARCH}
-  )
-endif ( NOT CGM_LIBRARIES )
+  ##
+  ## Kill temporary variables
+  ##
+  unset(_CGM_INCS)
+  unset(_CGM_INC)
+  unset(_CGM_IDIR)
+  unset(_CGM_LDIRS)
+  unset(_CGM_LDIR)
+  unset(_CGM_LL)
+  unset(_CGM_LIBS)
+  unset(_CGM_LIB)
+  unset(_CGM_LIB_LOC)
+else()
+  unset(CGM_FOUND)
+endif()
 
-if ( CGM_SOURCE_DIR AND CGM_BINARY_DIR AND NOT CGM_INCLUDE_DIRECTORIES )
-  set( cubit_geom_SOURCE_DIR "${CGM_SOURCE_DIR}/geom" )
-  set( cubit_geom_BINARY_DIR "${CGM_BINARY_DIR}/geom" )
-  set( cubit_util_SOURCE_DIR "${CGM_SOURCE_DIR}/util" )
-  set( cubit_util_BINARY_DIR "${CGM_BINARY_DIR}/util" )
-  set( cgma_init_SOURCE_DIR "${CGM_SOURCE_DIR}/init" )
-  set( cgma_init_BINARY_DIR "${CGM_BINARY_DIR}/init" )
-  set( CGM_INCLUDE_DIRECTORIES
-    "${cubit_util_SOURCE_DIR}"
-    "${cubit_util_BINARY_DIR}"
-    "${cubit_geom_SOURCE_DIR}"
-    "${cubit_geom_SOURCE_DIR}/ACIS"
-    "${cubit_geom_SOURCE_DIR}/Cholla"
-    "${cubit_geom_SOURCE_DIR}/facet"
-    "${cubit_geom_SOURCE_DIR}/facetbool"
-    "${cubit_geom_SOURCE_DIR}/OCC"
-    "${cubit_geom_SOURCE_DIR}/parallel"
-    "${cubit_geom_SOURCE_DIR}/SolidWorks"
-    "${cubit_geom_SOURCE_DIR}/virtual"
-    "${cubit_geom_BINARY_DIR}"
-    "${cgma_init_SOURCE_DIR}"
-    "${cgma_init_BINARY_DIR}"
-    CACHE PATH "Paths to util/CubitUtilConfigure.h.in, util/CubitUtilConfigure.h, geom/CubitGeomConfigure.h.in, AND geom/CubitGeomConfigure.h files." FORCE
-  )
-endif ( CGM_SOURCE_DIR AND CGM_BINARY_DIR AND NOT CGM_INCLUDE_DIRECTORIES )
-
-if ( CGM_UTIL_LIBRARY AND CGM_GEOM_LIBRARY AND CGM_INIT_LIBRARY AND NOT CGM_LIBRARIES )
-  # Link to libdl in case shared libraries are used.
-  set( CGM_LIBRARIES
-    "${CGM_INIT_LIBRARY}"
-    "${CGM_CHOLLA_LIBRARY}"
-    "${CGM_FACETBOOL_LIBRARY}"
-    "${CGM_FACET_LIBRARY}"
-    "${CGM_VIRTUAL_LIBRARY}"
-    "${CGM_GEOM_LIBRARY}"
-    "${CGM_UTIL_LIBRARY}"
-    dl
-    CACHE FILEPATH "Full paths to cubit_util AND cubit_geom libraries." FORCE
-  )
-endif ( CGM_UTIL_LIBRARY AND CGM_GEOM_LIBRARY AND CGM_INIT_LIBRARY AND NOT CGM_LIBRARIES )
-
-mark_as_advanced(
-  CGM_SOURCE_DIR
-  CGM_BINARY_DIR
-  CGM_INCLUDE_DIRECTORIES
-  CGM_LIBRARIES
-  CGM_UTIL_LIBRARY
-  CGM_GEOM_LIBRARY
-  CGM_INIT_LIBRARY
-  CGM_CHOLLA_LIBRARY
-  CGM_FACETBOOL_LIBRARY
-  CGM_FACET_LIBRARY
-  CGM_VIRTUAL_LIBRARY
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CGM
+  REQUIRED_VARS CGM_INCLUDE_DIRS CGM_LIBRARIES
+  VERSION_VAR CGM_VERSION
 )
-
-if ( NOT CGM_INCLUDE_DIRECTORIES OR NOT CGM_LIBRARIES )
-  set( CGM_INCLUDE_DIRECTORIES "" CACHE PATH "Paths to util/CubitUtilConfigure.h.in, util/CubitUtilConfigure.h, geom/CubitGeomConfigure.h.in, AND geom/CubitGeomConfigure.h files." )
-  set( CGM_LIBRARIES           "" CACHE PATH "Paths to cubit_util AND cubit_geom libraries." )
-  set( CGM_FOUND 0 )
-  if ( CGM_FIND_REQUIRED )
-    message( FATAL_ERROR "CGM is required. Please set CGM_INCLUDE_DIRECTORIES and CGM_LIBRARIES or set CGM_SOURCE_DIR and CGM_BINARY_DIR" )
-  endif ( CGM_FIND_REQUIRED )
-else ( NOT CGM_INCLUDE_DIRECTORIES OR NOT CGM_LIBRARIES )
-  set( CGM_FOUND 1 )
-endif ( NOT CGM_INCLUDE_DIRECTORIES OR NOT CGM_LIBRARIES )
-

diff --git a/config/FindHDF5.cmake b/config/FindHDF5.cmake
index f14395f..e26ce95 100644
--- a/config/FindHDF5.cmake
+++ b/config/FindHDF5.cmake
@@ -1,23 +1,100 @@
 #
 # Find the native HDF5 includes and library
 #
-# HDF5_INCLUDE_DIR - where to find H5public.h, etc.
+# HDF5_INCLUDES    - where to find hdf5.h, H5public.h, etc.
 # HDF5_LIBRARIES   - List of fully qualified libraries to link against when using hdf5.
 # HDF5_FOUND       - Do not attempt to use hdf5 if "no" or undefined.
 
-FIND_PATH(HDF5_INCLUDE_DIR H5public.h
+set( HDF5_DIR "" CACHE PATH "Path to search for HDF5 header and library files" )
+set (HDF5_FOUND NO CACHE INTERNAL "Found HDF5 components successfully." )
+
+if(EXISTS "${HDF5_DIR}/share/cmake/hdf5/hdf5-config.cmake")
+  include(${HDF5_DIR}/share/cmake/hdf5/hdf5-config.cmake)
+else()
+
+FIND_PATH(HDF5_INCLUDE_DIR
+  NAMES hdf5.h H5public.h
+  PATHS ${HDF5_DIR}/include
   /usr/local/include
   /usr/include
+  /opt/local/include
 )
 
-FIND_LIBRARY(HDF5_LIBRARY hdf5
-  /usr/local/lib
-  /usr/lib
+foreach (VARIANT dl m z )
+  FIND_LIBRARY(hdf5_deplibs_${VARIANT} ${VARIANT}
+    PATHS /lib /usr/local/lib /usr/lib /opt/local/lib
+  )
+  list(APPEND HDF5_DEP_LIBRARIES ${hdf5_deplibs_${VARIANT}})
+endforeach()
+
+FIND_LIBRARY(HDF5_BASE_LIBRARY hdf5 hdf5d)
+
+FIND_LIBRARY(HDF5_BASE_LIBRARY NAMES hdf5 hdf5d
+  PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
 )
+FIND_LIBRARY(HDF5_HLBASE_LIBRARY hdf5_hl hdf5_hld
+  PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
+)
+
+IF (NOT HDF5_FOUND)
+  IF (HDF5_INCLUDE_DIR AND HDF5_BASE_LIBRARY)
+    FIND_LIBRARY(HDF5_CXX_LIBRARY hdf5_cxx
+      PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
+    )
+    FIND_LIBRARY(HDF5_HLCXX_LIBRARY hdf5_hl_cxx
+      PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
+    )
+    FIND_LIBRARY(HDF5_FORT_LIBRARY hdf5_fortran
+      PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
+    )
+    FIND_LIBRARY(HDF5_HLFORT_LIBRARY
+      NAMES hdf5hl_fortran hdf5_hl_fortran
+      PATHS ${HDF5_DIR}/lib /usr/local/lib /usr/lib /opt/local/lib
+    )
+    SET( HDF5_INCLUDES "${HDF5_INCLUDE_DIR}" )
+    if (HDF5_FORT_LIBRARY)
+      FIND_PATH(HDF5_FORT_INCLUDE_DIR
+        NAMES hdf5.mod
+        PATHS ${HDF5_DIR}/include
+        ${HDF5_DIR}/include/fortran
+        /usr/local/include
+        /usr/include
+        /opt/local/include
+      )
+      if (HDF5_FORT_INCLUDE_DIR AND NOT ${HDF5_FORT_INCLUDE_DIR} STREQUAL ${HDF5_INCLUDE_DIR})
+        SET( HDF5_INCLUDES "${HDF5_INCLUDES} ${HDF5_FORT_INCLUDE_DIR}" )
+      endif (HDF5_FORT_INCLUDE_DIR AND NOT ${HDF5_FORT_INCLUDE_DIR} STREQUAL ${HDF5_INCLUDE_DIR})
+      unset(HDF5_FORT_INCLUDE_DIR CACHE)
+    endif (HDF5_FORT_LIBRARY)
+    # Add the libraries based on availability
+    foreach (VARIANT CXX FORT BASE )
+      if (HDF5_HL${VARIANT}_LIBRARY)
+        list(APPEND HDF5_LIBRARIES ${HDF5_HL${VARIANT}_LIBRARY})
+      endif (HDF5_HL${VARIANT}_LIBRARY)
+      if (HDF5_${VARIANT}_LIBRARY)
+        list(APPEND HDF5_LIBRARIES ${HDF5_${VARIANT}_LIBRARY})
+      endif (HDF5_${VARIANT}_LIBRARY)
+      unset(HDF5_HL${VARIANT}_LIBRARY CACHE)
+      unset(HDF5_${VARIANT}_LIBRARY CACHE)
+    endforeach()
+    list(APPEND HDF5_LIBRARIES ${HDF5_DEP_LIBRARIES})
+    SET( HDF5_FOUND YES )
+    message (STATUS "---   HDF5 Configuration ::")
+    message (STATUS "        INCLUDES  : ${HDF5_INCLUDES}")
+    message (STATUS "        LIBRARIES : ${HDF5_LIBRARIES}")
+  ELSE (HDF5_INCLUDE_DIR AND HDF5_BASE_LIBRARY)
+    set( HDF5_FOUND NO )
+    message("finding HDF5 failed, please try to set the var HDF5_DIR")
+  ENDIF(HDF5_INCLUDE_DIR AND HDF5_BASE_LIBRARY)
+ENDIF (NOT HDF5_FOUND)
+
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (HDF5 "HDF5 not found, check environment variables HDF5_DIR"
+  HDF5_DIR HDF5_INCLUDES HDF5_LIBRARIES)
+
+#now we create fake targets to be used
+if(EXISTS ${HDF5_DIR}/share/cmake/hdf5/hdf5-targets.cmake)
+  include(${HDF5_DIR}/share/cmake/hdf5/hdf5-targets.cmake)
+endif()
 
-IF(HDF5_INCLUDE_DIR)
-  IF(HDF5_LIBRARY)
-    SET( HDF5_LIBRARIES ${HDF5_LIBRARY} )
-    SET( HDF5_FOUND "YES" )
-  ENDIF(HDF5_LIBRARY)
-ENDIF(HDF5_INCLUDE_DIR)
+endif(EXISTS "${HDF5_DIR}/share/cmake/hdf5/hdf5-config.cmake")

diff --git a/config/FindNetCDF.cmake b/config/FindNetCDF.cmake
index f9e655c..bcb8be3 100644
--- a/config/FindNetCDF.cmake
+++ b/config/FindNetCDF.cmake
@@ -1,75 +1,132 @@
 #
 # Find NetCDF include directories and libraries
 #
-# NetCDF_INCLUDE_DIRECTORIES - where to find netcdf.h
+# NetCDF_INCLUDES            - list of include paths to find netcdf.h
 # NetCDF_LIBRARIES           - list of libraries to link against when using NetCDF
 # NetCDF_FOUND               - Do not attempt to use NetCDF if "no", "0", or undefined.
 
-set( NetCDF_PREFIX "" CACHE PATH "Path to search for NetCDF header and library files" )
+set (NetCDF_DIR "" CACHE PATH "Path to search for NetCDF header and library files" )
+set (NetCDF_FOUND NO CACHE INTERNAL "Found NetCDF components successfully." )
 
-find_path( NetCDF_INCLUDE_DIRECTORIES netcdf.h
+find_path( NetCDF_INCLUDE_DIR netcdf.h
+  ${NetCDF_DIR}
+  ${NetCDF_DIR}/include
   /usr/local/include
   /usr/include
 )
 
 find_library( NetCDF_C_LIBRARY
   NAMES netcdf
-  ${NetCDF_PREFIX}
-  ${NetCDF_PREFIX}/lib64
-  ${NetCDF_PREFIX}/lib
+  HINTS ${NetCDF_DIR}
+  ${NetCDF_DIR}/lib64
+  ${NetCDF_DIR}/lib
   /usr/local/lib64
   /usr/lib64
-  /usr/lib64/netcdf-3
+  /usr/lib64/netcdf
   /usr/local/lib
   /usr/lib
-  /usr/lib/netcdf-3
+  /usr/lib/netcdf
 )
 
 find_library( NetCDF_CXX_LIBRARY
   NAMES netcdf_c++
-  ${NetCDF_PREFIX}
-  ${NetCDF_PREFIX}/lib64
-  ${NetCDF_PREFIX}/lib
+  HINTS ${NetCDF_DIR}
+  ${NetCDF_DIR}/lib64
+  ${NetCDF_DIR}/lib
   /usr/local/lib64
   /usr/lib64
-  /usr/lib64/netcdf-3
+  /usr/lib64/netcdf
   /usr/local/lib
   /usr/lib
-  /usr/lib/netcdf-3
+  /usr/lib/netcdf
 )
 
 find_library( NetCDF_FORTRAN_LIBRARY
   NAMES netcdf_g77 netcdf_ifc netcdf_x86_64
-  ${NetCDF_PREFIX}
-  ${NetCDF_PREFIX}/lib64
-  ${NetCDF_PREFIX}/lib
+  HINTS ${NetCDF_DIR}
+  ${NetCDF_DIR}/lib64
+  ${NetCDF_DIR}/lib
   /usr/local/lib64
   /usr/lib64
-  /usr/lib64/netcdf-3
+  /usr/lib64/netcdf
   /usr/local/lib
   /usr/lib
-  /usr/lib/netcdf-3
+  /usr/lib/netcdf
 )
 
-set( NetCDF_LIBRARIES
-  ${NetCDF_C_LIBRARY}
-  ${NetCDF_CXX_LIBRARY}
-)
+IF (NOT NetCDF_FOUND)
+  if ( NetCDF_INCLUDE_DIR AND NetCDF_C_LIBRARY )
+    set( NetCDF_FOUND YES )
+    set(NetCDF_INCLUDES "${NetCDF_INCLUDE_DIR}")
+    set(NetCDF_LIBRARIES ${NetCDF_C_LIBRARY})
+    if ( NetCDF_CXX_LIBRARY )
+      set(NetCDF_LIBRARIES ${NetCDF_LIBRARIES} ${NetCDF_CXX_LIBRARY})
+    endif ( NetCDF_CXX_LIBRARY )
+    if ( NetCDF_FORTRAN_LIBRARY )
+      set(NetCDF_LIBRARIES ${NetCDF_LIBRARIES} ${NetCDF_FORTRAN_LIBRARY})
+    endif ( NetCDF_FORTRAN_LIBRARY )
+    message (STATUS "---   NetCDF Configuration ::")
+    message (STATUS "        INCLUDES  : ${NetCDF_INCLUDES}")
+    message (STATUS "        LIBRARIES : ${NetCDF_LIBRARIES}")
+  else ( NetCDF_INCLUDE_DIR AND NetCDF_C_LIBRARY )
+    set( NetCDF_FOUND NO )
+    message("finding NetCDF failed, please try to set the var NetCDF_DIR")
+  endif ( NetCDF_INCLUDE_DIR AND NetCDF_C_LIBRARY )
+ENDIF (NOT NetCDF_FOUND)
 
-set( NetCDF_FORTRAN_LIBRARIES
-  ${NetCDF_FORTRAN_LIBRARY}
+mark_as_advanced(
+  NetCDF_DIR
+  NetCDF_INCLUDES
+  NetCDF_LIBRARIES
 )
 
-if ( NetCDF_INCLUDE_DIRECTORIES AND NetCDF_LIBRARIES )
-  set( NetCDF_FOUND 1 )
-else ( NetCDF_INCLUDE_DIRECTORIES AND NetCDF_LIBRARIES )
-  set( NetCDF_FOUND 0 )
-endif ( NetCDF_INCLUDE_DIRECTORIES AND NetCDF_LIBRARIES )
+IF (MOAB_USE_MPI)
+  set (PNetCDF_DIR "" CACHE PATH "Path to search for parallel NetCDF header and library files" )
+  set (PNetCDF_FOUND NO CACHE INTERNAL "Found parallel NetCDF components successfully." )
 
-mark_as_advanced(
-  NetCDF_PREFIX
-  NetCDF_INCLUDE_DIRECTORIES
-  NetCDF_C_LIBRARY
-  NetCDF_CXX_LIBRARY
-  NetCDF_FORTRAN_LIBRARY
-)
+  find_path( PNetCDF_INCLUDES pnetcdf.h
+    ${PNetCDF_DIR}
+    ${PNetCDF_DIR}/include
+    /usr/local/include
+    /usr/include
+  )
+
+  find_library( PNetCDF_LIBRARIES
+    NAMES pnetcdf
+    HINTS ${PNetCDF_DIR}
+    ${PNetCDF_DIR}/lib64
+    ${PNetCDF_DIR}/lib
+    /usr/local/lib64
+    /usr/lib64
+    /usr/lib64/pnetcdf
+    /usr/local/lib
+    /usr/lib
+    /usr/lib/pnetcdf
+  )
+
+  IF (NOT PNetCDF_FOUND)
+    if ( PNetCDF_INCLUDES AND PNetCDF_LIBRARIES )
+      set( PNetCDF_FOUND YES )
+      message (STATUS "---   PNetCDF Configuration ::")
+      message (STATUS "        INCLUDES  : ${PNetCDF_INCLUDES}")
+      message (STATUS "        LIBRARIES : ${PNetCDF_LIBRARIES}")
+    else ( PNetCDF_INCLUDES AND PNetCDF_LIBRARIES )
+      set( NetCDF_FOUND NO )
+      message("finding PNetCDF failed, please try to set the var PNetCDF_DIR")
+    endif ( PNetCDF_INCLUDES AND PNetCDF_LIBRARIES )
+  ENDIF (NOT PNetCDF_FOUND)
+
+  mark_as_advanced(
+    PNetCDF_DIR
+    PNetCDF_INCLUDES
+    PNetCDF_LIBRARIES
+  )
+ELSE (MOAB_USE_MPI)
+  message (STATUS "Not configuring with PNetCDF since MPI installation not specified")
+ENDIF()
+
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (NetCDF "NetCDF not found, check environment variables NetCDF_DIR"
+  NetCDF_DIR NetCDF_INCLUDES NetCDF_LIBRARIES)
+find_package_handle_standard_args (PNetCDF "PNetCDF not found, check environment variables PNetCDF_DIR"
+  PNetCDF_DIR PNetCDF_INCLUDES PNetCDF_LIBRARIES)

diff --git a/config/FindZoltan.cmake b/config/FindZoltan.cmake
new file mode 100644
index 0000000..8c6b259
--- /dev/null
+++ b/config/FindZoltan.cmake
@@ -0,0 +1,91 @@
+#
+# Find Zoltan include directories and libraries
+#
+# Zoltan_INCLUDES            - list of include paths to find netcdf.h
+# Zoltan_LIBRARIES           - list of libraries to link against when using Zoltan
+# Zoltan_FOUND               - Do not attempt to use Zoltan if "no", "0", or undefined.
+
+set (Zoltan_DIR "" CACHE PATH "Path to search for Zoltan header and library files" )
+set (Zoltan_FOUND NO CACHE INTERNAL "Found Zoltan components successfully." )
+
+find_path( Zoltan_INCLUDE_DIR zoltan.h
+  ${Zoltan_DIR}
+  ${Zoltan_DIR}/include
+  /usr/local/include
+  /usr/include
+)
+
+find_library( Zoltan_LIBRARY
+  NAMES zoltan
+  HINTS ${Zoltan_DIR}
+  ${Zoltan_DIR}/lib64
+  ${Zoltan_DIR}/lib
+  /usr/local/lib64
+  /usr/lib64
+  /usr/lib64/zoltan
+  /usr/local/lib
+  /usr/lib
+  /usr/lib/zoltan
+)
+
+
+macro (Zoltan_GET_VARIABLE makefile name var)
+  set (${var} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
+  execute_process (COMMAND ${CMAKE_BUILD_TOOL} -f ${${makefile}} show VARIABLE=${name}
+    OUTPUT_VARIABLE ${var}
+    RESULT_VARIABLE zoltan_return)
+endmacro (Zoltan_GET_VARIABLE)
+
+macro (Zoltan_GET_ALL_VARIABLES)
+  if (NOT zoltan_config_current)
+    # A temporary makefile to probe this Zoltan components's configuration
+    # The current inspection is based on Zoltan-3.6 installation
+    set (zoltan_config_makefile "${CMAKE_CURRENT_BINARY_DIR}/Makefile.zoltan")
+    file (WRITE ${zoltan_config_makefile}
+      "## This file was autogenerated by FindZoltan.cmake
+include ${Zoltan_INCLUDE_DIR}/Makefile.export.zoltan
+include ${Zoltan_INCLUDE_DIR}/Makefile.export.zoltan.macros
+show :
+	- at echo -n \${\${VARIABLE}}")
+    Zoltan_GET_VARIABLE (zoltan_config_makefile ZOLTAN_CPPFLAGS    zoltan_extra_cppflags)
+    Zoltan_GET_VARIABLE (zoltan_config_makefile ZOLTAN_EXTRA_LIBS  zoltan_extra_libs)
+    Zoltan_GET_VARIABLE (zoltan_config_makefile ZOLTAN_LDFLAGS     zoltan_ldflags)
+    
+    file (REMOVE ${zoltan_config_makefile})
+    SET(tmp_incs "-I${Zoltan_INCLUDE_DIR} ${zoltan_extra_cppflags}")
+    resolve_includes(Zoltan_INCLUDES ${tmp_incs})
+    SET(tmp_libs "${Zoltan_LIBRARY} ${zoltan_ldflags} ${zoltan_extra_libs}")
+    resolve_libraries (Zoltan_LIBRARIES "${tmp_libs}")
+  endif ()
+endmacro (Zoltan_GET_ALL_VARIABLES)
+
+
+IF (NOT Zoltan_FOUND)
+  if ( Zoltan_INCLUDE_DIR AND Zoltan_LIBRARY )
+    set( Zoltan_FOUND YES )
+    if(EXISTS ${Zoltan_INCLUDE_DIR}/Makefile.export.zoltan)
+      include (ResolveCompilerPaths)
+      Zoltan_GET_ALL_VARIABLES()
+    else(EXISTS ${Zoltan_INCLUDE_DIR}/Makefile.export.zoltan)
+      SET(Zoltan_INCLUDES ${Zoltan_INCLUDE_DIR})
+      SET(Zoltan_LIBRARIES ${Zoltan_LIBRARY})
+    endif(EXISTS ${Zoltan_INCLUDE_DIR}/Makefile.export.zoltan)
+    message (STATUS "---   Zoltan Configuration ::")
+    message (STATUS "        INCLUDES  : ${Zoltan_INCLUDES}")
+    message (STATUS "        LIBRARIES : ${Zoltan_LIBRARIES}")
+  else ( Zoltan_INCLUDE_DIR AND Zoltan_LIBRARY )
+    set( Zoltan_FOUND NO )
+    message("finding Zoltan failed, please try to set the var Zoltan_DIR")
+  endif ( Zoltan_INCLUDE_DIR AND Zoltan_LIBRARY )
+ENDIF (NOT Zoltan_FOUND)
+
+mark_as_advanced(
+  Zoltan_DIR
+  Zoltan_INCLUDES
+  Zoltan_LIBRARIES
+)
+
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (Zoltan "Zoltan not found, check environment variables Zoltan_DIR"
+  Zoltan_DIR Zoltan_INCLUDES Zoltan_LIBRARIES)
+

diff --git a/config/ITAPSFortranMangling.cmake b/config/ITAPSFortranMangling.cmake
index 0dcd687..5b2c381 100644
--- a/config/ITAPSFortranMangling.cmake
+++ b/config/ITAPSFortranMangling.cmake
@@ -2,14 +2,14 @@
 
 # MACRO ( itaps_fortran_mangle input_file output_file prefix )
 
-SET( match_expr "^[ \\t]*void[ \\t]+${prefix}_([a-z][_a-zA-Z0-9]*)[ \\t]*\\(.*$" )
+SET( match_expr "^[ \\t]*void[ \\t]+${prefix}_([a-zA-Z][_a-zA-Z0-9]*)[ \\t]*\\(.*$" )
 FILE( STRINGS ${input_file} data REGEX ${match_expr} )
-FILE( WRITE ${output_file} "#include \"MOAB_FCDefs.h\"\n#ifdef FC_FUNC_\n\n" )
+FILE( WRITE ${output_file} "#include \"MOAB_FCDefs.h\"\n#ifdef MOAB_FC_FUNC_\n\n" )
 FOREACH( line ${data} )
   STRING(REGEX REPLACE ${match_expr} "${prefix}_\\1" func ${line})
   STRING(TOUPPER ${func} upper)
   STRING(TOLOWER ${func} lower)
-  FILE( APPEND ${output_file}  "#define ${func} FC_FUNC_( ${upper}, ${lower} )\n" )
+  FILE( APPEND ${output_file}  "#define ${func} ${DEF}_FC_FUNC_( ${lower}, ${upper} )\n" )
 ENDFOREACH( line )
 FILE( APPEND ${output_file} "\n#endif\n" )
 

diff --git a/config/ResolveCompilerPaths.cmake b/config/ResolveCompilerPaths.cmake
new file mode 100644
index 0000000..259dd99
--- /dev/null
+++ b/config/ResolveCompilerPaths.cmake
@@ -0,0 +1,99 @@
+# ResolveCompilerPaths - this module defines two macros
+#
+# RESOLVE_LIBRARIES (XXX_LIBRARIES LINK_LINE)
+#  This macro is intended to be used by FindXXX.cmake modules.
+#  It parses a compiler link line and resolves all libraries
+#  (-lfoo) using the library path contexts (-L/path) in scope.
+#  The result in XXX_LIBRARIES is the list of fully resolved libs.
+#  Example:
+#
+#    RESOLVE_LIBRARIES (FOO_LIBRARIES "-L/A -la -L/B -lb -lc -ld")
+#
+#  will be resolved to
+#
+#    FOO_LIBRARIES:STRING="/A/liba.so;/B/libb.so;/A/libc.so;/usr/lib/libd.so"
+#
+#  if the filesystem looks like
+#
+#    /A:       liba.so         libc.so
+#    /B:       liba.so libb.so
+#    /usr/lib: liba.so libb.so libc.so libd.so
+#
+#  and /usr/lib is a system directory.
+#
+#  Note: If RESOLVE_LIBRARIES() resolves a link line differently from
+#  the native linker, there is a bug in this macro (please report it).
+#
+# RESOLVE_INCLUDES (XXX_INCLUDES INCLUDE_LINE)
+#  This macro is intended to be used by FindXXX.cmake modules.
+#  It parses a compile line and resolves all includes
+#  (-I/path/to/include) to a list of directories.  Other flags are ignored.
+#  Example:
+#
+#    RESOLVE_INCLUDES (FOO_INCLUDES "-I/A -DBAR='\"irrelevant -I/string here\"' -I/B")
+#
+#  will be resolved to
+#
+#    FOO_INCLUDES:STRING="/A;/B"
+#
+#  assuming both directories exist.
+#  Note: as currently implemented, the -I/string will be picked up mistakenly (cry, cry)
+
+macro (RESOLVE_LIBRARIES LIBS LINK_LINE)
+  string (REGEX MATCHALL "((-L|-l|-Wl)([^\" ]+|\"[^\"]+\")|/[^\" ]+(a|so|dylib|dll))" _all_tokens "${LINK_LINE}")
+  set (_libs_found)
+  set (_directory_list)
+  foreach (token ${_all_tokens})
+    # message ("Resolving token = ${token}")
+    if (token MATCHES "-L([^\" ]+|\"[^\"]+\")")
+      # If it's a library path, add it to the list
+      string (REGEX REPLACE "^-L" "" token ${token})
+      string (REGEX REPLACE "//" "/" token ${token})
+      list (APPEND _directory_list ${token})
+      #message ("Resolved token with directory = ${token}")
+    elseif (token MATCHES "^(-l([^\" ]+|\"[^\"]+\")|/[^\" ]+(a|so|dylib|dll))")
+      # It's a library, resolve the path by looking in the list and then (by default) in system directories
+      string (REGEX REPLACE "^-l" "" token ${token})
+      set (_root)
+      if (token MATCHES "^/")	# We have an absolute path, add root to the search path
+	set (_root "/")
+      endif (token MATCHES "^/")
+      set (_lib "NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+      find_library (_lib ${token} HINTS ${_directory_list} ${_root})
+      #message ("Resolving shared library with directory = ${_lib}")
+      if (_lib)
+	string (REPLACE "//" "/" _lib ${_lib})
+        list (APPEND _libs_found ${_lib})
+      else (_lib)
+        message (STATUS "Unable to find library ${token}")
+        #message ("Unable to find library ${token}")
+      endif (_lib)
+    endif (token MATCHES "-L([^\" ]+|\"[^\"]+\")")
+  endforeach (token)
+  set (_lib "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE)
+  # only the LAST occurence of each library is required since there should be no circular dependencies
+  if (_libs_found)
+    list (REVERSE _libs_found)
+    list (REMOVE_DUPLICATES _libs_found)
+    list (REVERSE _libs_found)
+  endif (_libs_found)
+  set (${LIBS} "${_libs_found}")
+endmacro (RESOLVE_LIBRARIES)
+
+macro (RESOLVE_INCLUDES INCS COMPILE_LINE)
+  string (REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" _all_tokens "${COMPILE_LINE}")
+  set (_incs_found)
+  foreach (token ${_all_tokens})
+    string (REGEX REPLACE "^-I" "" token ${token})
+    string (REGEX REPLACE "//" "/" token ${token})
+    if (EXISTS ${token})
+      list (APPEND _incs_found ${token})
+    else (EXISTS ${token})
+      message (STATUS "Include directory ${token} does not exist")
+    endif (EXISTS ${token})
+  endforeach (token)
+  if (_incs_found)
+    list (REMOVE_DUPLICATES _incs_found)
+  endif(_incs_found)
+  set (${INCS} "${_incs_found}")
+endmacro (RESOLVE_INCLUDES)

diff --git a/itaps/CMakeLists.txt b/itaps/CMakeLists.txt
new file mode 100644
index 0000000..70978bb
--- /dev/null
+++ b/itaps/CMakeLists.txt
@@ -0,0 +1,17 @@
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+set( SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P} )
+
+configure_file(iBase_f.h.in "${CMAKE_CURRENT_BINARY_DIR}/iBase_f.h" @ONLY)
+
+set( BASE_INCLUDE_HEADERS iBase.h ${CMAKE_CURRENT_BINARY_DIR}/iBase_f.h)
+
+if(ENABLE_IMESH )
+  add_subdirectory(imesh)
+endif()
+
+if(ENABLE_IGEOM )
+  add_subdirectory(igeom)
+endif()
+
+install(FILES ${BASE_INCLUDE_HEADERS} DESTINATION include )

diff --git a/itaps/igeom/CMakeLists.txt b/itaps/igeom/CMakeLists.txt
new file mode 100644
index 0000000..828d0b7
--- /dev/null
+++ b/itaps/igeom/CMakeLists.txt
@@ -0,0 +1,21 @@
+ADD_CUSTOM_COMMAND(
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FBiGeom_protos.h
+  COMMAND ${CMAKE_COMMAND}
+          -DDEF:STRING=MOAB
+          -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/FBiGeom.h
+          -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/FBiGeom_protos.h
+          -Dprefix:STRING=FBiGeom
+          -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh.h )
+
+set( FBiGEOM_SOURCE FBiGeom_MOAB.hpp FBiGeom_MOAB.cpp )
+set( FBiGEOM_INCLUDE_HEADERS FBiGeom.h
+                             ${CMAKE_CURRENT_BINARY_DIR}/FBiGeom_protos.h
+	                           FBiGeom_f.h )
+
+add_library( FBiGeomMOAB
+  ${FBiGEOM_SOURCE}
+  ${FBiGEOM_INCLUDE_HEADERS} )
+
+target_link_libraries( FBiGeomMOAB MOAB )
+

diff --git a/itaps/imesh/CMakeLists.txt b/itaps/imesh/CMakeLists.txt
index e98c0b1..204ce93 100644
--- a/itaps/imesh/CMakeLists.txt
+++ b/itaps/imesh/CMakeLists.txt
@@ -3,69 +3,84 @@
 ADD_CUSTOM_COMMAND(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMesh_protos.h
   COMMAND ${CMAKE_COMMAND}
+          -DDEF:STRING=MOAB
           -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMesh.h
           -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMesh_protos.h
           -Dprefix:STRING=iMesh
           -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
-  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh.h
-  )
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh.h )
 ADD_CUSTOM_COMMAND(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMesh_extensions_protos.h
   COMMAND ${CMAKE_COMMAND}
+          -DDEF:STRING=MOAB
           -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMesh_extensions.h
           -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMesh_extensions_protos.h
           -Dprefix:STRING=iMesh
           -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
-  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh_extensions.h
-  )
-ADD_CUSTOM_COMMAND(
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
-  COMMAND ${CMAKE_COMMAND}
-          -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMeshP.h
-          -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
-          -Dprefix:STRING=iMeshP
-          -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
-  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMeshP.h
-  )
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh_extensions.h )
 
 set ( MOAB_IMESH_SRCS
-      iMesh_MOAB.cpp
-      ${CMAKE_CURRENT_BINARY_DIR}/iMesh_protos.h
-      ${CMAKE_CURRENT_BINARY_DIR}/iMesh_extensions_protos.h
-      ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h )
+          iMesh_MOAB.hpp iMesh_MOAB.cpp
+          MBIter.hpp )
+set ( MOAB_IMESH_LIB_INCLUDES
+          iMesh.h
+          iMesh_extensions.h
+          ${CMAKE_CURRENT_BINARY_DIR}/iMesh_extensions_protos.h
+          iMesh_f.h
+          ${CMAKE_CURRENT_BINARY_DIR}/iMesh_protos.h
+          MBiMesh.hpp )
 
-include_directories(
-    ${MOAB_BINARY_DIR}
-    ${MOAB_BINARY_DIR}/src
-    ${MOAB_BINARY_DIR}/src/parallel
-    ${MOAB_SOURCE_DIR}/src
-    ${MOAB_SOURCE_DIR}/itaps
-    ${MOAB_SOURCE_DIR}/itaps/imesh
-  )
+if ( MOAB_USE_MPI )
+  include_directories( ${CMAKE_SOURCE_DIR}/src/parallel
+                       ${CMAKE_BINARY_DIR}/src/parallel)
+  ADD_CUSTOM_COMMAND(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_extensions_protos.h
+    COMMAND ${CMAKE_COMMAND}
+            -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMeshP_extensions.h
+            -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMeshP_extensions_protos.h
+            -Dprefix:STRING=iMesh
+            -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
+    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh_extensions.h)
+  ADD_CUSTOM_COMMAND(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
+    COMMAND ${CMAKE_COMMAND}
+            -DDEF:STRING=MOAB
+            -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMeshP.h
+            -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
+            -Dprefix:STRING=iMeshP
+            -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
+    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMeshP.h )
+  set(MOAB_IMESH_SRCS ${MOAB_IMESH_SRCS}
+                      iMeshP_MOAB.cpp)
+  set(MOAB_IMESH_LIB_INCLUDES
+          ${MOAB_IMESH_LIB_INCLUDES}
+          ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
+          ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_extensions_protos.h )
+endif()
+
+include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
+                     ${CMAKE_CURRENT_BINARY_DIR}
+                     ${CMAKE_BINARY_DIR}/src
+                     ${CMAKE_SOURCE_DIR}/src
+                     ${CMAKE_SOURCE_DIR}/itaps
+                     ${CMAKE_BINARY_DIR}/itaps )
 
 if ( MOAB_USE_HDF5 AND HDF5_FOUND )
-  include_directories(
-    ${HDF5_INCLUDE_DIRECTORIES}
-    ${MOAB_SOURCE_DIR}/src/io/mhdf/include
-  )
-endif ( MOAB_USE_HDF5 AND HDF5_FOUND )
+  include_directories( ${HDF5_INCLUDE_DIRECTORIES}
+                       ${CMAKE_SOURCE_DIR}/src/io/mhdf/include )
+endif( )
 
-if ( MOAB_USE_MPI AND MPI_FOUND )
-  LIST ( APPEND MOAB_IMESH_SRCS
-         iMeshP_MOAB.cpp
-         ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h )
+set_source_files_properties( ${MOAB_IMESH_SRCS} COMPILE_FLAGS "${MOAB_DEFINES}" )
 
-  include_directories(
-    ${MOAB_SOURCE_DIR}/src/parallel
-  )
-endif ( MOAB_USE_MPI AND MPI_FOUND )
+add_library( iMesh ${MOAB_IMESH_SRCS}
+                   ${MOAB_IMESH_LIB_INCLUDES} )
 
-set_source_files_properties( ${MOAB_IMESH_SRCS}
-  COMPILE_FLAGS "${MOAB_DEFINES}"
-)
+target_link_libraries( iMesh MOAB )
 
-add_library( iMesh
-  ${MOAB_IMESH_SRCS}
-  )
+install(TARGETS iMesh EXPORT MOABTargets
+                      RUNTIME DESTINATION bin
+                      LIBRARY DESTINATION lib
+                      ARCHIVE DESTINATION lib )
+set( MOAB_INSTALL_TARGETS ${MOAB_INSTALL_TARGETS} iMesh)
 
-target_link_libraries( iMesh MOAB )
+install(FILES ${MOAB_IMESH_LIB_INCLUDES} DESTINATION include)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5b5cd8f..d7b1506 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,198 +1,230 @@
-
-  # MOAB Library
-  set ( MOABCORE_LIB_SRCS
-    AdaptiveKDTree.cpp
-    AEntityFactory.cpp
-    AffineXform.cpp
-    AxisBox.cpp
-    BitPage.cpp
-    BitTag.cpp
-    BoundBox.cpp
-    BSPTree.cpp
-    BSPTreePoly.cpp
-    CN.cpp
-    CartVect.cpp
-    Core.cpp
-    DebugOutput.cpp
-    DenseTag.cpp
-    DualTool.cpp
-    EntitySequence.cpp
-    Factory.cpp
-    FileOptions.cpp
-    GeomUtil.cpp
-    GeomTopoTool.cpp
-    HigherOrderFactory.cpp
-    HomXform.cpp
-    MeshSet.cpp
-    MeshSetSequence.cpp
-    MeshTag.cpp
-    MeshTopoUtil.cpp
-    OrientedBox.cpp
-    OrientedBoxTreeTool.cpp
-    PolyElementSeq.cpp
-    Range.cpp
-    RangeSeqIntersectIter.cpp
-    ReadUtil.cpp
-    ScdElementData.cpp
-    ScdInterface.cpp
-    ScdVertexData.cpp
-    SequenceData.cpp
-    SequenceManager.cpp
-    SetIterator.cpp
-    Skinner.cpp
-    SparseTag.cpp
-    StructuredElementSeq.cpp
-    SweptElementData.cpp
-    SweptElementSeq.cpp
-    SweptVertexData.cpp
-    SysUtil.cpp
-    TagInfo.cpp
-    Tree.cpp
-    TupleList.cpp
-    Types.cpp
-    TypeSequenceManager.cpp
-    UnstructuredElemSeq.cpp
-    Util.cpp
-    VarLenDenseTag.cpp
-    VarLenSparseTag.cpp
-    VertexSequence.cpp
-    WriteUtil.cpp
-  )
-
-  set ( MOABPTLOC_LIB_SRCS
-    lotte/findpt.c
-    lotte/errmem.c
-    lotte/poly.c
-    lotte/tensor.c
-  )
-
-  set ( MOABIO_LIB_SRCS
-    io/IODebugTrack.cpp
-    io/ExoIIUtil.cpp
-    io/FileTokenizer.cpp
-    io/GmshUtil.cpp
-    io/ReadABAQUS.cpp
-    io/ReadGmsh.cpp
-    io/ReadIDEAS.cpp
-    io/ReadMCNP5.cpp
-    io/ReadNASTRAN.cpp
-    io/ReadSmf.cpp
-    io/ReadSms.cpp
-    io/ReadSTL.cpp
-    io/ReadTemplate.cpp
-    io/ReadTetGen.cpp
-    io/ReadTxt.cpp
-    io/ReadVtk.cpp
-    io/SMF_State.cpp
-    io/Tqdcfr.cpp
-    io/VtkUtil.cpp
-    io/WriteAns.cpp
-    io/WriteGMV.cpp
-    io/WriteGmsh.cpp
-    io/WriteSTL.cpp
-    io/WriteSmf.cpp
-    io/WriteTemplate.cpp
-    io/WriteVtk.cpp
-    ReaderWriterSet.cpp
-  )
-
-  set ( MOABLD_LIB_SRCS
-    LocalDiscretization/ElemEvaluator.cpp
-    LocalDiscretization/LinearHex.cpp
-    LocalDiscretization/LinearQuad.cpp
-    LocalDiscretization/LinearTet.cpp
-    LocalDiscretization/LinearTri.cpp
-    LocalDiscretization/QuadraticHex.cpp
-#    LocalDiscretization/SpectralHex.cpp
-#    LocalDiscretization/SpectralQuad.cpp
-  ) 
-
-  include_directories(
-    ${MOAB_SOURCE_DIR}/src
-    ${MOAB_SOURCE_DIR}/src/io
-    ${MOAB_SOURCE_DIR}/src/parallel
-    ${MOAB_SOURCE_DIR}/src/LocalDiscretization
-    ${MOAB_SOURCE_DIR}/src/moab/point_locater/lotte
-    ${MOAB_BINARY_DIR}
-    ${MOAB_BINARY_DIR}/src
-    ${MOAB_BINARY_DIR}/src/parallel
-  )
-
-  if ( NetCDF_FOUND )
-    set ( MOAB_DEFINES "${MOAB_DEFINES} -DNETCDF_FILE" )
-    set ( MOABIO_LIB_SRCS
-      ${MOABIO_LIB_SRCS}
-      io/ReadNC.cpp
-      io/ReadNCDF.cpp
-      io/WriteNCDF.cpp
-      io/WriteSLAC.cpp
-      io/NCHelper.cpp
-      io/NCHelperEuler.cpp
-      io/NCHelperFV.cpp
-      io/NCHelperHOMME.cpp
-      io/NCHelperMPAS.cpp
-      io/NCHelperGCRM.cpp
-      SpectralMeshTool.cpp
-    )
-    include_directories(
-      ${NetCDF_INCLUDE_DIRECTORIES}
-    )
-  endif ( NetCDF_FOUND )
-
-  if ( HDF5_FOUND )
-    set ( MOAB_DEFINES "${MOAB_DEFINES} -DHDF5_FILE" )
-    check_function_exists( H5Pset_fapl_mpio MOAB_HDF_HAVE_PARALLEL )
-    set ( MOABIO_LIB_SRCS
-      ${MOABIO_LIB_SRCS}
-      io/HDF5Common.cpp
-      io/ReadHDF5.cpp
-      io/ReadHDF5Dataset.cpp
-      io/ReadHDF5VarLen.cpp
-      io/WriteHDF5.cpp
-    )
-
-    include_directories(
-      ${HDF5_INCLUDE_DIR}
-      io/mhdf/include
-    )
-    add_subdirectory( io/mhdf )
-  endif ( HDF5_FOUND )
-
-
-  SET(MOAB_LIB_SRCS ${MOABCORE_LIB_SRCS} ${MOABPTLOC_LIB_SRCS} ${MOABIO_LIB_SRCS} ${MOABLD_LIB_SRCS})
-
-  set_source_files_properties( ${MOAB_LIB_SRCS}
-    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}"
-  )
-  add_library( MOAB
-    ${MOAB_LIB_SRCS}
-  )
-
-  if ( MOAB_USE_NETCDF AND NetCDF_FOUND )
-    target_link_libraries( MOAB ${NetCDF_LIBRARIES} )
-  endif ( MOAB_USE_NETCDF AND NetCDF_FOUND )
-
-  if ( MOAB_USE_HDF AND HDF5_FOUND )
-    target_link_libraries( MOAB mhdf ${HDF5_LIBRARIES} )
-  endif ( MOAB_USE_HDF AND HDF5_FOUND )
-
-  if ( MOAB_USE_MPI AND MPI_FOUND )
-    add_subdirectory( parallel )
-    target_link_libraries( MOAB MOABpar )
-  endif ( MOAB_USE_MPI AND MPI_FOUND )
-
-  include( ${MOAB_SOURCE_DIR}/config/AutoconfHeader.cmake )
-  # Define some more variables so they will be substituted properly in the autoconf files.
-  set( MB_VERSION        "\"${MOAB_VERSION}\"" )
-  set( MB_VERSION_MAJOR  ${MOAB_VERSION_MAJOR} )
-  set( MB_VERSION_MINOR  ${MOAB_VERSION_MINOR} )
-  if ( DEFINED MOAB_VERSION_PATCH )
-    set( MB_VERSION_PATCH  ${MOAB_VERSION_PATCH} )
-  endif ( DEFINED MOAB_VERSION_PATCH )
-  set( MB_VERSION_STRING "\"${MOAB_VERSION_STRING}\"" )
-
-  autoconf_header( ${MOAB_SOURCE_DIR}/src/moab/Version.h.in ${MOAB_BINARY_DIR}/src/moab/Version.h )
-  autoconf_header( ${MOAB_SOURCE_DIR}/src/moab/EntityHandle.hpp.in ${MOAB_BINARY_DIR}/src/moab/EntityHandle.hpp )
-  autoconf_header( ${MOAB_SOURCE_DIR}/src/parallel/moab_mpi_config.h.in ${MOAB_BINARY_DIR}/src/parallel/moab_mpi_config.h )
-  autoconf_header( ${MOAB_SOURCE_DIR}/src/FCDefs.h.in ${MOAB_BINARY_DIR}/MOAB_FCDefs.h )
-  file( WRITE ${MOAB_BINARY_DIR}/src/MBCN_protos.h "" )
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}
+                    ${CMAKE_CURRENT_BINARY_DIR}
+                    parallel
+                    LocalDiscretization
+                    io io/mhdf
+                    ${MOAB_BINARY_DIR}/src/parallel )
+
+if(MOAB_USE_MPI AND MPI_FOUND)
+  add_subdirectory(parallel)
+  set( MOAB_MPI MOABpar )
+endif()
+
+#create the FCDefs.h and src/MOAB_FCDefs.h files
+configure_file(FCDefs.h.in "${CMAKE_CURRENT_BINARY_DIR}/FCDefs.h" @ONLY)
+#sed -e "s/FC_FUNC/MOAB_FC_FUNC/" src/FCDefs.h >src/MOAB_FCDefs.h
+file(READ ${CMAKE_CURRENT_BINARY_DIR}/FCDefs.h infile)
+string( REGEX REPLACE "FC_FUNC" "MOAB_FC_FUNC" outstring "${infile}" )
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/MOAB_FCDefs.h" "${outstring}")
+
+#Create the moab/EntityHandle.hpp file
+file(READ ${CMAKE_CURRENT_SOURCE_DIR}/moab/EntityHandle.hpp.in infile2)
+string( REGEX REPLACE "#undef" "#cmakedefine" outstring2 "${infile2}" )
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp.in" "${outstring2}")
+configure_file(${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp)
+
+#generate the Version.h file
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/moab/Version.h.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/moab/Version.h" @ONLY)
+
+set(moab_link_lib)
+add_subdirectory(io)
+add_subdirectory(LocalDiscretization)
+add_subdirectory(oldinc)
+
+ADD_CUSTOM_COMMAND(
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/MBCN_protos.h
+  COMMAND ${CMAKE_COMMAND}
+          -DDEF:STRING=MOAB
+          -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/MBCN.h
+          -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/MBCN_protos.h
+          -Dprefix:STRING=MBCN
+          -P ${CMAKE_SOURCE_DIR}/config/ITAPSFortranMangling.cmake
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/MBCN.h )
+
+if( MOAB_USE_HDF )
+  include_directories(${HDF5_INCLUDES})
+  set( MOAB_HDF_LIBS ${HDF5_LIBRARIES} )
+endif()
+if( MOAB_USE_NETCDF )
+  include_directories(${NetCDF_INCLUDES})
+  if ( MOAB_USE_MPI )
+    set( MOAB_NETCDF_LIBS ${PNetCDF_LIBRARIES} ${NetCDF_LIBRARIES} )
+  else ( MOAB_USE_MPI )
+    set( MOAB_NETCDF_LIBS ${NetCDF_LIBRARIES} )
+  endif ( MOAB_USE_MPI )
+endif()
+
+set(MOAB_LIB_SOURCES
+        AdaptiveKDTree.cpp
+        AEntityFactory.hpp AEntityFactory.cpp
+        AffineXform.hpp    AffineXform.cpp
+        AxisBox.hpp        AxisBox.cpp
+        BitPage.hpp        BitPage.cpp
+        BitTag.hpp         BitTag.cpp
+        BoundBox.cpp
+        BSPTree.cpp
+        BSPTreePoly.cpp
+        BVHTree.cpp
+        CN.cpp
+        CartVect.cpp
+        Core.cpp
+        DebugOutput.hpp DebugOutput.cpp
+        DenseTag.hpp    DenseTag.cpp
+        DualTool.cpp
+        ElementSequence.hpp
+        EntitySequence.hpp  EntitySequence.cpp
+        Factory.cpp
+        FBEngine.cpp
+        FileOptions.cpp
+        GeomUtil.cpp
+        GeomTopoTool.cpp
+        HigherOrderFactory.cpp
+        HomXform.cpp
+        Internals.hpp
+        MBCNArrays.hpp
+        MergeMesh.cpp
+        MeshSet.hpp         MeshSet.cpp
+        MeshSetSequence.hpp MeshSetSequence.cpp
+        MeshTag.hpp         MeshTag.cpp
+        MeshTopoUtil.cpp
+        OrientedBox.hpp     OrientedBox.cpp
+        OrientedBoxTreeTool.cpp
+        lotte/poly.c
+        lotte/findpt.c
+        lotte/errmem.c
+        lotte/tensor.c
+        PolyElementSeq.hpp  PolyElementSeq.cpp
+        ProgOptions.cpp
+        Range.cpp
+        RangeSeqIntersectIter.hpp RangeSeqIntersectIter.cpp
+        ReadUtil.hpp              ReadUtil.cpp
+        ReaderWriterSet.cpp
+        ReorderTool.cpp
+        ScdElementData.hpp        ScdElementData.cpp
+        ScdInterface.cpp
+        ScdVertexData.hpp         ScdVertexData.cpp
+        SequenceData.hpp          SequenceData.cpp
+        SequenceManager.hpp       SequenceManager.cpp
+        SetIterator.cpp
+        Skinner.cpp
+        SmoothCurve.hpp           SmoothCurve.cpp
+        SmoothFace.hpp            SmoothFace.cpp
+        SparseTag.hpp             SparseTag.cpp
+        SpatialLocator.cpp
+        SpectralMeshTool.cpp
+        StructuredElementSeq.hpp  StructuredElementSeq.cpp
+        SweptElementData.hpp      SweptElementData.cpp
+        SweptElementSeq.hpp       SweptElementSeq.cpp
+        SweptVertexData.hpp       SweptVertexData.cpp
+        SysUtil.hpp               SysUtil.cpp
+        TagCompare.hpp
+        TagInfo.hpp               TagInfo.cpp
+        TupleList.cpp
+        Tree.cpp
+        Types.cpp
+        TypeSequenceManager.hpp   TypeSequenceManager.cpp
+        UnstructuredElemSeq.hpp   UnstructuredElemSeq.cpp
+        Util.cpp
+        VarLenDenseTag.hpp        VarLenDenseTag.cpp
+        VarLenSparseTag.hpp       VarLenSparseTag.cpp
+        VarLenTag.hpp      
+        VertexSequence.hpp        VertexSequence.cpp
+        WriteUtil.hpp             WriteUtil.cpp
+        moab_mpe.h )
+
+set( MOAB_INSTALL_HEADERS
+        moab/AdaptiveKDTree.hpp
+        moab/BoundBox.hpp
+        moab/BSPTree.hpp
+        moab/BSPTreePoly.hpp
+        moab/BVHTree.hpp
+        moab/CN.hpp
+        moab/CartVect.hpp
+        moab/Compiler.hpp
+        moab/Core.hpp
+        moab/CpuTimer.hpp
+        moab/DualTool.hpp
+        moab/Error.hpp
+        moab/GeomTopoTool.hpp
+        moab/HigherOrderFactory.hpp
+        moab/HomXform.hpp
+        moab/EntityType.hpp
+        moab/FBEngine.hpp
+        moab/FileOptions.hpp
+        moab/FindPtFuncs.h
+        moab/Forward.hpp
+        moab/GeomUtil.hpp
+        moab/Interface.hpp
+        moab/point_locater/tree/common_tree.hpp
+        moab/point_locater/tree/element_tree.hpp
+        moab/point_locater/tree/bvh_tree.hpp
+        moab/point_locater/io.hpp 
+        moab/point_locater/element_maps/linear_hex_map.hpp 
+        moab/point_locater/element_maps/linear_tet_map.hpp 
+        moab/point_locater/element_maps/spectral_hex_map.hpp 
+        moab/point_locater/element_maps/quadratic_hex_map.hpp 
+        moab/point_locater/point_locater.hpp
+        moab/point_locater/parametrizer.hpp
+        moab/Matrix3.hpp
+        moab/MergeMesh.hpp
+        moab/MeshTopoUtil.hpp
+        moab/OrientedBoxTreeTool.hpp
+        moab/ProgOptions.hpp
+        moab/Range.hpp
+        moab/RangeMap.hpp
+        moab/ReadUtilIface.hpp
+        moab/ReaderIface.hpp
+        moab/ReaderWriterSet.hpp
+        moab/ReorderTool.hpp
+        moab/ScdInterface.hpp
+        moab/SetIterator.hpp
+        moab/Skinner.hpp
+        moab/SpatialLocator.hpp
+        moab/SpectralMeshTool.hpp
+        moab/Tree.hpp
+        moab/TreeStats.hpp
+        moab/Types.hpp
+        moab/UnknownInterface.hpp
+        moab/Util.hpp
+        moab/WriteUtilIface.hpp
+        moab/WriterIface.hpp
+        MBEntityType.h
+        MBCN.h
+        MBTagConventions.hpp )
+
+set( MOAB_GENERATED_INSTALL_HEADERS
+     ${CMAKE_CURRENT_BINARY_DIR}/MOAB_FCDefs.h
+     ${CMAKE_CURRENT_BINARY_DIR}/MBCN_protos.h
+     ${CMAKE_CURRENT_BINARY_DIR}/moab/EntityHandle.hpp )
+
+if( CGM_FOUND )
+  set( MOAB_CGM_LIBS ${CGM_LIBRARIES} )
+endif()
+
+if (MOAB_USE_ZOLTAN)
+  set( MOAB_LIB_SOURCES ${MOAB_LIB_SOURCES}
+          ${CMAKE_SOURCE_DIR}/tools/mbzoltan/MBZoltan.cpp )
+  set( MOAB_INSTALL_HEADERS ${MOAB_INSTALL_HEADERS}
+          ${CMAKE_SOURCE_DIR}/tools/mbzoltan/MBZoltan.hpp )
+  include_directories( ${Zoltan_INCLUDES} )
+  list(APPEND MOAB_DEP_LIBRARIES ${Zoltan_LIBRARIES})
+endif()
+add_library( MOAB ${MOAB_LIB_SOURCES} ${MOAB_INSTALL_HEADERS} ${MOAB_GENERATED_INSTALL_HEADERS}
+                  $<TARGET_OBJECTS:moabio> 
+                  $<TARGET_OBJECTS:moab_loc_discr> 
+                  ${MDHF_OBJ} )
+target_link_libraries( MOAB ${MOAB_MPI} ${MOAB_DEP_LIBRARIES} ${MOAB_LIBS} ${MOAB_CGM_LIBS} )
+set_target_properties( MOAB PROPERTIES COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}")
+
+install(TARGETS MOAB EXPORT MOABTargets
+                     RUNTIME DESTINATION bin
+                     LIBRARY DESTINATION lib
+                     ARCHIVE DESTINATION lib )
+set( MOAB_INSTALL_TARGETS ${MOAB_INSTALL_TARGETS} MOAB)
+include(AutoconfHeader)
+moab_install_headers(${MOAB_INSTALL_HEADERS})
+foreach (header ${MOAB_GENERATED_INSTALL_HEADERS})
+    STRING(REGEX REPLACE "^${CMAKE_CURRENT_BINARY_DIR}/" "" relative ${header})
+    string(REGEX MATCH "(.*)/" DIR ${relative})
+    install(FILES ${header} DESTINATION include/${DIR})
+endforeach()

diff --git a/src/LocalDiscretization/CMakeLists.txt b/src/LocalDiscretization/CMakeLists.txt
new file mode 100644
index 0000000..34bfdee
--- /dev/null
+++ b/src/LocalDiscretization/CMakeLists.txt
@@ -0,0 +1,21 @@
+set( MOAB_LOC_DSCR_SRCS ElemEvaluator.cpp
+                        LinearHex.cpp
+                        LinearQuad.cpp
+                        LinearTet.cpp
+                        LinearTri.cpp
+                        QuadraticHex.cpp )
+
+set( MOAB_LOCALDSRC_Install_Headers moab/ElemEvaluator.hpp
+                                    moab/LinearHex.hpp
+                                    moab/LinearQuad.hpp
+	                                  moab/LinearTet.hpp
+                                    moab/LinearTri.hpp
+                                    moab/QuadraticHex.hpp )
+
+add_library( moab_loc_discr OBJECT ${MOAB_LOC_DSCR_SRCS}
+                                   ${MOAB_LOCALDSRC_Install_Headers} )
+set_target_properties( moab_loc_discr 
+                       PROPERTIES COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}")
+
+include(AutoconfHeader)
+moab_install_headers(${MOAB_LOCALDSRC_Install_Headers})

diff --git a/src/io/CMakeLists.txt b/src/io/CMakeLists.txt
new file mode 100644
index 0000000..4f5be2c
--- /dev/null
+++ b/src/io/CMakeLists.txt
@@ -0,0 +1,107 @@
+include_directories( ${MOAB_SOURCE_DIR}/src/io
+                     ${MOAB_SOURCE_DIR}/src/mhdf
+                     ${MOAB_BINARY_DIR}/src/parallel
+                    )
+set( MOABIO_LIBS )
+set( MOABIO_DEFINES "-DIS_BUILDING_MB" )
+set( MOABIO_INSTALL_HEADERS moab/ExoIIInterface.hpp )
+set( MOABIO_LIB_SRCS
+        exodus_order.h
+        patran_order.h
+        IODebugTrack.hpp  IODebugTrack.cpp
+        ExoIIUtil.hpp     ExoIIUtil.cpp
+        FileTokenizer.hpp FileTokenizer.cpp
+        GmshUtil.hpp      GmshUtil.cpp
+        ReadABAQUS.hpp    ReadABAQUS.cpp
+        ReadGmsh.hpp      ReadGmsh.cpp
+        ReadIDEAS.hpp     ReadIDEAS.cpp
+        ReadMCNP5.hpp     ReadMCNP5.cpp
+        ReadNASTRAN.hpp   ReadNASTRAN.cpp
+        ReadSmf.hpp       ReadSmf.cpp
+        ReadSms.hpp       ReadSms.cpp
+        ReadSTL.hpp       ReadSTL.cpp
+        ReadTemplate.hpp  ReadTemplate.cpp
+        ReadTetGen.hpp    ReadTetGen.cpp
+        ReadTxt.hpp       ReadTxt.cpp
+        ReadVtk.hpp       ReadVtk.cpp
+        SMF_State.hpp     SMF_State.cpp
+        Tqdcfr.hpp        Tqdcfr.cpp
+        VtkUtil.hpp       VtkUtil.cpp
+        WriteAns.hpp      WriteAns.cpp
+        WriteGMV.hpp      WriteGMV.cpp
+        WriteGmsh.hpp     WriteGmsh.cpp
+        WriteSTL.hpp      WriteSTL.cpp
+        WriteSmf.hpp      WriteSmf.cpp
+        WriteTemplate.hpp WriteTemplate.cpp
+        WriteVtk.hpp      WriteVtk.cpp )
+
+if( MOAB_USE_NETCDF )
+  set( MOAB_NETCDF_SRCS
+          ReadNCDF.hpp      ReadNCDF.cpp
+          WriteNCDF.hpp     WriteNCDF.cpp
+          WriteSLAC.hpp     WriteSLAC.cpp
+          ReadNC.hpp        ReadNC.cpp
+          WriteNC.hpp       WriteNC.cpp
+          NCHelper.hpp      NCHelper.cpp
+          NCWriteHelper.hpp NCWriteHelper.cpp
+          NCHelperEuler.hpp NCHelperEuler.cpp
+          NCWriteEuler.hpp  NCWriteEuler.cpp
+          NCHelperFV.hpp    NCHelperFV.cpp
+          NCWriteFV.hpp     NCWriteFV.cpp
+          NCHelperGCRM.hpp  NCHelperGCRM.cpp
+          NCWriteGCRM.hpp   NCWriteGCRM.cpp
+          NCHelperHOMME.hpp NCHelperHOMME.cpp
+          NCWriteHOMME.hpp  NCWriteHOMME.cpp
+          NCHelperMPAS.hpp  NCHelperMPAS.cpp
+          NCWriteMPAS.hpp   NCWriteMPAS.cpp )
+  set( MOABIO_LIBS ${MOABIO_LIBS} ${NetCDF_LIBRARIES} )
+  include_directories(${NetCDF_INCLUDES})
+  # check for PNetCDF dependencies also
+  if( MOAB_USE_PNETCDF )
+    set( MOABIO_LIBS ${MOABIO_LIBS} ${PNetCDF_LIBRARIES} )
+    include_directories(${PNetCDF_INCLUDES})
+  endif( MOAB_USE_PNETCDF )
+endif( MOAB_USE_NETCDF )
+
+if ( MOAB_USE_CGNS )
+  set( MOAB_CGNS_SRCS ReadCGNS.hpp ReadCGNS.cpp
+                      WriteCGNS.hpp WriteCGNS.cpp)
+endif()
+
+if( MOAB_USE_HDF )
+  add_subdirectory( mhdf )
+  set( MOAB_HDF5_SRCS
+          HDF5Common.hpp HDF5Common.cpp
+          ReadHDF5.hpp ReadHDF5.cpp
+          ReadHDF5Dataset.hpp ReadHDF5Dataset.cpp
+          ReadHDF5VarLen.hpp ReadHDF5VarLen.cpp
+          WriteHDF5.cpp WriteHDF5.hpp )
+  set( MDHF_OBJ $<TARGET_OBJECTS:mhdf> PARENT_SCOPE )
+  set( MOABIO_LIBS ${MOABIO_LIBS} ${HDF5_LIBRARIES} )
+  include_directories(${HDF5_INCLUDES})
+  check_function_exists( H5Pset_fapl_mpio MOAB_HDF_HAVE_PARALLEL )
+endif()
+
+if( MOAB_USE_CCMIO )
+  set( MOAB_CCMIO_SRCS WriteCCMIO.hpp WriteCCMIO.cpp 
+                       ReadCCMIO.hpp ReadCCMIO.cpp )
+endif()
+
+if( MOAD_USE_DAMSEL )
+  set( MOAB_DAMSEL_SRCS
+          WriteDamsel.hpp WriteDamsel.cpp 
+          ReadDamsel.hpp  ReadDamsel.cpp
+          DamselUtil.hpp  DamselUtil.cpp )
+endif()
+
+if( CGM_FOUND )
+  set( MOAB_CGM_SRCS ReadCGM.hpp ReadCGM.cpp )
+endif()
+
+add_library( moabio OBJECT ${MOABIO_LIB_SRCS} ${MOAB_NETCDF_SRCS}
+                           ${MOAB_CGNS_SRCS}  ${MOAB_HDF5_SRCS}
+                           ${MOAB_CCMIO_SRCS} ${MOAB_DAMSEL_SRCS}
+                           ${MOAB_CGM_SRCS}   ${MOABIO_INSTALL_HEADERS} )
+set_target_properties( moabio PROPERTIES COMPILE_FLAGS "${MOABIO_DEFINES} ${MOAB_DEFINES}")
+include(AutoconfHeader)
+moab_install_headers(${MOABIO_INSTALL_HEADERS})

This diff is so big that we needed to truncate the remainder.

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