[MOAB-dev] commit/MOAB: vijaysm: Merged master into petsc

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Jun 23 08:30:46 CDT 2014


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/c97ac0f30a3f/
Changeset:   c97ac0f30a3f
Branch:      petsc
User:        vijaysm
Date:        2014-06-23 15:30:40
Summary:     Merged master into petsc
Affected #:  6 files

diff --git a/src/io/NCHelper.cpp b/src/io/NCHelper.cpp
index b2f99b9..93cda3b 100644
--- a/src/io/NCHelper.cpp
+++ b/src/io/NCHelper.cpp
@@ -551,89 +551,6 @@ ErrorCode NCHelper::read_variables_to_set(std::vector<ReadNC::VarData>& vdatas,
   return rval;
 }
 
-ErrorCode NCHelper::convert_variable(ReadNC::VarData& var_data, int tstep_num)
-{
-  DebugOutput& dbgOut = _readNC->dbgOut;
-
-  // Get ptr to tag space
-  void* data = var_data.varDatas[tstep_num];
-
-  // Get variable size
-  std::size_t sz = var_data.sz;
-  assert(sz > 0);
-
-  // Finally, read into that space
-  int success = 0;
-  int* idata;
-  double* ddata;
-  float* fdata;
-  short* sdata;
-
-  switch (var_data.varDataType) {
-    case NC_FLOAT:
-      ddata = (double*) var_data.varDatas[tstep_num];
-      fdata = (float*) var_data.varDatas[tstep_num];
-      // Convert in-place
-      for (int i = sz - 1; i >= 0; i--)
-        ddata[i] = fdata[i];
-      break;
-    case NC_SHORT:
-      idata = (int*) var_data.varDatas[tstep_num];
-      sdata = (short*) var_data.varDatas[tstep_num];
-      // Convert in-place
-      for (int i = sz - 1; i >= 0; i--)
-        idata[i] = sdata[i];
-      break;
-    default:
-      success = 1;
-  }
-
-  if (2 <= dbgOut.get_verbosity() && !success) {
-    double dmin, dmax;
-    int imin, imax;
-    switch (var_data.varDataType) {
-      case NC_DOUBLE:
-      case NC_FLOAT:
-        ddata = (double*) data;
-        if (sz == 0)
-          break;
-
-        dmin = dmax = ddata[0];
-        for (unsigned int i = 1; i < sz; i++) {
-          if (ddata[i] < dmin)
-            dmin = ddata[i];
-          if (ddata[i] > dmax)
-            dmax = ddata[i];
-        }
-        dbgOut.tprintf(2, "Variable %s (double): min = %f, max = %f\n", var_data.varName.c_str(), dmin, dmax);
-        break;
-      case NC_INT:
-      case NC_SHORT:
-        idata = (int*) data;
-        if (sz == 0)
-          break;
-
-        imin = imax = idata[0];
-        for (unsigned int i = 1; i < sz; i++) {
-          if (idata[i] < imin)
-            imin = idata[i];
-          if (idata[i] > imax)
-            imax = idata[i];
-        }
-        dbgOut.tprintf(2, "Variable %s (int): min = %d, max = %d\n", var_data.varName.c_str(), imin, imax);
-        break;
-      case NC_NAT:
-      case NC_BYTE:
-      case NC_CHAR:
-        break;
-      default: // Default case added to remove compiler warnings
-        success = 1;
-    }
-  }
-
-  return MB_SUCCESS;
-}
-
 ErrorCode NCHelper::read_coordinate(const char* var_name, int lmin, int lmax, std::vector<double>& cvals)
 {
   std::map<std::string, ReadNC::VarData>& varInfo = _readNC->varInfo;

diff --git a/src/io/NCHelper.hpp b/src/io/NCHelper.hpp
index 5b3b93c..afc49dc 100644
--- a/src/io/NCHelper.hpp
+++ b/src/io/NCHelper.hpp
@@ -48,9 +48,6 @@ protected:
   //! Read set variables (common to scd mesh and ucd mesh)
   ErrorCode read_variables_to_set(std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums);
 
-  //! Convert variables in place
-  ErrorCode convert_variable(ReadNC::VarData& var_data, int tstep_num);
-
   ErrorCode read_coordinate(const char* var_name, int lmin, int lmax,
                             std::vector<double>& cvals);
 

diff --git a/tools/dagmc/DagMC.cpp b/tools/dagmc/DagMC.cpp
index 6e2260a..151b3f5 100755
--- a/tools/dagmc/DagMC.cpp
+++ b/tools/dagmc/DagMC.cpp
@@ -1601,7 +1601,7 @@ ErrorCode DagMC::get_group_name( EntityHandle group_set, std::string& name )
   return MB_SUCCESS;
 }
 
-ErrorCode DagMC::parse_group_name( EntityHandle group_set, prop_map& result )
+ErrorCode DagMC::parse_group_name( EntityHandle group_set, prop_map& result, const char *delimiters )
 {
   ErrorCode rval;
   std::string group_name;
@@ -1609,7 +1609,7 @@ ErrorCode DagMC::parse_group_name( EntityHandle group_set, prop_map& result )
   if( rval != MB_SUCCESS ) return rval;
 
   std::vector< std::string > group_tokens;
-  tokenize( group_name, group_tokens, "_" );
+  tokenize( group_name, group_tokens, delimiters );
 
   // iterate over all the keyword positions 
   // keywords are even indices, their values (optional) are odd indices
@@ -1623,7 +1623,7 @@ ErrorCode DagMC::parse_group_name( EntityHandle group_set, prop_map& result )
   return MB_SUCCESS;
 }
 
