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

Tim Tautges tautges at mcs.anl.gov
Wed Dec 3 11:42:35 CST 2008


Why is it necessary to know that it's an occ file, e.g. why the brep 
file type stuff?  Shouldn't this be down in cgm somewhere?

- tim

kraftche at mcs.anl.gov wrote:
> Author: kraftche
> Date: 2008-12-03 11:29:55 -0600 (Wed, 03 Dec 2008)
> New Revision: 2302
> 
> Modified:
>    MOAB/trunk/tools/dagmc/cgm2moab.cc
>    MOAB/trunk/tools/dagmc/main.cc
> Log:
> o Correctly identify OCC BREP files
> o Use default geometry engine, rather than requesting ACIS
> o Check for invalid data in GMem object for surface facets
> 
> 
> Modified: MOAB/trunk/tools/dagmc/cgm2moab.cc
> ===================================================================
> --- MOAB/trunk/tools/dagmc/cgm2moab.cc	2008-12-03 17:19:10 UTC (rev 2301)
> +++ MOAB/trunk/tools/dagmc/cgm2moab.cc	2008-12-03 17:29:55 UTC (rev 2302)
> @@ -419,8 +419,13 @@
>      for (int i = 0; i < data.fListCount; i += data.facet_list()[i]+1) {
>        int* facet = data.facet_list() + i;
>        corners.resize( *facet );
> -      for (int j = 1; j <= *facet; ++j) 
> +      for (int j = 1; j <= *facet; ++j) {
> +        if (facet[j] >= (int)verts.size()) {
> +          std::cerr << "ERROR: Invalid facet data for surface " << face->id() << std::endl;
> +          return false;
> +        }
>          corners[j-1] = verts[facet[j]];
> +      }
>        MBEntityType type;
>        if (*facet == 3)
>          type = MBTRI;
> 
> Modified: MOAB/trunk/tools/dagmc/main.cc
> ===================================================================
> --- MOAB/trunk/tools/dagmc/main.cc	2008-12-03 17:19:10 UTC (rev 2301)
> +++ MOAB/trunk/tools/dagmc/main.cc	2008-12-03 17:29:55 UTC (rev 2302)
> @@ -10,6 +10,7 @@
>  #define GF_IGES_FILE_TYPE     "IGES"
>  #define GF_ACIS_TXT_FILE_TYPE "ACIS_SAT"
>  #define GF_ACIS_BIN_FILE_TYPE "ACIS_SAB"
> +#define GF_OCC_BREP_FILE_TYPE "BREP"
>  
>  /* Get the type of a file.
>     Return value is one of the above constants
> @@ -22,6 +23,7 @@
>  int is_iges_file( FILE* file );
>  int is_acis_txt_file( FILE* file );
>  int is_acis_bin_file( FILE* file );
> +int is_occ_brep_file( FILE* file );
>  
>  double parse_tol( char* argv[], int argc, int& i );
>  void usage(char *name);
> @@ -113,7 +115,7 @@
>          
>    
>      // Initialize CGM
> -  InitCGMA::initialize_cgma("ACIS");
> +  InitCGMA::initialize_cgma();
>    if (actuate_attribs) {
>      CGMApp::instance()->attrib_manager()->set_all_auto_read_flags( actuate_attribs );
>      CGMApp::instance()->attrib_manager()->set_all_auto_actuate_flags( actuate_attribs );
> @@ -268,6 +270,7 @@
>    static const char*  IGES_NAME = GF_IGES_FILE_TYPE;
>    static const char*   SAT_NAME = GF_ACIS_TXT_FILE_TYPE;
>    static const char*   SAB_NAME = GF_ACIS_BIN_FILE_TYPE;
> +  static const char*  BREP_NAME = GF_OCC_BREP_FILE_TYPE;
>    
>    if (is_cubit_file(file))
>      return CUBIT_NAME;
> @@ -279,6 +282,8 @@
>      return SAB_NAME;
>    else if (is_acis_txt_file(file))
>      return SAT_NAME;
> +  else if (is_occ_brep_file(file))
> +    return BREP_NAME;
>    else
>      return 0;
>  }
> @@ -337,3 +342,11 @@
>      
>    return !strcmp( buffer, "ACIS" );
>  }
> +
> +int is_occ_brep_file( FILE* file )
> +{
> +  unsigned char buffer[6];
> +  return !fseek(file, 0, SEEK_SET) &&
> +         fread(buffer, 6, 1, file) &&
> +         !memcmp(buffer, "DBRep_", 6);
> +}
> 
> 

-- 
================================================================
"You will keep in perfect peace him whose mind is
   steadfast, because he trusts in you."               Isaiah 26:3

              Tim Tautges            Argonne National Laboratory
          (tautges at mcs.anl.gov)      (telecommuting from UW-Madison)
          phone: (608) 263-8485      1500 Engineering Dr.
            fax: (608) 263-4499      Madison, WI 53706




More information about the moab-dev mailing list