[MOAB-dev] r2278 - in MOAB/trunk: . tools/dagmc

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Mon Nov 24 10:03:10 CST 2008


Author: kraftche
Date: 2008-11-24 10:03:10 -0600 (Mon, 24 Nov 2008)
New Revision: 2278

Modified:
   MOAB/trunk/configure.in
   MOAB/trunk/tools/dagmc/DagMC.cpp
   MOAB/trunk/tools/dagmc/Makefile.am
Log:
fix building of DagMC against Cubit CGM

Modified: MOAB/trunk/configure.in
===================================================================
--- MOAB/trunk/configure.in	2008-11-21 17:08:50 UTC (rev 2277)
+++ MOAB/trunk/configure.in	2008-11-24 16:03:10 UTC (rev 2278)
@@ -803,21 +803,53 @@
         AC_MSG_WARN([$CGM_DIR : not a directory.])
       fi
       CGM_MISSING=no
+      CGM_MAKE=
       AC_CHECK_FILE([${CGM_DIR}/lib/cgm.make],
-                    [CGM_CONFIG_OPTIONS="include ${CGM_DIR}/lib/cgm.make";
+                    [CGM_MAKE="${CGM_DIR}/lib/cgm.make";
                      DEFINES="$DEFINES -DCGM"],
                     [AC_CHECK_FILE([${CGM_DIR}/cgm.make],
-                                   [CGM_CONFIG_OPTIONS="include ${CGM_DIR}/cgm.make";
+                                   [CGM_MAKE="${CGM_DIR}/cgm.make";
                      DEFINES="$DEFINES -DCGM"],
                                    [AC_MSG_WARN([$CGM_DIR : not a configured CGM]); 
                                     CGM_MISSING=yes])
                     ])
       ;;
   esac
+  
+  if test "x$CGM_MISSING" = "xno"; then
+    CGM_CONFIG_OPTIONS="include $CGM_MAKE"
+    
+    AC_MSG_CHECKING([Checking for GeometryQueryTool::ray_fire(RefFace*,...)])
+    old_CPPFLAGS="$CPPFLAGS"
+    old_LDFLAGS="$LDFLAGS"
+    old_LIBS="$LIBS"
+    SNL_MAKE_INC_VAR([$CGM_MAKE],[CGM_DEFINES], [CPPFLAGS="$CPPFLAGS $make_val"])   
+    SNL_MAKE_INC_VAR([$CGM_MAKE],[CGM_INCLUDES],[CPPFLAGS="$CPPFLAGS $make_val"])   
+    SNL_MAKE_INC_VAR([$CGM_MAKE],[CGM_LTFLAGS],  [LDFLAGS="$CPPFLAGS $make_val"])   
+    SNL_MAKE_INC_VAR([$CGM_MAKE],[CGM_LDFLAGS],  [LDFLAGS="$CPPFLAGS $make_val"])   
+    SNL_MAKE_INC_VAR([$CGM_MAKE],[CGM_LIBS],     [LIBS="$make_val $libs"])   
+    AC_LANG_PUSH([C++])
+    AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM([#include "GeometryQueryTool.hpp"
+                        #include "CubitVector.hpp"],
+                      [CubitVector a,b;
+                       DLIList<double> c;
+                       GeometryQueryTool::instance()->fire_ray((RefFace*)0, a, b, c );
+                      ])],
+      [MOAB_CGM_DEFINES="-DHAVE_CGM_FIRE_RAY"; AC_MSG_RESULT(yes)],
+      [AC_MSG_RESULT(no)])
+    CPPFLAGS="$old_CPPFLAGS"
+    LDFLAGS="$old_LDFLAGS"
+    LIBS="$old_LIBS"
+    AC_LANG_POP([C++])
+  fi
+
+  AC_SUBST(MOAB_CGM_DEFINES)
   AC_SUBST(CGM_DIR)
   AC_SUBST(CGM_CONFIG_OPTIONS)
   DAGMC_CONFIG_OPTIONS="include \${MOAB_LIBDIR}/dagmc.make"
   AC_SUBST(DAGMC_CONFIG_OPTIONS)
+
 fi
 AM_CONDITIONAL( HAVE_CGM, [test "x$CGM_MISSING" = "xno"] )
 

Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp	2008-11-21 17:08:50 UTC (rev 2277)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp	2008-11-24 16:03:10 UTC (rev 2278)
@@ -123,10 +123,11 @@
 
 #ifdef CGM
   if (useCAD) {
-#ifdef CUBIT_CGM
-    std::cout << "use_cad = 1 not supported with this build of CGM/DagMC;"
-              << std:: endl
-              << "need an ACIS-based install of CGM." << std::endl;
+#ifndef HAVE_CGM_FIRE_RAY
+    std::cout << "use_cad = 1 not supported with this build of CGM/DagMC."
+              << std::endl
+              << "Required ray-fire query not available. (Cubit-based CGM?)" 
+              << std::endl;
     return MB_NOT_IMPLEMENTED;
 #else    
     rval = CAD_ray_intersect(point, dir, huge_val,
@@ -218,11 +219,12 @@
   moabMCNPUseDistLimit = !!atoi( options[2].value.c_str() );
 
   useCAD = !!atoi( options[3].value.c_str() );
-#ifdef CUBIT_CGM
+#ifndef HAVE_CGM_FIRE_RAY
   if (useCAD) {
     std::cout << "Warning: use_cad = 1 not supported with this build of "
               << "CGM/DagMC;" << std:: endl
-              << "need an ACIS-based install of CGM." << std::endl;
+              << "Required ray-fire query not available. (Cubit-based CGM?)" 
+              << std::endl;
   }
 #endif  
 
@@ -266,11 +268,12 @@
 
   useCAD = !!(use_cad);
   std::cout << "Turned " << (useCAD?"ON":"OFF") << " ray firing on full CAD model." << std::endl;
-#ifdef CUBIT_CGM
+#ifndef HAVE_CGM_FIRE_RAY
   if (useCAD) {
     std::cout << "Warning: use_cad = 1 not supported with this build of "
               << "CGM/DagMC;" << std:: endl
-              << "need an ACIS-based install of CGM." << std::endl;
+              << "Required ray-fire query not available. (Cubit-based CGM?)" 
+              << std::endl;
   }
 #endif  
 
@@ -1447,7 +1450,7 @@
                                       double &len) 
 {
 #ifdef CGM
-#ifdef CUBIT_CGM
+#ifndef HAVE_CGM_FIRE_RAY
   return MB_NOT_IMPLEMENTED;
 #else
   std::vector<double>::iterator dit = distances.begin();

Modified: MOAB/trunk/tools/dagmc/Makefile.am
===================================================================
--- MOAB/trunk/tools/dagmc/Makefile.am	2008-11-21 17:08:50 UTC (rev 2277)
+++ MOAB/trunk/tools/dagmc/Makefile.am	2008-11-24 16:03:10 UTC (rev 2278)
@@ -12,7 +12,7 @@
 
 if HAVE_CGM
 INCLUDES += $(CGM_INCLUDES)
-CPPFLAGS += $(CGM_CPPFLAGS) -DCGM
+CPPFLAGS += $(CGM_CPPFLAGS) -DCGM $(MOAB_CGM_DEFINES)
 CXXFLAGS += $(CGM_CXXFLAGS)
 
 libdagmc_la_SOURCES += cgm2moab.cc




More information about the moab-dev mailing list