[cgma-dev] r2282 - cgm/trunk/itaps
kraftche at mcs.anl.gov
kraftche at mcs.anl.gov
Tue Nov 25 09:51:46 CST 2008
Author: kraftche
Date: 2008-11-25 09:51:46 -0600 (Tue, 25 Nov 2008)
New Revision: 2282
Modified:
cgm/trunk/itaps/iGeom_CGMA.cc
Log:
only initialize CGM once
Modified: cgm/trunk/itaps/iGeom_CGMA.cc
===================================================================
--- cgm/trunk/itaps/iGeom_CGMA.cc 2008-11-24 19:08:50 UTC (rev 2281)
+++ cgm/trunk/itaps/iGeom_CGMA.cc 2008-11-25 15:51:46 UTC (rev 2282)
@@ -216,7 +216,23 @@
static bool iGeom_is_face_degenerate( RefFace* face );
+static CubitStatus init_cgm( const std::string& engine )
+{
+ CubitStatus status;
+ if (engine.empty())
+ status = InitCGMA::initialize_cgma();
+ else
+ status = InitCGMA::initialize_cgma( engine.c_str() );
+
+// sometimes can't have following, depending on CGM version
+ // CGMApp::instance()->attrib_manager()->silent_flag(true);
+ CGMApp::instance()->attrib_manager()->auto_flag(true);
+
+ return status;
+}
+
+
extern "C" {
void iGeom_getDescription( iGeom_Instance geom,
@@ -253,19 +269,12 @@
free(opt);
}
- CubitStatus status;
- if (engine.empty())
- status = InitCGMA::initialize_cgma();
- else
- status = InitCGMA::initialize_cgma( engine.c_str() );
+ // initialize static var with result so that call happens only once
+ static const CubitStatus status = init_cgm( engine );
+ // but check the result for every call
if (CUBIT_SUCCESS != status)
RETURN (iBase_FAILURE);
-// sometimes can't have following, depending on CGM version
- // CGMApp::instance()->attrib_manager()->silent_flag(true);
-
- CGMApp::instance()->attrib_manager()->auto_flag(true);
-
// return the tagmanager as the instance
*instance_out = &CGMTagManager::instance();
RETURN(iBase_SUCCESS);
More information about the cgma-dev
mailing list