//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-
// File : SMESH_Gen.idl
// Author : Paul RASCLE, EDF
-//
+
#ifndef _SMESH_GEN_IDL_
#define _SMESH_GEN_IDL_
/*!
* Hypothesis definintion error
*/
- struct AlgoStateError
+ struct AlgoStateError
{
Hypothesis_Status state;
string algoName;
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 );
void SetGeomEngine( in GEOM::GEOM_Gen geomcompo );
* Algorithms are 1D, 2D or 3D.
*/
SMESH_Hypothesis CreateHypothesis( in string theHypName,
- in string theLibName )
+ in string theLibName )
raises ( SALOME::SALOME_Exception );
/*!
* Set the object name
*/
void SetName( in string theObjectIOR,
- in string theObjectName )
+ in string theObjectName )
raises ( SALOME::SALOME_Exception );
/*!
*/
SMESH_Mesh CreateMesh( in GEOM::GEOM_Object theObject )
raises ( SALOME::SALOME_Exception );
-
+
/*!
* Create an empty mesh object
*/
SMESH_Mesh CreateEmptyMesh()
raises ( SALOME::SALOME_Exception );
-
+
/*!
* Create Mesh object importing data from given UNV file
* (UNV supported version is I-DEAS 10)
* Create Mesh object(s) importing data from given MED file
*/
mesh_array CreateMeshesFromMED( in string theFileName,
- out SMESH::DriverMED_ReadStatus theStatus )
+ out SMESH::DriverMED_ReadStatus theStatus )
raises ( SALOME::SALOME_Exception );
/*!
in boolean toCopyGroups,
in boolean toKeepIDs)
raises ( SALOME::SALOME_Exception );
-
+
/*!
* Concatenate the given meshes into one mesh.
* Union groups with the same name and type if
* theUniteIdenticalGroups flag is true.
- * Merge coincident nodes and elements if
+ * Merge coincident nodes and elements if
* theMergeNodesAndElements flag is true.
*/
- SMESH_Mesh Concatenate(in mesh_array theMeshesArray,
- in boolean theUniteIdenticalGroups,
- in boolean theMergeNodesAndElements,
- in double theMergeTolerance)
+ SMESH_Mesh Concatenate(in mesh_array theMeshesArray,
+ in boolean theUniteIdenticalGroups,
+ in boolean theMergeNodesAndElements,
+ in double theMergeTolerance)
raises ( SALOME::SALOME_Exception );
/*!
* Concatenate the given meshes into one mesh.
* Union groups with the same name and type if
* theUniteIdenticalGroups flag is true.
- * Merge coincident nodes and elements if
+ * Merge coincident nodes and elements if
* theMergeNodesAndElements flag is true.
* Create the groups of all elements from initial meshes.
*/
- SMESH_Mesh ConcatenateWithGroups(in mesh_array theMeshesArray,
- in boolean theUniteIdenticalGroups,
- in boolean theMergeNodesAndElements,
+ SMESH_Mesh ConcatenateWithGroups(in mesh_array theMeshesArray,
+ in boolean theUniteIdenticalGroups,
+ in boolean theMergeNodesAndElements,
in double theMergeTolerance)
raises ( SALOME::SALOME_Exception );
/*!
- * Mesh a subShape.
+ * Mesh a subShape.
* First, verify list of hypothesis associated with the subShape,
* return NOK if hypothesis are not sufficient
*/
- boolean Compute( in SMESH_Mesh theMesh,
- in GEOM::GEOM_Object theSubObject )
+ boolean Compute( in SMESH_Mesh theMesh,
+ in GEOM::GEOM_Object theSubObject )
raises ( SALOME::SALOME_Exception );
/*!
* Return true if hypotheses are defined well
*/
- boolean IsReadyToCompute( in SMESH_Mesh theMesh,
- in GEOM::GEOM_Object theSubObject )
+ boolean IsReadyToCompute( in SMESH_Mesh theMesh,
+ in GEOM::GEOM_Object theSubObject )
raises ( SALOME::SALOME_Exception );
/*!
* Evaluates size of prospective mesh on a shape
*/
- long_array Evaluate(in SMESH_Mesh theMesh,
- in GEOM::GEOM_Object theSubObject)
+ long_array Evaluate(in SMESH_Mesh theMesh,
+ in GEOM::GEOM_Object theSubObject)
raises ( SALOME::SALOME_Exception );
/*!
* First, verify list of hypothesis associated with the subShape.
* Return mesh preview structure
*/
- MeshPreviewStruct Precompute( in SMESH_Mesh theMesh,
- in GEOM::GEOM_Object theSubObject,
- in Dimension theDimension,
- inout long_array theShapesId )
+ MeshPreviewStruct Precompute( in SMESH_Mesh theMesh,
+ in GEOM::GEOM_Object theSubObject,
+ in Dimension theDimension,
+ inout long_array theShapesId )
raises ( SALOME::SALOME_Exception );
/*!
* Return errors of hypotheses definintion
* 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 )
raises ( SALOME::SALOME_Exception );
* Return errors of mesh computation
* 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 )
raises ( SALOME::SALOME_Exception );
/*!
* 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
*/
GEOM::GEOM_Object GetGeometryByMeshElement( in SMESH_Mesh theMesh,
* The returned geometrical object not published in study by this method.
*/
GEOM::GEOM_Object FindGeometryByMeshElement( in SMESH_Mesh theMesh,
- in long theElementID)
+ in long theElementID)
raises ( SALOME::SALOME_Exception );
/*!
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-
// SMESH SMESHClient : tool to update client mesh structure by mesh from server
// File : SMESH_Client.cxx
// Author : Pavel TELKOV
// Module : SMESH
-//
+
#include "SMESH_Client.hxx"
#include "SMESH_Mesh.hxx"
//=======================================================================
//function : AddNodesWithID
//=======================================================================
- inline void AddNodesWithID(SMDS_Mesh* theMesh,
+ inline void AddNodesWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : Add0DElementsWithID
//=======================================================================
- inline void Add0DElementsWithID(SMDS_Mesh* theMesh,
+ inline void Add0DElementsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : AddEdgesWithID
//=======================================================================
- inline void AddEdgesWithID(SMDS_Mesh* theMesh,
+ inline void AddEdgesWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : AddTriasWithID
//=======================================================================
- inline void AddTriasWithID(SMDS_Mesh* theMesh,
+ inline void AddTriasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : AddQuadsWithID
//=======================================================================
- inline void AddQuadsWithID(SMDS_Mesh* theMesh,
+ inline void AddQuadsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : AddPolygonsWithID
//=======================================================================
- inline void AddPolygonsWithID(SMDS_Mesh* theMesh,
+ inline void AddPolygonsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : AddTetrasWithID
//=======================================================================
- inline void AddTetrasWithID(SMDS_Mesh* theMesh,
+ inline void AddTetrasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : AddPiramidsWithID
//=======================================================================
- inline void AddPiramidsWithID(SMDS_Mesh* theMesh,
+ inline void AddPiramidsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : AddPrismsWithID
//=======================================================================
- inline void AddPrismsWithID(SMDS_Mesh* theMesh,
+ inline void AddPrismsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : AddHexasWithID
//=======================================================================
- inline void AddHexasWithID(SMDS_Mesh* theMesh,
+ inline void AddHexasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : AddPolyhedronsWithID
//=======================================================================
- inline void AddPolyhedronsWithID (SMDS_Mesh* theMesh,
+ inline void AddPolyhedronsWithID (SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : AddQuadEdgesWithID
//=======================================================================
- inline void AddQuadEdgesWithID(SMDS_Mesh* theMesh,
+ inline void AddQuadEdgesWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : AddQuadTriasWithID
//=======================================================================
- inline void AddQuadTriasWithID(SMDS_Mesh* theMesh,
+ inline void AddQuadTriasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : AddQuadQuadsWithID
//=======================================================================
- inline void AddQuadQuadsWithID(SMDS_Mesh* theMesh,
+ inline void AddQuadQuadsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : AddQuadTetrasWithID
//=======================================================================
- inline void AddQuadTetrasWithID(SMDS_Mesh* theMesh,
+ inline void AddQuadTetrasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : AddQuadPiramidsWithID
//=======================================================================
- inline void AddQuadPiramidsWithID(SMDS_Mesh* theMesh,
+ inline void AddQuadPiramidsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : AddQuadPentasWithID
//=======================================================================
- inline void AddQuadPentasWithID(SMDS_Mesh* theMesh,
+ inline void AddQuadPentasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : AddQuadHexasWithID
//=======================================================================
- inline void AddQuadHexasWithID(SMDS_Mesh* theMesh,
+ inline void AddQuadHexasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
//=======================================================================
//function : ChangePolyhedronNodes
//=======================================================================
- inline void ChangePolyhedronNodes (SMDS_Mesh* theMesh,
+ inline void ChangePolyhedronNodes (SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
}
//=======================================================================
-SMESH::SMESH_Gen_var
+SMESH::SMESH_Gen_var
SMESH_Client::GetSMESHGen(CORBA::ORB_ptr theORB,
CORBA::Boolean& theIsEmbeddedMode)
{
static SMESH::SMESH_Gen_var aMeshGen;
- if(CORBA::is_nil(aMeshGen.in())){
+ if(CORBA::is_nil(aMeshGen.in())){
#ifdef WNT
long aClientPID = (long)_getpid();
#else
SALOME_NamingService aNamingService(theORB);
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);
-
+
std::string aClientHostName = Kernel_Utils::GetHostname();
Engines::Container_var aServerContainer = aMeshGen->GetContainerRef();
CORBA::String_var aServerHostName = aServerContainer->getHostName();
//=======================================================================
// function : Create()
-// purpose :
+// purpose :
//=======================================================================
SMESH_Client::SMESH_Client(CORBA::ORB_ptr theORB,
SMESH::SMESH_Mesh_ptr theMesh):
//=================================================================================
-SMDS_Mesh*
-SMESH_Client::GetMesh() const
+SMDS_Mesh*
+SMESH_Client::GetMesh() const
{
- return mySMDSMesh;
+ return mySMDSMesh;
}
SMESH::SMESH_Mesh_ptr
SMESH_Client::GetMeshServer()
{
- return myMeshServer.in();
+ return myMeshServer.in();
}
anIsModified = aLength > 0;
if( MYDEBUG )
MESSAGE( "Update: length of the script is "<<aLength );
-
+
if(!anIsModified)
return false;
for( ; anElemId < aNbElems; anElemId++ )
mySMDSMesh->RemoveNode( FindNode( mySMDSMesh, anIndexes[anElemId] ) );
break;
-
+
case SMESH::REMOVE_ELEMENT:
for( ; anElemId < aNbElems; anElemId++ )
mySMDSMesh->RemoveElement( FindElement( mySMDSMesh, anIndexes[anElemId] ) );
mySMDSMesh->Renumber( anIndexes[i], anIndexes[i+1], anIndexes[i+2] );
}
break;
-
+
default:;
}
}
MESSAGE("Update - mySMDSMesh->NbVolumes() = "<<mySMDSMesh->NbVolumes());
}
} // end of update mesh by log script
-
+
return anIsModified;
}
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
// File : SMESH_Gen_i.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
-//
+
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
try {
PortableServer::Servant aServant = GetPOA()->reference_to_servant( theObject );
return aServant;
- }
+ }
catch (...) {
- INFOS( "GetServant - Unknown exception was caught!!!" );
+ INFOS( "GetServant - Unknown exception was caught!!!" );
return NULL;
}
}
/*!
* GetNS [ static ]
*
- * Get SALOME_NamingService object
+ * Get SALOME_NamingService object
*/
//=============================================================================
*
* Get SALOME_LifeCycleCORBA object
*/
-//=============================================================================
+//=============================================================================
SALOME_LifeCycleCORBA* SMESH_Gen_i::GetLCC() {
if ( myLCC == NULL ) {
myLCC = new SALOME_LifeCycleCORBA( GetNS() );
*
* Get GEOM::GEOM_Gen reference
*/
-//=============================================================================
+//=============================================================================
GEOM::GEOM_Gen_ptr SMESH_Gen_i::GetGeomEngine() {
//CCRT GEOM::GEOM_Gen_var aGeomEngine =
//CCRT GEOM::GEOM_Gen::_narrow( GetLCC()->FindOrLoad_Component("FactoryServer","GEOM") );
//CCRT return aGeomEngine._retn();
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);
}
return myGeomGen;
//=============================================================================
/*!
- * SMESH_Gen_i::SMESH_Gen_i
+ * SMESH_Gen_i::SMESH_Gen_i
*
* Standard constructor, used with Container
*/
SMESH_Gen_i::SMESH_Gen_i( CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
- PortableServer::ObjectId* contId,
- const char* instanceName,
+ PortableServer::ObjectId* contId,
+ const char* instanceName,
const char* interfaceName )
: Engines_Component_i( orb, poa, contId, instanceName, interfaceName )
{
myOrb = CORBA::ORB::_duplicate(orb);
myPoa = PortableServer::POA::_duplicate(poa);
-
+
_thisObj = this ;
_id = myPoa->activate_object( _thisObj );
-
+
myIsEmbeddedMode = false;
myShapeReader = NULL; // shape reader
mySMESHGen = this;
}
myStudyContextMap.clear();
// delete shape reader
- if ( !myShapeReader )
+ if ( !myShapeReader )
delete myShapeReader;
}
-
+
//=============================================================================
/*!
* SMESH_Gen_i::createHypothesis
}
else
{
- //try to use new format
+ //try to use new format
#ifdef WNT
aPlatformLibName = new char[ libNameLen + 5 ];
aPlatformLibName[0] = '\0';
// activate the CORBA servant of hypothesis
hypothesis_i = SMESH::SMESH_Hypothesis::_narrow( myHypothesis_i->_this() );
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();
}
GEOM_Client* SMESH_Gen_i::GetShapeReader()
{
// create shape reader if necessary
- if ( !myShapeReader )
+ if ( !myShapeReader )
myShapeReader = new GEOM_Client(GetContainerRef());
ASSERT( myShapeReader );
return myShapeReader;
// create study context, if it doesn't exist and set current study
int studyId = GetCurrentStudyID();
if ( myStudyContextMap.find( studyId ) == myStudyContextMap.end() ) {
- myStudyContextMap[ studyId ] = new StudyContext;
+ myStudyContextMap[ studyId ] = new StudyContext;
}
// myCurrentStudy may be nil
if ( !CORBA::is_nil( myCurrentStudy ) ) {
- SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
if( !myCurrentStudy->FindComponent( "GEOM" )->_is_nil() )
aStudyBuilder->LoadWith( myCurrentStudy->FindComponent( "GEOM" ), GetGeomEngine() );
//=============================================================================
/*!
- * SMESH_Gen_i::GetCurrentStudyContext
+ * SMESH_Gen_i::GetCurrentStudyContext
*
* Get current study context
*/
//=============================================================================
/*!
- * SMESH_Gen_i::CreateHypothesis
+ * SMESH_Gen_i::CreateHypothesis
*
* Create hypothesis/algorothm of given type and publish it in the study
*/
aStudyBuilder->NewCommand(); // There is a transaction
aResult->length( aNames.size() );
int i = 0;
-
+
// Iterate through all meshes and create mesh objects
for ( list<string>::iterator it = aNames.begin(); it != aNames.end(); it++ ) {
// Python Dump
// create mesh
SMESH::SMESH_Mesh_var mesh = createMesh();
-
+
// publish mesh in the study
SALOMEDS::SObject_var aSO;
if ( CanPublishInStudy( mesh ) )
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::IsReadyToCompute" );
if ( CORBA::is_nil( theShapeObject ) )
- THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference",
+ THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference",
SALOME::BAD_PARAM );
if ( CORBA::is_nil( theMesh ) )
*/
//================================================================================
-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 )
throw ( SALOME::SALOME_Exception )
{
shape = GeomObjectToShape( theSubObject );
else
shape = SMESH_Mesh::PseudoShape();
-
+
::SMESH_Mesh& mesh = meshServant->GetImpl();
error_array->length( mesh.GetMeshDS()->MaxShapeIndex() );
return error_array._retn();
}
-//
+//
//================================================================================
/*!
* \brief Return mesh elements preventing computation of a subshape
*/
//================================================================================
-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 )
throw ( SALOME::SALOME_Exception )
{
myLocShape = GeomObjectToShape( theSubObject );
else
myLocShape = SMESH_Mesh::PseudoShape();
-
+
::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
list< ::SMESH_Gen::TAlgoStateError > error_list;
list< ::SMESH_Gen::TAlgoStateError >::iterator error;
try
{
TopoDS_Shape myMainShape = GeomObjectToShape(theMainShapeObject);
- TopTools_IndexedMapOfShape myIndexToShape;
+ TopTools_IndexedMapOfShape myIndexToShape;
TopExp::MapShapes(myMainShape,myIndexToShape);
for ( int i = 0; i < theListOfSubShapeObject.length(); i++ )
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Compute" );
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 );
if ( CORBA::is_nil( theMesh ) )
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Precompute" );
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 );
if ( CORBA::is_nil( theMesh ) )
SMESH_subMesh* sm = myLocMesh.GetSubMeshContaining(*idIt);
if ( !sm || !sm->IsMeshComputed() )
continue;
-
+
const TopoDS_Shape& aSh = sm->GetSubShape();
const int shDim = myGen.GetShapeDim( aSh );
if ( shDim < 1 || shDim > theDimension )
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Evaluate" );
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 );
if ( CORBA::is_nil( theMesh ) )
throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
-
+
GEOM::GEOM_Object_var geom = FindGeometryByMeshElement(theMesh, theElementID);
if ( !geom->_is_nil() ) {
GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh();
//================================================================================
SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Concatenate(const SMESH::mesh_array& theMeshesArray,
- CORBA::Boolean theUniteIdenticalGroups,
- CORBA::Boolean theMergeNodesAndElements,
+ CORBA::Boolean theUniteIdenticalGroups,
+ CORBA::Boolean theMergeNodesAndElements,
CORBA::Double theMergeTolerance)
throw ( SALOME::SALOME_Exception )
{
SMESH::SMESH_Mesh_ptr
SMESH_Gen_i::ConcatenateWithGroups(const SMESH::mesh_array& theMeshesArray,
- CORBA::Boolean theUniteIdenticalGroups,
- CORBA::Boolean theMergeNodesAndElements,
+ CORBA::Boolean theUniteIdenticalGroups,
+ CORBA::Boolean theMergeNodesAndElements,
CORBA::Double theMergeTolerance)
throw ( SALOME::SALOME_Exception )
{
SMESH::SMESH_Mesh_ptr
SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
- CORBA::Boolean theUniteIdenticalGroups,
- CORBA::Boolean theMergeNodesAndElements,
+ CORBA::Boolean theUniteIdenticalGroups,
+ CORBA::Boolean theMergeNodesAndElements,
CORBA::Double theMergeTolerance,
CORBA::Boolean theCommonGroups)
throw ( SALOME::SALOME_Exception )
// create mesh
SMESH::SMESH_Mesh_var aNewMesh = CreateEmptyMesh();
-
+
SMESHDS_Mesh* aNewMeshDS = 0;
if ( !aNewMesh->_is_nil() ) {
SMESH_Mesh_i* aNewImpl = dynamic_cast<SMESH_Mesh_i*>( GetServant( aNewMesh ).in() );
const SMDS_VtkVolume* aVolume =
dynamic_cast<const SMDS_VtkVolume*> (anElem);
if ( aVolume ) {
- aNewElem = aNewMeshDS->AddPolyhedralVolume(aNodesArray,
+ aNewElem = aNewMeshDS->AddPolyhedralVolume(aNodesArray,
aVolume->GetQuantities());
elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID()));
if( theCommonGroups )
}
}
else {
-
+
aNewElem = aNewEditor.AddElement(aNodesArray,
anElemType,
anElem->IsPoly());
else if( anElemType == SMDSAbs_Volume )
anIDsVolumes[anNbVolumes++] = aNewElem->GetID();
}
- }
+ }
}//elems loop
// copy orphan nodes
default:
break;
}
-
+
aListOfNewGroups.clear();
aListOfNewGroups.push_back(aNewGroup);
aGroupsMap.insert(make_pair( make_pair(aGroupName, aGroupType), aListOfNewGroups ));
for (int j = 0; j < anInitIDs->length(); j++) {
anNewIDs[j] = elemsMap.find(anInitIDs[j])->second;
}
-
+
// check that current group name and type don't have identical ones in union mesh
if ( anIter == aGroupsMap.end() ) {
// add a new group in the mesh
aNewGroup = aNewImpl->CreateGroup(aGroupType, aGroupName);
// add elements into new group
aNewGroup->Add( anNewIDs );
-
+
aListOfNewGroups.push_back(aNewGroup);
aGroupsMap.insert(make_pair( make_pair(aGroupName, aGroupType), aListOfNewGroups ));
}
// rename identical groups
aNewGroup = aNewImpl->CreateGroup(aGroupType, aGroupName);
aNewGroup->Add( anNewIDs );
-
+
TListOfNewGroups& aNewGroups = anIter->second;
string aNewGroupName;
if (aNewGroups.size() == 1) {
}
}
}
-
+
// Update Python script
aPythonDump << aNewMesh << " = " << this;
if( !theCommonGroups )
SMESH_Mesh_i* srcMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( srcMesh );
if ( !srcMesh_i )
THROW_SALOME_CORBA_EXCEPTION( "bad mesh of IDSource", SALOME::BAD_PARAM );
-
+
SMESHDS_Mesh* srcMeshDS = srcMesh_i->GetImpl().GetMeshDS();
// 2. Make a new mesh
// ASSERT( theComponent->GetStudy()->StudyId() == myCurrentStudy->StudyId() )
// san -- in case <myCurrentStudy> differs from theComponent's study,
// use that of the component
- if ( myCurrentStudy->_is_nil() ||
+ if ( myCurrentStudy->_is_nil() ||
theComponent->GetStudy()->StudyId() != myCurrentStudy->StudyId() )
SetCurrentStudy( theComponent->GetStudy() );
aFileSeq->length( NUM_TMP_FILES );
TCollection_AsciiString aStudyName( "" );
- if ( isMultiFile )
+ if ( isMultiFile )
aStudyName = ( (char*)SALOMEDS_Tool::GetNameFromPath( myCurrentStudy->URL() ).c_str() );
// Set names of temporary files
if ( ok ) {
// san - it is impossible to recover applied hypotheses
// 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
//string myRefOnObject = myRefOnHyp->GetID();
if ( ok ) {
// san - it is impossible to recover applied algorithms
// 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
//string myRefOnObject = myRefOnAlgo->GetID();
SMESHDS_GroupBase* aGrpBaseDS = myGroupImpl->GetGroupDS();
if ( !aGrpBaseDS )
continue;
-
+
CORBA::String_var objStr = GetORB()->object_to_string( aSubObject );
int anId = myStudyContext->findId( string( objStr.in() ) );
aDataset->WriteOnDisk( anRGB );
aDataset->CloseOnDisk();
- // Pass SMESHDS_Group to MED writer
+ // Pass SMESHDS_Group to MED writer
SMESHDS_Group* aGrpDS = dynamic_cast<SMESHDS_Group*>( aGrpBaseDS );
if ( aGrpDS )
myWriter.AddGroup( aGrpDS );
}
aGroup->CloseOnDisk();
}
- } // loop on groups
-
+ } // loop on groups
+
if ( strcmp( strHasData.c_str(), "1" ) == 0 )
{
// Flush current mesh information into MED file
myWriter.Perform();
-
+
// maybe a shape was deleted in the study
if ( !shapeRefFound && !mySMESHDSMesh->ShapeToMesh().IsNull() && hasShape) {
TopoDS_Shape nullShape;
myLocMesh.ShapeToMesh( nullShape ); // remove shape referring data
}
-
+
if ( !mySMESHDSMesh->SubMeshes().empty() )
{
// Store submeshes
// ----------------
aGroup = new HDFgroup( "Submeshes", aTopGroup );
aGroup->CreateOnDisk();
-
+
// each element belongs to one or none submesh,
// so for each node/element, we store a submesh ID
-
+
// Make maps of submesh IDs of elements sorted by element IDs
typedef int TElemID;
typedef int TSubMID;
for ( itElem = aSubMesh->GetElements(); itElem->more(); ++hint)
hint = eId2smId.insert( hint, make_pair( itElem->next()->GetID(), aSubMeID ));
}
-
+
// Care of elements that are not on submeshes
if ( mySMESHDSMesh->NbNodes() != nId2smId.size() ) {
for ( itNode = mySMESHDSMesh->nodesIterator(); itNode->more(); )
for ( itElem = mySMESHDSMesh->elementsIterator(); itElem->more(); )
eId2smId.insert( make_pair( itElem->next()->GetID(), 0 ));
}
-
+
// Store submesh IDs
for ( int isNode = 0; isNode < 2; ++isNode )
{
//
delete[] smIDs;
}
-
+
// Store node positions on sub-shapes (SMDS_Position):
// ----------------------------------------------------
-
+
aGroup = new HDFgroup( "Node Positions", aTopGroup );
aGroup->CreateOnDisk();
-
+
// in aGroup, create 5 datasets to contain:
// "Nodes on Edges" - ID of node on edge
// "Edge positions" - U parameter on node on edge
// "Nodes on Faces" - ID of node on face
// "Face U positions" - U parameter of node on face
// "Face V positions" - V parameter of node on face
-
+
// Find out nb of nodes on edges and faces
// Collect corresponing sub-meshes
int nbEdgeNodes = 0, nbFaceNodes = 0;
continue; // submesh containing other submeshs
int nbNodes = aSubMesh->NbNodes();
if ( nbNodes == 0 ) continue;
-
+
int aShapeID = (*itSubM).first;
if ( aShapeID < 1 || aShapeID > mySMESHDSMesh->MaxShapeIndex() )
continue;
int* aNodeIDs = new int [ nbNodes ];
double* aUPos = new double [ nbNodes ];
double* aVPos = ( onFace ? new double[ nbNodes ] : 0 );
-
+
// Fill arrays
// loop on sub-meshes
list<SMESHDS_SubMesh*> * pListSM = ( onFace ? &aFaceSM : &aEdgeSM );
for ( ; itSM != pListSM->end(); itSM++ )
{
SMESHDS_SubMesh* aSubMesh = (*itSM);
-
+
SMDS_NodeIteratorPtr itNode = aSubMesh->GetNodes();
// loop on nodes in aSubMesh
while ( itNode->more() )
//node ID
const SMDS_MeshNode* node = itNode->next();
aNodeIDs [ iNode ] = node->GetID();
-
+
// Position
const SMDS_PositionPtr pos = node->GetPosition();
if ( onFace ) { // on FACE
}
} // loop on nodes in aSubMesh
} // loop on sub-meshes
-
+
// Write datasets
if ( nbNodes )
{
aDataset->CreateOnDisk();
aDataset->WriteOnDisk( aNodeIDs );
aDataset->CloseOnDisk();
-
+
// U Positions
aDSName = ( onFace ? "Face U positions" : "Edge positions");
aDataset = new HDFdataset( (char*)aDSName.c_str(), aGroup, HDF_FLOAT64, aSize, 1);
delete [] aNodeIDs;
delete [] aUPos;
if ( aVPos ) delete [] aVPos;
-
+
} // treat positions on edges or faces
-
+
// close "Node Positions" group
- aGroup->CloseOnDisk();
-
+ aGroup->CloseOnDisk();
+
} // if ( there are submeshes in SMESHDS_Mesh )
} // if ( hasData )
-
+
// close mesh HDF group
aTopGroup->CloseOnDisk();
}
}
}
}
-
+
// close HDF file
aFile->CloseOnDisk();
delete aFile;
aStreamFile = SALOMEDS_Tool::PutFilesToStream( tmpDir.ToCString(), aFileSeq.in(), isMultiFile );
// Remove temporary files and directory
- if ( !isMultiFile )
+ if ( !isMultiFile )
SALOMEDS_Tool::RemoveTemporaryFiles( tmpDir.ToCString(), aFileSeq.in(), true );
INFOS( "SMESH_Gen_i::Save() completed" );
buffer[size * 3] = '\0';
SALOMEDS::TMPFile_var anAsciiStreamFile = new SALOMEDS::TMPFile(size*3, size*3, buffer, 1);
-
+
return anAsciiStreamFile._retn();
}
if ( aStudy->_is_nil() )
return;
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
aStudyBuilder->LoadWith( theCompRoot, GetGeomEngine() );
}
//=============================================================================
{
INFOS( "SMESH_Gen_i::Load" );
- if ( myCurrentStudy->_is_nil() ||
+ if ( myCurrentStudy->_is_nil() ||
theComponent->GetStudy()->StudyId() != myCurrentStudy->StudyId() )
SetCurrentStudy( theComponent->GetStudy() );
// Get temporary files location
TCollection_AsciiString tmpDir =
isMultiFile ? TCollection_AsciiString( ( char* )theURL ) : ( char* )SALOMEDS_Tool::GetTmpDir().c_str();
-
+
INFOS( "THE URL++++++++++++++" )
INFOS( theURL );
INFOS( "THE TMP PATH+++++++++" );
tmpDir.ToCString(),
isMultiFile );
TCollection_AsciiString aStudyName( "" );
- if ( isMultiFile )
+ if ( isMultiFile )
aStudyName = ( (char*)SALOMEDS_Tool::GetNameFromPath( myCurrentStudy->URL() ).c_str() );
// Set names of temporary files
list< pair< SMESH_Mesh_i*, HDFgroup* > > meshGroupList;
// get total number of top-level groups
- int aNbGroups = aFile->nInternalObjects();
+ int aNbGroups = aFile->nInternalObjects();
if ( aNbGroups > 0 ) {
// --> in first turn we should read&create hypotheses
if ( aFile->ExistInternalObject( "Hypotheses" ) ) {
// open hypotheses root HDF group
- aTopGroup = new HDFgroup( "Hypotheses", aFile );
+ aTopGroup = new HDFgroup( "Hypotheses", aFile );
aTopGroup->OpenOnDisk();
// get number of hypotheses
- int aNbObjects = aTopGroup->nInternalObjects();
+ int aNbObjects = aTopGroup->nInternalObjects();
for ( int j = 0; j < aNbObjects; j++ ) {
// try to identify hypothesis
char hypGrpName[ HDF_NAME_MAX_LEN+1 ];
if ( string( hypGrpName ).substr( 0, 10 ) == string( "Hypothesis" ) ) {
// open hypothesis group
- aGroup = new HDFgroup( hypGrpName, aTopGroup );
+ aGroup = new HDFgroup( hypGrpName, aTopGroup );
aGroup->OpenOnDisk();
// --> get hypothesis id
// --> then we should read&create algorithms
if ( aFile->ExistInternalObject( "Algorithms" ) ) {
// open algorithms root HDF group
- aTopGroup = new HDFgroup( "Algorithms", aFile );
+ aTopGroup = new HDFgroup( "Algorithms", aFile );
aTopGroup->OpenOnDisk();
// get number of algorithms
- int aNbObjects = aTopGroup->nInternalObjects();
+ int aNbObjects = aTopGroup->nInternalObjects();
for ( int j = 0; j < aNbObjects; j++ ) {
// try to identify algorithm
char hypGrpName[ HDF_NAME_MAX_LEN+1 ];
if ( string( hypGrpName ).substr( 0, 9 ) == string( "Algorithm" ) ) {
// open algorithm group
- aGroup = new HDFgroup( hypGrpName, aTopGroup );
+ aGroup = new HDFgroup( hypGrpName, aTopGroup );
aGroup->OpenOnDisk();
// --> get algorithm id
continue;
// open mesh HDF group
- aTopGroup = new HDFgroup( meshName, aFile );
+ aTopGroup = new HDFgroup( meshName, aFile );
aTopGroup->OpenOnDisk();
// get number of child HDF objects
- int aNbObjects = aTopGroup->nInternalObjects();
+ int aNbObjects = aTopGroup->nInternalObjects();
if ( aNbObjects > 0 ) {
// create mesh
if(MYDEBUG) MESSAGE( "VSR - load mesh : id = " << id );
aGroup = new HDFgroup( "Applied Algorithms", aTopGroup );
aGroup->OpenOnDisk();
// get number of applied algorithms
- int aNbSubObjects = aGroup->nInternalObjects();
+ int aNbSubObjects = aGroup->nInternalObjects();
if(MYDEBUG) MESSAGE( "VSR - number of applied algos " << aNbSubObjects );
for ( int j = 0; j < aNbSubObjects; j++ ) {
char name_dataset[ HDF_NAME_MAX_LEN+1 ];
aGroup = new HDFgroup( "Applied Hypotheses", aTopGroup );
aGroup->OpenOnDisk();
// get number of applied hypotheses
- int aNbSubObjects = aGroup->nInternalObjects();
+ int aNbSubObjects = aGroup->nInternalObjects();
for ( int j = 0; j < aNbSubObjects; j++ ) {
char name_dataset[ HDF_NAME_MAX_LEN+1 ];
aGroup->InternalObjectIndentify( j, name_dataset );
aGroup->OpenOnDisk();
// get number of submeshes
- int aNbSubMeshes = aGroup->nInternalObjects();
+ int aNbSubMeshes = aGroup->nInternalObjects();
for ( int k = 0; k < aNbSubMeshes; k++ ) {
// identify submesh
char name_submeshgroup[ HDF_NAME_MAX_LEN+1 ];
aSubSubGroup = new HDFgroup( "Applied Algorithms", aSubGroup );
aSubSubGroup->OpenOnDisk();
// get number of applied algorithms
- int aNbSubObjects = aSubSubGroup->nInternalObjects();
+ int aNbSubObjects = aSubSubGroup->nInternalObjects();
for ( int l = 0; l < aNbSubObjects; l++ ) {
char name_dataset[ HDF_NAME_MAX_LEN+1 ];
aSubSubGroup->InternalObjectIndentify( l, name_dataset );
aSubSubGroup = new HDFgroup( "Applied Hypotheses", aSubGroup );
aSubSubGroup->OpenOnDisk();
// get number of applied hypotheses
- int aNbSubObjects = aSubSubGroup->nInternalObjects();
+ int aNbSubObjects = aSubSubGroup->nInternalObjects();
for ( int l = 0; l < aNbSubObjects; l++ ) {
char name_dataset[ HDF_NAME_MAX_LEN+1 ];
aSubSubGroup->InternalObjectIndentify( l, name_dataset );
else
{
// open a group
- aGroup = new HDFgroup( "Submeshes", aTopGroup );
+ aGroup = new HDFgroup( "Submeshes", aTopGroup );
aGroup->OpenOnDisk();
int maxID = Max( mySMESHDSMesh->MaxSubMeshIndex(), mySMESHDSMesh->MaxShapeIndex() );
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;
double *aEpos = 0, *aFupos = 0, *aFvpos = 0;
// open a group
- aGroup = new HDFgroup( "Node Positions", aTopGroup );
+ aGroup = new HDFgroup( "Node Positions", aTopGroup );
aGroup->OpenOnDisk();
// loop on 5 data sets
aGroup = new HDFgroup( name_group, aTopGroup );
aGroup->OpenOnDisk();
// get number of groups
- int aNbSubObjects = aGroup->nInternalObjects();
+ int aNbSubObjects = aGroup->nInternalObjects();
for ( int j = 0; j < aNbSubObjects; j++ ) {
char name_dataset[ HDF_NAME_MAX_LEN+1 ];
aGroup->InternalObjectIndentify( j, name_dataset );
SMESH::ElementType type = (SMESH::ElementType)(ii - GetNodeGroupsTag() + 1);
SMESH::SMESH_GroupBase_var aNewGroup = SMESH::SMESH_GroupBase::_duplicate
( myNewMeshImpl->createGroup( type, nameFromFile, aShape ) );
- // Obtain a SMESHDS_Group object
+ // Obtain a SMESHDS_Group object
if ( aNewGroup->_is_nil() )
continue;
anOrderIds.push_back( TListOfInt() );
else
anOrderIds.back().push_back(smIDs[ i ]);
-
+
myNewMeshImpl->GetImpl().SetMeshOrder( anOrderIds );
}
} // loop on meshes
myLocShape = myLocMesh.GetShapeToMesh();
else
myLocShape = SMESH_Mesh::PseudoShape();
-
+
myLocMesh.GetSubMesh(myLocShape)->
ComputeStateEngine (SMESH_subMesh::SUBMESH_RESTORED);
}
// close mesh group
if(aTopGroup)
- aTopGroup->CloseOnDisk();
+ aTopGroup->CloseOnDisk();
}
// close HDF file
aFile->CloseOnDisk();
delete aFile;
// Remove temporary files created from the stream
- if ( !isMultiFile )
+ if ( !isMultiFile )
SALOMEDS_Tool::RemoveTemporaryFiles( tmpDir.ToCString(), aFileSeq.in(), true );
INFOS( "SMESH_Gen_i::Load completed" );
}
SALOMEDS::TMPFile_var aRealStreamFile = new SALOMEDS::TMPFile(real_size, real_size, buffer, 1);
-
+
return Load( theComponent, *(aRealStreamFile._retn()), theURL, isMultiFile );
}
// printf( "--------------------------- SMESH_Gen_i::Close, delete aGroup = %p \n", i_mesh->second );
// delete i_mesh->second;
// }
-
+
// delete SMESHDS_Mesh's
// it's too long on big meshes
// delete context->myDocument;
// context->myDocument = 0;
// }
-
+
myCurrentStudy = SALOMEDS::Study::_nil();
return;
}
//=============================================================================
/*!
* SMESH_Gen_i::ComponentDataType
- *
+ *
* Get component data type
*/
//=============================================================================
return CORBA::string_dup( "SMESH" );
}
-
+
//=============================================================================
/*!
* SMESH_Gen_i::IORToLocalPersistentID
- *
+ *
* Transform data from transient form to persistent
*/
//=============================================================================
{
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::IORToLocalPersistentID" );
StudyContext* myStudyContext = GetCurrentStudyContext();
-
+
if ( myStudyContext && strcmp( IORString, "" ) != 0 ) {
int anId = myStudyContext->findId( IORString );
if ( anId ) {
//=======================================================================
//function : RegisterObject
-//purpose :
+//purpose :
//=======================================================================
int SMESH_Gen_i::RegisterObject(CORBA::Object_ptr theObject)
{
return myCurrentStudy->_is_nil() || myCurrentStudy->_non_existent() ? -1 : myCurrentStudy->StudyId();
}
-
+
//=============================================================================
-/*!
+/*!
* SMESHEngine_factory
*
- * C factory, accessible with dlsym, after dlopen
+ * C factory, accessible with dlsym, after dlopen
*/
//=============================================================================
extern "C"
{ SMESH_I_EXPORT
PortableServer::ObjectId* SMESHEngine_factory( CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
+ PortableServer::POA_ptr poa,
PortableServer::ObjectId* contId,
- const char* instanceName,
+ const char* instanceName,
const char* interfaceName )
{
if(MYDEBUG) MESSAGE( "PortableServer::ObjectId* SMESHEngine_factory()" );