Rename Engines::Component to Engines::EngineComponent

This commit is contained in:
jfa 2011-02-28 14:55:52 +00:00
parent b9918993a1
commit b21fc186af
4 changed files with 195 additions and 200 deletions

View File

@ -19,10 +19,9 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : SMESH_Gen.idl // File : SMESH_Gen.idl
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
//
#ifndef _SMESH_GEN_IDL_ #ifndef _SMESH_GEN_IDL_
#define _SMESH_GEN_IDL_ #define _SMESH_GEN_IDL_
@ -76,7 +75,7 @@ module SMESH
/*! /*!
* Hypothesis definintion error * Hypothesis definintion error
*/ */
struct AlgoStateError struct AlgoStateError
{ {
Hypothesis_Status state; Hypothesis_Status state;
string algoName; string algoName;
@ -111,7 +110,7 @@ module SMESH
typedef sequence<ComputeError> compute_error_array; typedef sequence<ComputeError> compute_error_array;
interface SMESH_Gen : Engines::Component, SALOMEDS::Driver interface SMESH_Gen : Engines::EngineComponent, SALOMEDS::Driver
{ {
//GEOM::GEOM_Gen SetGeomEngine( in string containerLoc ); //GEOM::GEOM_Gen SetGeomEngine( in string containerLoc );
void SetGeomEngine( in GEOM::GEOM_Gen geomcompo ); void SetGeomEngine( in GEOM::GEOM_Gen geomcompo );
@ -150,7 +149,7 @@ module SMESH
* Algorithms are 1D, 2D or 3D. * Algorithms are 1D, 2D or 3D.
*/ */
SMESH_Hypothesis CreateHypothesis( in string theHypName, SMESH_Hypothesis CreateHypothesis( in string theHypName,
in string theLibName ) in string theLibName )
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
/*! /*!
@ -181,7 +180,7 @@ module SMESH
* Set the object name * Set the object name
*/ */
void SetName( in string theObjectIOR, void SetName( in string theObjectIOR,
in string theObjectName ) in string theObjectName )
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
/*! /*!
@ -193,13 +192,13 @@ module SMESH
*/ */
SMESH_Mesh CreateMesh( in GEOM::GEOM_Object theObject ) SMESH_Mesh CreateMesh( in GEOM::GEOM_Object theObject )
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
/*! /*!
* Create an empty mesh object * Create an empty mesh object
*/ */
SMESH_Mesh CreateEmptyMesh() SMESH_Mesh CreateEmptyMesh()
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
/*! /*!
* Create Mesh object importing data from given UNV file * Create Mesh object importing data from given UNV file
* (UNV supported version is I-DEAS 10) * (UNV supported version is I-DEAS 10)
@ -211,7 +210,7 @@ module SMESH
* Create Mesh object(s) importing data from given MED file * Create Mesh object(s) importing data from given MED file
*/ */
mesh_array CreateMeshesFromMED( in string theFileName, mesh_array CreateMeshesFromMED( in string theFileName,
out SMESH::DriverMED_ReadStatus theStatus ) out SMESH::DriverMED_ReadStatus theStatus )
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
/*! /*!
@ -233,55 +232,55 @@ module SMESH
in boolean toCopyGroups, in boolean toCopyGroups,
in boolean toKeepIDs) in boolean toKeepIDs)
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
/*! /*!
* Concatenate the given meshes into one mesh. * Concatenate the given meshes into one mesh.
* Union groups with the same name and type if * Union groups with the same name and type if
* theUniteIdenticalGroups flag is true. * theUniteIdenticalGroups flag is true.
* Merge coincident nodes and elements if * Merge coincident nodes and elements if
* theMergeNodesAndElements flag is true. * theMergeNodesAndElements flag is true.
*/ */
SMESH_Mesh Concatenate(in mesh_array theMeshesArray, SMESH_Mesh Concatenate(in mesh_array theMeshesArray,
in boolean theUniteIdenticalGroups, in boolean theUniteIdenticalGroups,
in boolean theMergeNodesAndElements, in boolean theMergeNodesAndElements,
in double theMergeTolerance) in double theMergeTolerance)
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
/*! /*!
* Concatenate the given meshes into one mesh. * Concatenate the given meshes into one mesh.
* Union groups with the same name and type if * Union groups with the same name and type if
* theUniteIdenticalGroups flag is true. * theUniteIdenticalGroups flag is true.
* Merge coincident nodes and elements if * Merge coincident nodes and elements if
* theMergeNodesAndElements flag is true. * theMergeNodesAndElements flag is true.
* Create the groups of all elements from initial meshes. * Create the groups of all elements from initial meshes.
*/ */
SMESH_Mesh ConcatenateWithGroups(in mesh_array theMeshesArray, SMESH_Mesh ConcatenateWithGroups(in mesh_array theMeshesArray,
in boolean theUniteIdenticalGroups, in boolean theUniteIdenticalGroups,
in boolean theMergeNodesAndElements, in boolean theMergeNodesAndElements,
in double theMergeTolerance) in double theMergeTolerance)
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
/*! /*!
* Mesh a subShape. * Mesh a subShape.
* First, verify list of hypothesis associated with the subShape, * First, verify list of hypothesis associated with the subShape,
* return NOK if hypothesis are not sufficient * return NOK if hypothesis are not sufficient
*/ */
boolean Compute( in SMESH_Mesh theMesh, boolean Compute( in SMESH_Mesh theMesh,
in GEOM::GEOM_Object theSubObject ) in GEOM::GEOM_Object theSubObject )
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
/*! /*!
* Return true if hypotheses are defined well * Return true if hypotheses are defined well
*/ */
boolean IsReadyToCompute( in SMESH_Mesh theMesh, boolean IsReadyToCompute( in SMESH_Mesh theMesh,
in GEOM::GEOM_Object theSubObject ) in GEOM::GEOM_Object theSubObject )
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
/*! /*!
* Evaluates size of prospective mesh on a shape * Evaluates size of prospective mesh on a shape
*/ */
long_array Evaluate(in SMESH_Mesh theMesh, long_array Evaluate(in SMESH_Mesh theMesh,
in GEOM::GEOM_Object theSubObject) in GEOM::GEOM_Object theSubObject)
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
/*! /*!
@ -289,17 +288,17 @@ module SMESH
* First, verify list of hypothesis associated with the subShape. * First, verify list of hypothesis associated with the subShape.
* Return mesh preview structure * Return mesh preview structure
*/ */
MeshPreviewStruct Precompute( in SMESH_Mesh theMesh, MeshPreviewStruct Precompute( in SMESH_Mesh theMesh,
in GEOM::GEOM_Object theSubObject, in GEOM::GEOM_Object theSubObject,
in Dimension theDimension, in Dimension theDimension,
inout long_array theShapesId ) inout long_array theShapesId )
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
/*! /*!
* Return errors of hypotheses definintion * Return errors of hypotheses definintion
* algo_error_array is empty if everything is OK * algo_error_array is empty if everything is OK
*/ */
algo_error_array GetAlgoState( in SMESH_Mesh theMesh, algo_error_array GetAlgoState( in SMESH_Mesh theMesh,
in GEOM::GEOM_Object theSubObject ) in GEOM::GEOM_Object theSubObject )
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
@ -307,7 +306,7 @@ module SMESH
* Return errors of mesh computation * Return errors of mesh computation
* compute_error_array is empty if everything is OK * compute_error_array is empty if everything is OK
*/ */
compute_error_array GetComputeErrors( in SMESH_Mesh theMesh, compute_error_array GetComputeErrors( in SMESH_Mesh theMesh,
in GEOM::GEOM_Object theSubObject ) in GEOM::GEOM_Object theSubObject )
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
@ -328,7 +327,7 @@ module SMESH
/*! /*!
* Return geometrical object the given element is built on. * Return geometrical object the given element is built on.
* The returned geometrical object, if not nil, is either found in the * The returned geometrical object, if not nil, is either found in the
* study or is published by this method with the given name * study or is published by this method with the given name
*/ */
GEOM::GEOM_Object GetGeometryByMeshElement( in SMESH_Mesh theMesh, GEOM::GEOM_Object GetGeometryByMeshElement( in SMESH_Mesh theMesh,
@ -341,7 +340,7 @@ module SMESH
* The returned geometrical object not published in study by this method. * The returned geometrical object not published in study by this method.
*/ */
GEOM::GEOM_Object FindGeometryByMeshElement( in SMESH_Mesh theMesh, GEOM::GEOM_Object FindGeometryByMeshElement( in SMESH_Mesh theMesh,
in long theElementID) in long theElementID)
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );
/*! /*!

View File

@ -15,7 +15,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// --- // ---
// File : GeomSelectionTools.cxx // File : GeomSelectionTools.cxx
@ -219,17 +218,17 @@ TopAbs_ShapeEnum GeomSelectionTools::entryToShapeType(std::string entry){
SalomeApp_Application* anApp = GetSalomeApplication(); SalomeApp_Application* anApp = GetSalomeApplication();
if (anApp) { if (anApp) {
// MESSAGE("Got Application"); // MESSAGE("Got Application");
Engines::Component_var component = anApp->lcc()->FindOrLoad_Component( "FactoryServer","GEOM" ); Engines::EngineComponent_var component = anApp->lcc()->FindOrLoad_Component( "FactoryServer","GEOM" );
GEOM::GEOM_Gen_var _geomEngine = GEOM::GEOM_Gen::_narrow(component); GEOM::GEOM_Gen_var _geomEngine = GEOM::GEOM_Gen::_narrow(component);
// MESSAGE("Got GEOM engine"); // MESSAGE("Got GEOM engine");
// if the Geom Object is a group // if the Geom Object is a group
if (aShape->GetType() == GEOM_GROUP){ if (aShape->GetType() == GEOM_GROUP){
// MESSAGE("It's a group"); // MESSAGE("It's a group");
GEOM::GEOM_IGroupOperations_var aGroupOp = _geomEngine->GetIGroupOperations(myStudy->StudyId()); GEOM::GEOM_IGroupOperations_var aGroupOp = _geomEngine->GetIGroupOperations(myStudy->StudyId());
ShapeType= (TopAbs_ShapeEnum)aGroupOp->GetType(aShape); ShapeType= (TopAbs_ShapeEnum)aGroupOp->GetType(aShape);
} }
// if not // if not
else { else {
GEOM_Client* aClient = new GEOM_Client(); GEOM_Client* aClient = new GEOM_Client();
if ( aClient && !_geomEngine->_is_nil() ) { if ( aClient && !_geomEngine->_is_nil() ) {
// MESSAGE("GEOM client is OK and GEOM engine is not null"); // MESSAGE("GEOM client is OK and GEOM engine is not null");
@ -306,7 +305,7 @@ GeomAbs_SurfaceType GeomSelectionTools::getFaceInformation(TopoDS_Shape S)
QString PluginUtils::PrintDoubleValue( double theValue, int thePrecision ) QString PluginUtils::PrintDoubleValue( double theValue, int thePrecision )
{ {
const double prec = 1e-12; const double prec = 1e-12;
if ( qAbs(theValue) < prec ) if ( qAbs(theValue) < prec )
return "0"; return "0";
@ -325,7 +324,7 @@ QString PluginUtils::PrintDoubleValue( double theValue, int thePrecision )
// remove trailing zeroes // remove trailing zeroes
QRegExp expre( QString( "(%1|%2)[+-]?[0-9]+$" ).arg( QLocale().exponential().toLower(), QRegExp expre( QString( "(%1|%2)[+-]?[0-9]+$" ).arg( QLocale().exponential().toLower(),
QLocale().exponential().toUpper() ) ); QLocale().exponential().toUpper() ) );
int idx = aRes.indexOf( expre ); int idx = aRes.indexOf( expre );
@ -340,4 +339,3 @@ QString PluginUtils::PrintDoubleValue( double theValue, int thePrecision )
return aRes == "-0" ? QString( "0" ) : aRes + aResExp; return aRes == "-0" ? QString( "0" ) : aRes + aResExp;
} }

View File

@ -19,12 +19,11 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// SMESH SMESHClient : tool to update client mesh structure by mesh from server // SMESH SMESHClient : tool to update client mesh structure by mesh from server
// File : SMESH_Client.cxx // File : SMESH_Client.cxx
// Author : Pavel TELKOV // Author : Pavel TELKOV
// Module : SMESH // Module : SMESH
//
#include "SMESH_Client.hxx" #include "SMESH_Client.hxx"
#include "SMESH_Mesh.hxx" #include "SMESH_Mesh.hxx"
@ -84,7 +83,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddNodesWithID //function : AddNodesWithID
//======================================================================= //=======================================================================
inline void AddNodesWithID(SMDS_Mesh* theMesh, inline void AddNodesWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -107,7 +106,7 @@ namespace
//======================================================================= //=======================================================================
//function : Add0DElementsWithID //function : Add0DElementsWithID
//======================================================================= //=======================================================================
inline void Add0DElementsWithID(SMDS_Mesh* theMesh, inline void Add0DElementsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -129,7 +128,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddEdgesWithID //function : AddEdgesWithID
//======================================================================= //=======================================================================
inline void AddEdgesWithID(SMDS_Mesh* theMesh, inline void AddEdgesWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -150,7 +149,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddTriasWithID //function : AddTriasWithID
//======================================================================= //=======================================================================
inline void AddTriasWithID(SMDS_Mesh* theMesh, inline void AddTriasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -172,7 +171,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddQuadsWithID //function : AddQuadsWithID
//======================================================================= //=======================================================================
inline void AddQuadsWithID(SMDS_Mesh* theMesh, inline void AddQuadsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var theSeq, SMESH::log_array_var theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -195,7 +194,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddPolygonsWithID //function : AddPolygonsWithID
//======================================================================= //=======================================================================
inline void AddPolygonsWithID(SMDS_Mesh* theMesh, inline void AddPolygonsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -222,7 +221,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddTetrasWithID //function : AddTetrasWithID
//======================================================================= //=======================================================================
inline void AddTetrasWithID(SMDS_Mesh* theMesh, inline void AddTetrasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -245,7 +244,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddPiramidsWithID //function : AddPiramidsWithID
//======================================================================= //=======================================================================
inline void AddPiramidsWithID(SMDS_Mesh* theMesh, inline void AddPiramidsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -269,7 +268,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddPrismsWithID //function : AddPrismsWithID
//======================================================================= //=======================================================================
inline void AddPrismsWithID(SMDS_Mesh* theMesh, inline void AddPrismsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -294,7 +293,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddHexasWithID //function : AddHexasWithID
//======================================================================= //=======================================================================
inline void AddHexasWithID(SMDS_Mesh* theMesh, inline void AddHexasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -321,7 +320,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddPolyhedronsWithID //function : AddPolyhedronsWithID
//======================================================================= //=======================================================================
inline void AddPolyhedronsWithID (SMDS_Mesh* theMesh, inline void AddPolyhedronsWithID (SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -355,7 +354,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddQuadEdgesWithID //function : AddQuadEdgesWithID
//======================================================================= //=======================================================================
inline void AddQuadEdgesWithID(SMDS_Mesh* theMesh, inline void AddQuadEdgesWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -377,7 +376,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddQuadTriasWithID //function : AddQuadTriasWithID
//======================================================================= //=======================================================================
inline void AddQuadTriasWithID(SMDS_Mesh* theMesh, inline void AddQuadTriasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -402,7 +401,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddQuadQuadsWithID //function : AddQuadQuadsWithID
//======================================================================= //=======================================================================
inline void AddQuadQuadsWithID(SMDS_Mesh* theMesh, inline void AddQuadQuadsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var theSeq, SMESH::log_array_var theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -429,7 +428,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddQuadTetrasWithID //function : AddQuadTetrasWithID
//======================================================================= //=======================================================================
inline void AddQuadTetrasWithID(SMDS_Mesh* theMesh, inline void AddQuadTetrasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -458,7 +457,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddQuadPiramidsWithID //function : AddQuadPiramidsWithID
//======================================================================= //=======================================================================
inline void AddQuadPiramidsWithID(SMDS_Mesh* theMesh, inline void AddQuadPiramidsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -490,7 +489,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddQuadPentasWithID //function : AddQuadPentasWithID
//======================================================================= //=======================================================================
inline void AddQuadPentasWithID(SMDS_Mesh* theMesh, inline void AddQuadPentasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -524,7 +523,7 @@ namespace
//======================================================================= //=======================================================================
//function : AddQuadHexasWithID //function : AddQuadHexasWithID
//======================================================================= //=======================================================================
inline void AddQuadHexasWithID(SMDS_Mesh* theMesh, inline void AddQuadHexasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -563,7 +562,7 @@ namespace
//======================================================================= //=======================================================================
//function : ChangePolyhedronNodes //function : ChangePolyhedronNodes
//======================================================================= //=======================================================================
inline void ChangePolyhedronNodes (SMDS_Mesh* theMesh, inline void ChangePolyhedronNodes (SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
@ -595,13 +594,13 @@ namespace
} }
//======================================================================= //=======================================================================
SMESH::SMESH_Gen_var SMESH::SMESH_Gen_var
SMESH_Client::GetSMESHGen(CORBA::ORB_ptr theORB, SMESH_Client::GetSMESHGen(CORBA::ORB_ptr theORB,
CORBA::Boolean& theIsEmbeddedMode) CORBA::Boolean& theIsEmbeddedMode)
{ {
static SMESH::SMESH_Gen_var aMeshGen; static SMESH::SMESH_Gen_var aMeshGen;
if(CORBA::is_nil(aMeshGen.in())){ if(CORBA::is_nil(aMeshGen.in())){
#ifdef WNT #ifdef WNT
long aClientPID = (long)_getpid(); long aClientPID = (long)_getpid();
#else #else
@ -610,9 +609,9 @@ SMESH_Client::GetSMESHGen(CORBA::ORB_ptr theORB,
SALOME_NamingService aNamingService(theORB); SALOME_NamingService aNamingService(theORB);
SALOME_LifeCycleCORBA aLifeCycleCORBA(&aNamingService); SALOME_LifeCycleCORBA aLifeCycleCORBA(&aNamingService);
Engines::Component_var aComponent = aLifeCycleCORBA.FindOrLoad_Component("FactoryServer","SMESH"); Engines::EngineComponent_var aComponent = aLifeCycleCORBA.FindOrLoad_Component("FactoryServer","SMESH");
aMeshGen = SMESH::SMESH_Gen::_narrow(aComponent); aMeshGen = SMESH::SMESH_Gen::_narrow(aComponent);
std::string aClientHostName = Kernel_Utils::GetHostname(); std::string aClientHostName = Kernel_Utils::GetHostname();
Engines::Container_var aServerContainer = aMeshGen->GetContainerRef(); Engines::Container_var aServerContainer = aMeshGen->GetContainerRef();
CORBA::String_var aServerHostName = aServerContainer->getHostName(); CORBA::String_var aServerHostName = aServerContainer->getHostName();
@ -627,7 +626,7 @@ SMESH_Client::GetSMESHGen(CORBA::ORB_ptr theORB,
//======================================================================= //=======================================================================
// function : Create() // function : Create()
// purpose : // purpose :
//======================================================================= //=======================================================================
SMESH_Client::SMESH_Client(CORBA::ORB_ptr theORB, SMESH_Client::SMESH_Client(CORBA::ORB_ptr theORB,
SMESH::SMESH_Mesh_ptr theMesh): SMESH::SMESH_Mesh_ptr theMesh):
@ -675,10 +674,10 @@ SMESH_Client::~SMESH_Client()
//================================================================================= //=================================================================================
SMDS_Mesh* SMDS_Mesh*
SMESH_Client::GetMesh() const SMESH_Client::GetMesh() const
{ {
return mySMDSMesh; return mySMDSMesh;
} }
@ -694,7 +693,7 @@ SMESH_Client::operator->() const
SMESH::SMESH_Mesh_ptr SMESH::SMESH_Mesh_ptr
SMESH_Client::GetMeshServer() SMESH_Client::GetMeshServer()
{ {
return myMeshServer.in(); return myMeshServer.in();
} }
@ -718,7 +717,7 @@ SMESH_Client::Update(bool theIsClear)
anIsModified = aLength > 0; anIsModified = aLength > 0;
if( MYDEBUG ) if( MYDEBUG )
MESSAGE( "Update: length of the script is "<<aLength ); MESSAGE( "Update: length of the script is "<<aLength );
if(!anIsModified) if(!anIsModified)
return false; return false;
@ -762,7 +761,7 @@ SMESH_Client::Update(bool theIsClear)
for( ; anElemId < aNbElems; anElemId++ ) for( ; anElemId < aNbElems; anElemId++ )
mySMDSMesh->RemoveNode( FindNode( mySMDSMesh, anIndexes[anElemId] ) ); mySMDSMesh->RemoveNode( FindNode( mySMDSMesh, anIndexes[anElemId] ) );
break; break;
case SMESH::REMOVE_ELEMENT: case SMESH::REMOVE_ELEMENT:
for( ; anElemId < aNbElems; anElemId++ ) for( ; anElemId < aNbElems; anElemId++ )
mySMDSMesh->RemoveElement( FindElement( mySMDSMesh, anIndexes[anElemId] ) ); mySMDSMesh->RemoveElement( FindElement( mySMDSMesh, anIndexes[anElemId] ) );
@ -803,7 +802,7 @@ SMESH_Client::Update(bool theIsClear)
mySMDSMesh->Renumber( anIndexes[i], anIndexes[i+1], anIndexes[i+2] ); mySMDSMesh->Renumber( anIndexes[i], anIndexes[i+1], anIndexes[i+2] );
} }
break; break;
default:; default:;
} }
} }
@ -830,6 +829,6 @@ SMESH_Client::Update(bool theIsClear)
MESSAGE("Update - mySMDSMesh->NbVolumes() = "<<mySMDSMesh->NbVolumes()); MESSAGE("Update - mySMDSMesh->NbVolumes() = "<<mySMDSMesh->NbVolumes());
} }
} // end of update mesh by log script } // end of update mesh by log script
return anIsModified; return anIsModified;
} }

View File

@ -19,12 +19,11 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
// File : SMESH_Gen_i.cxx // File : SMESH_Gen_i.cxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
//
#include <TopExp.hxx> #include <TopExp.hxx>
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
@ -156,9 +155,9 @@ PortableServer::ServantBase_var SMESH_Gen_i::GetServant( CORBA::Object_ptr theOb
try { try {
PortableServer::Servant aServant = GetPOA()->reference_to_servant( theObject ); PortableServer::Servant aServant = GetPOA()->reference_to_servant( theObject );
return aServant; return aServant;
} }
catch (...) { catch (...) {
INFOS( "GetServant - Unknown exception was caught!!!" ); INFOS( "GetServant - Unknown exception was caught!!!" );
return NULL; return NULL;
} }
} }
@ -195,7 +194,7 @@ CORBA::Object_var SMESH_Gen_i::SObjectToObject( SALOMEDS::SObject_ptr theSObject
/*! /*!
* GetNS [ static ] * GetNS [ static ]
* *
* Get SALOME_NamingService object * Get SALOME_NamingService object
*/ */
//============================================================================= //=============================================================================
@ -215,7 +214,7 @@ SALOME_NamingService* SMESH_Gen_i::GetNS()
* *
* Get SALOME_LifeCycleCORBA object * Get SALOME_LifeCycleCORBA object
*/ */
//============================================================================= //=============================================================================
SALOME_LifeCycleCORBA* SMESH_Gen_i::GetLCC() { SALOME_LifeCycleCORBA* SMESH_Gen_i::GetLCC() {
if ( myLCC == NULL ) { if ( myLCC == NULL ) {
myLCC = new SALOME_LifeCycleCORBA( GetNS() ); myLCC = new SALOME_LifeCycleCORBA( GetNS() );
@ -230,14 +229,14 @@ SALOME_LifeCycleCORBA* SMESH_Gen_i::GetLCC() {
* *
* Get GEOM::GEOM_Gen reference * Get GEOM::GEOM_Gen reference
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Gen_ptr SMESH_Gen_i::GetGeomEngine() { GEOM::GEOM_Gen_ptr SMESH_Gen_i::GetGeomEngine() {
//CCRT GEOM::GEOM_Gen_var aGeomEngine = //CCRT GEOM::GEOM_Gen_var aGeomEngine =
//CCRT GEOM::GEOM_Gen::_narrow( GetLCC()->FindOrLoad_Component("FactoryServer","GEOM") ); //CCRT GEOM::GEOM_Gen::_narrow( GetLCC()->FindOrLoad_Component("FactoryServer","GEOM") );
//CCRT return aGeomEngine._retn(); //CCRT return aGeomEngine._retn();
if(CORBA::is_nil(myGeomGen)) if(CORBA::is_nil(myGeomGen))
{ {
Engines::Component_ptr temp=GetLCC()->FindOrLoad_Component("FactoryServer","GEOM"); Engines::EngineComponent_ptr temp=GetLCC()->FindOrLoad_Component("FactoryServer","GEOM");
myGeomGen=GEOM::GEOM_Gen::_narrow(temp); myGeomGen=GEOM::GEOM_Gen::_narrow(temp);
} }
return myGeomGen; return myGeomGen;
@ -258,7 +257,7 @@ SMESH_Gen_i::SMESH_Gen_i()
//============================================================================= //=============================================================================
/*! /*!
* SMESH_Gen_i::SMESH_Gen_i * SMESH_Gen_i::SMESH_Gen_i
* *
* Standard constructor, used with Container * Standard constructor, used with Container
*/ */
@ -266,8 +265,8 @@ SMESH_Gen_i::SMESH_Gen_i()
SMESH_Gen_i::SMESH_Gen_i( CORBA::ORB_ptr orb, SMESH_Gen_i::SMESH_Gen_i( CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa, PortableServer::POA_ptr poa,
PortableServer::ObjectId* contId, PortableServer::ObjectId* contId,
const char* instanceName, const char* instanceName,
const char* interfaceName ) const char* interfaceName )
: Engines_Component_i( orb, poa, contId, instanceName, interfaceName ) : Engines_Component_i( orb, poa, contId, instanceName, interfaceName )
{ {
@ -275,10 +274,10 @@ SMESH_Gen_i::SMESH_Gen_i( CORBA::ORB_ptr orb,
myOrb = CORBA::ORB::_duplicate(orb); myOrb = CORBA::ORB::_duplicate(orb);
myPoa = PortableServer::POA::_duplicate(poa); myPoa = PortableServer::POA::_duplicate(poa);
_thisObj = this ; _thisObj = this ;
_id = myPoa->activate_object( _thisObj ); _id = myPoa->activate_object( _thisObj );
myIsEmbeddedMode = false; myIsEmbeddedMode = false;
myShapeReader = NULL; // shape reader myShapeReader = NULL; // shape reader
mySMESHGen = this; mySMESHGen = this;
@ -336,10 +335,10 @@ SMESH_Gen_i::~SMESH_Gen_i()
} }
myStudyContextMap.clear(); myStudyContextMap.clear();
// delete shape reader // delete shape reader
if ( !myShapeReader ) if ( !myShapeReader )
delete myShapeReader; delete myShapeReader;
} }
//============================================================================= //=============================================================================
/*! /*!
* SMESH_Gen_i::createHypothesis * SMESH_Gen_i::createHypothesis
@ -377,7 +376,7 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
} }
else else
{ {
//try to use new format //try to use new format
#ifdef WNT #ifdef WNT
aPlatformLibName = new char[ libNameLen + 5 ]; aPlatformLibName = new char[ libNameLen + 5 ];
aPlatformLibName[0] = '\0'; aPlatformLibName[0] = '\0';
@ -463,7 +462,7 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
// activate the CORBA servant of hypothesis // activate the CORBA servant of hypothesis
hypothesis_i = SMESH::SMESH_Hypothesis::_narrow( myHypothesis_i->_this() ); hypothesis_i = SMESH::SMESH_Hypothesis::_narrow( myHypothesis_i->_this() );
int nextId = RegisterObject( hypothesis_i ); int nextId = RegisterObject( hypothesis_i );
if(MYDEBUG) MESSAGE( "Add hypo to map with id = "<< nextId ); if(MYDEBUG) MESSAGE( "Add hypo to map with id = "<< nextId );
return hypothesis_i._retn(); return hypothesis_i._retn();
} }
@ -511,7 +510,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::createMesh()
GEOM_Client* SMESH_Gen_i::GetShapeReader() GEOM_Client* SMESH_Gen_i::GetShapeReader()
{ {
// create shape reader if necessary // create shape reader if necessary
if ( !myShapeReader ) if ( !myShapeReader )
myShapeReader = new GEOM_Client(GetContainerRef()); myShapeReader = new GEOM_Client(GetContainerRef());
ASSERT( myShapeReader ); ASSERT( myShapeReader );
return myShapeReader; return myShapeReader;
@ -594,12 +593,12 @@ void SMESH_Gen_i::SetCurrentStudy( SALOMEDS::Study_ptr theStudy )
// create study context, if it doesn't exist and set current study // create study context, if it doesn't exist and set current study
int studyId = GetCurrentStudyID(); int studyId = GetCurrentStudyID();
if ( myStudyContextMap.find( studyId ) == myStudyContextMap.end() ) { if ( myStudyContextMap.find( studyId ) == myStudyContextMap.end() ) {
myStudyContextMap[ studyId ] = new StudyContext; myStudyContextMap[ studyId ] = new StudyContext;
} }
// myCurrentStudy may be nil // myCurrentStudy may be nil
if ( !CORBA::is_nil( myCurrentStudy ) ) { if ( !CORBA::is_nil( myCurrentStudy ) ) {
SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder(); SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
if( !myCurrentStudy->FindComponent( "GEOM" )->_is_nil() ) if( !myCurrentStudy->FindComponent( "GEOM" )->_is_nil() )
aStudyBuilder->LoadWith( myCurrentStudy->FindComponent( "GEOM" ), GetGeomEngine() ); aStudyBuilder->LoadWith( myCurrentStudy->FindComponent( "GEOM" ), GetGeomEngine() );
@ -639,7 +638,7 @@ SALOMEDS::Study_ptr SMESH_Gen_i::GetCurrentStudy()
//============================================================================= //=============================================================================
/*! /*!
* SMESH_Gen_i::GetCurrentStudyContext * SMESH_Gen_i::GetCurrentStudyContext
* *
* Get current study context * Get current study context
*/ */
@ -655,7 +654,7 @@ StudyContext* SMESH_Gen_i::GetCurrentStudyContext()
//============================================================================= //=============================================================================
/*! /*!
* SMESH_Gen_i::CreateHypothesis * SMESH_Gen_i::CreateHypothesis
* *
* Create hypothesis/algorothm of given type and publish it in the study * Create hypothesis/algorothm of given type and publish it in the study
*/ */
@ -943,7 +942,7 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMED( const char* theFileName,
aStudyBuilder->NewCommand(); // There is a transaction aStudyBuilder->NewCommand(); // There is a transaction
aResult->length( aNames.size() ); aResult->length( aNames.size() );
int i = 0; int i = 0;
// Iterate through all meshes and create mesh objects // Iterate through all meshes and create mesh objects
for ( list<string>::iterator it = aNames.begin(); it != aNames.end(); it++ ) { for ( list<string>::iterator it = aNames.begin(); it != aNames.end(); it++ ) {
// Python Dump // Python Dump
@ -951,7 +950,7 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMED( const char* theFileName,
// create mesh // create mesh
SMESH::SMESH_Mesh_var mesh = createMesh(); SMESH::SMESH_Mesh_var mesh = createMesh();
// publish mesh in the study // publish mesh in the study
SALOMEDS::SObject_var aSO; SALOMEDS::SObject_var aSO;
if ( CanPublishInStudy( mesh ) ) if ( CanPublishInStudy( mesh ) )
@ -1040,7 +1039,7 @@ CORBA::Boolean SMESH_Gen_i::IsReadyToCompute( SMESH::SMESH_Mesh_ptr theMesh,
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::IsReadyToCompute" ); if(MYDEBUG) MESSAGE( "SMESH_Gen_i::IsReadyToCompute" );
if ( CORBA::is_nil( theShapeObject ) ) if ( CORBA::is_nil( theShapeObject ) )
THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference", THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference",
SALOME::BAD_PARAM ); SALOME::BAD_PARAM );
if ( CORBA::is_nil( theMesh ) ) if ( CORBA::is_nil( theMesh ) )
@ -1108,7 +1107,7 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::GetAlgoSO(const ::SMESH_Algo* algo)
*/ */
//================================================================================ //================================================================================
SMESH::compute_error_array* SMESH_Gen_i::GetComputeErrors( SMESH::SMESH_Mesh_ptr theMesh, SMESH::compute_error_array* SMESH_Gen_i::GetComputeErrors( SMESH::SMESH_Mesh_ptr theMesh,
GEOM::GEOM_Object_ptr theSubObject ) GEOM::GEOM_Object_ptr theSubObject )
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
{ {
@ -1130,7 +1129,7 @@ SMESH::compute_error_array* SMESH_Gen_i::GetComputeErrors( SMESH::SMESH_Mesh_ptr
shape = GeomObjectToShape( theSubObject ); shape = GeomObjectToShape( theSubObject );
else else
shape = SMESH_Mesh::PseudoShape(); shape = SMESH_Mesh::PseudoShape();
::SMESH_Mesh& mesh = meshServant->GetImpl(); ::SMESH_Mesh& mesh = meshServant->GetImpl();
error_array->length( mesh.GetMeshDS()->MaxShapeIndex() ); error_array->length( mesh.GetMeshDS()->MaxShapeIndex() );
@ -1170,7 +1169,7 @@ SMESH::compute_error_array* SMESH_Gen_i::GetComputeErrors( SMESH::SMESH_Mesh_ptr
return error_array._retn(); return error_array._retn();
} }
// //
//================================================================================ //================================================================================
/*! /*!
* \brief Return mesh elements preventing computation of a subshape * \brief Return mesh elements preventing computation of a subshape
@ -1265,7 +1264,7 @@ SMESH_Gen_i::GetBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
*/ */
//================================================================================ //================================================================================
SMESH::algo_error_array* SMESH_Gen_i::GetAlgoState( SMESH::SMESH_Mesh_ptr theMesh, SMESH::algo_error_array* SMESH_Gen_i::GetAlgoState( SMESH::SMESH_Mesh_ptr theMesh,
GEOM::GEOM_Object_ptr theSubObject ) GEOM::GEOM_Object_ptr theSubObject )
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
{ {
@ -1288,7 +1287,7 @@ SMESH::algo_error_array* SMESH_Gen_i::GetAlgoState( SMESH::SMESH_Mesh_ptr theMes
myLocShape = GeomObjectToShape( theSubObject ); myLocShape = GeomObjectToShape( theSubObject );
else else
myLocShape = SMESH_Mesh::PseudoShape(); myLocShape = SMESH_Mesh::PseudoShape();
::SMESH_Mesh& myLocMesh = meshServant->GetImpl(); ::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
list< ::SMESH_Gen::TAlgoStateError > error_list; list< ::SMESH_Gen::TAlgoStateError > error_list;
list< ::SMESH_Gen::TAlgoStateError >::iterator error; list< ::SMESH_Gen::TAlgoStateError >::iterator error;
@ -1341,7 +1340,7 @@ SMESH::long_array* SMESH_Gen_i::GetSubShapesId( GEOM::GEOM_Object_ptr theMainSha
try try
{ {
TopoDS_Shape myMainShape = GeomObjectToShape(theMainShapeObject); TopoDS_Shape myMainShape = GeomObjectToShape(theMainShapeObject);
TopTools_IndexedMapOfShape myIndexToShape; TopTools_IndexedMapOfShape myIndexToShape;
TopExp::MapShapes(myMainShape,myIndexToShape); TopExp::MapShapes(myMainShape,myIndexToShape);
for ( int i = 0; i < theListOfSubShapeObject.length(); i++ ) for ( int i = 0; i < theListOfSubShapeObject.length(); i++ )
@ -1408,7 +1407,7 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Compute" ); if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Compute" );
if ( CORBA::is_nil( theShapeObject ) && theMesh->HasShapeToMesh()) if ( CORBA::is_nil( theShapeObject ) && theMesh->HasShapeToMesh())
THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference", THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference",
SALOME::BAD_PARAM ); SALOME::BAD_PARAM );
if ( CORBA::is_nil( theMesh ) ) if ( CORBA::is_nil( theMesh ) )
@ -1470,7 +1469,7 @@ SMESH::MeshPreviewStruct* SMESH_Gen_i::Precompute( SMESH::SMESH_Mesh_ptr theMesh
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Precompute" ); if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Precompute" );
if ( CORBA::is_nil( theShapeObject ) && theMesh->HasShapeToMesh()) if ( CORBA::is_nil( theShapeObject ) && theMesh->HasShapeToMesh())
THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference", THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference",
SALOME::BAD_PARAM ); SALOME::BAD_PARAM );
if ( CORBA::is_nil( theMesh ) ) if ( CORBA::is_nil( theMesh ) )
@ -1520,7 +1519,7 @@ SMESH::MeshPreviewStruct* SMESH_Gen_i::Precompute( SMESH::SMESH_Mesh_ptr theMesh
SMESH_subMesh* sm = myLocMesh.GetSubMeshContaining(*idIt); SMESH_subMesh* sm = myLocMesh.GetSubMeshContaining(*idIt);
if ( !sm || !sm->IsMeshComputed() ) if ( !sm || !sm->IsMeshComputed() )
continue; continue;
const TopoDS_Shape& aSh = sm->GetSubShape(); const TopoDS_Shape& aSh = sm->GetSubShape();
const int shDim = myGen.GetShapeDim( aSh ); const int shDim = myGen.GetShapeDim( aSh );
if ( shDim < 1 || shDim > theDimension ) if ( shDim < 1 || shDim > theDimension )
@ -1657,7 +1656,7 @@ SMESH::long_array* SMESH_Gen_i::Evaluate(SMESH::SMESH_Mesh_ptr theMesh,
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Evaluate" ); if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Evaluate" );
if ( CORBA::is_nil( theShapeObject ) && theMesh->HasShapeToMesh()) if ( CORBA::is_nil( theShapeObject ) && theMesh->HasShapeToMesh())
THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference", THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference",
SALOME::BAD_PARAM ); SALOME::BAD_PARAM );
if ( CORBA::is_nil( theMesh ) ) if ( CORBA::is_nil( theMesh ) )
@ -1743,7 +1742,7 @@ SMESH_Gen_i::GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
{ {
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
GEOM::GEOM_Object_var geom = FindGeometryByMeshElement(theMesh, theElementID); GEOM::GEOM_Object_var geom = FindGeometryByMeshElement(theMesh, theElementID);
if ( !geom->_is_nil() ) { if ( !geom->_is_nil() ) {
GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh(); GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh();
@ -1864,8 +1863,8 @@ SMESH_Gen_i::FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
//================================================================================ //================================================================================
SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Concatenate(const SMESH::mesh_array& theMeshesArray, SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Concatenate(const SMESH::mesh_array& theMeshesArray,
CORBA::Boolean theUniteIdenticalGroups, CORBA::Boolean theUniteIdenticalGroups,
CORBA::Boolean theMergeNodesAndElements, CORBA::Boolean theMergeNodesAndElements,
CORBA::Double theMergeTolerance) CORBA::Double theMergeTolerance)
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
{ {
@ -1887,8 +1886,8 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Concatenate(const SMESH::mesh_array& theMeshe
SMESH::SMESH_Mesh_ptr SMESH::SMESH_Mesh_ptr
SMESH_Gen_i::ConcatenateWithGroups(const SMESH::mesh_array& theMeshesArray, SMESH_Gen_i::ConcatenateWithGroups(const SMESH::mesh_array& theMeshesArray,
CORBA::Boolean theUniteIdenticalGroups, CORBA::Boolean theUniteIdenticalGroups,
CORBA::Boolean theMergeNodesAndElements, CORBA::Boolean theMergeNodesAndElements,
CORBA::Double theMergeTolerance) CORBA::Double theMergeTolerance)
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
{ {
@ -1909,8 +1908,8 @@ SMESH_Gen_i::ConcatenateWithGroups(const SMESH::mesh_array& theMeshesArray,
SMESH::SMESH_Mesh_ptr SMESH::SMESH_Mesh_ptr
SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray, SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
CORBA::Boolean theUniteIdenticalGroups, CORBA::Boolean theUniteIdenticalGroups,
CORBA::Boolean theMergeNodesAndElements, CORBA::Boolean theMergeNodesAndElements,
CORBA::Double theMergeTolerance, CORBA::Double theMergeTolerance,
CORBA::Boolean theCommonGroups) CORBA::Boolean theCommonGroups)
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
@ -1925,7 +1924,7 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
// create mesh // create mesh
SMESH::SMESH_Mesh_var aNewMesh = CreateEmptyMesh(); SMESH::SMESH_Mesh_var aNewMesh = CreateEmptyMesh();
SMESHDS_Mesh* aNewMeshDS = 0; SMESHDS_Mesh* aNewMeshDS = 0;
if ( !aNewMesh->_is_nil() ) { if ( !aNewMesh->_is_nil() ) {
SMESH_Mesh_i* aNewImpl = dynamic_cast<SMESH_Mesh_i*>( GetServant( aNewMesh ).in() ); SMESH_Mesh_i* aNewImpl = dynamic_cast<SMESH_Mesh_i*>( GetServant( aNewMesh ).in() );
@ -2003,7 +2002,7 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
const SMDS_VtkVolume* aVolume = const SMDS_VtkVolume* aVolume =
dynamic_cast<const SMDS_VtkVolume*> (anElem); dynamic_cast<const SMDS_VtkVolume*> (anElem);
if ( aVolume ) { if ( aVolume ) {
aNewElem = aNewMeshDS->AddPolyhedralVolume(aNodesArray, aNewElem = aNewMeshDS->AddPolyhedralVolume(aNodesArray,
aVolume->GetQuantities()); aVolume->GetQuantities());
elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID())); elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID()));
if( theCommonGroups ) if( theCommonGroups )
@ -2011,7 +2010,7 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
} }
} }
else { else {
aNewElem = aNewEditor.AddElement(aNodesArray, aNewElem = aNewEditor.AddElement(aNodesArray,
anElemType, anElemType,
anElem->IsPoly()); anElem->IsPoly());
@ -2024,7 +2023,7 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
else if( anElemType == SMDSAbs_Volume ) else if( anElemType == SMDSAbs_Volume )
anIDsVolumes[anNbVolumes++] = aNewElem->GetID(); anIDsVolumes[anNbVolumes++] = aNewElem->GetID();
} }
} }
}//elems loop }//elems loop
// copy orphan nodes // copy orphan nodes
@ -2110,7 +2109,7 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
default: default:
break; break;
} }
aListOfNewGroups.clear(); aListOfNewGroups.clear();
aListOfNewGroups.push_back(aNewGroup); aListOfNewGroups.push_back(aNewGroup);
aGroupsMap.insert(make_pair( make_pair(aGroupName, aGroupType), aListOfNewGroups )); aGroupsMap.insert(make_pair( make_pair(aGroupName, aGroupType), aListOfNewGroups ));
@ -2138,14 +2137,14 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
for (int j = 0; j < anInitIDs->length(); j++) { for (int j = 0; j < anInitIDs->length(); j++) {
anNewIDs[j] = elemsMap.find(anInitIDs[j])->second; anNewIDs[j] = elemsMap.find(anInitIDs[j])->second;
} }
// check that current group name and type don't have identical ones in union mesh // check that current group name and type don't have identical ones in union mesh
if ( anIter == aGroupsMap.end() ) { if ( anIter == aGroupsMap.end() ) {
// add a new group in the mesh // add a new group in the mesh
aNewGroup = aNewImpl->CreateGroup(aGroupType, aGroupName); aNewGroup = aNewImpl->CreateGroup(aGroupType, aGroupName);
// add elements into new group // add elements into new group
aNewGroup->Add( anNewIDs ); aNewGroup->Add( anNewIDs );
aListOfNewGroups.push_back(aNewGroup); aListOfNewGroups.push_back(aNewGroup);
aGroupsMap.insert(make_pair( make_pair(aGroupName, aGroupType), aListOfNewGroups )); aGroupsMap.insert(make_pair( make_pair(aGroupName, aGroupType), aListOfNewGroups ));
} }
@ -2160,7 +2159,7 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
// rename identical groups // rename identical groups
aNewGroup = aNewImpl->CreateGroup(aGroupType, aGroupName); aNewGroup = aNewImpl->CreateGroup(aGroupType, aGroupName);
aNewGroup->Add( anNewIDs ); aNewGroup->Add( anNewIDs );
TListOfNewGroups& aNewGroups = anIter->second; TListOfNewGroups& aNewGroups = anIter->second;
string aNewGroupName; string aNewGroupName;
if (aNewGroups.size() == 1) { if (aNewGroups.size() == 1) {
@ -2189,7 +2188,7 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
} }
} }
} }
// Update Python script // Update Python script
aPythonDump << aNewMesh << " = " << this; aPythonDump << aNewMesh << " = " << this;
if( !theCommonGroups ) if( !theCommonGroups )
@ -2257,7 +2256,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CopyMesh(SMESH::SMESH_IDSource_ptr meshPart,
SMESH_Mesh_i* srcMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( srcMesh ); SMESH_Mesh_i* srcMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( srcMesh );
if ( !srcMesh_i ) if ( !srcMesh_i )
THROW_SALOME_CORBA_EXCEPTION( "bad mesh of IDSource", SALOME::BAD_PARAM ); THROW_SALOME_CORBA_EXCEPTION( "bad mesh of IDSource", SALOME::BAD_PARAM );
SMESHDS_Mesh* srcMeshDS = srcMesh_i->GetImpl().GetMeshDS(); SMESHDS_Mesh* srcMeshDS = srcMesh_i->GetImpl().GetMeshDS();
// 2. Make a new mesh // 2. Make a new mesh
@ -2493,7 +2492,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
// ASSERT( theComponent->GetStudy()->StudyId() == myCurrentStudy->StudyId() ) // ASSERT( theComponent->GetStudy()->StudyId() == myCurrentStudy->StudyId() )
// san -- in case <myCurrentStudy> differs from theComponent's study, // san -- in case <myCurrentStudy> differs from theComponent's study,
// use that of the component // use that of the component
if ( myCurrentStudy->_is_nil() || if ( myCurrentStudy->_is_nil() ||
theComponent->GetStudy()->StudyId() != myCurrentStudy->StudyId() ) theComponent->GetStudy()->StudyId() != myCurrentStudy->StudyId() )
SetCurrentStudy( theComponent->GetStudy() ); SetCurrentStudy( theComponent->GetStudy() );
@ -2514,7 +2513,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
aFileSeq->length( NUM_TMP_FILES ); aFileSeq->length( NUM_TMP_FILES );
TCollection_AsciiString aStudyName( "" ); TCollection_AsciiString aStudyName( "" );
if ( isMultiFile ) if ( isMultiFile )
aStudyName = ( (char*)SALOMEDS_Tool::GetNameFromPath( myCurrentStudy->URL() ).c_str() ); aStudyName = ( (char*)SALOMEDS_Tool::GetNameFromPath( myCurrentStudy->URL() ).c_str() );
// Set names of temporary files // Set names of temporary files
@ -2835,7 +2834,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
if ( ok ) { if ( ok ) {
// san - it is impossible to recover applied hypotheses // san - it is impossible to recover applied hypotheses
// using their entries within Load() method, // using their entries within Load() method,
// for there are no AttributeIORs in the study when Load() is working. // for there are no AttributeIORs in the study when Load() is working.
// Hence, it is better to store persistent IDs of hypotheses as references to them // Hence, it is better to store persistent IDs of hypotheses as references to them
//string myRefOnObject = myRefOnHyp->GetID(); //string myRefOnObject = myRefOnHyp->GetID();
@ -2878,7 +2877,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
if ( ok ) { if ( ok ) {
// san - it is impossible to recover applied algorithms // san - it is impossible to recover applied algorithms
// using their entries within Load() method, // using their entries within Load() method,
// for there are no AttributeIORs in the study when Load() is working. // for there are no AttributeIORs in the study when Load() is working.
// Hence, it is better to store persistent IDs of algorithms as references to them // Hence, it is better to store persistent IDs of algorithms as references to them
//string myRefOnObject = myRefOnAlgo->GetID(); //string myRefOnObject = myRefOnAlgo->GetID();
@ -3142,7 +3141,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
SMESHDS_GroupBase* aGrpBaseDS = myGroupImpl->GetGroupDS(); SMESHDS_GroupBase* aGrpBaseDS = myGroupImpl->GetGroupDS();
if ( !aGrpBaseDS ) if ( !aGrpBaseDS )
continue; continue;
CORBA::String_var objStr = GetORB()->object_to_string( aSubObject ); CORBA::String_var objStr = GetORB()->object_to_string( aSubObject );
int anId = myStudyContext->findId( string( objStr.in() ) ); int anId = myStudyContext->findId( string( objStr.in() ) );
@ -3173,7 +3172,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
aDataset->WriteOnDisk( anRGB ); aDataset->WriteOnDisk( anRGB );
aDataset->CloseOnDisk(); aDataset->CloseOnDisk();
// Pass SMESHDS_Group to MED writer // Pass SMESHDS_Group to MED writer
SMESHDS_Group* aGrpDS = dynamic_cast<SMESHDS_Group*>( aGrpBaseDS ); SMESHDS_Group* aGrpDS = dynamic_cast<SMESHDS_Group*>( aGrpBaseDS );
if ( aGrpDS ) if ( aGrpDS )
myWriter.AddGroup( aGrpDS ); myWriter.AddGroup( aGrpDS );
@ -3208,29 +3207,29 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
} }
aGroup->CloseOnDisk(); aGroup->CloseOnDisk();
} }
} // loop on groups } // loop on groups
if ( strcmp( strHasData.c_str(), "1" ) == 0 ) if ( strcmp( strHasData.c_str(), "1" ) == 0 )
{ {
// Flush current mesh information into MED file // Flush current mesh information into MED file
myWriter.Perform(); myWriter.Perform();
// maybe a shape was deleted in the study // maybe a shape was deleted in the study
if ( !shapeRefFound && !mySMESHDSMesh->ShapeToMesh().IsNull() && hasShape) { if ( !shapeRefFound && !mySMESHDSMesh->ShapeToMesh().IsNull() && hasShape) {
TopoDS_Shape nullShape; TopoDS_Shape nullShape;
myLocMesh.ShapeToMesh( nullShape ); // remove shape referring data myLocMesh.ShapeToMesh( nullShape ); // remove shape referring data
} }
if ( !mySMESHDSMesh->SubMeshes().empty() ) if ( !mySMESHDSMesh->SubMeshes().empty() )
{ {
// Store submeshes // Store submeshes
// ---------------- // ----------------
aGroup = new HDFgroup( "Submeshes", aTopGroup ); aGroup = new HDFgroup( "Submeshes", aTopGroup );
aGroup->CreateOnDisk(); aGroup->CreateOnDisk();
// each element belongs to one or none submesh, // each element belongs to one or none submesh,
// so for each node/element, we store a submesh ID // so for each node/element, we store a submesh ID
// Make maps of submesh IDs of elements sorted by element IDs // Make maps of submesh IDs of elements sorted by element IDs
typedef int TElemID; typedef int TElemID;
typedef int TSubMID; typedef int TSubMID;
@ -3255,7 +3254,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
for ( itElem = aSubMesh->GetElements(); itElem->more(); ++hint) for ( itElem = aSubMesh->GetElements(); itElem->more(); ++hint)
hint = eId2smId.insert( hint, make_pair( itElem->next()->GetID(), aSubMeID )); hint = eId2smId.insert( hint, make_pair( itElem->next()->GetID(), aSubMeID ));
} }
// Care of elements that are not on submeshes // Care of elements that are not on submeshes
if ( mySMESHDSMesh->NbNodes() != nId2smId.size() ) { if ( mySMESHDSMesh->NbNodes() != nId2smId.size() ) {
for ( itNode = mySMESHDSMesh->nodesIterator(); itNode->more(); ) for ( itNode = mySMESHDSMesh->nodesIterator(); itNode->more(); )
@ -3269,7 +3268,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
for ( itElem = mySMESHDSMesh->elementsIterator(); itElem->more(); ) for ( itElem = mySMESHDSMesh->elementsIterator(); itElem->more(); )
eId2smId.insert( make_pair( itElem->next()->GetID(), 0 )); eId2smId.insert( make_pair( itElem->next()->GetID(), 0 ));
} }
// Store submesh IDs // Store submesh IDs
for ( int isNode = 0; isNode < 2; ++isNode ) for ( int isNode = 0; isNode < 2; ++isNode )
{ {
@ -3290,20 +3289,20 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
// //
delete[] smIDs; delete[] smIDs;
} }
// Store node positions on sub-shapes (SMDS_Position): // Store node positions on sub-shapes (SMDS_Position):
// ---------------------------------------------------- // ----------------------------------------------------
aGroup = new HDFgroup( "Node Positions", aTopGroup ); aGroup = new HDFgroup( "Node Positions", aTopGroup );
aGroup->CreateOnDisk(); aGroup->CreateOnDisk();
// in aGroup, create 5 datasets to contain: // in aGroup, create 5 datasets to contain:
// "Nodes on Edges" - ID of node on edge // "Nodes on Edges" - ID of node on edge
// "Edge positions" - U parameter on node on edge // "Edge positions" - U parameter on node on edge
// "Nodes on Faces" - ID of node on face // "Nodes on Faces" - ID of node on face
// "Face U positions" - U parameter of node on face // "Face U positions" - U parameter of node on face
// "Face V positions" - V parameter of node on face // "Face V positions" - V parameter of node on face
// Find out nb of nodes on edges and faces // Find out nb of nodes on edges and faces
// Collect corresponing sub-meshes // Collect corresponing sub-meshes
int nbEdgeNodes = 0, nbFaceNodes = 0; int nbEdgeNodes = 0, nbFaceNodes = 0;
@ -3316,7 +3315,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
continue; // submesh containing other submeshs continue; // submesh containing other submeshs
int nbNodes = aSubMesh->NbNodes(); int nbNodes = aSubMesh->NbNodes();
if ( nbNodes == 0 ) continue; if ( nbNodes == 0 ) continue;
int aShapeID = (*itSubM).first; int aShapeID = (*itSubM).first;
if ( aShapeID < 1 || aShapeID > mySMESHDSMesh->MaxShapeIndex() ) if ( aShapeID < 1 || aShapeID > mySMESHDSMesh->MaxShapeIndex() )
continue; continue;
@ -3344,7 +3343,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
int* aNodeIDs = new int [ nbNodes ]; int* aNodeIDs = new int [ nbNodes ];
double* aUPos = new double [ nbNodes ]; double* aUPos = new double [ nbNodes ];
double* aVPos = ( onFace ? new double[ nbNodes ] : 0 ); double* aVPos = ( onFace ? new double[ nbNodes ] : 0 );
// Fill arrays // Fill arrays
// loop on sub-meshes // loop on sub-meshes
list<SMESHDS_SubMesh*> * pListSM = ( onFace ? &aFaceSM : &aEdgeSM ); list<SMESHDS_SubMesh*> * pListSM = ( onFace ? &aFaceSM : &aEdgeSM );
@ -3352,7 +3351,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
for ( ; itSM != pListSM->end(); itSM++ ) for ( ; itSM != pListSM->end(); itSM++ )
{ {
SMESHDS_SubMesh* aSubMesh = (*itSM); SMESHDS_SubMesh* aSubMesh = (*itSM);
SMDS_NodeIteratorPtr itNode = aSubMesh->GetNodes(); SMDS_NodeIteratorPtr itNode = aSubMesh->GetNodes();
// loop on nodes in aSubMesh // loop on nodes in aSubMesh
while ( itNode->more() ) while ( itNode->more() )
@ -3360,7 +3359,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
//node ID //node ID
const SMDS_MeshNode* node = itNode->next(); const SMDS_MeshNode* node = itNode->next();
aNodeIDs [ iNode ] = node->GetID(); aNodeIDs [ iNode ] = node->GetID();
// Position // Position
const SMDS_PositionPtr pos = node->GetPosition(); const SMDS_PositionPtr pos = node->GetPosition();
if ( onFace ) { // on FACE if ( onFace ) { // on FACE
@ -3386,7 +3385,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
} }
} // loop on nodes in aSubMesh } // loop on nodes in aSubMesh
} // loop on sub-meshes } // loop on sub-meshes
// Write datasets // Write datasets
if ( nbNodes ) if ( nbNodes )
{ {
@ -3397,7 +3396,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
aDataset->CreateOnDisk(); aDataset->CreateOnDisk();
aDataset->WriteOnDisk( aNodeIDs ); aDataset->WriteOnDisk( aNodeIDs );
aDataset->CloseOnDisk(); aDataset->CloseOnDisk();
// U Positions // U Positions
aDSName = ( onFace ? "Face U positions" : "Edge positions"); aDSName = ( onFace ? "Face U positions" : "Edge positions");
aDataset = new HDFdataset( (char*)aDSName.c_str(), aGroup, HDF_FLOAT64, aSize, 1); aDataset = new HDFdataset( (char*)aDSName.c_str(), aGroup, HDF_FLOAT64, aSize, 1);
@ -3415,15 +3414,15 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
delete [] aNodeIDs; delete [] aNodeIDs;
delete [] aUPos; delete [] aUPos;
if ( aVPos ) delete [] aVPos; if ( aVPos ) delete [] aVPos;
} // treat positions on edges or faces } // treat positions on edges or faces
// close "Node Positions" group // close "Node Positions" group
aGroup->CloseOnDisk(); aGroup->CloseOnDisk();
} // if ( there are submeshes in SMESHDS_Mesh ) } // if ( there are submeshes in SMESHDS_Mesh )
} // if ( hasData ) } // if ( hasData )
// close mesh HDF group // close mesh HDF group
aTopGroup->CloseOnDisk(); aTopGroup->CloseOnDisk();
} }
@ -3431,7 +3430,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
} }
} }
} }
// close HDF file // close HDF file
aFile->CloseOnDisk(); aFile->CloseOnDisk();
delete aFile; delete aFile;
@ -3440,7 +3439,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
aStreamFile = SALOMEDS_Tool::PutFilesToStream( tmpDir.ToCString(), aFileSeq.in(), isMultiFile ); aStreamFile = SALOMEDS_Tool::PutFilesToStream( tmpDir.ToCString(), aFileSeq.in(), isMultiFile );
// Remove temporary files and directory // Remove temporary files and directory
if ( !isMultiFile ) if ( !isMultiFile )
SALOMEDS_Tool::RemoveTemporaryFiles( tmpDir.ToCString(), aFileSeq.in(), true ); SALOMEDS_Tool::RemoveTemporaryFiles( tmpDir.ToCString(), aFileSeq.in(), true );
INFOS( "SMESH_Gen_i::Save() completed" ); INFOS( "SMESH_Gen_i::Save() completed" );
@ -3472,7 +3471,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::SaveASCII( SALOMEDS::SComponent_ptr theComponent
buffer[size * 3] = '\0'; buffer[size * 3] = '\0';
SALOMEDS::TMPFile_var anAsciiStreamFile = new SALOMEDS::TMPFile(size*3, size*3, buffer, 1); SALOMEDS::TMPFile_var anAsciiStreamFile = new SALOMEDS::TMPFile(size*3, size*3, buffer, 1);
return anAsciiStreamFile._retn(); return anAsciiStreamFile._retn();
} }
@ -3493,7 +3492,7 @@ void SMESH_Gen_i::loadGeomData( SALOMEDS::SComponent_ptr theCompRoot )
if ( aStudy->_is_nil() ) if ( aStudy->_is_nil() )
return; return;
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
aStudyBuilder->LoadWith( theCompRoot, GetGeomEngine() ); aStudyBuilder->LoadWith( theCompRoot, GetGeomEngine() );
} }
//============================================================================= //=============================================================================
@ -3539,7 +3538,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
{ {
INFOS( "SMESH_Gen_i::Load" ); INFOS( "SMESH_Gen_i::Load" );
if ( myCurrentStudy->_is_nil() || if ( myCurrentStudy->_is_nil() ||
theComponent->GetStudy()->StudyId() != myCurrentStudy->StudyId() ) theComponent->GetStudy()->StudyId() != myCurrentStudy->StudyId() )
SetCurrentStudy( theComponent->GetStudy() ); SetCurrentStudy( theComponent->GetStudy() );
@ -3555,7 +3554,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
// Get temporary files location // Get temporary files location
TCollection_AsciiString tmpDir = TCollection_AsciiString tmpDir =
isMultiFile ? TCollection_AsciiString( ( char* )theURL ) : ( char* )SALOMEDS_Tool::GetTmpDir().c_str(); isMultiFile ? TCollection_AsciiString( ( char* )theURL ) : ( char* )SALOMEDS_Tool::GetTmpDir().c_str();
INFOS( "THE URL++++++++++++++" ) INFOS( "THE URL++++++++++++++" )
INFOS( theURL ); INFOS( theURL );
INFOS( "THE TMP PATH+++++++++" ); INFOS( "THE TMP PATH+++++++++" );
@ -3566,7 +3565,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
tmpDir.ToCString(), tmpDir.ToCString(),
isMultiFile ); isMultiFile );
TCollection_AsciiString aStudyName( "" ); TCollection_AsciiString aStudyName( "" );
if ( isMultiFile ) if ( isMultiFile )
aStudyName = ( (char*)SALOMEDS_Tool::GetNameFromPath( myCurrentStudy->URL() ).c_str() ); aStudyName = ( (char*)SALOMEDS_Tool::GetNameFromPath( myCurrentStudy->URL() ).c_str() );
// Set names of temporary files // Set names of temporary files
@ -3609,16 +3608,16 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
list< pair< SMESH_Mesh_i*, HDFgroup* > > meshGroupList; list< pair< SMESH_Mesh_i*, HDFgroup* > > meshGroupList;
// get total number of top-level groups // get total number of top-level groups
int aNbGroups = aFile->nInternalObjects(); int aNbGroups = aFile->nInternalObjects();
if ( aNbGroups > 0 ) { if ( aNbGroups > 0 ) {
// --> in first turn we should read&create hypotheses // --> in first turn we should read&create hypotheses
if ( aFile->ExistInternalObject( "Hypotheses" ) ) { if ( aFile->ExistInternalObject( "Hypotheses" ) ) {
// open hypotheses root HDF group // open hypotheses root HDF group
aTopGroup = new HDFgroup( "Hypotheses", aFile ); aTopGroup = new HDFgroup( "Hypotheses", aFile );
aTopGroup->OpenOnDisk(); aTopGroup->OpenOnDisk();
// get number of hypotheses // get number of hypotheses
int aNbObjects = aTopGroup->nInternalObjects(); int aNbObjects = aTopGroup->nInternalObjects();
for ( int j = 0; j < aNbObjects; j++ ) { for ( int j = 0; j < aNbObjects; j++ ) {
// try to identify hypothesis // try to identify hypothesis
char hypGrpName[ HDF_NAME_MAX_LEN+1 ]; char hypGrpName[ HDF_NAME_MAX_LEN+1 ];
@ -3626,7 +3625,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
if ( string( hypGrpName ).substr( 0, 10 ) == string( "Hypothesis" ) ) { if ( string( hypGrpName ).substr( 0, 10 ) == string( "Hypothesis" ) ) {
// open hypothesis group // open hypothesis group
aGroup = new HDFgroup( hypGrpName, aTopGroup ); aGroup = new HDFgroup( hypGrpName, aTopGroup );
aGroup->OpenOnDisk(); aGroup->OpenOnDisk();
// --> get hypothesis id // --> get hypothesis id
@ -3713,11 +3712,11 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
// --> then we should read&create algorithms // --> then we should read&create algorithms
if ( aFile->ExistInternalObject( "Algorithms" ) ) { if ( aFile->ExistInternalObject( "Algorithms" ) ) {
// open algorithms root HDF group // open algorithms root HDF group
aTopGroup = new HDFgroup( "Algorithms", aFile ); aTopGroup = new HDFgroup( "Algorithms", aFile );
aTopGroup->OpenOnDisk(); aTopGroup->OpenOnDisk();
// get number of algorithms // get number of algorithms
int aNbObjects = aTopGroup->nInternalObjects(); int aNbObjects = aTopGroup->nInternalObjects();
for ( int j = 0; j < aNbObjects; j++ ) { for ( int j = 0; j < aNbObjects; j++ ) {
// try to identify algorithm // try to identify algorithm
char hypGrpName[ HDF_NAME_MAX_LEN+1 ]; char hypGrpName[ HDF_NAME_MAX_LEN+1 ];
@ -3725,7 +3724,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
if ( string( hypGrpName ).substr( 0, 9 ) == string( "Algorithm" ) ) { if ( string( hypGrpName ).substr( 0, 9 ) == string( "Algorithm" ) ) {
// open algorithm group // open algorithm group
aGroup = new HDFgroup( hypGrpName, aTopGroup ); aGroup = new HDFgroup( hypGrpName, aTopGroup );
aGroup->OpenOnDisk(); aGroup->OpenOnDisk();
// --> get algorithm id // --> get algorithm id
@ -3823,11 +3822,11 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
continue; continue;
// open mesh HDF group // open mesh HDF group
aTopGroup = new HDFgroup( meshName, aFile ); aTopGroup = new HDFgroup( meshName, aFile );
aTopGroup->OpenOnDisk(); aTopGroup->OpenOnDisk();
// get number of child HDF objects // get number of child HDF objects
int aNbObjects = aTopGroup->nInternalObjects(); int aNbObjects = aTopGroup->nInternalObjects();
if ( aNbObjects > 0 ) { if ( aNbObjects > 0 ) {
// create mesh // create mesh
if(MYDEBUG) MESSAGE( "VSR - load mesh : id = " << id ); if(MYDEBUG) MESSAGE( "VSR - load mesh : id = " << id );
@ -3960,7 +3959,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
aGroup = new HDFgroup( "Applied Algorithms", aTopGroup ); aGroup = new HDFgroup( "Applied Algorithms", aTopGroup );
aGroup->OpenOnDisk(); aGroup->OpenOnDisk();
// get number of applied algorithms // get number of applied algorithms
int aNbSubObjects = aGroup->nInternalObjects(); int aNbSubObjects = aGroup->nInternalObjects();
if(MYDEBUG) MESSAGE( "VSR - number of applied algos " << aNbSubObjects ); if(MYDEBUG) MESSAGE( "VSR - number of applied algos " << aNbSubObjects );
for ( int j = 0; j < aNbSubObjects; j++ ) { for ( int j = 0; j < aNbSubObjects; j++ ) {
char name_dataset[ HDF_NAME_MAX_LEN+1 ]; char name_dataset[ HDF_NAME_MAX_LEN+1 ];
@ -3999,7 +3998,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
aGroup = new HDFgroup( "Applied Hypotheses", aTopGroup ); aGroup = new HDFgroup( "Applied Hypotheses", aTopGroup );
aGroup->OpenOnDisk(); aGroup->OpenOnDisk();
// get number of applied hypotheses // get number of applied hypotheses
int aNbSubObjects = aGroup->nInternalObjects(); int aNbSubObjects = aGroup->nInternalObjects();
for ( int j = 0; j < aNbSubObjects; j++ ) { for ( int j = 0; j < aNbSubObjects; j++ ) {
char name_dataset[ HDF_NAME_MAX_LEN+1 ]; char name_dataset[ HDF_NAME_MAX_LEN+1 ];
aGroup->InternalObjectIndentify( j, name_dataset ); aGroup->InternalObjectIndentify( j, name_dataset );
@ -4057,7 +4056,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
aGroup->OpenOnDisk(); aGroup->OpenOnDisk();
// get number of submeshes // get number of submeshes
int aNbSubMeshes = aGroup->nInternalObjects(); int aNbSubMeshes = aGroup->nInternalObjects();
for ( int k = 0; k < aNbSubMeshes; k++ ) { for ( int k = 0; k < aNbSubMeshes; k++ ) {
// identify submesh // identify submesh
char name_submeshgroup[ HDF_NAME_MAX_LEN+1 ]; char name_submeshgroup[ HDF_NAME_MAX_LEN+1 ];
@ -4124,7 +4123,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
aSubSubGroup = new HDFgroup( "Applied Algorithms", aSubGroup ); aSubSubGroup = new HDFgroup( "Applied Algorithms", aSubGroup );
aSubSubGroup->OpenOnDisk(); aSubSubGroup->OpenOnDisk();
// get number of applied algorithms // get number of applied algorithms
int aNbSubObjects = aSubSubGroup->nInternalObjects(); int aNbSubObjects = aSubSubGroup->nInternalObjects();
for ( int l = 0; l < aNbSubObjects; l++ ) { for ( int l = 0; l < aNbSubObjects; l++ ) {
char name_dataset[ HDF_NAME_MAX_LEN+1 ]; char name_dataset[ HDF_NAME_MAX_LEN+1 ];
aSubSubGroup->InternalObjectIndentify( l, name_dataset ); aSubSubGroup->InternalObjectIndentify( l, name_dataset );
@ -4161,7 +4160,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
aSubSubGroup = new HDFgroup( "Applied Hypotheses", aSubGroup ); aSubSubGroup = new HDFgroup( "Applied Hypotheses", aSubGroup );
aSubSubGroup->OpenOnDisk(); aSubSubGroup->OpenOnDisk();
// get number of applied hypotheses // get number of applied hypotheses
int aNbSubObjects = aSubSubGroup->nInternalObjects(); int aNbSubObjects = aSubSubGroup->nInternalObjects();
for ( int l = 0; l < aNbSubObjects; l++ ) { for ( int l = 0; l < aNbSubObjects; l++ ) {
char name_dataset[ HDF_NAME_MAX_LEN+1 ]; char name_dataset[ HDF_NAME_MAX_LEN+1 ];
aSubSubGroup->InternalObjectIndentify( l, name_dataset ); aSubSubGroup->InternalObjectIndentify( l, name_dataset );
@ -4215,12 +4214,12 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
else else
{ {
// open a group // open a group
aGroup = new HDFgroup( "Submeshes", aTopGroup ); aGroup = new HDFgroup( "Submeshes", aTopGroup );
aGroup->OpenOnDisk(); aGroup->OpenOnDisk();
int maxID = Max( mySMESHDSMesh->MaxSubMeshIndex(), mySMESHDSMesh->MaxShapeIndex() ); int maxID = Max( mySMESHDSMesh->MaxSubMeshIndex(), mySMESHDSMesh->MaxShapeIndex() );
vector< SMESHDS_SubMesh * > subMeshes( maxID + 1, (SMESHDS_SubMesh*) 0 ); vector< SMESHDS_SubMesh * > subMeshes( maxID + 1, (SMESHDS_SubMesh*) 0 );
vector< TopAbs_ShapeEnum > smType ( maxID + 1, TopAbs_SHAPE ); vector< TopAbs_ShapeEnum > smType ( maxID + 1, TopAbs_SHAPE );
PositionCreator aPositionCreator; PositionCreator aPositionCreator;
@ -4310,7 +4309,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
double *aEpos = 0, *aFupos = 0, *aFvpos = 0; double *aEpos = 0, *aFupos = 0, *aFvpos = 0;
// open a group // open a group
aGroup = new HDFgroup( "Node Positions", aTopGroup ); aGroup = new HDFgroup( "Node Positions", aTopGroup );
aGroup->OpenOnDisk(); aGroup->OpenOnDisk();
// loop on 5 data sets // loop on 5 data sets
@ -4421,7 +4420,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
aGroup = new HDFgroup( name_group, aTopGroup ); aGroup = new HDFgroup( name_group, aTopGroup );
aGroup->OpenOnDisk(); aGroup->OpenOnDisk();
// get number of groups // get number of groups
int aNbSubObjects = aGroup->nInternalObjects(); int aNbSubObjects = aGroup->nInternalObjects();
for ( int j = 0; j < aNbSubObjects; j++ ) { for ( int j = 0; j < aNbSubObjects; j++ ) {
char name_dataset[ HDF_NAME_MAX_LEN+1 ]; char name_dataset[ HDF_NAME_MAX_LEN+1 ];
aGroup->InternalObjectIndentify( j, name_dataset ); aGroup->InternalObjectIndentify( j, name_dataset );
@ -4466,7 +4465,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
SMESH::ElementType type = (SMESH::ElementType)(ii - GetNodeGroupsTag() + 1); SMESH::ElementType type = (SMESH::ElementType)(ii - GetNodeGroupsTag() + 1);
SMESH::SMESH_GroupBase_var aNewGroup = SMESH::SMESH_GroupBase::_duplicate SMESH::SMESH_GroupBase_var aNewGroup = SMESH::SMESH_GroupBase::_duplicate
( myNewMeshImpl->createGroup( type, nameFromFile, aShape ) ); ( myNewMeshImpl->createGroup( type, nameFromFile, aShape ) );
// Obtain a SMESHDS_Group object // Obtain a SMESHDS_Group object
if ( aNewGroup->_is_nil() ) if ( aNewGroup->_is_nil() )
continue; continue;
@ -4527,7 +4526,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
anOrderIds.push_back( TListOfInt() ); anOrderIds.push_back( TListOfInt() );
else else
anOrderIds.back().push_back(smIDs[ i ]); anOrderIds.back().push_back(smIDs[ i ]);
myNewMeshImpl->GetImpl().SetMeshOrder( anOrderIds ); myNewMeshImpl->GetImpl().SetMeshOrder( anOrderIds );
} }
} // loop on meshes } // loop on meshes
@ -4543,7 +4542,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
myLocShape = myLocMesh.GetShapeToMesh(); myLocShape = myLocMesh.GetShapeToMesh();
else else
myLocShape = SMESH_Mesh::PseudoShape(); myLocShape = SMESH_Mesh::PseudoShape();
myLocMesh.GetSubMesh(myLocShape)-> myLocMesh.GetSubMesh(myLocShape)->
ComputeStateEngine (SMESH_subMesh::SUBMESH_RESTORED); ComputeStateEngine (SMESH_subMesh::SUBMESH_RESTORED);
} }
@ -4556,14 +4555,14 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
// close mesh group // close mesh group
if(aTopGroup) if(aTopGroup)
aTopGroup->CloseOnDisk(); aTopGroup->CloseOnDisk();
} }
// close HDF file // close HDF file
aFile->CloseOnDisk(); aFile->CloseOnDisk();
delete aFile; delete aFile;
// Remove temporary files created from the stream // Remove temporary files created from the stream
if ( !isMultiFile ) if ( !isMultiFile )
SALOMEDS_Tool::RemoveTemporaryFiles( tmpDir.ToCString(), aFileSeq.in(), true ); SALOMEDS_Tool::RemoveTemporaryFiles( tmpDir.ToCString(), aFileSeq.in(), true );
INFOS( "SMESH_Gen_i::Load completed" ); INFOS( "SMESH_Gen_i::Load completed" );
@ -4605,7 +4604,7 @@ bool SMESH_Gen_i::LoadASCII( SALOMEDS::SComponent_ptr theComponent,
} }
SALOMEDS::TMPFile_var aRealStreamFile = new SALOMEDS::TMPFile(real_size, real_size, buffer, 1); SALOMEDS::TMPFile_var aRealStreamFile = new SALOMEDS::TMPFile(real_size, real_size, buffer, 1);
return Load( theComponent, *(aRealStreamFile._retn()), theURL, isMultiFile ); return Load( theComponent, *(aRealStreamFile._retn()), theURL, isMultiFile );
} }
@ -4641,7 +4640,7 @@ void SMESH_Gen_i::Close( SALOMEDS::SComponent_ptr theComponent )
// printf( "--------------------------- SMESH_Gen_i::Close, delete aGroup = %p \n", i_mesh->second ); // printf( "--------------------------- SMESH_Gen_i::Close, delete aGroup = %p \n", i_mesh->second );
// delete i_mesh->second; // delete i_mesh->second;
// } // }
// delete SMESHDS_Mesh's // delete SMESHDS_Mesh's
// it's too long on big meshes // it's too long on big meshes
@ -4649,7 +4648,7 @@ void SMESH_Gen_i::Close( SALOMEDS::SComponent_ptr theComponent )
// delete context->myDocument; // delete context->myDocument;
// context->myDocument = 0; // context->myDocument = 0;
// } // }
myCurrentStudy = SALOMEDS::Study::_nil(); myCurrentStudy = SALOMEDS::Study::_nil();
return; return;
} }
@ -4657,7 +4656,7 @@ void SMESH_Gen_i::Close( SALOMEDS::SComponent_ptr theComponent )
//============================================================================= //=============================================================================
/*! /*!
* SMESH_Gen_i::ComponentDataType * SMESH_Gen_i::ComponentDataType
* *
* Get component data type * Get component data type
*/ */
//============================================================================= //=============================================================================
@ -4668,11 +4667,11 @@ char* SMESH_Gen_i::ComponentDataType()
return CORBA::string_dup( "SMESH" ); return CORBA::string_dup( "SMESH" );
} }
//============================================================================= //=============================================================================
/*! /*!
* SMESH_Gen_i::IORToLocalPersistentID * SMESH_Gen_i::IORToLocalPersistentID
* *
* Transform data from transient form to persistent * Transform data from transient form to persistent
*/ */
//============================================================================= //=============================================================================
@ -4684,7 +4683,7 @@ char* SMESH_Gen_i::IORToLocalPersistentID( SALOMEDS::SObject_ptr /*theSObject*/,
{ {
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::IORToLocalPersistentID" ); if(MYDEBUG) MESSAGE( "SMESH_Gen_i::IORToLocalPersistentID" );
StudyContext* myStudyContext = GetCurrentStudyContext(); StudyContext* myStudyContext = GetCurrentStudyContext();
if ( myStudyContext && strcmp( IORString, "" ) != 0 ) { if ( myStudyContext && strcmp( IORString, "" ) != 0 ) {
int anId = myStudyContext->findId( IORString ); int anId = myStudyContext->findId( IORString );
if ( anId ) { if ( anId ) {
@ -4722,7 +4721,7 @@ char* SMESH_Gen_i::LocalPersistentIDToIOR( SALOMEDS::SObject_ptr /*theSObject*/,
//======================================================================= //=======================================================================
//function : RegisterObject //function : RegisterObject
//purpose : //purpose :
//======================================================================= //=======================================================================
int SMESH_Gen_i::RegisterObject(CORBA::Object_ptr theObject) int SMESH_Gen_i::RegisterObject(CORBA::Object_ptr theObject)
@ -4776,21 +4775,21 @@ int SMESH_Gen_i::GetCurrentStudyID()
{ {
return myCurrentStudy->_is_nil() || myCurrentStudy->_non_existent() ? -1 : myCurrentStudy->StudyId(); return myCurrentStudy->_is_nil() || myCurrentStudy->_non_existent() ? -1 : myCurrentStudy->StudyId();
} }
//============================================================================= //=============================================================================
/*! /*!
* SMESHEngine_factory * SMESHEngine_factory
* *
* C factory, accessible with dlsym, after dlopen * C factory, accessible with dlsym, after dlopen
*/ */
//============================================================================= //=============================================================================
extern "C" extern "C"
{ SMESH_I_EXPORT { SMESH_I_EXPORT
PortableServer::ObjectId* SMESHEngine_factory( CORBA::ORB_ptr orb, PortableServer::ObjectId* SMESHEngine_factory( CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa, PortableServer::POA_ptr poa,
PortableServer::ObjectId* contId, PortableServer::ObjectId* contId,
const char* instanceName, const char* instanceName,
const char* interfaceName ) const char* interfaceName )
{ {
if(MYDEBUG) MESSAGE( "PortableServer::ObjectId* SMESHEngine_factory()" ); if(MYDEBUG) MESSAGE( "PortableServer::ObjectId* SMESHEngine_factory()" );