[MOAB-dev] r5588 - MOAB/trunk/tools/dagmc
sjackson at cae.wisc.edu
sjackson at cae.wisc.edu
Fri Jun 22 17:27:08 CDT 2012
Author: sjackson
Date: 2012-06-22 17:27:08 -0500 (Fri, 22 Jun 2012)
New Revision: 5588
Modified:
MOAB/trunk/tools/dagmc/dagmc_preproc.cpp
Log:
Give dagmc_preproc a feature to update mcnp5 property syntax
The syntax of the 'tally' and 'imp' metadata group names is
changing to become compatible with the new property system.
This optional argument updates from the old dag-mcnp5 naming
convention to the new one.
This may not be the final home of this feature.
Modified: MOAB/trunk/tools/dagmc/dagmc_preproc.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/dagmc_preproc.cpp 2012-06-22 22:07:49 UTC (rev 5587)
+++ MOAB/trunk/tools/dagmc/dagmc_preproc.cpp 2012-06-22 22:27:08 UTC (rev 5588)
@@ -11,6 +11,7 @@
#include <iomanip>
#include <cstdlib>
#include <algorithm>
+#include <cstdio>
using namespace moab;
@@ -39,6 +40,64 @@
chkerr( dag.moab_instance(), code, line, file );
}
+
+ErrorCode update_mcnp5_property_names( Interface* MBI )
+{
+ ErrorCode rval;
+ Tag category_tag;
+ rval = MBI->tag_get_handle( CATEGORY_TAG_NAME, 32, MB_TYPE_OPAQUE, category_tag );
+ if (MB_SUCCESS != rval)
+ return rval;
+ char group_category[CATEGORY_TAG_SIZE];
+ std::fill(group_category, group_category+CATEGORY_TAG_SIZE, '\0');
+ sprintf(group_category, "%s", "Group");
+ const void* const group_val[] = {&group_category};
+ Range groups;
+ rval = MBI->get_entities_by_type_and_tag(0, MBENTITYSET, &category_tag,
+ group_val, 1, groups);
+ if (MB_SUCCESS != rval)
+ return rval;
+
+ Tag name_tag;
+ rval = MBI->tag_get_handle( NAME_TAG_NAME, NAME_TAG_SIZE, MB_TYPE_OPAQUE, name_tag );
+ if (MB_SUCCESS != rval)
+ return rval;
+ for( Range::iterator i = groups.begin(); i != groups.end(); ++i ){
+ EntityHandle grp = *i;
+ const void* p;
+ int ignored;
+ rval = MBI->tag_get_by_ptr( name_tag, &grp, 1, &p, &ignored );
+ if( MB_SUCCESS != rval ) return rval;
+ const char* grpname = static_cast<const char*>(p);
+ std::string modname(grpname);
+ size_t idx;
+ if( modname.find("tally_") == 0 ){
+ std::string arg = modname.substr(6);
+ // replace up to 2 underscores
+ int count = 0;
More information about the moab-dev
mailing list