-ErrorCode DagMC::detect_available_props( std::vector<std::string>& keywords_list )
+ErrorCode DagMC::detect_available_props( std::vector<std::string>& keywords_list, const char *delimiters )
 {
   ErrorCode rval;
   std::set< std::string > keywords;
@@ -1631,7 +1631,7 @@ ErrorCode DagMC::detect_available_props( std::vector<std::string>& keywords_list
        grp != group_handles().end(); ++grp )
   {
     std::map< std::string, std::string > properties;
-    rval = parse_group_name( *grp, properties );
+    rval = parse_group_name( *grp, properties, delimiters );
     if( rval == MB_TAG_NOT_FOUND ) continue;
     else if( rval != MB_SUCCESS ) return rval;
 
@@ -1698,7 +1698,8 @@ ErrorCode DagMC::unpack_packed_string( Tag tag, EntityHandle eh,
 }
 
 ErrorCode DagMC::parse_properties( const std::vector<std::string>& keywords,
-                                   const std::map<std::string, std::string>& keyword_synonyms )
+                                   const std::map<std::string, std::string>& keyword_synonyms,
+				   const char *delimiters)
 {
   ErrorCode rval;
 
@@ -1739,7 +1740,7 @@ ErrorCode DagMC::parse_properties( const std::vector<std::string>& keywords,
   {
 
     prop_map properties;
-    rval = parse_group_name( *grp, properties );
+    rval = parse_group_name( *grp, properties, delimiters );
     if( rval == MB_TAG_NOT_FOUND ) continue;
     else if( rval != MB_SUCCESS ) return rval;
 

diff --git a/tools/dagmc/DagMC.hpp b/tools/dagmc/DagMC.hpp
index fe39082..6b79f67 100755
--- a/tools/dagmc/DagMC.hpp
+++ b/tools/dagmc/DagMC.hpp
@@ -377,13 +377,15 @@ public:
    * @param keywords_out The result list of keywords.  This list could be
    *        validly passed to parse_properties().
    */
-  ErrorCode detect_available_props( std::vector<std::string>& keywords_out );
+  ErrorCode detect_available_props( std::vector<std::string>& keywords_out, const char *delimiters = "_" );
 
   /** Parse properties from group names per metadata syntax standard
    * 
    * @param keywords A list of keywords to parse.  These are considered the canonical
    *                 names of the properties, and constitute the valid inputs to 
    *                 has_prop() and prop_value().
+   * @param delimiters An array of characters the routine will use to split the groupname
+   *                   into properties.
    * @param synonyms An optional mapping of synonym keywords to canonical keywords. 
    *                 This allows more than one group name keyword to take on the same
    *                 meaning
@@ -392,7 +394,8 @@ public:
    *                 group named "graveyard".
    */
   ErrorCode parse_properties( const std::vector<std::string>& keywords, 
-                              const std::map<std::string,std::string>& synonyms = no_synonyms );
+                              const std::map<std::string,std::string>& synonyms = no_synonyms, 
+			      const char* delimiters = "_" );
 
   /** Get the value of a property on a volume or surface
    *
@@ -463,7 +466,7 @@ private:
   /** tokenize the metadata stored in group names - basically borroed from ReadCGM.cpp */
   void tokenize( const std::string& str,
                  std::vector<std::string>& tokens,
-                 const char* delimiters ) const;
+                 const char* delimiters = "_" ) const;
 
   // a common type within the property and group name functions
   typedef std::map<std::string, std::string> prop_map;
@@ -471,7 +474,7 @@ private:
   /** Store the name of a group in a string */
   ErrorCode get_group_name( EntityHandle group_set, std::string& name );
   /** Parse a group name into a set of key:value pairs */
-  ErrorCode parse_group_name( EntityHandle group_set, prop_map& result );
+  ErrorCode parse_group_name( EntityHandle group_set, prop_map& result, const char* delimiters = "_");
   /** Add a string value to a property tag for a given entity */
   ErrorCode append_packed_string( Tag, EntityHandle, std::string& );
   /** Convert a property tag's value on a handle to a list of strings */

diff --git a/tools/dagmc/dagmc_preproc.cpp b/tools/dagmc/dagmc_preproc.cpp
index 98b4c63..ce21baa 100644
--- a/tools/dagmc/dagmc_preproc.cpp
+++ b/tools/dagmc/dagmc_preproc.cpp
@@ -454,7 +454,7 @@ int main( int argc, char* argv[] ){
    CHECKERR( *dag, ret );
 
    std::vector< std::string > keywords;
-   ret = dag->detect_available_props( keywords );
+   ret = dag->detect_available_props( keywords);
    CHECKERR( *dag, ret );
    ret = dag->parse_properties( keywords );
    CHECKERR( *dag, ret );

diff --git a/tools/mbzoltan/MBZoltan.hpp b/tools/mbzoltan/MBZoltan.hpp
index 2acce87..c303158 100644
--- a/tools/mbzoltan/MBZoltan.hpp
+++ b/tools/mbzoltan/MBZoltan.hpp
@@ -26,6 +26,7 @@
 #include "moab_mpi.h"
 #include "zoltan_cpp.h"
 #include "moab/Range.hpp"
+#include <time.h>
 
 #ifdef CGM
 #include <map>

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