-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
#include "Utils_CorbaException.hxx"
#include "Utils_ExceptHandlers.hxx"
-#include <TopoDS_Iterator.hxx>
#include "SMESHDS_Mesh.hxx"
#include "SMESH_subMesh.hxx"
#include "SMESH_Mesh_i.hxx"
#include "SMESH_subMesh_i.hxx"
+#include "SMESH_Gen_i.hxx"
+
+#include <TopoDS_Iterator.hxx>
using namespace std;
//=============================================================================
SMESH_MEDSupport_i::SMESH_MEDSupport_i(SMESH_subMesh_i * sm, string name,
string description, SALOME_MED::medEntityMesh entity)
- :_subMesh_i(sm), _name(name), _description(description), _entity(entity),
- _seqNumber(false), _seqLength(0)
+ :_subMesh_i(sm), _name(name), _description(description), _entity(entity),
+ _seqNumber(false), _seqLength(0)
{
BEGIN_OF("Constructor SMESH_MEDSupport_i");
- _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS();
+ int subMeshId = sm->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();
- }
+ SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( sm->GetMesh() );
+ _subMesh = mesh_i->GetImpl().GetSubMeshContaining( subMeshId );
if (_entity == SALOME_MED::MED_NODE)
{
*/
//=============================================================================
SMESH_MEDSupport_i::
-SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s):_subMesh_i(s._subMesh_i),
+SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s):_subMesh(s._subMesh),
_name(s._name), _description(s._description), _entity(s._entity),
_seqNumber(false), _seqLength(0)
{
BEGIN_OF("Constructor SMESH_MEDSupport_i");
- _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS();
-
- int subMeshId = _subMesh_i->GetId();
- 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();
- }
-
END_OF("Constructor SMESH_MEDSupport_i");
}
CORBA::Long SMESH_MEDSupport_i::getCorbaIndex()throw(SALOME::SALOME_Exception)
{
- if (_subMeshDS == NULL)
+ if (_subMesh == NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR);
MESSAGE("Not implemented for SMESH_i");
char *SMESH_MEDSupport_i::getName() throw(SALOME::SALOME_Exception)
{
- if (_subMeshDS==NULL)
+ if (_subMesh==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR);
return CORBA::string_dup(_name.c_str());
char *SMESH_MEDSupport_i::getDescription() throw(SALOME::SALOME_Exception)
{
- if (_subMeshDS==NULL)
+ if (_subMesh==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR);
return CORBA::string_dup(_description.c_str());
*/
//=============================================================================
-SALOME_MED::MESH_ptr SMESH_MEDSupport_i::getMesh()throw(SALOME::
+SALOME_MED::GMESH_ptr SMESH_MEDSupport_i::getMesh()throw(SALOME::
SALOME_Exception)
{
- if (_subMeshDS==NULL)
+ if (_subMesh==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR);
- return _subMesh_i->_mesh_i->GetMEDMesh();
+ return _subMesh_i->GetMesh()->GetMEDMesh();
}
//=============================================================================
CORBA::Boolean SMESH_MEDSupport_i::isOnAllElements()throw(SALOME::
SALOME_Exception)
{
- if (_subMeshDS==NULL)
+ if (_subMesh==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR);
if (_seqNumber == false)
{
if (_entity != SALOME_MED::MED_NONE)
{
- _seqLength = _subMeshDS->NbNodes();
+ _seqLength = _subMesh_i->GetNumberOfNodes(/*all=*/false);
_seqNumber = true;
}
else
}
try
{
- _isOnAllElements = (_seqLength == _meshDS->NbNodes());
+ _isOnAllElements = (_seqLength == _subMesh->GetFather()->NbNodes());
}
catch(...)
{
SALOME_MED::medEntityMesh SMESH_MEDSupport_i::getEntity()throw(SALOME::
SALOME_Exception)
{
- if (_subMeshDS==NULL)
+ if (_subMesh==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR);
return _entity;
SALOME_MED::medGeometryElement_array *
SMESH_MEDSupport_i::getTypes()throw(SALOME::SALOME_Exception)
{
- if (_subMeshDS==NULL)
+ if (_subMesh==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR);
SALOME_MED::medGeometryElement_array_var myseq =
CORBA::Long SMESH_MEDSupport_i::getNumberOfElements(SALOME_MED::
medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
{
- if (_subMeshDS==NULL)
+ if (_subMesh==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR);
return _numberOfGeometricType;
SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- if (_subMeshDS==NULL)
+ if (_subMesh==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support",
SALOME::INTERNAL_ERROR);
SALOME_TYPES::ListOfLong_var myseq = new SALOME_TYPES::ListOfLong;
int i = 0;
- myseq->length(_subMeshDS->NbNodes());
+ myseq->length(_subMesh_i->GetNumberOfNodes(/*all=*/false));
- SMDS_NodeIteratorPtr it = _subMeshDS->GetNodes();
- while(it->more())
+ if ( _subMesh->GetSubMeshDS() )
{
- myseq[i] = it->next()->GetID();
- i++;
- };
+ SMDS_NodeIteratorPtr it = _subMesh->GetSubMeshDS()->GetNodes();
+ while(it->more())
+ {
+ myseq[i] = it->next()->GetID();
+ i++;
+ };
+ }
SCRUTE(myseq->length());
MESSAGE("End of SMESH_MEDSupport_i::getNumber");