[cgma-dev] r2248 - in cgm/trunk: geom/virtual init

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Fri Nov 14 12:29:19 CST 2008


Author: kraftche
Date: 2008-11-14 12:29:19 -0600 (Fri, 14 Nov 2008)
New Revision: 2248

Modified:
   cgm/trunk/geom/virtual/VirtualQueryEngine.cpp
   cgm/trunk/init/InitCGMA.cpp
Log:
Fix issues initializing cubit-based CGMA:
 o Fix segfault trying to set default engine to ACIS
 o Make VG initialization compatible with Cubit
 


Modified: cgm/trunk/geom/virtual/VirtualQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/virtual/VirtualQueryEngine.cpp	2008-11-14 18:27:21 UTC (rev 2247)
+++ cgm/trunk/geom/virtual/VirtualQueryEngine.cpp	2008-11-14 18:29:19 UTC (rev 2248)
@@ -640,7 +640,6 @@
    //GeometryQueryTool::instance()->set_default_engine(this); 
   CompositeEngine::instance();
   PartitionEngine::instance();
-  register_attributes();
 }
 
 

Modified: cgm/trunk/init/InitCGMA.cpp
===================================================================
--- cgm/trunk/init/InitCGMA.cpp	2008-11-14 18:27:21 UTC (rev 2247)
+++ cgm/trunk/init/InitCGMA.cpp	2008-11-14 18:29:19 UTC (rev 2248)
@@ -54,23 +54,25 @@
 {
   CGMApp::instance()->startup( 0, NULL );
   GeometryModifyEngine* default_engine = 0;
+  bool ignore_default = false;
 
-#if defined(CUBIT_CGM) || defined(HAVE_ACIS)
-  GeometryModifyEngine* acis_engine_ptr;
-  #ifdef CUBIT_CGM
-    if (!AcisQueryEngine::instance_)
-      AcisQueryEngine::instance_ = new (reinterpret_cast<AcisQueryEngine*>(new dummym)) AcisQueryEngine;
-    if (!AcisModifyEngine::instance_)
-      AcisModifyEngine::instance_ = new (reinterpret_cast<AcisModifyEngine*>(new dummym)) AcisModifyEngine;
-    acis_engine_ptr = reinterpret_cast<GeometryModifyEngine*>
-                         (AcisModifyEngine::instance_);
-  #else
-    AcisQueryEngine::instance();
-    AcisModifyEngine::instance();
-    acis_engine_ptr = AcisModifyEngine::instance();
-  #endif
+#ifdef CUBIT_CGM
+  if (!AcisQueryEngine::instance_)
+    AcisQueryEngine::instance_ = new (reinterpret_cast<AcisQueryEngine*>(new dummym)) AcisQueryEngine;
+  if (!AcisModifyEngine::instance_)
+    AcisModifyEngine::instance_ = new (reinterpret_cast<AcisModifyEngine*>(new dummym)) AcisModifyEngine;
   if (default_engine_name && streq_nocase("ACIS",default_engine_name))
-    default_engine = acis_engine_ptr;
+    ignore_default = true; // We cannot set the default engine correctly
+                       // because we cannot safely cast to GeometryModifyEngine
+                       // without the complete definition of AcisModifyEngine.
+                       // But it shouldn't matter, as ACIS is the default for
+                       // Cubit anyway.
+#elif defined(HAVE_ACIS)
+  AcisQueryEngine::instance();
+  AcisModifyEngine::instance();
+  acis_engine_ptr = AcisModifyEngine::instance();
+  if (default_engine_name && streq_nocase("ACIS",default_engine_name))
+    default_engine = AcisModifyEngine::instance();
 #endif
 
 #ifdef HAVE_OCC  
@@ -82,12 +84,12 @@
 
   FacetQueryEngine::instance();
   FacetModifyEngine::instance();
-  VirtualQueryEngine::instance();
+  VirtualQueryEngine::instance()->register_attributes();
 
   if (default_engine_name && streq_nocase("FACET",default_engine_name))
     default_engine = FacetModifyEngine::instance();
 
-  if(default_engine_name) {
+  if(default_engine_name && !ignore_default) {
     if (!default_engine) {
       PRINT_ERROR("Invalid or unsupported engine: '%s'\n", default_engine_name);
       return CUBIT_FAILURE;




More information about the cgma-dev mailing list