Update to match the new implementation of SMDS

This commit is contained in:
jrt 2003-09-04 10:41:22 +00:00
parent fb91f8b907
commit dd138f193f
8 changed files with 1479 additions and 1573 deletions

View File

@ -571,7 +571,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
int meshId = myMesh->GetId(); int meshId = myMesh->GetId();
SMESH_Mesh_i* meshServant = myStudyContext->mapMesh_i[meshId]; SMESH_Mesh_i* meshServant = myStudyContext->mapMesh_i[meshId];
::SMESH_Mesh& myLocMesh = meshServant->GetImpl(); ::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
Handle(SMESHDS_Mesh) mySMESHDSMesh = myLocMesh.GetMeshDS(); SMESHDS_Mesh* mySMESHDSMesh = myLocMesh.GetMeshDS();
SCRUTE(mySMESHDSMesh->NbNodes()); SCRUTE(mySMESHDSMesh->NbNodes());
if (mySMESHDSMesh->NbNodes()>0) {//checks if the mesh is not empty if (mySMESHDSMesh->NbNodes()>0) {//checks if the mesh is not empty
@ -1136,7 +1136,7 @@ bool SMESH_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
int meshId = myNewMesh->GetId(); int meshId = myNewMesh->GetId();
SMESH_Mesh_i* meshServant = myStudyContext->mapMesh_i[meshId]; SMESH_Mesh_i* meshServant = myStudyContext->mapMesh_i[meshId];
::SMESH_Mesh& myLocMesh = meshServant->GetImpl(); ::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
Handle(SMESHDS_Mesh) mySMESHDSMesh = myLocMesh.GetMeshDS(); SMESHDS_Mesh* mySMESHDSMesh = myLocMesh.GetMeshDS();
DriverMED_R_SMESHDS_Mesh* myReader = new DriverMED_R_SMESHDS_Mesh; DriverMED_R_SMESHDS_Mesh* myReader = new DriverMED_R_SMESHDS_Mesh;

File diff suppressed because it is too large Load Diff

View File

@ -37,147 +37,131 @@
#include "SMDS_MeshElement.hxx" #include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx" #include "SMDS_MeshNode.hxx"
#include "SMDS_MeshFacesIterator.hxx"
#include "SMDS_MeshEdgesIterator.hxx"
#include "SMDS_MeshNodesIterator.hxx"
#include "SMDS_MeshVolumesIterator.hxx"
#define MED_NBR_GEOMETRIE_MAILLE 15 #define MED_NBR_GEOMETRIE_MAILLE 15
#define MED_NBR_TYPE 5 #define MED_NBR_TYPE 5
class SMESH_Mesh_i; class SMESH_Mesh_i;
class SMESH_MEDMesh_i: class SMESH_MEDMesh_i:
public POA_SALOME_MED::MESH, public POA_SALOME_MED::MESH, public PortableServer::RefCountServantBase
public PortableServer::RefCountServantBase
{ {
public : public: private: protected:
// C++ object containing values
::SMESH_Mesh_i * _mesh_i;
SMESHDS_Mesh *_meshDS;
private : string _meshId;
bool _compte;
bool _creeFamily;
int _indexElts;
int _indexEnts;
int _famIdent;
protected: map < SALOME_MED::medGeometryElement, int >_mapIndToSeqElts;
// C++ object containing values Engines::long_array_var _seq_elemId[MED_NBR_GEOMETRIE_MAILLE];
::SMESH_Mesh_i* _mesh_i;
Handle (SMESHDS_Mesh) _meshDS;
string _meshId;
bool _compte;
bool _creeFamily;
int _indexElts;
int _indexEnts;
int _famIdent;
map <SALOME_MED::medGeometryElement,int> _mapIndToSeqElts; map < SALOME_MED::medEntityMesh, int >_mapNbTypes;
Engines::long_array_var _seq_elemId[MED_NBR_GEOMETRIE_MAILLE]; map < SALOME_MED::medEntityMesh, int >_mapIndToVectTypes;
vector < SALOME_MED::medGeometryElement >
_TypesId[MED_NBR_GEOMETRIE_MAILLE];
map <SALOME_MED::medEntityMesh,int> _mapNbTypes; vector < SALOME_MED::FAMILY_ptr > _families;
map <SALOME_MED::medEntityMesh,int> _mapIndToVectTypes; public:
vector<SALOME_MED::medGeometryElement> _TypesId[MED_NBR_GEOMETRIE_MAILLE];
vector<SALOME_MED::FAMILY_ptr> _families; // Constructors and associated internal methods
public: SMESH_MEDMesh_i();
SMESH_MEDMesh_i(SMESH_Mesh_i * m);
~SMESH_MEDMesh_i();
// Constructors and associated internal methods // IDL Methods
SMESH_MEDMesh_i(); char *getName() throw(SALOME::SALOME_Exception);
SMESH_MEDMesh_i(SMESH_Mesh_i* m); CORBA::Long getSpaceDimension() throw(SALOME::SALOME_Exception);
~SMESH_MEDMesh_i(); CORBA::Long getMeshDimension() throw(SALOME::SALOME_Exception);
// IDL Methods char *getCoordinateSystem() throw(SALOME::SALOME_Exception);
char * getName() throw (SALOME::SALOME_Exception); Engines::double_array * getCoordinates(SALOME_MED::medModeSwitch typeSwitch)
CORBA::Long getSpaceDimension() throw (SALOME::SALOME_Exception); throw(SALOME::SALOME_Exception);
CORBA::Long getMeshDimension() throw (SALOME::SALOME_Exception); Engines::string_array * getCoordinatesNames()
throw(SALOME::SALOME_Exception);
Engines::string_array * getCoordinatesUnits()
throw(SALOME::SALOME_Exception);
CORBA::Long getNumberOfNodes() throw(SALOME::SALOME_Exception);
char * getCoordinateSystem() CORBA::Long getNumberOfTypes(SALOME_MED::medEntityMesh entity)
throw (SALOME::SALOME_Exception); throw(SALOME::SALOME_Exception);
Engines::double_array* getCoordinates(SALOME_MED::medModeSwitch typeSwitch) SALOME_MED::medGeometryElement_array *
throw (SALOME::SALOME_Exception); getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME::
Engines::string_array* getCoordinatesNames() SALOME_Exception);
throw (SALOME::SALOME_Exception);
Engines::string_array* getCoordinatesUnits()
throw (SALOME::SALOME_Exception);
CORBA::Long getNumberOfNodes()
throw (SALOME::SALOME_Exception);
CORBA::Long getNumberOfTypes (SALOME_MED::medEntityMesh entity) CORBA::Long getNumberOfElements(SALOME_MED::medEntityMesh entity,
throw (SALOME::SALOME_Exception); SALOME_MED::medGeometryElement geomElement)
SALOME_MED::medGeometryElement_array* getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME::SALOME_Exception);
throw (SALOME::SALOME_Exception); Engines::long_array * getConnectivity(SALOME_MED::medModeSwitch typeSwitch,
SALOME_MED::medConnectivity mode,
SALOME_MED::medEntityMesh entity,
SALOME_MED::medGeometryElement geomElement)
throw(SALOME::SALOME_Exception);
Engines::long_array * getConnectivityIndex(SALOME_MED::medConnectivity mode,
SALOME_MED::medEntityMesh entity) throw(SALOME::SALOME_Exception);
CORBA::Long getNumberOfElements (SALOME_MED::medEntityMesh entity, CORBA::Long getElementNumber(SALOME_MED::medConnectivity mode,
SALOME_MED::medGeometryElement geomElement) SALOME_MED::medEntityMesh entity,
throw (SALOME::SALOME_Exception); SALOME_MED::medGeometryElement type,
Engines::long_array* getConnectivity (SALOME_MED::medModeSwitch typeSwitch, const Engines::long_array & connectivity)
SALOME_MED::medConnectivity mode, throw(SALOME::SALOME_Exception);
SALOME_MED::medEntityMesh entity,
SALOME_MED::medGeometryElement geomElement)
throw (SALOME::SALOME_Exception);
Engines::long_array* getConnectivityIndex(SALOME_MED::medConnectivity mode,
SALOME_MED::medEntityMesh entity)
throw (SALOME::SALOME_Exception);
CORBA::Long getElementNumber(SALOME_MED::medConnectivity mode, Engines::long_array *
SALOME_MED::medEntityMesh entity, getReverseConnectivity(SALOME_MED::medConnectivity mode) throw(SALOME::
SALOME_MED::medGeometryElement type, SALOME_Exception);
const Engines::long_array & connectivity) Engines::long_array *
throw (SALOME::SALOME_Exception); getReverseConnectivityIndex(SALOME_MED::
medConnectivity mode) throw(SALOME::SALOME_Exception);
Engines::long_array* getReverseConnectivity(SALOME_MED::medConnectivity mode) // Family and Group
CORBA::Long getNumberOfFamilies(SALOME_MED::medEntityMesh entity)
throw(SALOME::SALOME_Exception);
CORBA::Long getNumberOfGroups(SALOME_MED::medEntityMesh entity)
throw(SALOME::SALOME_Exception);
SALOME_MED::Family_array * getFamilies(SALOME_MED::medEntityMesh entity)
throw(SALOME::SALOME_Exception);
SALOME_MED::FAMILY_ptr getFamily(SALOME_MED::medEntityMesh entity,
CORBA::Long i) throw(SALOME::SALOME_Exception);
SALOME_MED::Group_array * getGroups(SALOME_MED::medEntityMesh entity)
throw(SALOME::SALOME_Exception);
SALOME_MED::GROUP_ptr getGroup(SALOME_MED::medEntityMesh entity,
CORBA::Long i) throw(SALOME::SALOME_Exception);
//
SALOME_MED::FIELD_ptr getVolume(SALOME_MED::SUPPORT_ptr mySupport)
throw(SALOME::SALOME_Exception);
SALOME_MED::FIELD_ptr getArea(SALOME_MED::SUPPORT_ptr mySupport)
throw(SALOME::SALOME_Exception);
SALOME_MED::FIELD_ptr getLength(SALOME_MED::SUPPORT_ptr mySupport)
throw(SALOME::SALOME_Exception);
SALOME_MED::FIELD_ptr getNormal(SALOME_MED::SUPPORT_ptr mySupport)
throw(SALOME::SALOME_Exception);
SALOME_MED::FIELD_ptr getBarycenter(SALOME_MED::SUPPORT_ptr mySupport)
throw(SALOME::SALOME_Exception);
SALOME_MED::FIELD_ptr getNeighbourhood(SALOME_MED::SUPPORT_ptr mySupport)
throw(SALOME::SALOME_Exception);
throw (SALOME::SALOME_Exception); // Others
Engines::long_array* getReverseConnectivityIndex(SALOME_MED::medConnectivity mode) void addInStudy(SALOMEDS::Study_ptr myStudy,
throw (SALOME::SALOME_Exception); SALOME_MED::MESH_ptr myIor) throw(SALOME::SALOME_Exception);
CORBA::Long addDriver(SALOME_MED::medDriverTypes driverType,
const char *fileName, const char *meshName)
throw(SALOME::SALOME_Exception);
void rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception);
void read(CORBA::Long i) throw(SALOME::SALOME_Exception);
void write(CORBA::Long i, const char *driverMeshName)
throw(SALOME::SALOME_Exception);
// Family and Group // Cuisine interne
CORBA::Long getNumberOfFamilies (SALOME_MED::medEntityMesh entity) CORBA::Long getCorbaIndex() throw(SALOME::SALOME_Exception);
throw (SALOME::SALOME_Exception);
CORBA::Long getNumberOfGroups (SALOME_MED::medEntityMesh entity)
throw (SALOME::SALOME_Exception);
SALOME_MED::Family_array* getFamilies (SALOME_MED::medEntityMesh entity)
throw (SALOME::SALOME_Exception);
SALOME_MED::FAMILY_ptr getFamily (SALOME_MED::medEntityMesh entity,
CORBA::Long i)
throw (SALOME::SALOME_Exception);
SALOME_MED::Group_array* getGroups (SALOME_MED::medEntityMesh entity)
throw (SALOME::SALOME_Exception);
SALOME_MED::GROUP_ptr getGroup (SALOME_MED::medEntityMesh entity,
CORBA::Long i)
throw (SALOME::SALOME_Exception);
//
SALOME_MED::FIELD_ptr getVolume (SALOME_MED::SUPPORT_ptr mySupport)
throw (SALOME::SALOME_Exception);
SALOME_MED::FIELD_ptr getArea (SALOME_MED::SUPPORT_ptr mySupport)
throw (SALOME::SALOME_Exception);
SALOME_MED::FIELD_ptr getLength (SALOME_MED::SUPPORT_ptr mySupport)
throw (SALOME::SALOME_Exception);
SALOME_MED::FIELD_ptr getNormal (SALOME_MED::SUPPORT_ptr mySupport)
throw (SALOME::SALOME_Exception);
SALOME_MED::FIELD_ptr getBarycenter (SALOME_MED::SUPPORT_ptr mySupport)
throw (SALOME::SALOME_Exception);
SALOME_MED::FIELD_ptr getNeighbourhood (SALOME_MED::SUPPORT_ptr mySupport)
throw (SALOME::SALOME_Exception);
//
// Others void calculeNbElts() throw(SALOME::SALOME_Exception);
void addInStudy (SALOMEDS::Study_ptr myStudy, void createFamilies() throw(SALOME::SALOME_Exception);
SALOME_MED::MESH_ptr myIor)
throw (SALOME::SALOME_Exception);
CORBA::Long addDriver (SALOME_MED::medDriverTypes driverType,
const char* fileName, const char* meshName)
throw (SALOME::SALOME_Exception);
void rmDriver (CORBA::Long i)
throw (SALOME::SALOME_Exception);
void read (CORBA::Long i)
throw (SALOME::SALOME_Exception);
void write (CORBA::Long i, const char* driverMeshName)
throw (SALOME::SALOME_Exception);
// Cuisine interne
CORBA::Long getCorbaIndex() throw (SALOME::SALOME_Exception);
//
void calculeNbElts() throw (SALOME::SALOME_Exception);
void createFamilies() throw (SALOME::SALOME_Exception);
}; };
#endif /* _MED_MESH_I_HXX_ */ #endif /* _MED_MESH_I_HXX_ */

View File

@ -31,7 +31,6 @@ using namespace std;
#include <TopoDS_Iterator.hxx> #include <TopoDS_Iterator.hxx>
#include "SMESHDS_Mesh.hxx" #include "SMESHDS_Mesh.hxx"
#include "SMDS_MapIteratorOfExtendedMap.hxx"
#include "SMESH_subMesh.hxx" #include "SMESH_subMesh.hxx"
#include "SMESH_Mesh_i.hxx" #include "SMESH_Mesh_i.hxx"
@ -44,8 +43,8 @@ using namespace std;
//============================================================================= //=============================================================================
SMESH_MEDSupport_i::SMESH_MEDSupport_i() SMESH_MEDSupport_i::SMESH_MEDSupport_i()
{ {
BEGIN_OF("Default Constructor SMESH_MEDSupport_i"); BEGIN_OF("Default Constructor SMESH_MEDSupport_i");
END_OF("Default Constructor SMESH_MEDSupport_i"); END_OF("Default Constructor SMESH_MEDSupport_i");
} }
//============================================================================= //=============================================================================
@ -53,70 +52,68 @@ SMESH_MEDSupport_i::SMESH_MEDSupport_i()
* Constructor * Constructor
*/ */
//============================================================================= //=============================================================================
SMESH_MEDSupport_i::SMESH_MEDSupport_i(SMESH_subMesh_i* sm, SMESH_MEDSupport_i::SMESH_MEDSupport_i(SMESH_subMesh_i * sm, string name,
string name, string description, SALOME_MED::medEntityMesh entity)
string description, :_subMesh_i(sm), _name(name), _description(description), _entity(entity),
SALOME_MED::medEntityMesh entity) : _seqNumber(false), _seqLength(0)
_subMesh_i(sm),
_name(name),
_description(description),
_entity(entity),
_seqNumber(false),
_seqLength(0)
{ {
BEGIN_OF("Constructor SMESH_MEDSupport_i"); BEGIN_OF("Constructor SMESH_MEDSupport_i");
_meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS(); _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS();
int subMeshId = _subMesh_i->GetId(); int subMeshId = _subMesh_i->GetId();
MESSAGE ( " subMeshId " << subMeshId ) MESSAGE(" subMeshId " << subMeshId)
if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) != _subMesh_i->_mesh_i->_mapSubMesh.end()) {
::SMESH_subMesh* subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId];
_subMeshDS = subMesh->GetSubMeshDS();
}
if ( _entity == SALOME_MED::MED_NODE) if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) !=
{ _subMesh_i->_mesh_i->_mapSubMesh.end())
_numberOfGeometricType = 1 ; {
_geometricType = new SALOME_MED::medGeometryElement[1] ; ::SMESH_subMesh * subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId];
_geometricType[0] = SALOME_MED::MED_NONE ; _subMeshDS = subMesh->GetSubMeshDS();
} }
else
{
MESSAGE("Pas implemente dans cette version");
THROW_SALOME_CORBA_EXCEPTION("Seules les familles de noeuds sont implementees ", \
SALOME::BAD_PARAM);
}
END_OF("Constructor SMESH_MEDSupport_i"); if (_entity == SALOME_MED::MED_NODE)
{
_numberOfGeometricType = 1;
_geometricType = new SALOME_MED::medGeometryElement[1];
_geometricType[0] = SALOME_MED::MED_NONE;
}
else
{
MESSAGE("Pas implemente dans cette version");
THROW_SALOME_CORBA_EXCEPTION
("Seules les familles de noeuds sont implementees ",
SALOME::BAD_PARAM);
}
END_OF("Constructor SMESH_MEDSupport_i");
} }
//============================================================================= //=============================================================================
/*! /*!
* Constructor * Constructor
*/ */
//============================================================================= //=============================================================================
SMESH_MEDSupport_i::SMESH_MEDSupport_i(const SMESH_MEDSupport_i &s) : SMESH_MEDSupport_i::
_subMesh_i(s._subMesh_i), SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s):_subMesh_i(s._subMesh_i),
_name(s._name), _name(s._name), _description(s._description), _entity(s._entity),
_description(s._description), _seqNumber(false), _seqLength(0)
_entity(s._entity),
_seqNumber(false),
_seqLength(0)
{ {
BEGIN_OF("Constructor SMESH_MEDSupport_i"); BEGIN_OF("Constructor SMESH_MEDSupport_i");
_meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS(); _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS();
int subMeshId = _subMesh_i->GetId(); int subMeshId = _subMesh_i->GetId();
if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) != _subMesh_i->_mesh_i->_mapSubMesh.end()) { if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) !=
::SMESH_subMesh* subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId]; _subMesh_i->_mesh_i->_mapSubMesh.end())
_subMeshDS = subMesh->GetSubMeshDS(); {
} ::SMESH_subMesh * subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId];
_subMeshDS = subMesh->GetSubMeshDS();
}
END_OF("Constructor SMESH_MEDSupport_i"); END_OF("Constructor SMESH_MEDSupport_i");
} }
//============================================================================= //=============================================================================
/*! /*!
* Destructor * Destructor
@ -126,21 +123,20 @@ SMESH_MEDSupport_i::SMESH_MEDSupport_i(const SMESH_MEDSupport_i &s) :
SMESH_MEDSupport_i::~SMESH_MEDSupport_i() SMESH_MEDSupport_i::~SMESH_MEDSupport_i()
{ {
} }
//============================================================================= //=============================================================================
/*! /*!
* CORBA: Accessor for Corba Index * CORBA: Accessor for Corba Index
*/ */
//============================================================================= //=============================================================================
CORBA::Long SMESH_MEDSupport_i::getCorbaIndex() CORBA::Long SMESH_MEDSupport_i::getCorbaIndex()throw(SALOME::SALOME_Exception)
throw (SALOME::SALOME_Exception)
{ {
if (_subMeshDS==NULL) if (_subMeshDS == NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR); SALOME::INTERNAL_ERROR);
MESSAGE("Not implemented for SMESH_i"); MESSAGE("Not implemented for SMESH_i");
THROW_SALOME_CORBA_EXCEPTION("Not Implemented ", \ THROW_SALOME_CORBA_EXCEPTION("Not Implemented ", SALOME::BAD_PARAM);
SALOME::BAD_PARAM);
} }
@ -150,13 +146,12 @@ CORBA::Long SMESH_MEDSupport_i::getCorbaIndex()
*/ */
//============================================================================= //=============================================================================
char * SMESH_MEDSupport_i::getName() char *SMESH_MEDSupport_i::getName() throw(SALOME::SALOME_Exception)
throw (SALOME::SALOME_Exception)
{ {
if (_subMeshDS.IsNull()) if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR); SALOME::INTERNAL_ERROR);
return CORBA::string_dup(_name.c_str()); return CORBA::string_dup(_name.c_str());
} }
@ -166,13 +161,12 @@ char * SMESH_MEDSupport_i::getName()
*/ */
//============================================================================= //=============================================================================
char* SMESH_MEDSupport_i::getDescription() char *SMESH_MEDSupport_i::getDescription() throw(SALOME::SALOME_Exception)
throw (SALOME::SALOME_Exception)
{ {
if (_subMeshDS.IsNull()) if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR); SALOME::INTERNAL_ERROR);
return CORBA::string_dup(_description.c_str()); return CORBA::string_dup(_description.c_str());
} }
//============================================================================= //=============================================================================
@ -181,14 +175,14 @@ char* SMESH_MEDSupport_i::getDescription()
*/ */
//============================================================================= //=============================================================================
SALOME_MED::MESH_ptr SMESH_MEDSupport_i::getMesh() SALOME_MED::MESH_ptr SMESH_MEDSupport_i::getMesh()throw(SALOME::
throw (SALOME::SALOME_Exception) SALOME_Exception)
{ {
if (_subMeshDS.IsNull()) if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR); SALOME::INTERNAL_ERROR);
return _subMesh_i->_mesh_i->GetMEDMesh(); return _subMesh_i->_mesh_i->GetMEDMesh();
} }
//============================================================================= //=============================================================================
@ -197,48 +191,37 @@ SALOME_MED::MESH_ptr SMESH_MEDSupport_i::getMesh()
*/ */
//============================================================================= //=============================================================================
CORBA::Boolean SMESH_MEDSupport_i::isOnAllElements() CORBA::Boolean SMESH_MEDSupport_i::isOnAllElements()throw(SALOME::
throw (SALOME::SALOME_Exception) SALOME_Exception)
{ {
if (_subMeshDS.IsNull()) if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR); SALOME::INTERNAL_ERROR);
if (_seqNumber == false) if (_seqNumber == false)
{ {
if (_entity != SALOME_MED::MED_NONE) if (_entity != SALOME_MED::MED_NONE)
{ {
int i = 0; _seqLength = _subMeshDS->NbNodes();
const SMDS_MapOfMeshElement& myNodesMap = _subMeshDS->GetNodes(); _seqNumber = true;
for (SMDS_MapIteratorOfExtendedMap it(myNodesMap); it.More(); it.Next()) }
{ else
const Handle(SMDS_MeshElement)& elem = myNodesMap.FindID(it.Key()->GetID()); {
const Handle(SMDS_MeshNode)& node = _meshDS->GetNode(1,elem); MESSAGE("Only Node Families are implemented ");
i ++; THROW_SALOME_CORBA_EXCEPTION("Not implemented Yet ",
SALOME::BAD_PARAM);
}
} }
_seqLength=i; try
_seqNumber=true; {
} _isOnAllElements = (_seqLength == _meshDS->NbNodes());
else }
{ catch(...)
MESSAGE("Only Node Families are implemented "); {
THROW_SALOME_CORBA_EXCEPTION("Not implemented Yet ", \ MESSAGE("unable to acces related Mesh");
SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
} SALOME::INTERNAL_ERROR);
} };
try return _isOnAllElements;
{
if (_seqLength == _meshDS->NbNodes())
_isOnAllElements=true;
else
_isOnAllElements=false;
}
catch(...)
{
MESSAGE("unable to acces related Mesh");
THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
SALOME::INTERNAL_ERROR);
};
return _isOnAllElements;
} }
//============================================================================= //=============================================================================
@ -247,13 +230,13 @@ CORBA::Boolean SMESH_MEDSupport_i::isOnAllElements()
*/ */
//============================================================================= //=============================================================================
SALOME_MED::medEntityMesh SMESH_MEDSupport_i::getEntity() SALOME_MED::medEntityMesh SMESH_MEDSupport_i::getEntity()throw(SALOME::
throw (SALOME::SALOME_Exception) SALOME_Exception)
{ {
if (_subMeshDS.IsNull()) if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR); SALOME::INTERNAL_ERROR);
return _entity; return _entity;
} }
//============================================================================= //=============================================================================
@ -262,29 +245,30 @@ SALOME_MED::medEntityMesh SMESH_MEDSupport_i::getEntity()
*/ */
//============================================================================= //=============================================================================
SALOME_MED::medGeometryElement_array * SMESH_MEDSupport_i::getTypes() SALOME_MED::medGeometryElement_array *
throw (SALOME::SALOME_Exception) SMESH_MEDSupport_i::getTypes()throw(SALOME::SALOME_Exception)
{ {
if (_subMeshDS.IsNull()) if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR); SALOME::INTERNAL_ERROR);
SALOME_MED::medGeometryElement_array_var myseq = new SALOME_MED::medGeometryElement_array; SALOME_MED::medGeometryElement_array_var myseq =
try new SALOME_MED::medGeometryElement_array;
{ try
int mySeqLength = _numberOfGeometricType;
myseq->length(mySeqLength);
for (int i=0;i<mySeqLength;i++)
{ {
myseq[i]=_geometricType[i]; int mySeqLength = _numberOfGeometricType;
myseq->length(mySeqLength);
for (int i = 0; i < mySeqLength; i++)
{
myseq[i] = _geometricType[i];
}
} }
} catch(...)
catch(...) {
{ MESSAGE("Exception lors de la recherche des differents types");
MESSAGE("Exception lors de la recherche des differents types"); THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support Types",
THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support Types", \ SALOME::INTERNAL_ERROR);
SALOME::INTERNAL_ERROR); }
} return myseq._retn();
return myseq._retn();
} }
//============================================================================= //=============================================================================
@ -293,13 +277,13 @@ SALOME_MED::medGeometryElement_array * SMESH_MEDSupport_i::getTypes()
* existing in the support * existing in the support
*/ */
//============================================================================= //=============================================================================
CORBA::Long SMESH_MEDSupport_i::getNumberOfElements(SALOME_MED::medGeometryElement geomElement) CORBA::Long SMESH_MEDSupport_i::getNumberOfElements(SALOME_MED::
throw (SALOME::SALOME_Exception) medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
{ {
if (_subMeshDS.IsNull()) if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR); SALOME::INTERNAL_ERROR);
return _numberOfGeometricType; return _numberOfGeometricType;
} }
@ -309,39 +293,38 @@ CORBA::Long SMESH_MEDSupport_i::getNumberOfElements(SALOME_MED::medGeometryEleme
*/ */
//============================================================================= //=============================================================================
Engines::long_array * SMESH_MEDSupport_i::getNumber(SALOME_MED::medGeometryElement geomElement) Engines::long_array * SMESH_MEDSupport_i::getNumber(
throw (SALOME::SALOME_Exception) SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
{ {
if (_subMeshDS.IsNull()) if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR); SALOME::INTERNAL_ERROR);
// A changer s'il ne s agit plus seulement de famille de noeuds
if (geomElement != SALOME_MED::MED_NONE)
THROW_SALOME_CORBA_EXCEPTION("Not implemented", SALOME::BAD_PARAM);
// A changer s'il ne s agit plus seulement de famille de noeuds Engines::long_array_var myseq = new Engines::long_array;
if (geomElement != SALOME_MED::MED_NONE)
THROW_SALOME_CORBA_EXCEPTION("Not implemented", \
SALOME::BAD_PARAM);
Engines::long_array_var myseq= new Engines::long_array; int i = 0;
myseq->length(_subMeshDS->NbNodes());
const set<const SMDS_MeshNode*> & myNodesMap = _subMeshDS->GetNodes();
set<const SMDS_MeshNode*>::const_iterator it=myNodesMap.begin();
int i =0; for (; it!=myNodesMap.end(); it++)
const SMDS_MapOfMeshElement& myNodesMap = _subMeshDS->GetNodes(); {
for (SMDS_MapIteratorOfExtendedMap it(myNodesMap); it.More(); it.Next()) myseq[i] = (*it)->GetID();
{ SCRUTE((*it)->GetID());
const Handle(SMDS_MeshElement)& elem = myNodesMap.FindID(it.Key()->GetID()); SCRUTE(myseq[i]);
const Handle(SMDS_MeshNode)& node = _meshDS->GetNode(1,elem); i++;
myseq->length(i+1); };
myseq[i]=node->GetID();
SCRUTE(node->GetID()); SCRUTE(myseq->length());
SCRUTE(myseq[i]); MESSAGE("End of SMESH_MEDSupport_i::getNumber");
i++; return myseq._retn();
};
SCRUTE(myseq->length());
MESSAGE("yyyyy");
return myseq._retn();
} }
//============================================================================= //=============================================================================
/*! /*!
* CORBA: Global Nodes Index (optionnaly designed by the user) * CORBA: Global Nodes Index (optionnaly designed by the user)
@ -349,13 +332,12 @@ MESSAGE("yyyyy");
*/ */
//============================================================================= //=============================================================================
Engines::long_array * SMESH_MEDSupport_i::getNumberIndex() Engines::long_array *
throw (SALOME::SALOME_Exception) SMESH_MEDSupport_i::getNumberIndex()throw(SALOME::SALOME_Exception)
{ {
MESSAGE("Not implemented for SMESH_i"); MESSAGE("Not implemented for SMESH_i");
THROW_SALOME_CORBA_EXCEPTION("Not Implemented", \ THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
SALOME::BAD_PARAM); return 0;
return 0;
} }
//============================================================================= //=============================================================================
@ -364,10 +346,9 @@ Engines::long_array * SMESH_MEDSupport_i::getNumberIndex()
*/ */
//============================================================================= //=============================================================================
CORBA::Long SMESH_MEDSupport_i::getNumberOfGaussPoints(SALOME_MED::medGeometryElement geomElement) CORBA::Long SMESH_MEDSupport_i::getNumberOfGaussPoints(SALOME_MED::
throw (SALOME::SALOME_Exception) medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
{ {
MESSAGE("Not implemented for SMESH_i"); MESSAGE("Not implemented for SMESH_i");
return 0; return 0;
} }

View File

@ -1,28 +1,28 @@
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
// //
// //
// //
// File : SMESH_MEDSupport_i.hxx // File : SMESH_MEDSupport_i.hxx
// Module : SMESH // Module : SMESH
#ifndef _MED_SMESH_MEDSUPPORT_I_HXX_ #ifndef _MED_SMESH_MEDSUPPORT_I_HXX_
#define _MED_SMESH_MEDSUPPORT_I_HXX_ #define _MED_SMESH_MEDSUPPORT_I_HXX_
@ -40,62 +40,52 @@
class SMESH_subMesh_i; class SMESH_subMesh_i;
class SMESH_MEDSupport_i: class SMESH_MEDSupport_i:
public POA_SALOME_MED::SUPPORT, public POA_SALOME_MED::SUPPORT, public PortableServer::RefCountServantBase
public PortableServer::RefCountServantBase
{ {
public:
protected : // Constructors and associated internal methods
SMESH_MEDSupport_i(); SMESH_MEDSupport_i(SMESH_subMesh_i * sm,
~SMESH_MEDSupport_i(); string name, string description, SALOME_MED::medEntityMesh entity);
SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s);
// IDL Methods
char *getName() throw(SALOME::SALOME_Exception);
char *getDescription() throw(SALOME::SALOME_Exception);
SALOME_MED::MESH_ptr getMesh() throw(SALOME::SALOME_Exception);
CORBA::Boolean isOnAllElements() throw(SALOME::SALOME_Exception);
SALOME_MED::medEntityMesh getEntity() throw(SALOME::SALOME_Exception);
CORBA::Long getNumberOfElements(SALOME_MED::medGeometryElement geomElement)
throw(SALOME::SALOME_Exception);
Engines::long_array * getNumber(SALOME_MED::medGeometryElement geomElement)
throw(SALOME::SALOME_Exception);
Engines::long_array * getNumberIndex() throw(SALOME::SALOME_Exception);
CORBA::Long getNumberOfGaussPoints(SALOME_MED::
medGeometryElement geomElement) throw(SALOME::SALOME_Exception);
SALOME_MED::medGeometryElement_array *
getTypes() throw(SALOME::SALOME_Exception);
CORBA::Long getCorbaIndex() throw(SALOME::SALOME_Exception);
void createSeq() throw(SALOME::SALOME_Exception);
public : public: //public field
const SMESHDS_SubMesh * _subMeshDS;
Handle_SMESHDS_SubMesh _subMeshDS; ::SMESH_subMesh_i * _subMesh_i;
::SMESH_subMesh_i* _subMesh_i;
Handle_SMESHDS_Mesh _meshDS; SMESHDS_Mesh * _meshDS;
string _name; string _name;
string _description; string _description;
bool _isOnAllElements; bool _isOnAllElements;
bool _seqNumber; bool _seqNumber;
int _seqLength; int _seqLength;
SALOME_MED::medEntityMesh _entity; SALOME_MED::medEntityMesh _entity;
SALOME_MED::medGeometryElement * _geometricType; SALOME_MED::medGeometryElement * _geometricType;
int _numberOfGeometricType; int _numberOfGeometricType;
public:
// Constructors and associated internal methods
SMESH_MEDSupport_i(SMESH_subMesh_i* sm,
string name,
string description,
SALOME_MED::medEntityMesh entity);
SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s);
// IDL Methods
char * getName() throw (SALOME::SALOME_Exception);
char * getDescription() throw (SALOME::SALOME_Exception);
SALOME_MED::MESH_ptr getMesh() throw (SALOME::SALOME_Exception);
CORBA::Boolean isOnAllElements() throw (SALOME::SALOME_Exception);
SALOME_MED::medEntityMesh getEntity() throw (SALOME::SALOME_Exception);
CORBA::Long getNumberOfElements(SALOME_MED::medGeometryElement geomElement)
throw (SALOME::SALOME_Exception);
Engines::long_array* getNumber(SALOME_MED::medGeometryElement geomElement)
throw (SALOME::SALOME_Exception);
Engines::long_array* getNumberIndex()
throw (SALOME::SALOME_Exception);
CORBA::Long getNumberOfGaussPoints(SALOME_MED::medGeometryElement geomElement)
throw (SALOME::SALOME_Exception);
SALOME_MED::medGeometryElement_array* getTypes()
throw (SALOME::SALOME_Exception);
CORBA::Long getCorbaIndex() throw (SALOME::SALOME_Exception);
void createSeq() throw (SALOME::SALOME_Exception);
protected:
SMESH_MEDSupport_i();
~SMESH_MEDSupport_i();
}; };
#endif /* _MED_MEDSUPPORT_I_HXX_ */ #endif /* _MED_MEDSUPPORT_I_HXX_ */

