cgma
InitCGMA Class Reference

#include <InitCGMA.hpp>

List of all members.

Static Public Member Functions

static CubitStatus initialize_cgma (const char *default_engine_name=0)
static CubitStatus deinitialize_cgma ()

Detailed Description

Definition at line 7 of file InitCGMA.hpp.


Member Function Documentation

Definition at line 123 of file InitCGMA.cpp.

CubitStatus InitCGMA::initialize_cgma ( const char *  default_engine_name = 0) [static]

Definition at line 55 of file InitCGMA.cpp.

{
  if( has_been_initialized ){
    // CGM is already initialized.  Return success if previous initialization had
    // the same parameter, failure otherwise.
    if( default_engine_name == first_engine_name ){
      return CUBIT_SUCCESS;
    }
    else if( default_engine_name && first_engine_name && 
         streq_nocase( default_engine_name, first_engine_name )){
      return CUBIT_SUCCESS;
    }
    else{
      PRINT_ERROR( "initialize_cgma() called again, but default engines differ.\n" );
      return CUBIT_FAILURE;
    }
  }

  std::vector<CubitString> args;
  CGMApp::instance()->startup( args );
  GeometryModifyEngine* default_engine = 0;
  bool ignore_default = false;

  // Now register attribute 43 (must be removed as the bug in CUBIT is fixed in future versions)
  // Register CA_ASSEMBLY_DATA (a dummy attribute)
  CGMApp::instance()->attrib_manager()->register_attrib_type(CA_ASSEMBLY_DATA, "assembly data", "ASSEMBLY_DATA",
    CAAssemblyData_creator, CUBIT_FALSE, CUBIT_FALSE, CUBIT_FALSE, CUBIT_FALSE, CUBIT_FALSE, CUBIT_FALSE);

#ifdef HAVE_OCC  
  OCCQueryEngine::instance();
  OCCModifyEngine::instance();
  if (default_engine_name && streq_nocase("OCC",default_engine_name))
    default_engine = OCCModifyEngine::instance();
#endif  

  FacetQueryEngine::instance();
  FacetModifyEngine::instance();
  VirtualQueryEngine::instance()->register_attributes();

  if (default_engine_name && streq_nocase("FACET",default_engine_name)) {
    default_engine = FacetModifyEngine::instance();
    FacetModifyEngine::instance()->set_modify_enabled(CUBIT_TRUE);
  }

  if(default_engine_name && !ignore_default) {
    if (!default_engine) {
      PRINT_ERROR("Invalid or unsupported engine: '%s'\n", default_engine_name);
      return CUBIT_FAILURE;
    }
    
    CubitStatus rval;
    rval = GeometryModifyTool::instance()->set_default_gme(default_engine);
    if (CUBIT_SUCCESS != rval)
      return rval;
    rval = GeometryQueryTool::instance()->set_default_gqe(default_engine->get_gqe());
    if (CUBIT_SUCCESS != rval)
      return rval;
  }
  
  // set has_been_initialized only if everything worked
  if( default_engine_name ){
    first_engine_name = CubitUtil::util_strdup(default_engine_name); 
  }
  has_been_initialized = true;

  return CUBIT_SUCCESS;
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines