[MOAB-dev] r1603 - MOAB/trunk/tools/dagmc

wilsonp at mcs.anl.gov wilsonp at mcs.anl.gov
Wed Feb 20 20:48:22 CST 2008


Author: wilsonp
Date: 2008-02-20 20:48:22 -0600 (Wed, 20 Feb 2008)
New Revision: 1603

Modified:
   MOAB/trunk/tools/dagmc/DagMC.cpp
   MOAB/trunk/tools/dagmc/DagMC.hpp
Log:
Added capabality to set dagmc settings from the calling application.

Faceting tolerance must be determined early and passed to load_and_init().
Other settings can be set later using set_settings.

In MCNP(X), this is done by setting the faceting tolerance on the command line
and the others in the input file (RDUM, IDUM).


Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp	2008-02-20 20:15:29 UTC (rev 1602)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp	2008-02-21 02:48:22 UTC (rev 1603)
@@ -231,7 +231,41 @@
   }
 
 }
+void DagMC::set_settings(int source_cell, int use_cad, int use_dist_limit,
+			 double distance_tolerance) {
+  moabMCNPSourceCell = source_cell;
+  if (moabMCNPSourceCell < 0) {
+    std::cerr << "Invalid source_cell = " << moabMCNPSourceCell << std::endl;
+    exit(2);
+  }
 
+  std::cout << "Set Source Cell = " << moabMCNPSourceCell << std::endl;
+
+  distanceTolerance = distance_tolerance;
+  if (distanceTolerance <= 0 || distanceTolerance > 1) {
+    std::cerr << "Invalid distance_tolerance = " << distanceTolerance << std::endl;
+    exit(2);
+  }
+
+  std::cout << "Set distance tolerance = " << distanceTolerance << std::endl;
+
+  moabMCNPUseDistLimit = !!(use_dist_limit);
+
+  std::cout << "Turned " << (moabMCNPUseDistLimit?"ON":"OFF") << " distance limit." << std::endl;
+
+  useCAD = !!(use_cad);
+  std::cout << "Turned " << (useCAD?"ON":"OFF") << " ray firing on full CAD model." << std::endl;
+#ifdef CUBIT_CGM
+  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;
+  }
+#endif  
+
+
+}
+
 void DagMC::read_settings( const char* filename )
 {
   int num_opt = sizeof(options) / sizeof(options[0]);
@@ -795,9 +829,10 @@
 }
 
 MBErrorCode DagMC::load_file_and_init(const char* cfile,
-                                       const int clen,
-                                       const char* ffile,
-                                       const int flen)
+                                      const int clen,
+                                      const char* ffile,
+                                      const int flen,
+				      const double facet_tolerance)
 {
     // Always do this first to make sure we have at least the
     // default values if noone ever calls read_settings(). If
@@ -805,6 +840,9 @@
     // re-parse the same values.
   read_settings(0);
 
+  if (facet_tolerance > 0 )
+    facetingTolerance = facet_tolerance;
+
   MBErrorCode rval;
   
   std::string scfile = cfile;                                           

Modified: MOAB/trunk/tools/dagmc/DagMC.hpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.hpp	2008-02-20 20:15:29 UTC (rev 1602)
+++ MOAB/trunk/tools/dagmc/DagMC.hpp	2008-02-21 02:48:22 UTC (rev 1603)
@@ -78,7 +78,8 @@
   MBErrorCode load_file_and_init(const char* cfile,
                                  const int clen,
                                  const char* ffile,
-                                 const int flen);
+                                 const int flen,
+				 const double facet_tolerance = 0);
 
     // map between MBEntityHandle, base-1 index, and GLOBAL_ID
   MBEntityHandle entity_by_index( int dimension, int index );
@@ -95,6 +96,8 @@
   void read_settings( const char* filename );
   void write_settings( FILE* filp, bool with_description = true );
   void parse_settings();
+  void set_settings(int source_cell, int use_cad, int use_dist_limit,
+		    double distance_tolerance);
 
   char *get_spec_reflect();
   char *get_white_reflect();
@@ -146,7 +149,7 @@
   double discard_dist_tol() {return discardDistTol;}
 
   double faceting_tolerance() {return facetingTolerance;}
-  
+
   int source_cell() {return moabMCNPSourceCell;}
 
   bool use_dist_limit() {return moabMCNPUseDistLimit;}




More information about the moab-dev mailing list