View File

@ -29,9 +29,6 @@
using namespace std; using namespace std;
#include "SMESH_MeshEditor_i.hxx" #include "SMESH_MeshEditor_i.hxx"
#include "SMDS_MeshEdgesIterator.hxx"
#include "SMDS_MeshFacesIterator.hxx"
#include "SMDS_MeshVolumesIterator.hxx"
#include "SMDS_MeshEdge.hxx" #include "SMDS_MeshEdge.hxx"
#include "SMDS_MeshFace.hxx" #include "SMDS_MeshFace.hxx"
#include "SMDS_MeshVolume.hxx" #include "SMDS_MeshVolume.hxx"
@ -41,16 +38,15 @@ using namespace std;
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx> #include <TColStd_MapIteratorOfMapOfInteger.hxx>
//============================================================================= //=============================================================================
/*! /*!
* *
*/ */
//============================================================================= //=============================================================================
SMESH_MeshEditor_i::SMESH_MeshEditor_i(const Handle(SMESHDS_Mesh)& theMesh) { SMESH_MeshEditor_i::SMESH_MeshEditor_i(SMESHDS_Mesh* theMesh)
_myMeshDS = theMesh; {
_myMeshDS = theMesh;
}; };
//============================================================================= //=============================================================================
@ -59,13 +55,16 @@ SMESH_MeshEditor_i::SMESH_MeshEditor_i(const Handle(SMESHDS_Mesh)& theMesh) {
*/ */
//============================================================================= //=============================================================================
CORBA::Boolean SMESH_MeshEditor_i::RemoveElements(const SMESH::long_array& IDsOfElements) { CORBA::Boolean SMESH_MeshEditor_i::RemoveElements(const SMESH::
for (int i = 0 ; i< IDsOfElements.length(); i++) { long_array & IDsOfElements)
CORBA::Long index = IDsOfElements[i]; {
_myMeshDS->RemoveElement(index); for (int i = 0; i < IDsOfElements.length(); i++)
MESSAGE ( "Element "<< index << " was removed" ) {
} CORBA::Long index = IDsOfElements[i];
return true; _myMeshDS->RemoveElement(index);
MESSAGE("Element " << index << " was removed")
}
return true;
}; };
//============================================================================= //=============================================================================
@ -74,66 +73,23 @@ CORBA::Boolean SMESH_MeshEditor_i::RemoveElements(const SMESH::long_array& IDsOf
*/ */
//============================================================================= //=============================================================================
CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH::long_array& IDsOfNodes) { CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH::
long_array & IDsOfNodes)
// Here we try to collect all 1D, 2D and 3D elements which contain at least one {
// of <IDsOfNodes> in order to remove such elements. // It's nodes' turn to die
// This seems correct since e.g a triangle without 1 vertex looks nonsense. for (int i = 0; i < IDsOfNodes.length(); i++)
TColStd_MapOfInteger elemsToRemove; {
const SMDS_MeshNode * node=_myMeshDS->FindNode(IDsOfNodes[i]);
for (int i = 0 ; i< IDsOfNodes.length(); i++) { if(node==NULL)
{
CORBA::Long ID = IDsOfNodes[i]; MESSAGE("SMESH_MeshEditor_i::RemoveNodes: Node "<<IDsOfNodes[i]
<<" not found");
SMDS_MeshEdgesIterator edgeIt(_myMeshDS); continue;
for (; edgeIt.More(); edgeIt.Next()) { }
Handle(SMDS_MeshEdge) anEdge = Handle(SMDS_MeshEdge)::DownCast(edgeIt.Value()); _myMeshDS->RemoveNode(IDsOfNodes[i]);
for (Standard_Integer i = 0; i < anEdge->NbNodes(); i++) { MESSAGE("Node " << index << " was removed")
if (anEdge->GetConnection(i) == ID) {
Standard_Integer elemID = anEdge->GetID();
if (!elemsToRemove.Contains(elemID)) elemsToRemove.Add(elemID);
} }
} return true;
}
SMDS_MeshFacesIterator faceIt(_myMeshDS);
for (; faceIt.More(); faceIt.Next()) {
Handle(SMDS_MeshFace) aFace = Handle(SMDS_MeshFace)::DownCast(faceIt.Value());
for (Standard_Integer i = 0; i < aFace->NbNodes(); i++) {
if (aFace->GetConnection(i) == ID) {
Standard_Integer elemID = aFace->GetID();
if (!elemsToRemove.Contains(elemID)) elemsToRemove.Add(elemID);
}
}
}
SMDS_MeshVolumesIterator volIt(_myMeshDS);
for (; volIt.More(); volIt.Next()) {
Handle(SMDS_MeshVolume) aVol = Handle(SMDS_MeshVolume)::DownCast(volIt.Value());
for (Standard_Integer i = 0; i < aVol->NbNodes(); i++) {
if (aVol->GetConnection(i) == ID) {
Standard_Integer elemID = aVol->GetID();
if (!elemsToRemove.Contains(elemID)) elemsToRemove.Add(elemID);
}
}
}
}
// Now remove them!
TColStd_MapIteratorOfMapOfInteger it(elemsToRemove);
for (; it.More(); it.Next()) {
Standard_Integer elemID = it.Key();
_myMeshDS->RemoveElement(elemID);
MESSAGE("RemoveNodes(): element removed: " << elemID)
}
// It's nodes' turn to die
for (int i = 0 ; i< IDsOfNodes.length(); i++) {
CORBA::Long index = IDsOfNodes[i];
_myMeshDS->RemoveNode(index);
MESSAGE ( "Node "<< index << " was removed" )
}
return true;
}; };
//============================================================================= //=============================================================================
@ -142,14 +98,16 @@ CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH::long_array& IDsOfNod
*/ */
//============================================================================= //=============================================================================
CORBA::Boolean SMESH_MeshEditor_i::AddEdge(const SMESH::long_array& IDsOfNodes) { CORBA::Boolean SMESH_MeshEditor_i::AddEdge(const SMESH::long_array & IDsOfNodes)
int NbNodes = IDsOfNodes.length(); {
if ( NbNodes == 2 ) { int NbNodes = IDsOfNodes.length();
CORBA::Long index1 = IDsOfNodes[0]; if (NbNodes == 2)
CORBA::Long index2 = IDsOfNodes[1]; {
int idTri = _myMeshDS->AddEdge(index1,index2); CORBA::Long index1 = IDsOfNodes[0];
} CORBA::Long index2 = IDsOfNodes[1];
return true; _myMeshDS->AddEdge(index1, index2);
}
return true;
} }
//============================================================================= //=============================================================================
@ -159,12 +117,11 @@ CORBA::Boolean SMESH_MeshEditor_i::AddEdge(const SMESH::long_array& IDsOfNodes)
//============================================================================= //=============================================================================
CORBA::Boolean SMESH_MeshEditor_i::AddNode(CORBA::Double x, CORBA::Boolean SMESH_MeshEditor_i::AddNode(CORBA::Double x,
CORBA::Double y, CORBA::Double y, CORBA::Double z)
CORBA::Double z) { {
MESSAGE( " AddNode " << x << " , " << y << " , " << z ) MESSAGE(" AddNode " << x << " , " << y << " , " << z)
int idNode = _myMeshDS->AddNode(x,y,z); int idNode = _myMeshDS->AddNode(x, y, z)->GetID();
MESSAGE( " idNode " << idNode ) MESSAGE(" idNode " << idNode) return true;
return true;
} }
//============================================================================= //=============================================================================
@ -173,21 +130,25 @@ CORBA::Boolean SMESH_MeshEditor_i::AddNode(CORBA::Double x,
*/ */
//============================================================================= //=============================================================================
CORBA::Boolean SMESH_MeshEditor_i::AddFace(const SMESH::long_array& IDsOfNodes) { CORBA::Boolean SMESH_MeshEditor_i::AddFace(const SMESH::long_array & IDsOfNodes)
int NbNodes = IDsOfNodes.length(); {
if ( NbNodes == 3 ) { int NbNodes = IDsOfNodes.length();
CORBA::Long index1 = IDsOfNodes[0]; if (NbNodes == 3)
CORBA::Long index2 = IDsOfNodes[1]; {
CORBA::Long index3 = IDsOfNodes[2]; CORBA::Long index1 = IDsOfNodes[0];
int idTri = _myMeshDS->AddFace(index1,index2,index3); CORBA::Long index2 = IDsOfNodes[1];
} else if ( NbNodes == 4 ) { CORBA::Long index3 = IDsOfNodes[2];
CORBA::Long index1 = IDsOfNodes[0]; _myMeshDS->AddFace(index1, index2, index3);
CORBA::Long index2 = IDsOfNodes[1]; }
CORBA::Long index3 = IDsOfNodes[2]; else if (NbNodes == 4)
CORBA::Long index4 = IDsOfNodes[3]; {
int idTri = _myMeshDS->AddFace(index1,index2,index3,index4); CORBA::Long index1 = IDsOfNodes[0];
} CORBA::Long index2 = IDsOfNodes[1];
return true; CORBA::Long index3 = IDsOfNodes[2];
CORBA::Long index4 = IDsOfNodes[3];
_myMeshDS->AddFace(index1, index2, index3, index4);
}
return true;
}; };
//============================================================================= //=============================================================================
@ -196,39 +157,49 @@ CORBA::Boolean SMESH_MeshEditor_i::AddFace(const SMESH::long_array& IDsOfNodes)
*/ */
//============================================================================= //=============================================================================
CORBA::Boolean SMESH_MeshEditor_i::AddVolume(const SMESH::long_array& IDsOfNodes) { CORBA::Boolean SMESH_MeshEditor_i::AddVolume(const SMESH::
int NbNodes = IDsOfNodes.length(); long_array & IDsOfNodes)
if ( NbNodes == 4 ) { {
CORBA::Long index1 = IDsOfNodes[0]; int NbNodes = IDsOfNodes.length();
CORBA::Long index2 = IDsOfNodes[1]; if (NbNodes == 4)
CORBA::Long index3 = IDsOfNodes[2]; {
CORBA::Long index4 = IDsOfNodes[3]; CORBA::Long index1 = IDsOfNodes[0];
int idTetra = _myMeshDS->AddVolume(index1,index2,index3,index4); CORBA::Long index2 = IDsOfNodes[1];
} else if ( NbNodes == 5 ) { CORBA::Long index3 = IDsOfNodes[2];
CORBA::Long index1 = IDsOfNodes[0]; CORBA::Long index4 = IDsOfNodes[3];
CORBA::Long index2 = IDsOfNodes[1]; _myMeshDS->AddVolume(index1, index2, index3, index4);
CORBA::Long index3 = IDsOfNodes[2]; }
CORBA::Long index4 = IDsOfNodes[3]; else if (NbNodes == 5)
CORBA::Long index5 = IDsOfNodes[4]; {
int idPyramid = _myMeshDS->AddVolume(index1,index2,index3,index4,index5); CORBA::Long index1 = IDsOfNodes[0];
} else if ( NbNodes == 6 ) { CORBA::Long index2 = IDsOfNodes[1];
CORBA::Long index1 = IDsOfNodes[0]; CORBA::Long index3 = IDsOfNodes[2];
CORBA::Long index2 = IDsOfNodes[1]; CORBA::Long index4 = IDsOfNodes[3];
CORBA::Long index3 = IDsOfNodes[2]; CORBA::Long index5 = IDsOfNodes[4];
CORBA::Long index4 = IDsOfNodes[3]; _myMeshDS->AddVolume(index1, index2, index3, index4, index5);
CORBA::Long index5 = IDsOfNodes[4]; }
CORBA::Long index6 = IDsOfNodes[5]; else if (NbNodes == 6)
int idPrism = _myMeshDS->AddVolume(index1,index2,index3,index4,index5,index6); {
} else if ( NbNodes == 8 ) { CORBA::Long index1 = IDsOfNodes[0];
CORBA::Long index1 = IDsOfNodes[0]; CORBA::Long index2 = IDsOfNodes[1];
CORBA::Long index2 = IDsOfNodes[1]; CORBA::Long index3 = IDsOfNodes[2];
CORBA::Long index3 = IDsOfNodes[2]; CORBA::Long index4 = IDsOfNodes[3];
CORBA::Long index4 = IDsOfNodes[3]; CORBA::Long index5 = IDsOfNodes[4];
CORBA::Long index5 = IDsOfNodes[4]; CORBA::Long index6 = IDsOfNodes[5];
CORBA::Long index6 = IDsOfNodes[5]; _myMeshDS->AddVolume(index1, index2, index3, index4, index5, index6);
CORBA::Long index7 = IDsOfNodes[6]; }
CORBA::Long index8 = IDsOfNodes[7]; else if (NbNodes == 8)
int idHexa = _myMeshDS->AddVolume(index1,index2,index3,index4,index5,index6,index7,index8); {
} CORBA::Long index1 = IDsOfNodes[0];
return true; CORBA::Long index2 = IDsOfNodes[1];
CORBA::Long index3 = IDsOfNodes[2];
CORBA::Long index4 = IDsOfNodes[3];
CORBA::Long index5 = IDsOfNodes[4];
CORBA::Long index6 = IDsOfNodes[5];
CORBA::Long index7 = IDsOfNodes[6];
CORBA::Long index8 = IDsOfNodes[7];
_myMeshDS->AddVolume(index1, index2, index3, index4, index5, index6,
index7, index8);
}
return true;
}; };

View File

@ -34,30 +34,27 @@
#include "SMESHDS_Mesh.hxx" #include "SMESHDS_Mesh.hxx"
class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
class SMESH_MeshEditor_i:
public POA_SMESH::SMESH_MeshEditor
{ {
public: public:
SMESH_MeshEditor_i(const Handle(SMESHDS_Mesh)& theMesh); SMESH_MeshEditor_i(SMESHDS_Mesh * theMesh);
virtual ~SMESH_MeshEditor_i() {}; virtual ~ SMESH_MeshEditor_i()
{
};
// --- CORBA // --- CORBA
CORBA::Boolean RemoveElements(const SMESH::long_array& IDsOfElements); CORBA::Boolean RemoveElements(const SMESH::long_array & IDsOfElements);
CORBA::Boolean RemoveNodes(const SMESH::long_array& IDsOfNodes); CORBA::Boolean RemoveNodes(const SMESH::long_array & IDsOfNodes);
CORBA::Boolean AddNode(CORBA::Double x, CORBA::Boolean AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z);
CORBA::Double y, CORBA::Boolean AddEdge(const SMESH::long_array & IDsOfNodes);
CORBA::Double z); CORBA::Boolean AddFace(const SMESH::long_array & IDsOfNodes);
CORBA::Boolean AddEdge(const SMESH::long_array& IDsOfNodes); CORBA::Boolean AddVolume(const SMESH::long_array & IDsOfNodes);
CORBA::Boolean AddFace(const SMESH::long_array& IDsOfNodes);
CORBA::Boolean AddVolume(const SMESH::long_array& IDsOfNodes);
private: private:
SMESH::SMESH_subMesh_var _myMesh; SMESH::SMESH_subMesh_var _myMesh;
Handle (SMESHDS_Mesh) _myMeshDS; SMESHDS_Mesh *_myMeshDS;
}; };
#endif #endif

