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

sjackson at cae.wisc.edu sjackson at cae.wisc.edu
Fri Jun 15 16:33:27 CDT 2012


Author: sjackson
Date: 2012-06-15 16:33:26 -0500 (Fri, 15 Jun 2012)
New Revision: 5581

Modified:
   MOAB/trunk/tools/dagmc/DagMC.cpp
   MOAB/trunk/tools/dagmc/DagMC.hpp
   MOAB/trunk/tools/dagmc/dagmc_preproc.cpp
   MOAB/trunk/tools/dagmc/dagmc_preproc.hpp
   MOAB/trunk/tools/dagmc/obb_analysis.cpp
Log:
Give DagMC a new metadata interface

Metadata are now expressed in terms of properties,
which may be set on any volume or surface, and which
have (possibly empty) string values.

Update dagmc_preproc to use this new interface.

The old MCNP-specific metadata functions remain for now,
until DAG-MCNP5 can be updated for this new interface.

Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp	2012-06-14 21:23:45 UTC (rev 5580)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp	2012-06-15 21:33:26 UTC (rev 5581)
@@ -22,6 +22,7 @@
 #include <sstream>
 #include <limits>
 #include <algorithm>
+#include <set>
 
 #include <ctype.h>
 #include <string.h>
@@ -91,6 +92,9 @@
 
 DagMC *DagMC::instance_ = NULL;
 
+// Empty synonym map for DagMC::parse_metadata()
+const std::map<std::string, std::string> DagMC::no_synonyms;
+
 void DagMC::create_instance(Interface *mb_impl) 
 {
   if (NULL == mb_impl) mb_impl = new Core();
@@ -1628,6 +1632,163 @@
 
 /* SECTION V: Metadata handling */
 
+ErrorCode DagMC::get_group_name( EntityHandle group_set, std::string& name )
+{
+  ErrorCode rval;
+  const void* v = NULL;
+  int ignored;
+  rval = MBI->tag_get_by_ptr(name_tag(), &group_set, 1, &v, &ignored);
+  if( MB_SUCCESS != rval ) return rval;
+  name = static_cast<const char*>(v);
+  return MB_SUCCESS;
+}
+
+ErrorCode DagMC::parse_group_name( EntityHandle group_set, prop_map& result )
+{
+  ErrorCode rval;
+  std::string group_name;
+  rval = get_group_name( group_set, group_name );
+  if( rval != MB_SUCCESS ) return rval;
+
+  std::vector< std::string > group_tokens;
+  tokenize( group_name, group_tokens, "_" );
+
+  // iterate over all the keyword positions 
+  // keywords are even indices, their values (optional) are odd indices
+  for( unsigned int i = 0; i < group_tokens.size(); i += 2 ){
+    std::string groupkey = group_tokens[i];


More information about the moab-dev mailing list