View File

@ -26,7 +26,6 @@
// Module : SMESH // Module : SMESH
// $Header$ // $Header$
using namespace std;
using namespace std; using namespace std;
#include "SMESH_Mesh_i.hxx" #include "SMESH_Mesh_i.hxx"
#include "SMESH_subMesh_i.hxx" #include "SMESH_subMesh_i.hxx"
@ -40,22 +39,12 @@ using namespace std;
#include "OpUtil.hxx" #include "OpUtil.hxx"
#include "TCollection_AsciiString.hxx" #include "TCollection_AsciiString.hxx"
// #include "SMESHDS_ListOfAsciiString.hxx"
// #include "SMESHDS_ListIteratorOfListOfAsciiString.hxx"
#include "TColStd_ListOfInteger.hxx"
#include "TColStd_ListOfReal.hxx"
#include "TColStd_ListIteratorOfListOfInteger.hxx"
#include "TColStd_ListIteratorOfListOfReal.hxx"
#include "SMESHDS_Command.hxx" #include "SMESHDS_Command.hxx"
#include "SMESHDS_CommandType.hxx" #include "SMESHDS_CommandType.hxx"
#include "SMESHDS_ListOfCommand.hxx"
#include "SMESHDS_ListIteratorOfListOfCommand.hxx"
#include "Handle_SMESHDS_Command.hxx"
#include "SMESH_MeshEditor_i.hxx" #include "SMESH_MeshEditor_i.hxx"
#include <string> #include <string>
#include <iostream> #include <iostream>
//#include <sstream>
//**** SMESHDS en champ //**** SMESHDS en champ
@ -67,8 +56,8 @@ using namespace std;
SMESH_Mesh_i::SMESH_Mesh_i() SMESH_Mesh_i::SMESH_Mesh_i()
{ {
MESSAGE("SMESH_Mesh_i: default constructor, not for use"); MESSAGE("SMESH_Mesh_i: default constructor, not for use");
ASSERT(0); ASSERT(0);
}; };
//============================================================================= //=============================================================================
@ -77,16 +66,14 @@ SMESH_Mesh_i::SMESH_Mesh_i()
*/ */
//============================================================================= //=============================================================================
SMESH_Mesh_i::SMESH_Mesh_i(SMESH_Gen_i* gen_i, SMESH_Mesh_i::SMESH_Mesh_i(SMESH_Gen_i * gen_i,
GEOM::GEOM_Gen_ptr geomEngine, GEOM::GEOM_Gen_ptr geomEngine, CORBA::Long studyId, int localId)
CORBA::Long studyId,
int localId)
{ {
MESSAGE("SMESH_Mesh_i"); MESSAGE("SMESH_Mesh_i");
_gen_i = gen_i; _gen_i = gen_i;
_id = localId; _id = localId;
_geom = GEOM::GEOM_Gen::_narrow(geomEngine); _geom = GEOM::GEOM_Gen::_narrow(geomEngine);
_studyId = studyId; _studyId = studyId;
} }
//============================================================================= //=============================================================================
@ -97,11 +84,10 @@ SMESH_Mesh_i::SMESH_Mesh_i(SMESH_Gen_i* gen_i,
SMESH_Mesh_i::~SMESH_Mesh_i() SMESH_Mesh_i::~SMESH_Mesh_i()
{ {
MESSAGE("~SMESH_Mesh_i"); MESSAGE("~SMESH_Mesh_i");
// **** // ****
}; };
//============================================================================= //=============================================================================
/*! /*!
* *
@ -109,144 +95,139 @@ SMESH_Mesh_i::~SMESH_Mesh_i()
//============================================================================= //=============================================================================
CORBA::Boolean SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_Shape_ptr aSubShape, CORBA::Boolean SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
SMESH::SMESH_Hypothesis_ptr anHyp) SMESH::SMESH_Hypothesis_ptr anHyp) throw(SALOME::SALOME_Exception)
throw (SALOME::SALOME_Exception)
{ {
MESSAGE("AddHypothesis"); MESSAGE("AddHypothesis");
// **** proposer liste de subShape (selection multiple) // **** proposer liste de subShape (selection multiple)
GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape); GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape);
if (CORBA::is_nil(mySubShape)) if (CORBA::is_nil(mySubShape))
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", \ THROW_SALOME_CORBA_EXCEPTION("bad subShape reference",
SALOME::BAD_PARAM); SALOME::BAD_PARAM);
SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp); SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp);
if (CORBA::is_nil(myHyp)) if (CORBA::is_nil(myHyp))
THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference", \ THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference",
SALOME::BAD_PARAM); SALOME::BAD_PARAM);
bool ret = false; bool ret = false;
try try
{
TopoDS_Shape myLocSubShape=
_gen_i->_ShapeReader->GetShape(_geom,mySubShape);
int hypId = myHyp->GetId();
ret = _impl->AddHypothesis(myLocSubShape, hypId);
}
catch (SALOME_Exception& S_ex)
{
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \
SALOME::BAD_PARAM);
}
return ret;
};
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Boolean
SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
SMESH::SMESH_Hypothesis_ptr anHyp)
throw (SALOME::SALOME_Exception)
{
MESSAGE("RemoveHypothesis");
// **** proposer liste de subShape (selection multiple)
GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape);
if (CORBA::is_nil(mySubShape))
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", \
SALOME::BAD_PARAM);
SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp);
if (CORBA::is_nil(myHyp))
THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference", \
SALOME::BAD_PARAM);
bool ret = false;
try
{
TopoDS_Shape myLocSubShape=
_gen_i->_ShapeReader->GetShape(_geom,mySubShape);
int hypId = myHyp->GetId();
ret = _impl->RemoveHypothesis(myLocSubShape, hypId);
}
catch (SALOME_Exception& S_ex)
{
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \
SALOME::BAD_PARAM);
}
return ret;
};
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH::ListOfHypothesis*
SMESH_Mesh_i::GetHypothesisList(GEOM::GEOM_Shape_ptr aSubShape)
throw (SALOME::SALOME_Exception)
{
MESSAGE("GetHypothesisList");
// ****
};
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetElementsOnShape(GEOM::GEOM_Shape_ptr aSubShape)
throw (SALOME::SALOME_Exception)
{
MESSAGE("SMESH_Mesh_i::GetElementsOnShape");
GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape);
if (CORBA::is_nil(mySubShape))
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", \
SALOME::BAD_PARAM);
int subMeshId = 0;
try
{
SMESH_subMesh_i* subMeshServant;
TopoDS_Shape myLocSubShape
= _gen_i->_ShapeReader->GetShape(_geom,mySubShape);
//Get or Create the SMESH_subMesh object implementation
::SMESH_subMesh * mySubMesh
= _impl->GetSubMesh(myLocSubShape);
subMeshId = mySubMesh->GetId();
// create a new subMesh object servant if there is none for the shape
if (_mapSubMesh.find(subMeshId) != _mapSubMesh.end())
{ {
ASSERT(_mapSubMesh_i.find(subMeshId) != _mapSubMesh_i.end()); TopoDS_Shape myLocSubShape =
subMeshServant = _mapSubMesh_i[subMeshId]; _gen_i->_ShapeReader->GetShape(_geom, mySubShape);
int hypId = myHyp->GetId();
ret = _impl->AddHypothesis(myLocSubShape, hypId);
} }
else catch(SALOME_Exception & S_ex)
{ {
// create and activate the CORBA servant of Mesh THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
subMeshServant = new SMESH_subMesh_i(_gen_i, this, subMeshId);
SMESH::SMESH_subMesh_var subMesh
= SMESH::SMESH_subMesh::_narrow(subMeshServant->_this());
_mapSubMesh[subMeshId] = mySubMesh;
_mapSubMesh_i[subMeshId] = subMeshServant;
_mapSubMeshIor[subMeshId]
= SMESH::SMESH_subMesh::_duplicate(subMesh);
} }
} return ret;
catch (SALOME_Exception& S_ex) };
{
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
}
ASSERT(_mapSubMeshIor.find(subMeshId) != _mapSubMeshIor.end()); //=============================================================================
return SMESH::SMESH_subMesh::_duplicate(_mapSubMeshIor[subMeshId]); /*!
*
*/
//=============================================================================
CORBA::Boolean
SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
SMESH::SMESH_Hypothesis_ptr anHyp) throw(SALOME::SALOME_Exception)
{
MESSAGE("RemoveHypothesis");
// **** proposer liste de subShape (selection multiple)
GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape);
if (CORBA::is_nil(mySubShape))
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference",
SALOME::BAD_PARAM);
SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp);
if (CORBA::is_nil(myHyp))
THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference",
SALOME::BAD_PARAM);
bool ret = false;
try
{
TopoDS_Shape myLocSubShape =
_gen_i->_ShapeReader->GetShape(_geom, mySubShape);
int hypId = myHyp->GetId();
ret = _impl->RemoveHypothesis(myLocSubShape, hypId);
}
catch(SALOME_Exception & S_ex)
{
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
}
return ret;
};
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH::ListOfHypothesis *
SMESH_Mesh_i::GetHypothesisList(GEOM::GEOM_Shape_ptr aSubShape)
throw(SALOME::SALOME_Exception)
{
MESSAGE("GetHypothesisList");
// ****
};
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetElementsOnShape(GEOM::
GEOM_Shape_ptr aSubShape) throw(SALOME::SALOME_Exception)
{
MESSAGE("SMESH_Mesh_i::GetElementsOnShape");
GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape);
if (CORBA::is_nil(mySubShape))
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference",
SALOME::BAD_PARAM);
int subMeshId = 0;
try
{
SMESH_subMesh_i *subMeshServant;
TopoDS_Shape myLocSubShape
= _gen_i->_ShapeReader->GetShape(_geom, mySubShape);
//Get or Create the SMESH_subMesh object implementation
::SMESH_subMesh * mySubMesh = _impl->GetSubMesh(myLocSubShape);
subMeshId = mySubMesh->GetId();
// create a new subMesh object servant if there is none for the shape
if (_mapSubMesh.find(subMeshId) != _mapSubMesh.end())
{
ASSERT(_mapSubMesh_i.find(subMeshId) != _mapSubMesh_i.end());
subMeshServant = _mapSubMesh_i[subMeshId];
}
else
{
// create and activate the CORBA servant of Mesh
subMeshServant = new SMESH_subMesh_i(_gen_i, this, subMeshId);
SMESH::SMESH_subMesh_var subMesh
= SMESH::SMESH_subMesh::_narrow(subMeshServant->_this());
_mapSubMesh[subMeshId] = mySubMesh;
_mapSubMesh_i[subMeshId] = subMeshServant;
_mapSubMeshIor[subMeshId]
= SMESH::SMESH_subMesh::_duplicate(subMesh);
}
}
catch(SALOME_Exception & S_ex)
{
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
}
ASSERT(_mapSubMeshIor.find(subMeshId) != _mapSubMeshIor.end());
return SMESH::SMESH_subMesh::_duplicate(_mapSubMeshIor[subMeshId]);
} }
//============================================================================= //=============================================================================
@ -255,62 +236,63 @@ SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetElementsOnShape(GEOM::GEOM_Shape_ptr a
*/ */
//============================================================================= //=============================================================================
SMESH::log_array* SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet) SMESH::log_array * SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet)
throw (SALOME::SALOME_Exception) throw(SALOME::SALOME_Exception)
{ {
MESSAGE("SMESH_Mesh_i::GetLog"); MESSAGE("SMESH_Mesh_i::GetLog");
SMESH::log_array_var aLog; SMESH::log_array_var aLog;
try try
{ {
const SMESHDS_ListOfCommand& logDS =_impl->GetLog(); list < SMESHDS_Command * >logDS = _impl->GetLog();
aLog = new SMESH::log_array; aLog = new SMESH::log_array;
int indexLog = 0; int indexLog = 0;
int lg = logDS.Extent(); int lg = logDS.size();
SCRUTE(lg); SCRUTE(lg);
aLog->length(lg); aLog->length(lg);
SMESHDS_ListIteratorOfListOfCommand its(logDS); list < SMESHDS_Command * >::iterator its = logDS.begin();
while(its.More()) while (its != logDS.end())
{ {
Handle(SMESHDS_Command) com = its.Value(); SMESHDS_Command *com = *its;
int comType = com->GetType(); int comType = com->GetType();
//SCRUTE(comType); //SCRUTE(comType);
int lgcom = com->GetNumber(); int lgcom = com->GetNumber();
//SCRUTE(lgcom); //SCRUTE(lgcom);
const TColStd_ListOfInteger& intList = com->GetIndexes(); const list < int >&intList = com->GetIndexes();
int inum = intList.Extent(); int inum = intList.size();
//SCRUTE(inum); //SCRUTE(inum);
TColStd_ListIteratorOfListOfInteger ii(intList); list < int >::const_iterator ii = intList.begin();
const TColStd_ListOfReal& coordList = com->GetCoords(); const list < double >&coordList = com->GetCoords();
int rnum = coordList.Extent(); int rnum = coordList.size();
//SCRUTE(rnum); //SCRUTE(rnum);
TColStd_ListIteratorOfListOfReal ir(coordList); list < double >::const_iterator ir = coordList.begin();
aLog[indexLog].commandType = comType; aLog[indexLog].commandType = comType;
aLog[indexLog].number = lgcom; aLog[indexLog].number = lgcom;
aLog[indexLog].coords.length(rnum); aLog[indexLog].coords.length(rnum);
aLog[indexLog].indexes.length(inum); aLog[indexLog].indexes.length(inum);
for (int i=0; i<rnum; i++) for (int i = 0; i < rnum; i++)
{ {
aLog[indexLog].coords[i] = ir.Value(); aLog[indexLog].coords[i] = *ir;
//MESSAGE(" "<<i<<" "<<ir.Value()); //MESSAGE(" "<<i<<" "<<ir.Value());
ir.Next(); ir++;
} }
for (int i=0; i<inum; i++) for (int i = 0; i < inum; i++)
{ {
aLog[indexLog].indexes[i] = ii.Value(); aLog[indexLog].indexes[i] = *ii;
//MESSAGE(" "<<i<<" "<<ii.Value()); //MESSAGE(" "<<i<<" "<<ii.Value());
ii.Next(); ii++;
} }
indexLog++; indexLog++;
its.Next(); its++;
} }
if (clearAfterGet) _impl->ClearLog(); if (clearAfterGet)
} _impl->ClearLog();
catch (SALOME_Exception& S_ex) }
{ catch(SALOME_Exception & S_ex)
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); {
} THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
return aLog._retn(); }
return aLog._retn();
} }
// SMESH::string_array* SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet) // SMESH::string_array* SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet)
@ -330,97 +312,97 @@ SMESH::log_array* SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet)
// SMESHDS_ListIteratorOfListOfCommand its(logDS); // SMESHDS_ListIteratorOfListOfCommand its(logDS);
// while(its.More()) // while(its.More())
// { // {
// Handle(SMESHDS_Command) com = its.Value(); // Handle(SMESHDS_Command) com = its.Value();
// int comType = com->GetType(); // int comType = com->GetType();
// SCRUTE(comType); // SCRUTE(comType);
// int lgcom = com->GetNumber(); // int lgcom = com->GetNumber();
// SCRUTE(lgcom); // SCRUTE(lgcom);
// logSize += lgcom; // logSize += lgcom;
// aLog->length(logSize); // aLog->length(logSize);
// SCRUTE(logSize); // SCRUTE(logSize);
// const TColStd_ListOfInteger& intList = com->GetIndexes(); // const TColStd_ListOfInteger& intList = com->GetIndexes();
// TColStd_ListIteratorOfListOfInteger ii(intList); // TColStd_ListIteratorOfListOfInteger ii(intList);
// const TColStd_ListOfReal& coordList = com->GetCoords(); // const TColStd_ListOfReal& coordList = com->GetCoords();
// TColStd_ListIteratorOfListOfReal ir(coordList); // TColStd_ListIteratorOfListOfReal ir(coordList);
// for (int icom = 1; icom <= lgcom; icom++) // for (int icom = 1; icom <= lgcom; icom++)
// { // {
// ostringstream S; // ostringstream S;
// switch (comType) // switch (comType)
// { // {
// case SMESHDS_AddNode: // case SMESHDS_AddNode:
// S << "AddNode " << ii.Value(); ii.Next(); // S << "AddNode " << ii.Value(); ii.Next();
// S << " " << ir.Value(); ir.Next(); // S << " " << ir.Value(); ir.Next();
// S << " " << ir.Value(); ir.Next(); // S << " " << ir.Value(); ir.Next();
// S << " " << ir.Value(); ir.Next(); // S << " " << ir.Value(); ir.Next();
// break; // break;
// case SMESHDS_AddEdge: // case SMESHDS_AddEdge:
// S << "AddEdge " << ii.Value(); ii.Next(); // S << "AddEdge " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// break; // break;
// case SMESHDS_AddTriangle: // case SMESHDS_AddTriangle:
// S << "AddFace " << ii.Value(); ii.Next(); // S << "AddFace " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// break; // break;
// case SMESHDS_AddQuadrangle: // case SMESHDS_AddQuadrangle:
// S << "AddFace " << ii.Value(); ii.Next(); // S << "AddFace " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// break; // break;
// case SMESHDS_AddTetrahedron: // case SMESHDS_AddTetrahedron:
// S << "AddVolume " << ii.Value(); ii.Next(); // S << "AddVolume " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// break; // break;
// case SMESHDS_AddPyramid: // case SMESHDS_AddPyramid:
// S << "AddVolume " << ii.Value(); ii.Next(); // S << "AddVolume " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// break; // break;
// case SMESHDS_AddPrism: // case SMESHDS_AddPrism:
// S << "AddVolume " << ii.Value(); ii.Next(); // S << "AddVolume " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// break; // break;
// case SMESHDS_AddHexahedron: // case SMESHDS_AddHexahedron:
// S << "AddVolume " << ii.Value(); ii.Next(); // S << "AddVolume " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next(); // S << " " << ii.Value(); ii.Next();
// break; // break;
// case SMESHDS_RemoveNode: // case SMESHDS_RemoveNode:
// S << "RemoveNode " << ii.Value(); ii.Next(); // S << "RemoveNode " << ii.Value(); ii.Next();
// break; // break;
// case SMESHDS_RemoveElement: // case SMESHDS_RemoveElement:
// S << "RemoveElement " << ii.Value(); ii.Next(); // S << "RemoveElement " << ii.Value(); ii.Next();
// break; // break;
// default: // default:
// ASSERT(0); // ASSERT(0);
// break; // break;
// } // }
// string ch = S.str(); // string ch = S.str();
// SCRUTE(ch); // SCRUTE(ch);
// aLog[indexLog++] = CORBA::string_dup(ch.c_str()); // aLog[indexLog++] = CORBA::string_dup(ch.c_str());
// } // }
// its.Next(); // its.Next();
// } // }
// if (clearAfterGet) _impl->ClearLog(); // if (clearAfterGet) _impl->ClearLog();
// } // }
@ -437,11 +419,10 @@ SMESH::log_array* SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet)
*/ */
//============================================================================= //=============================================================================
void SMESH_Mesh_i::ClearLog() void SMESH_Mesh_i::ClearLog() throw(SALOME::SALOME_Exception)
throw (SALOME::SALOME_Exception)
{ {
MESSAGE("SMESH_Mesh_i::ClearLog"); MESSAGE("SMESH_Mesh_i::ClearLog");
// **** // ****
} }
//============================================================================= //=============================================================================
@ -450,11 +431,10 @@ void SMESH_Mesh_i::ClearLog()
*/ */
//============================================================================= //=============================================================================
CORBA::Long SMESH_Mesh_i::GetId() CORBA::Long SMESH_Mesh_i::GetId()throw(SALOME::SALOME_Exception)
throw (SALOME::SALOME_Exception)
{ {
MESSAGE("SMESH_Mesh_i::GetId"); MESSAGE("SMESH_Mesh_i::GetId");
return _id; return _id;
} }
//============================================================================= //=============================================================================
@ -463,21 +443,9 @@ CORBA::Long SMESH_Mesh_i::GetId()
*/ */
//============================================================================= //=============================================================================
CORBA::Long SMESH_Mesh_i::GetStudyId() CORBA::Long SMESH_Mesh_i::GetStudyId()throw(SALOME::SALOME_Exception)
throw (SALOME::SALOME_Exception)
{ {
return _studyId; return _studyId;
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_Mesh_i::SetImpl(::SMESH_Mesh* impl)
{
MESSAGE("SMESH_Mesh_i::SetImpl");
_impl = impl;
} }
//============================================================================= //=============================================================================
@ -486,10 +454,22 @@ void SMESH_Mesh_i::SetImpl(::SMESH_Mesh* impl)
*/ */
//============================================================================= //=============================================================================
::SMESH_Mesh& SMESH_Mesh_i::GetImpl() void SMESH_Mesh_i::SetImpl(::SMESH_Mesh * impl)
{ {
MESSAGE("SMESH_Mesh_i::GetImpl()"); MESSAGE("SMESH_Mesh_i::SetImpl");
return *_impl; _impl = impl;
}
//=============================================================================
/*!
*
*/
//=============================================================================
::SMESH_Mesh & SMESH_Mesh_i::GetImpl()
{
MESSAGE("SMESH_Mesh_i::GetImpl()");
return *_impl;
} }
//============================================================================= //=============================================================================
@ -500,8 +480,8 @@ void SMESH_Mesh_i::SetImpl(::SMESH_Mesh* impl)
GEOM::GEOM_Gen_ptr SMESH_Mesh_i::GetGeomEngine() GEOM::GEOM_Gen_ptr SMESH_Mesh_i::GetGeomEngine()
{ {
MESSAGE("SMESH_Mesh_i::GetGeomEngine"); MESSAGE("SMESH_Mesh_i::GetGeomEngine");
return GEOM::GEOM_Gen::_duplicate(_geom); return GEOM::GEOM_Gen::_duplicate(_geom);
} }
//============================================================================= //=============================================================================
@ -512,9 +492,9 @@ GEOM::GEOM_Gen_ptr SMESH_Mesh_i::GetGeomEngine()
void SMESH_Mesh_i::SetIor(SMESH::SMESH_Mesh_ptr myIor) void SMESH_Mesh_i::SetIor(SMESH::SMESH_Mesh_ptr myIor)
{ {
MESSAGE("SMESH_Mesh_i::SetIor"); MESSAGE("SMESH_Mesh_i::SetIor");
_myIor = SMESH::SMESH_Mesh::_duplicate(myIor); _myIor = SMESH::SMESH_Mesh::_duplicate(myIor);
ASSERT(! CORBA::is_nil(_myIor)); ASSERT(!CORBA::is_nil(_myIor));
} }
//============================================================================= //=============================================================================
@ -525,10 +505,11 @@ void SMESH_Mesh_i::SetIor(SMESH::SMESH_Mesh_ptr myIor)
SMESH::SMESH_Mesh_ptr SMESH_Mesh_i::GetIor() SMESH::SMESH_Mesh_ptr SMESH_Mesh_i::GetIor()
{ {
MESSAGE("SMESH_Mesh_i::GetIor"); MESSAGE("SMESH_Mesh_i::GetIor");
ASSERT(! CORBA::is_nil(_myIor)); ASSERT(!CORBA::is_nil(_myIor));
return SMESH::SMESH_Mesh::_duplicate(_myIor); return SMESH::SMESH_Mesh::_duplicate(_myIor);
} }
//============================================================================= //=============================================================================
/*! /*!
* *
@ -537,9 +518,10 @@ SMESH::SMESH_Mesh_ptr SMESH_Mesh_i::GetIor()
SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor() SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor()
{ {
SMESH_MeshEditor_i* aMeshEditor = new SMESH_MeshEditor_i(_impl->GetMeshDS()); SMESH_MeshEditor_i *aMeshEditor =
SMESH::SMESH_MeshEditor_var aMesh = aMeshEditor->_this(); new SMESH_MeshEditor_i(_impl->GetMeshDS());
return aMesh._retn(); SMESH::SMESH_MeshEditor_var aMesh = aMeshEditor->_this();
return aMesh._retn();
} }
//============================================================================= //=============================================================================
@ -548,35 +530,17 @@ SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor()
*/ */
//============================================================================= //=============================================================================
void SMESH_Mesh_i::ExportMED( const char* file ) void SMESH_Mesh_i::ExportMED(const char *file) throw(SALOME::SALOME_Exception)
throw (SALOME::SALOME_Exception)
{ {
_impl->ExportMED( file ); _impl->ExportMED(file);
} }
void SMESH_Mesh_i::ExportDAT( const char* file ) void SMESH_Mesh_i::ExportDAT(const char *file) throw(SALOME::SALOME_Exception)
throw (SALOME::SALOME_Exception)
{ {
_impl->ExportDAT( file ); _impl->ExportDAT(file);
} }
void SMESH_Mesh_i::ExportUNV( const char* file ) void SMESH_Mesh_i::ExportUNV(const char *file) throw(SALOME::SALOME_Exception)
throw (SALOME::SALOME_Exception)
{ {
_impl->ExportUNV( file ); _impl->ExportUNV(file);
}
//=============================================================================
/*!
*
*/
//=============================================================================
SALOME_MED::MESH_ptr SMESH_Mesh_i::GetMEDMesh()
throw (SALOME::SALOME_Exception)
{
SMESH_MEDMesh_i* aMedMesh = new SMESH_MEDMesh_i( this );
SALOME_MED::MESH_var aMesh = aMedMesh->_this();
return aMesh._retn();
} }
//============================================================================= //=============================================================================
@ -584,10 +548,12 @@ SALOME_MED::MESH_ptr SMESH_Mesh_i::GetMEDMesh()
* *
*/ */
//============================================================================= //=============================================================================
CORBA::Long SMESH_Mesh_i::NbNodes()
throw (SALOME::SALOME_Exception) SALOME_MED::MESH_ptr SMESH_Mesh_i::GetMEDMesh()throw(SALOME::SALOME_Exception)
{ {
return _impl->NbNodes(); SMESH_MEDMesh_i *aMedMesh = new SMESH_MEDMesh_i(this);
SALOME_MED::MESH_var aMesh = aMedMesh->_this();
return aMesh._retn();
} }
//============================================================================= //=============================================================================
@ -595,10 +561,9 @@ CORBA::Long SMESH_Mesh_i::NbNodes()
* *
*/ */
//============================================================================= //=============================================================================
CORBA::Long SMESH_Mesh_i::NbEdges() CORBA::Long SMESH_Mesh_i::NbNodes()throw(SALOME::SALOME_Exception)
throw (SALOME::SALOME_Exception)
{ {
return _impl->NbEdges(); return _impl->NbNodes();
} }
//============================================================================= //=============================================================================
@ -606,20 +571,9 @@ CORBA::Long SMESH_Mesh_i::NbEdges()
* *
*/ */
//============================================================================= //=============================================================================
CORBA::Long SMESH_Mesh_i::NbFaces() CORBA::Long SMESH_Mesh_i::NbEdges()throw(SALOME::SALOME_Exception)
throw (SALOME::SALOME_Exception)
{ {
return _impl->NbFaces(); return _impl->NbEdges();
}
CORBA::Long SMESH_Mesh_i::NbTriangles()
throw (SALOME::SALOME_Exception)
{
return _impl->NbTriangles();
}
CORBA::Long SMESH_Mesh_i::NbQuadrangles()
throw (SALOME::SALOME_Exception)
{
return _impl->NbQuadrangles();
} }
//============================================================================= //=============================================================================
@ -627,20 +581,19 @@ CORBA::Long SMESH_Mesh_i::NbQuadrangles()
* *
*/ */
//============================================================================= //=============================================================================
CORBA::Long SMESH_Mesh_i::NbVolumes() CORBA::Long SMESH_Mesh_i::NbFaces()throw(SALOME::SALOME_Exception)
throw (SALOME::SALOME_Exception)
{ {
return _impl->NbVolumes(); return _impl->NbFaces();
} }
CORBA::Long SMESH_Mesh_i::NbTetras()
throw (SALOME::SALOME_Exception) CORBA::Long SMESH_Mesh_i::NbTriangles()throw(SALOME::SALOME_Exception)
{ {
return _impl->NbTetras(); return _impl->NbTriangles();
} }
CORBA::Long SMESH_Mesh_i::NbHexas()
throw (SALOME::SALOME_Exception) CORBA::Long SMESH_Mesh_i::NbQuadrangles()throw(SALOME::SALOME_Exception)
{ {
return _impl->NbHexas(); return _impl->NbQuadrangles();
} }
//============================================================================= //=============================================================================
@ -648,8 +601,27 @@ CORBA::Long SMESH_Mesh_i::NbHexas()
* *
*/ */
//============================================================================= //=============================================================================
CORBA::Long SMESH_Mesh_i::NbSubMesh() CORBA::Long SMESH_Mesh_i::NbVolumes()throw(SALOME::SALOME_Exception)
throw (SALOME::SALOME_Exception)
{ {
return _impl->NbSubMesh(); return _impl->NbVolumes();
}
CORBA::Long SMESH_Mesh_i::NbTetras()throw(SALOME::SALOME_Exception)
{
return _impl->NbTetras();
}
CORBA::Long SMESH_Mesh_i::NbHexas()throw(SALOME::SALOME_Exception)
{
return _impl->NbHexas();
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_Mesh_i::NbSubMesh()throw(SALOME::SALOME_Exception)
{
return _impl->NbSubMesh();
} }