23237: EDF 12367 - SIGSEGV with Remove group

(SMESH_Gen_i_1.cxx)

IPAL53059: Not all solids are highlighted by magenta
  (SMESHGUI_ComputeDlg.cxx)

+ remove "using namespace std" from headers
This commit is contained in:
eap 2016-02-15 15:08:20 +03:00
parent d2ed8e8dab
commit 20248b6e76
38 changed files with 282 additions and 235 deletions

View File

@ -175,7 +175,7 @@ namespace {
n += q2 ^ q3; n += q2 ^ q3;
} }
double len = n.Modulus(); double len = n.Modulus();
bool zeroLen = ( len <= numeric_limits<double>::min()); bool zeroLen = ( len <= std::numeric_limits<double>::min());
if ( !zeroLen ) if ( !zeroLen )
n /= len; n /= len;
@ -312,12 +312,12 @@ double NumericalFunctor::Round( const double & aVal )
*/ */
//================================================================================ //================================================================================
void NumericalFunctor::GetHistogram(int nbIntervals, void NumericalFunctor::GetHistogram(int nbIntervals,
std::vector<int>& nbEvents, std::vector<int>& nbEvents,
std::vector<double>& funValues, std::vector<double>& funValues,
const vector<int>& elements, const std::vector<int>& elements,
const double* minmax, const double* minmax,
const bool isLogarithmic) const bool isLogarithmic)
{ {
if ( nbIntervals < 1 || if ( nbIntervals < 1 ||
!myMesh || !myMesh ||
@ -336,7 +336,7 @@ void NumericalFunctor::GetHistogram(int nbIntervals,
} }
else else
{ {
vector<int>::const_iterator id = elements.begin(); std::vector<int>::const_iterator id = elements.begin();
for ( ; id != elements.end(); ++id ) for ( ; id != elements.end(); ++id )
values.insert( GetValue( *id )); values.insert( GetValue( *id ));
} }
@ -2163,7 +2163,7 @@ bool BareBorderVolume::IsSatisfy(long theElementId )
if ( myTool.IsFreeFace( iF )) if ( myTool.IsFreeFace( iF ))
{ {
const SMDS_MeshNode** n = myTool.GetFaceNodes(iF); const SMDS_MeshNode** n = myTool.GetFaceNodes(iF);
vector< const SMDS_MeshNode*> nodes( n, n+myTool.NbFaceNodes(iF)); std::vector< const SMDS_MeshNode*> nodes( n, n+myTool.NbFaceNodes(iF));
if ( !myMesh->FindElement( nodes, SMDSAbs_Face, /*Nomedium=*/false)) if ( !myMesh->FindElement( nodes, SMDSAbs_Face, /*Nomedium=*/false))
return true; return true;
} }
@ -2302,15 +2302,15 @@ void CoincidentNodes::SetMesh( const SMDS_Mesh* theMesh )
while ( nIt->more() ) while ( nIt->more() )
nodesToCheck.insert( nodesToCheck.end(), nIt->next() ); nodesToCheck.insert( nodesToCheck.end(), nIt->next() );
list< list< const SMDS_MeshNode*> > nodeGroups; std::list< std::list< const SMDS_MeshNode*> > nodeGroups;
SMESH_OctreeNode::FindCoincidentNodes ( nodesToCheck, &nodeGroups, myToler ); SMESH_OctreeNode::FindCoincidentNodes ( nodesToCheck, &nodeGroups, myToler );
myCoincidentIDs.Clear(); myCoincidentIDs.Clear();
list< list< const SMDS_MeshNode*> >::iterator groupIt = nodeGroups.begin(); std::list< std::list< const SMDS_MeshNode*> >::iterator groupIt = nodeGroups.begin();
for ( ; groupIt != nodeGroups.end(); ++groupIt ) for ( ; groupIt != nodeGroups.end(); ++groupIt )
{ {
list< const SMDS_MeshNode*>& coincNodes = *groupIt; std::list< const SMDS_MeshNode*>& coincNodes = *groupIt;
list< const SMDS_MeshNode*>::iterator n = coincNodes.begin(); std::list< const SMDS_MeshNode*>::iterator n = coincNodes.begin();
for ( ; n != coincNodes.end(); ++n ) for ( ; n != coincNodes.end(); ++n )
myCoincidentIDs.Add( (*n)->GetID() ); myCoincidentIDs.Add( (*n)->GetID() );
} }
@ -2342,7 +2342,7 @@ bool CoincidentElements::IsSatisfy( long theElementId )
if ( const SMDS_MeshElement* e = myMesh->FindElement( theElementId )) if ( const SMDS_MeshElement* e = myMesh->FindElement( theElementId ))
{ {
if ( e->GetType() != GetType() ) return false; if ( e->GetType() != GetType() ) return false;
set< const SMDS_MeshNode* > elemNodes( e->begin_nodes(), e->end_nodes() ); std::set< const SMDS_MeshNode* > elemNodes( e->begin_nodes(), e->end_nodes() );
const int nbNodes = e->NbNodes(); const int nbNodes = e->NbNodes();
SMDS_ElemIteratorPtr invIt = (*elemNodes.begin())->GetInverseElementIterator( GetType() ); SMDS_ElemIteratorPtr invIt = (*elemNodes.begin())->GetInverseElementIterator( GetType() );
while ( invIt->more() ) while ( invIt->more() )
@ -2589,18 +2589,20 @@ bool FreeFaces::IsSatisfy( long theId )
int nbNode = aFace->NbNodes(); int nbNode = aFace->NbNodes();
// collect volumes to check that number of volumes with count equal nbNode not less than 2 // collect volumes to check that number of volumes with count equal nbNode not less than 2
typedef map< SMDS_MeshElement*, int > TMapOfVolume; // map of volume counters typedef std::map< SMDS_MeshElement*, int > TMapOfVolume; // map of volume counters
typedef map< SMDS_MeshElement*, int >::iterator TItrMapOfVolume; // iterator typedef std::map< SMDS_MeshElement*, int >::iterator TItrMapOfVolume; // iterator
TMapOfVolume mapOfVol; TMapOfVolume mapOfVol;
SMDS_ElemIteratorPtr nodeItr = aFace->nodesIterator(); SMDS_ElemIteratorPtr nodeItr = aFace->nodesIterator();
while ( nodeItr->more() ) { while ( nodeItr->more() )
{
const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(nodeItr->next()); const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(nodeItr->next());
if ( !aNode ) continue; if ( !aNode ) continue;
SMDS_ElemIteratorPtr volItr = aNode->GetInverseElementIterator(SMDSAbs_Volume); SMDS_ElemIteratorPtr volItr = aNode->GetInverseElementIterator(SMDSAbs_Volume);
while ( volItr->more() ) { while ( volItr->more() )
{
SMDS_MeshElement* aVol = (SMDS_MeshElement*)volItr->next(); SMDS_MeshElement* aVol = (SMDS_MeshElement*)volItr->next();
TItrMapOfVolume itr = mapOfVol.insert(make_pair(aVol, 0)).first; TItrMapOfVolume itr = mapOfVol.insert( std::make_pair( aVol, 0 )).first;
(*itr).second++; (*itr).second++;
} }
} }
@ -2704,8 +2706,8 @@ void GroupColor::SetMesh( const SMDS_Mesh* theMesh )
return; return;
// iterates on groups and find necessary elements ids // iterates on groups and find necessary elements ids
const std::set<SMESHDS_GroupBase*>& aGroups = aMesh->GetGroups(); const std::set<SMESHDS_GroupBase*>& aGroups = aMesh->GetGroups();
set<SMESHDS_GroupBase*>::const_iterator GrIt = aGroups.begin(); std::set<SMESHDS_GroupBase*>::const_iterator GrIt = aGroups.begin();
for (; GrIt != aGroups.end(); GrIt++) for (; GrIt != aGroups.end(); GrIt++)
{ {
SMESHDS_GroupBase* aGrp = (*GrIt); SMESHDS_GroupBase* aGrp = (*GrIt);
@ -2932,10 +2934,10 @@ void ConnectedElements::SetPoint( double x, double y, double z )
// find myNodeID by myXYZ if possible // find myNodeID by myXYZ if possible
if ( myMeshModifTracer.GetMesh() ) if ( myMeshModifTracer.GetMesh() )
{ {
auto_ptr<SMESH_ElementSearcher> searcher SMESHUtils::Deleter<SMESH_ElementSearcher> searcher
( SMESH_MeshAlgos::GetElementSearcher( (SMDS_Mesh&) *myMeshModifTracer.GetMesh() )); ( SMESH_MeshAlgos::GetElementSearcher( (SMDS_Mesh&) *myMeshModifTracer.GetMesh() ));
vector< const SMDS_MeshElement* > foundElems; std::vector< const SMDS_MeshElement* > foundElems;
searcher->FindElementsByPoint( gp_Pnt(x,y,z), SMDSAbs_All, foundElems ); searcher->FindElementsByPoint( gp_Pnt(x,y,z), SMDSAbs_All, foundElems );
if ( !foundElems.empty() ) if ( !foundElems.empty() )
@ -2961,7 +2963,7 @@ bool ConnectedElements::IsSatisfy( long theElementId )
if ( !node0 ) if ( !node0 )
return false; return false;
list< const SMDS_MeshNode* > nodeQueue( 1, node0 ); std::list< const SMDS_MeshNode* > nodeQueue( 1, node0 );
std::set< int > checkedNodeIDs; std::set< int > checkedNodeIDs;
// algo: // algo:
// foreach node in nodeQueue: // foreach node in nodeQueue:
@ -3050,8 +3052,8 @@ void CoplanarFaces::SetMesh( const SMDS_Mesh* theMesh )
const double cosTol = Cos( myToler * M_PI / 180. ); const double cosTol = Cos( myToler * M_PI / 180. );
NCollection_Map< SMESH_TLink, SMESH_TLink > checkedLinks; NCollection_Map< SMESH_TLink, SMESH_TLink > checkedLinks;
std::list< pair< const SMDS_MeshElement*, gp_Vec > > faceQueue; std::list< std::pair< const SMDS_MeshElement*, gp_Vec > > faceQueue;
faceQueue.push_back( make_pair( face, myNorm )); faceQueue.push_back( std::make_pair( face, myNorm ));
while ( !faceQueue.empty() ) while ( !faceQueue.empty() )
{ {
face = faceQueue.front().first; face = faceQueue.front().first;
@ -3074,7 +3076,7 @@ void CoplanarFaces::SetMesh( const SMDS_Mesh* theMesh )
if (!normOK || isLessAngle( myNorm, norm, cosTol)) if (!normOK || isLessAngle( myNorm, norm, cosTol))
{ {
myCoplanarIDs.Add( f->GetID() ); myCoplanarIDs.Add( f->GetID() );
faceQueue.push_back( make_pair( f, norm )); faceQueue.push_back( std::make_pair( f, norm ));
} }
} }
} }

View File

@ -70,9 +70,9 @@ extern "C"
elem->getshapeId() ); \ elem->getshapeId() ); \
}} }}
#define END_ELEM_WRITE_ADD_TO_MAP( elem, e2id ) \ #define END_ELEM_WRITE_ADD_TO_MAP( elem, e2id ) \
elem->getshapeId() ); \ elem->getshapeId() ); \
e2id.insert( e2id.end(), make_pair( elem, gmfID )); \ e2id.insert( e2id.end(), std::make_pair( elem, gmfID )); \
}} }}
#define END_EXTRA_VERTICES_WRITE() \ #define END_EXTRA_VERTICES_WRITE() \
@ -145,7 +145,7 @@ Driver_Mesh::Status DriverGMF_Write::Perform()
const SMDS_MeshNode* n = nodeIt->next(); const SMDS_MeshNode* n = nodeIt->next();
n->GetXYZ( xyz ); n->GetXYZ( xyz );
GmfSetLin( meshID, GmfVertices, xyz[0], xyz[1], xyz[2], n->getshapeId() ); GmfSetLin( meshID, GmfVertices, xyz[0], xyz[1], xyz[2], n->getshapeId() );
node2IdMap.insert( node2IdMap.end(), make_pair( n, ++iN )); node2IdMap.insert( node2IdMap.end(), std::make_pair( n, ++iN ));
} }
if ( iN != nbNodes ) if ( iN != nbNodes )
return addMessage("Wrong nb of nodes returned by nodesIterator", /*fatal=*/true); return addMessage("Wrong nb of nodes returned by nodesIterator", /*fatal=*/true);

View File

@ -95,7 +95,7 @@ bool DriverMED_W_Field::Set(SMESHDS_Mesh * mesh,
if ( _nbElemsByGeom.empty() || _elemType != type ) if ( _nbElemsByGeom.empty() || _elemType != type )
{ {
_elemType = type; _elemType = type;
_nbElemsByGeom.resize( 1, make_pair( SMDSEntity_Last, 0 )); _nbElemsByGeom.resize( 1, std::make_pair( SMDSEntity_Last, 0 ));
// count nb of elems of each geometry // count nb of elems of each geometry
for ( int iG = 0; iG < SMDSEntity_Last; ++iG ) for ( int iG = 0; iG < SMDSEntity_Last; ++iG )
@ -107,7 +107,7 @@ bool DriverMED_W_Field::Set(SMESHDS_Mesh * mesh,
nbElems = mesh->GetMeshInfo().NbElements( geom ); nbElems = mesh->GetMeshInfo().NbElements( geom );
if ( nbElems < 1 ) continue; if ( nbElems < 1 ) continue;
_nbElemsByGeom.push_back( make_pair( geom, nbElems + _nbElemsByGeom.back().second )); _nbElemsByGeom.push_back( std::make_pair( geom, nbElems + _nbElemsByGeom.back().second ));
} }
// add nodes of missing 0D elements on VERTEXes // add nodes of missing 0D elements on VERTEXes
if ( _addODOnVertices && _elemType == SMDSAbs_0DElement ) if ( _addODOnVertices && _elemType == SMDSAbs_0DElement )
@ -118,8 +118,8 @@ bool DriverMED_W_Field::Set(SMESHDS_Mesh * mesh,
if ( !nodes.empty() ) if ( !nodes.empty() )
{ {
if ( _nbElemsByGeom.size() == 1 ) if ( _nbElemsByGeom.size() == 1 )
_nbElemsByGeom.push_back( make_pair( SMDSEntity_0D, 0)); _nbElemsByGeom.push_back( std::make_pair( SMDSEntity_0D, 0));
_nbElemsByGeom.push_back( make_pair( SMDSEntity_Node, _nbElemsByGeom.push_back( std::make_pair( SMDSEntity_Node,
nodes.size() + _nbElemsByGeom.back().second )); nodes.size() + _nbElemsByGeom.back().second ));
} }
} }
@ -314,7 +314,7 @@ Driver_Mesh::Status DriverMED_W_Field::Perform()
SMDSAbs_EntityType smdsType = _nbElemsByGeom[iG].first; SMDSAbs_EntityType smdsType = _nbElemsByGeom[iG].first;
MED::EGeometrieElement medType = (MED::EGeometrieElement) DriverMED::GetMedGeoType( smdsType ); MED::EGeometrieElement medType = (MED::EGeometrieElement) DriverMED::GetMedGeoType( smdsType );
int nbElems = _nbElemsByGeom[iG].second - _nbElemsByGeom[iG-1].second; int nbElems = _nbElemsByGeom[iG].second - _nbElemsByGeom[iG-1].second;
type2nb.insert( make_pair( medType, nbElems )); type2nb.insert( std::make_pair( medType, nbElems ));
} }
MED::EEntiteMaillage entity = ( _elemType == SMDSAbs_Node ? MED::eNOEUD : MED::eMAILLE ); MED::EEntiteMaillage entity = ( _elemType == SMDSAbs_Node ? MED::eNOEUD : MED::eMAILLE );

View File

@ -747,7 +747,7 @@ public:
void incrementNodesCapacity(int nbNodes); void incrementNodesCapacity(int nbNodes);
void incrementCellsCapacity(int nbCells); void incrementCellsCapacity(int nbCells);
void adjustStructure(); void adjustStructure();
void dumpGrid(string ficdump="dumpGrid"); void dumpGrid(std::string ficdump="dumpGrid");
static int chunkSize; static int chunkSize;
//! low level modification: add, change or remove node or element //! low level modification: add, change or remove node or element

View File

@ -25,7 +25,6 @@
#define SMDS_MeshInfo_HeaderFile #define SMDS_MeshInfo_HeaderFile
#include <vector> #include <vector>
using namespace std;
#include "SMESH_SMDS.hxx" #include "SMESH_SMDS.hxx"

View File

@ -95,7 +95,7 @@ void SMDS_VtkVolume::initPoly(const std::vector<vtkIdType>& nodeIds,
SMDS_UnstructuredGrid* grid = mesh->getGrid(); SMDS_UnstructuredGrid* grid = mesh->getGrid();
//double center[3]; //double center[3];
//this->gravityCenter(grid, &nodeIds[0], nodeIds.size(), &center[0]); //this->gravityCenter(grid, &nodeIds[0], nodeIds.size(), &center[0]);
vector<vtkIdType> ptIds; std::vector<vtkIdType> ptIds;
vtkIdType nbFaces = nbNodesPerFace.size(); vtkIdType nbFaces = nbNodesPerFace.size();
int k = 0; int k = 0;
for (int i = 0; i < nbFaces; i++) for (int i = 0; i < nbFaces; i++)
@ -365,7 +365,7 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetFaceNode(const int face_ind, const int n
*/ */
std::vector<int> SMDS_VtkVolume::GetQuantities() const std::vector<int> SMDS_VtkVolume::GetQuantities() const
{ {
vector<int> quantities; std::vector<int> quantities;
SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId]; SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
vtkUnstructuredGrid* grid = mesh->getGrid(); vtkUnstructuredGrid* grid = mesh->getGrid();
vtkIdType aVtkType = grid->GetCellType(this->myVtkID); vtkIdType aVtkType = grid->GetCellType(this->myVtkID);

View File

@ -215,7 +215,7 @@ class SMESH_EXPORT SMESH_Algo : public SMESH_Hypothesis
* have a name (type) listed in the algorithm. Hypothesis associated to * have a name (type) listed in the algorithm. Hypothesis associated to
* father shape -are not- taken into account (see GetUsedHypothesis) * father shape -are not- taken into account (see GetUsedHypothesis)
*/ */
const list <const SMESHDS_Hypothesis *> & const std::list <const SMESHDS_Hypothesis *> &
GetAppliedHypothesis(SMESH_Mesh & aMesh, GetAppliedHypothesis(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape, const TopoDS_Shape & aShape,
const bool ignoreAuxiliary=true) const; const bool ignoreAuxiliary=true) const;

View File

@ -93,11 +93,11 @@ public:
SMESH_EXPORT ElemFeatures& Init( double diameter ) SMESH_EXPORT ElemFeatures& Init( double diameter )
{ myType = SMDSAbs_Ball; myBallDiameter = diameter; return *this; } { myType = SMDSAbs_Ball; myBallDiameter = diameter; return *this; }
SMESH_EXPORT ElemFeatures& Init( vector<int>& quanities, bool isQuad=false ) SMESH_EXPORT ElemFeatures& Init( std::vector<int>& quanities, bool isQuad=false )
{ myType = SMDSAbs_Volume; myIsPoly = 1; myIsQuad = isQuad; { myType = SMDSAbs_Volume; myIsPoly = 1; myIsQuad = isQuad;
myPolyhedQuantities.swap( quanities ); return *this; } myPolyhedQuantities.swap( quanities ); return *this; }
SMESH_EXPORT ElemFeatures& Init( const vector<int>& quanities, bool isQuad=false ) SMESH_EXPORT ElemFeatures& Init( const std::vector<int>& quanities, bool isQuad=false )
{ myType = SMDSAbs_Volume; myIsPoly = 1; myIsQuad = isQuad; { myType = SMDSAbs_Volume; myIsPoly = 1; myIsQuad = isQuad;
myPolyhedQuantities = quanities; return *this; } myPolyhedQuantities = quanities; return *this; }
@ -777,8 +777,8 @@ public:
const bool theHasRefPoint, const bool theHasRefPoint,
const gp_Pnt& theRefPoint, const gp_Pnt& theRefPoint,
const bool theMakeGroups); const bool theMakeGroups);
void LinearAngleVariation(const int NbSteps, void LinearAngleVariation(const int NbSteps,
list<double>& theAngles); std::list<double>& theAngles);
bool doubleNodes( SMESHDS_Mesh* theMeshDS, bool doubleNodes( SMESHDS_Mesh* theMeshDS,
const TIDSortedElemSet& theElems, const TIDSortedElemSet& theElems,

View File

@ -45,7 +45,7 @@ SMESH_ProxyMesh::SMESH_ProxyMesh():_mesh(0)
*/ */
//================================================================================ //================================================================================
SMESH_ProxyMesh::SMESH_ProxyMesh(vector<SMESH_ProxyMesh::Ptr>& components): SMESH_ProxyMesh::SMESH_ProxyMesh(std::vector<SMESH_ProxyMesh::Ptr>& components):
_mesh(0) _mesh(0)
{ {
if ( components.empty() ) return; if ( components.empty() ) return;
@ -68,8 +68,8 @@ SMESH_ProxyMesh::SMESH_ProxyMesh(vector<SMESH_ProxyMesh::Ptr>& components):
if ( _subMeshes[j] ) if ( _subMeshes[j] )
{ {
// unite 2 sub-meshes // unite 2 sub-meshes
set< const SMDS_MeshElement * > elems( _subMeshes[j]->_elements.begin(), std::set< const SMDS_MeshElement * > elems( _subMeshes[j]->_elements.begin(),
_subMeshes[j]->_elements.end()); _subMeshes[j]->_elements.end());
elems.insert( m->_subMeshes[j]->_elements.begin(), elems.insert( m->_subMeshes[j]->_elements.begin(),
m->_subMeshes[j]->_elements.end()); m->_subMeshes[j]->_elements.end());
_subMeshes[j]->_elements.assign( elems.begin(), elems.end() ); _subMeshes[j]->_elements.assign( elems.begin(), elems.end() );
@ -103,7 +103,7 @@ SMESH_ProxyMesh::~SMESH_ProxyMesh()
delete _subMeshes[i]; delete _subMeshes[i];
_subMeshes.clear(); _subMeshes.clear();
set< const SMDS_MeshElement* >::iterator i = _elemsInMesh.begin(); std::set< const SMDS_MeshElement* >::iterator i = _elemsInMesh.begin();
for ( ; i != _elemsInMesh.end(); ++i ) for ( ; i != _elemsInMesh.end(); ++i )
GetMeshDS()->RemoveFreeElement( *i, 0 ); GetMeshDS()->RemoveFreeElement( *i, 0 );
_elemsInMesh.clear(); _elemsInMesh.clear();
@ -203,12 +203,12 @@ namespace
class TFilteringIterator : public SMDS_ElemIterator class TFilteringIterator : public SMDS_ElemIterator
{ {
SMDS_ElemIteratorPtr _iter; SMDS_ElemIteratorPtr _iter;
const SMDS_MeshElement * _curElem; const SMDS_MeshElement * _curElem;
vector< SMDSAbs_EntityType> _okTypes; std::vector< SMDSAbs_EntityType> _okTypes;
public: public:
TFilteringIterator( const vector< SMDSAbs_EntityType>& okTypes, TFilteringIterator( const std::vector< SMDSAbs_EntityType>& okTypes,
const SMDS_ElemIteratorPtr& elemIterator) const SMDS_ElemIteratorPtr& elemIterator)
:_iter(elemIterator), _curElem(0), _okTypes(okTypes) :_iter(elemIterator), _curElem(0), _okTypes(okTypes)
{ {
next(); next();
@ -282,11 +282,11 @@ SMDS_ElemIteratorPtr SMESH_ProxyMesh::GetFaces() const
// ... else elements filtered using allowedTypes are additionally returned // ... else elements filtered using allowedTypes are additionally returned
SMDS_ElemIteratorPtr facesIter = GetMeshDS()->elementsIterator(SMDSAbs_Face); SMDS_ElemIteratorPtr facesIter = GetMeshDS()->elementsIterator(SMDSAbs_Face);
SMDS_ElemIteratorPtr filterIter( new TFilteringIterator( _allowedTypes, facesIter )); SMDS_ElemIteratorPtr filterIter( new TFilteringIterator( _allowedTypes, facesIter ));
vector< SMDS_ElemIteratorPtr > iters(2); std::vector< SMDS_ElemIteratorPtr > iters(2);
iters[0] = proxyIter; iters[0] = proxyIter;
iters[1] = filterIter; iters[1] = filterIter;
typedef vector< SMDS_ElemIteratorPtr > TElemIterVector; typedef std::vector< SMDS_ElemIteratorPtr > TElemIterVector;
typedef SMDS_IteratorOnIterators<const SMDS_MeshElement *, TElemIterVector> TItersIter; typedef SMDS_IteratorOnIterators<const SMDS_MeshElement *, TElemIterVector> TItersIter;
return SMDS_ElemIteratorPtr( new TItersIter( iters )); return SMDS_ElemIteratorPtr( new TItersIter( iters ));
} }
@ -431,7 +431,7 @@ void SMESH_ProxyMesh::removeTmpElement( const SMDS_MeshElement* elem )
{ {
if ( elem && elem->GetID() > 0 ) if ( elem && elem->GetID() > 0 )
{ {
set< const SMDS_MeshElement* >::iterator i = _elemsInMesh.find( elem ); std::set< const SMDS_MeshElement* >::iterator i = _elemsInMesh.find( elem );
if ( i != _elemsInMesh.end() ) if ( i != _elemsInMesh.end() )
{ {
GetMeshDS()->RemoveFreeElement( elem, 0 ); GetMeshDS()->RemoveFreeElement( elem, 0 );
@ -468,7 +468,7 @@ void SMESH_ProxyMesh::setNode2Node(const SMDS_MeshNode* srcNode,
SubMesh* sm = const_cast<SubMesh*>( subMesh ); SubMesh* sm = const_cast<SubMesh*>( subMesh );
if ( !subMesh->_n2n ) if ( !subMesh->_n2n )
sm->_n2n = new TN2NMap; sm->_n2n = new TN2NMap;
sm->_n2n->insert( make_pair( srcNode, proxyNode )); sm->_n2n->insert( std::make_pair( srcNode, proxyNode ));
} }
//================================================================================ //================================================================================

View File

@ -61,6 +61,7 @@ static int MYDEBUG = 0;
namespace namespace
{ {
using std::runtime_error;
//======================================================================= //=======================================================================
//function : FindNode //function : FindNode
@ -972,7 +973,7 @@ SMESH_Client::Update(bool theIsClear)
int nbNodes = anIndexes[i++]; int nbNodes = anIndexes[i++];
// nodes // nodes
//ASSERT( nbNodes < 9 ); //ASSERT( nbNodes < 9 );
vector<const SMDS_MeshNode*> aNodes( nbNodes ); std::vector<const SMDS_MeshNode*> aNodes( nbNodes );
for ( int iNode = 0; iNode < nbNodes; iNode++ ) for ( int iNode = 0; iNode < nbNodes; iNode++ )
aNodes[ iNode ] = FindNode( mySMDSMesh, anIndexes[i++] ); aNodes[ iNode ] = FindNode( mySMDSMesh, anIndexes[i++] );
// change // change

View File

@ -118,8 +118,8 @@ namespace
static int FirstHexahedronIds[] = {0,1,2,3,4,5,6,7,0,1,2,3}; static int FirstHexahedronIds[] = {0,1,2,3,4,5,6,7,0,1,2,3};
static int LastHexahedronIds[] = {1,2,3,0,5,6,7,4,4,5,6,7}; static int LastHexahedronIds[] = {1,2,3,0,5,6,7,4,4,5,6,7};
static vector<int> FirstPolygonIds; static std::vector<int> FirstPolygonIds;
static vector<int> LastPolygonIds; static std::vector<int> LastPolygonIds;
void ReverseConnectivity( std::vector<vtkIdType> & ids, SMDSAbs_EntityType type, void ReverseConnectivity( std::vector<vtkIdType> & ids, SMDSAbs_EntityType type,
bool toReverse, // inverse element bool toReverse, // inverse element

View File

@ -108,6 +108,7 @@
#define MARGIN 11 #define MARGIN 11
#define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" ) #define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" )
#define __SHAPE_RGB__ 250, 0, 250
enum TCol { enum TCol {
COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, COL_BAD_MESH, NB_COLUMNS COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, COL_BAD_MESH, NB_COLUMNS
@ -147,10 +148,10 @@ namespace SMESH
{ {
myProperty = vtkProperty::New(); myProperty = vtkProperty::New();
myProperty->SetRepresentationToWireframe(); myProperty->SetRepresentationToWireframe();
myProperty->SetColor( 250, 0, 250 ); myProperty->SetColor( __SHAPE_RGB__ );
myProperty->SetAmbientColor( 250, 0, 250 ); myProperty->SetAmbientColor( __SHAPE_RGB__ );
myProperty->SetDiffuseColor( 250, 0, 250 ); myProperty->SetDiffuseColor( __SHAPE_RGB__ );
//myProperty->SetSpecularColor( 250, 0, 250 ); //myProperty->SetSpecularColor( __SHAPE_RGB__ );
myProperty->SetLineWidth( 5 ); myProperty->SetLineWidth( 5 );
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@ -278,13 +279,18 @@ namespace SMESH
actor = GEOM_Actor::New(); actor = GEOM_Actor::New();
if ( actor ) { if ( actor ) {
actor->SetShape(shape,0,0); actor->SetShape(shape,0,0);
actor->SetProperty(myProperty); // actor->SetProperty(myProperty);
actor->SetShadingProperty(myProperty); // actor->SetShadingProperty(myProperty);
actor->SetWireframeProperty(myProperty); // actor->SetWireframeProperty(myProperty);
actor->SetPreviewProperty(myProperty); // actor->SetPreviewProperty(myProperty);
actor->PickableOff(); actor->PickableOff();
// if ( shape.ShapeType() == TopAbs_EDGE ) //
// actor->SubShapeOn(); actor->SetWidth( myProperty->GetLineWidth() );
actor->SetIsosWidth( myProperty->GetLineWidth() );
actor->SetIsosColor( __SHAPE_RGB__ );
actor->SetColor( __SHAPE_RGB__ );
// if ( shape.ShapeType() == TopAbs_EDGE )
// actor->SubShapeOn();
myViewWindow->AddActor( actor ); myViewWindow->AddActor( actor );
} }
} }
@ -732,10 +738,11 @@ void SMESHGUI_ComputeDlg_QThread::cancel()
//================================================================================ //================================================================================
//================================================================================ //================================================================================
SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget * parent, SMESHGUI_ComputeDlg_QThreadQDialog::
SMESH::SMESH_Gen_var gen, SMESHGUI_ComputeDlg_QThreadQDialog(QWidget * parent,
SMESH::SMESH_Mesh_var mesh, SMESH::SMESH_Gen_var gen,
GEOM::GEOM_Object_var mainShape) SMESH::SMESH_Mesh_var mesh,
GEOM::GEOM_Object_var mainShape)
: QDialog(parent, : QDialog(parent,
Qt::WindowSystemMenuHint | Qt::WindowSystemMenuHint |
Qt::WindowCloseButtonHint | Qt::WindowCloseButtonHint |
@ -916,23 +923,28 @@ void SMESHGUI_BaseComputeOp::computeMesh()
if ( !memoryLack ) if ( !memoryLack )
{ {
// List of objects that will be updated automatically // List of objects that will be updated automatically
QList< QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) > > aListToUpdate; typedef QList< QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) > > TListOf_IDSrc_SObj;
SMESH::SMESH_IDSource_var aMeshObj = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aMeshSObj ); TListOf_IDSrc_SObj aListToUpdate;
SMESH::SMESH_IDSource_var aMeshObj =
SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aMeshSObj );
// put Mesh into list // put Mesh into list
aListToUpdate.append( QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) >(aMeshObj, aMeshSObj) ); aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aMeshObj, aMeshSObj ));
SMESH::submesh_array_var aSubMeshes = myMesh->GetSubMeshes(); SMESH::submesh_array_var aSubMeshes = myMesh->GetSubMeshes();
// put SubMeshes into list // put SubMeshes into list
for ( CORBA::ULong i = 0; i < aSubMeshes->length(); i++ ) { for ( CORBA::ULong i = 0; i < aSubMeshes->length(); i++ )
{
SMESH::SMESH_subMesh_var sm = aSubMeshes[i]; SMESH::SMESH_subMesh_var sm = aSubMeshes[i];
if ( CORBA::is_nil( sm ) ) continue; if ( CORBA::is_nil( sm ) ) continue;
_PTR(SObject) smSObj = SMESH::ObjectToSObject( sm ); _PTR(SObject) smSObj = SMESH::ObjectToSObject( sm );
if ( !smSObj ) continue; if ( !smSObj ) continue;
SMESH::SMESH_IDSource_var aSubMeshObj = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( smSObj ); SMESH::SMESH_IDSource_var aSubMeshObj =
aListToUpdate.append( QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) >(aSubMeshObj, smSObj) ); SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( smSObj );
aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aSubMeshObj, smSObj ));
} }
// put Groups into list // put Groups into list
SMESH::ListOfGroups_var aGroups = myMesh->GetGroups(); SMESH::ListOfGroups_var aGroups = myMesh->GetGroups();
for ( size_t i = 0; i < aGroups->length(); ++i ) { for ( size_t i = 0; i < aGroups->length(); ++i )
{
SMESH::SMESH_GroupBase_var aGrp = aGroups[i]; SMESH::SMESH_GroupBase_var aGrp = aGroups[i];
if ( CORBA::is_nil( aGrp ) ) continue; if ( CORBA::is_nil( aGrp ) ) continue;
SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp ); SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp );
@ -941,26 +953,31 @@ void SMESHGUI_BaseComputeOp::computeMesh()
if ( !aStdGroup->_is_nil() ) continue; // don't update the standalone groups if ( !aStdGroup->_is_nil() ) continue; // don't update the standalone groups
_PTR(SObject) aGroupSO = SMESH::FindSObject( aGrp ); _PTR(SObject) aGroupSO = SMESH::FindSObject( aGrp );
if ( !aGroupSO ) continue; if ( !aGroupSO ) continue;
SMESH::SMESH_IDSource_var aGroupObj = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aGroupSO ); SMESH::SMESH_IDSource_var aGroupObj =
aListToUpdate.append( QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) >(aGroupObj, aGroupSO) ); SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aGroupSO );
aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aGroupObj, aGroupSO ));
} }
// update mesh, sub-mesh and groups, if it's possible // update mesh, sub-mesh and groups, if it's possible
QList< QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) > >::iterator anIter; TListOf_IDSrc_SObj::iterator anIter;
for( anIter = aListToUpdate.begin(); anIter != aListToUpdate.end(); anIter++ ) { for ( anIter = aListToUpdate.begin(); anIter != aListToUpdate.end(); anIter++ )
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( (*anIter).second )); {
if ( getSMESHGUI()->automaticUpdate( (*anIter).first, &entities, &limitExceeded, &hidden, &nbElements ) ) SMESH::SMESH_Mesh_var aMesh =
SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( (*anIter).second ));
if ( getSMESHGUI()->automaticUpdate( (*anIter).first, &entities, &limitExceeded,
&hidden, &nbElements ) )
{ {
try { try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
#endif
bool toDisplay = false; bool toDisplay = false;
if ( !aMesh->_is_nil() ) // display only a mesh
if ( !aMesh->_is_nil() ) { // display a mesh only {
toDisplay = true; toDisplay = true;
SMESH_Actor *anActor = SMESH::FindActorByObject( aMesh ); SMESH_Actor *anActor = SMESH::FindActorByObject( aMesh );
if ( !anActor ) anActor = SMESH::CreateActor( (*anIter).second->GetStudy(), (*anIter).second->GetID().c_str(), true ); if ( !anActor ) anActor = SMESH::CreateActor( (*anIter).second->GetStudy(),
(*anIter).second->GetID().c_str(),
/*clearLog =*/ true );
if ( anActor ) // actor is not created for an empty mesh if ( anActor ) // actor is not created for an empty mesh
{ {
anActor->SetEntityMode( entities ); anActor->SetEntityMode( entities );
@ -981,7 +998,10 @@ void SMESHGUI_BaseComputeOp::computeMesh()
if ( hidden & SMESH_Actor::eBallElem ) hiddenMsg << tr( "SMESH_BALLS" ); if ( hidden & SMESH_Actor::eBallElem ) hiddenMsg << tr( "SMESH_BALLS" );
SUIT_MessageBox::warning( desktop(), SUIT_MessageBox::warning( desktop(),
tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_WARNING" ),
tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ).arg( nbElements ).arg( limitSize ).arg( hiddenMsg.join(", ") ) ); tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ).
arg( nbElements ).
arg( limitSize ).
arg( hiddenMsg.join(", ")));
} }
} }
catch (...) { catch (...) {
@ -1000,12 +1020,12 @@ void SMESHGUI_BaseComputeOp::computeMesh()
{ {
SUIT_MessageBox::warning( desktop(), SUIT_MessageBox::warning( desktop(),
tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_WARNING" ),
tr( "SMESH_WRN_SIZE_LIMIT_EXCEEDED" ).arg( nbElements ).arg( limitSize ) ); tr( "SMESH_WRN_SIZE_LIMIT_EXCEEDED" ).
arg( nbElements ).arg( limitSize ) );
} }
} }
} }
LightApp_SelectionMgr *Sel = selectionMgr(); if ( LightApp_SelectionMgr *Sel = selectionMgr() )
if ( Sel )
{ {
SALOME_ListIO selected; SALOME_ListIO selected;
selected.Append( myIObject ); selected.Append( myIObject );
@ -1017,7 +1037,8 @@ void SMESHGUI_BaseComputeOp::computeMesh()
if ( memoryLack ) if ( memoryLack )
aMemoryReserve.release(); aMemoryReserve.release();
myCompDlg->setWindowTitle(tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED")); myCompDlg->setWindowTitle
( tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED" ));
// SHOW ERRORS // SHOW ERRORS
@ -1234,8 +1255,9 @@ void SMESHGUI_BaseComputeOp::onPublishShape()
if ( !SMESH::getSubShapeSO( 1, myMainShape )) // the main shape not published if ( !SMESH::getSubShapeSO( 1, myMainShape )) // the main shape not published
{ {
QString name = GEOMBase::GetDefaultName( SMESH::shapeTypeName( myMainShape, "MAIN_SHAPE" )); QString name = GEOMBase::GetDefaultName( SMESH::shapeTypeName( myMainShape, "MAIN_SHAPE" ));
SALOMEDS::SObject_wrap so = SALOMEDS::SObject_wrap so = geomGen->AddInStudy( study, myMainShape,
geomGen->AddInStudy( study, myMainShape, name.toLatin1().data(), GEOM::GEOM_Object::_nil()); name.toLatin1().data(),
GEOM::GEOM_Object::_nil());
// look for myMainShape in the table // look for myMainShape in the table
for ( int r = 0, nr = table()->rowCount(); r < nr; ++r ) { for ( int r = 0, nr = table()->rowCount(); r < nr; ++r ) {
if ( table()->item( r, COL_SHAPEID )->text() == "1" ) { if ( table()->item( r, COL_SHAPEID )->text() == "1" ) {
@ -1252,7 +1274,8 @@ void SMESHGUI_BaseComputeOp::onPublishShape()
if ( curSub == 1 ) continue; if ( curSub == 1 ) continue;
} }
QString name = GEOMBase::GetDefaultName( SMESH::shapeTypeName( shape, "ERROR_SHAPE" )); QString name = GEOMBase::GetDefaultName( SMESH::shapeTypeName( shape, "ERROR_SHAPE" ));
SALOMEDS::SObject_wrap so = geomGen->AddInStudy( study, shape, name.toLatin1().data(), myMainShape); SALOMEDS::SObject_wrap so = geomGen->AddInStudy( study, shape,
name.toLatin1().data(), myMainShape);
if ( !so->_is_nil() ) { if ( !so->_is_nil() ) {
CORBA::String_var name = so->GetName(); CORBA::String_var name = so->GetName();
CORBA::String_var entry = so->GetID(); CORBA::String_var entry = so->GetID();
@ -1995,7 +2018,8 @@ void SMESHGUI_PrecomputeOp::onPreview()
if ( isShowError ) if ( isShowError )
{ {
myDlg->hide(); myDlg->hide();
aCompDlg->setWindowTitle(tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED")); aCompDlg->setWindowTitle
( tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED" ));
showComputeResult( memoryLack, noCompError, aCompErrors, noHypoError, aHypErrors ); showComputeResult( memoryLack, noCompError, aCompErrors, noHypoError, aHypErrors );
} }
} }
@ -2198,7 +2222,8 @@ void SMESHGUI_BaseComputeOp::evaluateMesh()
aMemoryReserve.release(); aMemoryReserve.release();
evaluateFailed = ( aCompErrors->length() > 0 ); evaluateFailed = ( aCompErrors->length() > 0 );
myCompDlg->setWindowTitle(tr( evaluateFailed ? "SMESH_WRN_EVALUATE_FAILED" : "SMESH_EVALUATE_SUCCEED")); myCompDlg->setWindowTitle
( tr( evaluateFailed ? "SMESH_WRN_EVALUATE_FAILED" : "SMESH_EVALUATE_SUCCEED" ));
// SHOW ERRORS // SHOW ERRORS

View File

@ -1852,7 +1852,7 @@ void SMESHGUI_SplitVolumesDlg::showFacetByElement( int elemID )
gp_XYZ bc( 0,0,0 ); gp_XYZ bc( 0,0,0 );
Bnd_B3d bbox; Bnd_B3d bbox;
SMDS_NodeIteratorPtr nIt = elem->nodeIterator(); SMDS_NodeIteratorPtr nIt = elem->nodeIterator();
vector< const SMDS_MeshNode* > nodes; std::vector< const SMDS_MeshNode* > nodes;
nodes.reserve( elem->NbNodes() ); nodes.reserve( elem->NbNodes() );
while ( nIt->more() ) while ( nIt->more() )
{ {

View File

@ -30,40 +30,38 @@
# include <string> # include <string>
# include <sstream> # include <sstream>
using namespace std;
/*! /*!
* \brief Class to generate string from any type * \brief Class to generate string from any type
*/ */
class SMESH_Comment : public string class SMESH_Comment : public std::string
{ {
ostringstream _s ; std::ostringstream _s ;
public : public :
SMESH_Comment():string("") {} SMESH_Comment():std::string("") {}
SMESH_Comment(const SMESH_Comment& c):string() { SMESH_Comment(const SMESH_Comment& c):std::string() {
_s << c.c_str() ; _s << c.c_str() ;
this->string::operator=( _s.str() ); this->std::string::operator=( _s.str() );
} }
SMESH_Comment & operator=(const SMESH_Comment& c) { SMESH_Comment & operator=(const SMESH_Comment& c) {
_s << c.c_str() ; _s << c.c_str() ;
this->string::operator=( _s.str() ); this->std::string::operator=( _s.str() );
return *this; return *this;
} }
template <class T> template <class T>
SMESH_Comment( const T &anything ) { SMESH_Comment( const T &anything ) {
_s << anything ; _s << anything ;
this->string::operator=( _s.str() ); this->std::string::operator=( _s.str() );
} }
template <class T> template <class T>
SMESH_Comment & operator<<( const T &anything ) { SMESH_Comment & operator<<( const T &anything ) {
_s << anything ; _s << anything ;
this->string::operator=( _s.str() ); this->std::string::operator=( _s.str() );
return *this ; return *this ;
} }

View File

@ -290,7 +290,7 @@ namespace
void BNode::AddClose ( const BEdge* e, double u ) const void BNode::AddClose ( const BEdge* e, double u ) const
{ {
if ( ! e->Contains( this )) if ( ! e->Contains( this ))
myCloseEdges.push_back( make_pair( const_cast< BEdge* >( e ), u )); myCloseEdges.push_back( std::make_pair( const_cast< BEdge* >( e ), u ));
} }
BEdge* BNode::GetCloseEdgeOfBorder( int borderID, double * uPtr ) const BEdge* BNode::GetCloseEdgeOfBorder( int borderID, double * uPtr ) const
{ {
@ -569,9 +569,9 @@ void SMESH_MeshAlgos::FindCoincidentFreeBorders(SMDS_Mesh& mesh,
// form groups of coincident parts of free borders // form groups of coincident parts of free borders
TFreeBorderPart part; TFreeBorderPart part;
TCoincidentGroup group; TCoincidentGroup group;
vector< BEdge* > ranges; // couples of edges delimiting parts std::vector< BEdge* > ranges; // couples of edges delimiting parts
BEdge* be = 0; // a current edge BEdge* be = 0; // a current edge
int skipGroup = bEdges.size(); // a group ID used to avoid repeating treatment of edges int skipGroup = bEdges.size(); // a group ID used to avoid repeating treatment of edges

View File

@ -1297,7 +1297,7 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
TCollection_AsciiString aLongString, aFunctionType; TCollection_AsciiString aLongString, aFunctionType;
int where = 1; int where = 1;
set< string > functionNameSet; std::set< std::string > functionNameSet;
while ( SMESH::TPythonDump::CutoutLongString( anUpdatedScript, where, aLongString, aFunctionType )) while ( SMESH::TPythonDump::CutoutLongString( anUpdatedScript, where, aLongString, aFunctionType ))
{ {
// make a python string literal // make a python string literal

View File

@ -1628,7 +1628,7 @@ void ConnectedElements_i::SetThreshold ( const char*
{ {
case SMESH::ConnectedElements::POINT: // read 3 node coordinates /////////////////// case SMESH::ConnectedElements::POINT: // read 3 node coordinates ///////////////////
{ {
vector< double > xyz; std::vector< double > xyz;
char* endptr; char* endptr;
do do
{ {

View File

@ -71,16 +71,16 @@ public:
mapIdToId.clear(); mapIdToId.clear();
} }
// register object in the internal map and return its id // register object in the internal map and return its id
int addObject( string theIOR ) int addObject( std::string theIOR )
{ {
int nextId = getNextId(); int nextId = getNextId();
mapIdToIOR[ nextId ] = theIOR; mapIdToIOR[ nextId ] = theIOR;
return nextId; return nextId;
} }
// find the object id in the internal map by the IOR // find the object id in the internal map by the IOR
int findId( string theIOR ) int findId( std::string theIOR )
{ {
map<int, string>::iterator imap; std::map<int, std::string>::iterator imap;
for ( imap = mapIdToIOR.begin(); imap != mapIdToIOR.end(); ++imap ) { for ( imap = mapIdToIOR.begin(); imap != mapIdToIOR.end(); ++imap ) {
if ( imap->second == theIOR ) if ( imap->second == theIOR )
return imap->first; return imap->first;
@ -88,18 +88,18 @@ public:
return 0; return 0;
} }
// get object's IOR by id // get object's IOR by id
string getIORbyId( const int theId ) std::string getIORbyId( const int theId )
{ {
if ( mapIdToIOR.find( theId ) != mapIdToIOR.end() ) if ( mapIdToIOR.find( theId ) != mapIdToIOR.end() )
return mapIdToIOR[ theId ]; return mapIdToIOR[ theId ];
return string( "" ); return std::string( "" );
} }
// get object's IOR by old id // get object's IOR by old id
string getIORbyOldId( const int theOldId ) std::string getIORbyOldId( const int theOldId )
{ {
if ( mapIdToId.find( theOldId ) != mapIdToId.end() ) if ( mapIdToId.find( theOldId ) != mapIdToId.end() )
return getIORbyId( mapIdToId[ theOldId ] ); return getIORbyId( mapIdToId[ theOldId ] );
return string( "" ); return std::string( "" );
} }
// maps old object id to the new one (used when restoring data) // maps old object id to the new one (used when restoring data)
void mapOldToNew( const int oldId, const int newId ) { void mapOldToNew( const int oldId, const int newId ) {
@ -107,7 +107,7 @@ public:
} }
// get old id by a new one // get old id by a new one
int getOldId( const int newId ) { int getOldId( const int newId ) {
map<int, int>::iterator imap; std::map<int, int>::iterator imap;
for ( imap = mapIdToId.begin(); imap != mapIdToId.end(); ++imap ) { for ( imap = mapIdToId.begin(); imap != mapIdToId.end(); ++imap ) {
if ( imap->second == newId ) if ( imap->second == newId )
return imap->first; return imap->first;
@ -125,8 +125,8 @@ private:
return id; return id;
} }
map<int, string> mapIdToIOR; // persistent-to-transient map std::map<int, std::string> mapIdToIOR; // persistent-to-transient map
map<int, int> mapIdToId; // used to translate object from persistent to transient form std::map<int, int> mapIdToId; // to translate object from persistent to transient form
}; };
// =========================================================== // ===========================================================
@ -568,7 +568,7 @@ public:
typename TInterface::_var_type GetObjectByOldId( const int oldID ) typename TInterface::_var_type GetObjectByOldId( const int oldID )
{ {
if ( StudyContext* myStudyContext = GetCurrentStudyContext() ) { if ( StudyContext* myStudyContext = GetCurrentStudyContext() ) {
string ior = myStudyContext->getIORbyOldId( oldID ); std::string ior = myStudyContext->getIORbyOldId( oldID );
if ( !ior.empty() ) if ( !ior.empty() )
return TInterface::_narrow(GetORB()->string_to_object( ior.c_str() )); return TInterface::_narrow(GetORB()->string_to_object( ior.c_str() ));
} }
@ -671,13 +671,13 @@ private:
::SMESH_Gen myGen; // SMESH_Gen local implementation ::SMESH_Gen myGen; // SMESH_Gen local implementation
// hypotheses managing // hypotheses managing
map<string, GenericHypothesisCreator_i*> myHypCreatorMap; std::map<std::string, GenericHypothesisCreator_i*> myHypCreatorMap;
map<int, StudyContext*> myStudyContextMap; // Map of study context objects std::map<int, StudyContext*> myStudyContextMap; // Map of study context objects
GEOM_Client* myShapeReader; // Shape reader GEOM_Client* myShapeReader; // Shape reader
SALOMEDS::Study_var myCurrentStudy; // Current study SALOMEDS::Study_var myCurrentStudy; // Current study
CORBA::Boolean myIsEmbeddedMode; // Current mode CORBA::Boolean myIsEmbeddedMode; // Current mode
// Default color of groups // Default color of groups
std::string myDefaultGroupColor; std::string myDefaultGroupColor;

View File

@ -47,12 +47,12 @@
#ifdef _DEBUG_ #ifdef _DEBUG_
static int MYDEBUG = 0; static int MYDEBUG = 0;
//static int VARIABLE_DEBUG = 0;
#else #else
static int MYDEBUG = 0; static int MYDEBUG = 0;
//static int VARIABLE_DEBUG = 0;
#endif #endif
using namespace std;
//============================================================================= //=============================================================================
/*! /*!
* Get...Tag [ static ] * Get...Tag [ static ]
@ -281,7 +281,8 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_wrap curObj; SALOMEDS::SObject_wrap curObj;
if ( theFatherObject->GetLastChildTag() > theTag ) if ( theFatherObject->GetLastChildTag() > theTag )
{ {
SALOMEDS::UseCaseIterator_wrap anUseCaseIter = useCaseBuilder->GetUseCaseIterator(theFatherObject); SALOMEDS::UseCaseIterator_wrap
anUseCaseIter = useCaseBuilder->GetUseCaseIterator(theFatherObject);
for ( ; anUseCaseIter->More(); anUseCaseIter->Next() ) { for ( ; anUseCaseIter->More(); anUseCaseIter->Next() ) {
curObj = anUseCaseIter->Value(); curObj = anUseCaseIter->Value();
if ( curObj->Tag() > theTag ) { if ( curObj->Tag() > theTag ) {
@ -294,21 +295,29 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr theStudy,
} }
SALOMEDS::GenericAttribute_wrap anAttr; SALOMEDS::GenericAttribute_wrap anAttr;
if ( !CORBA::is_nil( theIOR )) { if ( !CORBA::is_nil( theIOR ))
{
anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeIOR" ); anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeIOR" );
CORBA::String_var objStr = SMESH_Gen_i::GetORB()->object_to_string( theIOR ); CORBA::String_var objStr = SMESH_Gen_i::GetORB()->object_to_string( theIOR );
SALOMEDS::AttributeIOR_wrap iorAttr = anAttr; SALOMEDS::AttributeIOR_wrap iorAttr = anAttr;
iorAttr->SetValue( objStr.in() ); CORBA::String_var objStrCur = iorAttr->Value();
// UnRegister() !!! bool sameIOR = ( objStrCur.in() && strcmp( objStr.in(), objStrCur.in() ) == 0 );
SALOME::GenericObj_var genObj = SALOME::GenericObj::_narrow( theIOR ); if ( !sameIOR )
if ( !genObj->_is_nil() ) {
genObj->UnRegister(); iorAttr->SetValue( objStr.in() );
// UnRegister() !!!
SALOME::GenericObj_var genObj = SALOME::GenericObj::_narrow( theIOR );
if ( !genObj->_is_nil() )
genObj->UnRegister();
}
} }
if ( thePixMap ) { if ( thePixMap ) {
anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributePixMap" ); anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributePixMap" );
SALOMEDS::AttributePixMap_wrap pm = anAttr; SALOMEDS::AttributePixMap_wrap pm = anAttr;
pm->SetPixMap( thePixMap ); pm->SetPixMap( thePixMap );
} }
if ( !theSelectable ) { if ( !theSelectable ) {
anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeSelectable" ); anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeSelectable" );
SALOMEDS::AttributeSelectable_wrap selAttr = anAttr; SALOMEDS::AttributeSelectable_wrap selAttr = anAttr;

View File

@ -502,8 +502,8 @@ namespace
*/ */
//================================================================================ //================================================================================
void getNodesOfElements(SMDS_ElemIteratorPtr elemIt, void getNodesOfElements(SMDS_ElemIteratorPtr elemIt,
set<const SMDS_MeshNode* >& nodes) std::set<const SMDS_MeshNode* >& nodes)
{ {
while ( elemIt->more() ) while ( elemIt->more() )
{ {
@ -531,7 +531,7 @@ CORBA::Long SMESH_GroupBase_i::GetNumberOfNodes()
{ {
if ( myNbNodes < 0 || g->GetTic() != myGroupDSTic ) if ( myNbNodes < 0 || g->GetTic() != myGroupDSTic )
{ {
set<const SMDS_MeshNode* > nodes; std::set<const SMDS_MeshNode* > nodes;
getNodesOfElements( g->GetElements(), nodes ); getNodesOfElements( g->GetElements(), nodes );
myNbNodes = nodes.size(); myNbNodes = nodes.size();
myGroupDSTic = g->GetTic(); myGroupDSTic = g->GetTic();
@ -574,10 +574,10 @@ SMESH::long_array* SMESH_GroupBase_i::GetNodeIDs()
SMESH::long_array_var aRes = new SMESH::long_array(); SMESH::long_array_var aRes = new SMESH::long_array();
if ( SMESHDS_GroupBase* g = GetGroupDS()) if ( SMESHDS_GroupBase* g = GetGroupDS())
{ {
set<const SMDS_MeshNode* > nodes; std::set<const SMDS_MeshNode* > nodes;
getNodesOfElements( g->GetElements(), nodes ); getNodesOfElements( g->GetElements(), nodes );
aRes->length( nodes.size() ); aRes->length( nodes.size() );
set<const SMDS_MeshNode*>::iterator nIt = nodes.begin(), nEnd = nodes.end(); std::set<const SMDS_MeshNode*>::iterator nIt = nodes.begin(), nEnd = nodes.end();
for ( int i = 0; nIt != nEnd; ++nIt, ++i ) for ( int i = 0; nIt != nEnd; ++nIt, ++i )
aRes[i] = (*nIt)->GetID(); aRes[i] = (*nIt)->GetID();
} }
@ -918,7 +918,7 @@ SMESH::long_array* SMESH_GroupOnFilter_i::GetMeshInfo()
if ( g->GetType() != SMDSAbs_Node ) if ( g->GetType() != SMDSAbs_Node )
{ {
vector< int > nbElems = static_cast< SMESHDS_GroupOnFilter* >( g )->GetMeshInfo(); std::vector< int > nbElems = static_cast< SMESHDS_GroupOnFilter* >( g )->GetMeshInfo();
for ( size_t i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++) for ( size_t i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++)
if ( i < nbElems.size() ) if ( i < nbElems.size() )
aRes[i] = nbElems[ i ]; aRes[i] = nbElems[ i ];

View File

@ -221,12 +221,12 @@ static void enlargeBoundingBox(const SMDS_MeshNode* theNode,
theMeasure.node1 = theNode->GetID(); theMeasure.node1 = theNode->GetID();
} }
else { else {
theMeasure.minX = min( theMeasure.minX, theNode->X() ); theMeasure.minX = std::min( theMeasure.minX, theNode->X() );
theMeasure.maxX = max( theMeasure.maxX, theNode->X() ); theMeasure.maxX = std::max( theMeasure.maxX, theNode->X() );
theMeasure.minY = min( theMeasure.minY, theNode->Y() ); theMeasure.minY = std::min( theMeasure.minY, theNode->Y() );
theMeasure.maxY = max( theMeasure.maxY, theNode->Y() ); theMeasure.maxY = std::max( theMeasure.maxY, theNode->Y() );
theMeasure.minZ = min( theMeasure.minZ, theNode->Z() ); theMeasure.minZ = std::min( theMeasure.minZ, theNode->Z() );
theMeasure.maxZ = max( theMeasure.maxZ, theNode->Z() ); theMeasure.maxZ = std::max( theMeasure.maxZ, theNode->Z() );
} }
} }

View File

@ -5249,10 +5249,10 @@ void SMESH_MeshEditor_i::dumpGroupsList(TPythonDump & theDumpPytho
*/ */
//================================================================================ //================================================================================
string SMESH_MeshEditor_i::generateGroupName(const string& thePrefix) std::string SMESH_MeshEditor_i::generateGroupName(const std::string& thePrefix)
{ {
SMESH::ListOfGroups_var groups = myMesh_i->GetGroups(); SMESH::ListOfGroups_var groups = myMesh_i->GetGroups();
set<string> groupNames; set<std::string> groupNames;
// Get existing group names // Get existing group names
for (int i = 0, nbGroups = groups->length(); i < nbGroups; i++ ) { for (int i = 0, nbGroups = groups->length(); i < nbGroups; i++ ) {
@ -5265,7 +5265,7 @@ string SMESH_MeshEditor_i::generateGroupName(const string& thePrefix)
} }
// Find new name // Find new name
string name = thePrefix; std::string name = thePrefix;
int index = 0; int index = 0;
while (!groupNames.insert(name).second) while (!groupNames.insert(name).second)
@ -5573,8 +5573,8 @@ SMESH_MeshEditor_i::DoubleNodeGroupNew( SMESH::SMESH_GroupBase_ptr theNodes,
// Create group with newly created nodes // Create group with newly created nodes
SMESH::long_array_var anIds = GetLastCreatedNodes(); SMESH::long_array_var anIds = GetLastCreatedNodes();
if (anIds->length() > 0) { if (anIds->length() > 0) {
string anUnindexedName (theNodes->GetName()); std::string anUnindexedName (theNodes->GetName());
string aNewName = generateGroupName(anUnindexedName + "_double"); std::string aNewName = generateGroupName(anUnindexedName + "_double");
aNewGroup = myMesh_i->CreateGroup(SMESH::NODE, aNewName.c_str()); aNewGroup = myMesh_i->CreateGroup(SMESH::NODE, aNewName.c_str());
aNewGroup->Add(anIds); aNewGroup->Add(anIds);
pyDump << aNewGroup << " = "; pyDump << aNewGroup << " = ";
@ -5672,8 +5672,8 @@ SMESH_MeshEditor_i::DoubleNodeGroupsNew( const SMESH::ListOfGroups& theNodes,
// Create group with newly created nodes // Create group with newly created nodes
SMESH::long_array_var anIds = GetLastCreatedNodes(); SMESH::long_array_var anIds = GetLastCreatedNodes();
if (anIds->length() > 0) { if (anIds->length() > 0) {
string anUnindexedName (theNodes[0]->GetName()); std::string anUnindexedName (theNodes[0]->GetName());
string aNewName = generateGroupName(anUnindexedName + "_double"); std::string aNewName = generateGroupName(anUnindexedName + "_double");
aNewGroup = myMesh_i->CreateGroup(SMESH::NODE, aNewName.c_str()); aNewGroup = myMesh_i->CreateGroup(SMESH::NODE, aNewName.c_str());
aNewGroup->Add(anIds); aNewGroup->Add(anIds);
pyDump << aNewGroup << " = "; pyDump << aNewGroup << " = ";
@ -5897,7 +5897,7 @@ SMESH_MeshEditor_i::DoubleNodeElemGroup2New(SMESH::SMESH_GroupBase_ptr theElems,
{ {
// Create group with newly created elements // Create group with newly created elements
CORBA::String_var elemGroupName = theElems->GetName(); CORBA::String_var elemGroupName = theElems->GetName();
string aNewName = generateGroupName( string(elemGroupName.in()) + "_double"); std::string aNewName = generateGroupName( std::string(elemGroupName.in()) + "_double");
if ( !getEditor().GetLastCreatedElems().IsEmpty() && theElemGroupNeeded ) if ( !getEditor().GetLastCreatedElems().IsEmpty() && theElemGroupNeeded )
{ {
SMESH::long_array_var anIds = GetLastCreatedElems(); SMESH::long_array_var anIds = GetLastCreatedElems();
@ -6129,7 +6129,7 @@ SMESH_MeshEditor_i::DoubleNodeElemGroups2New(const SMESH::ListOfGroups& theElems
{ {
// Create group with newly created elements // Create group with newly created elements
CORBA::String_var elemGroupName = theElems[0]->GetName(); CORBA::String_var elemGroupName = theElems[0]->GetName();
string aNewName = generateGroupName( string(elemGroupName.in()) + "_double"); std::string aNewName = generateGroupName( std::string(elemGroupName.in()) + "_double");
if ( !getEditor().GetLastCreatedElems().IsEmpty() && theElemGroupNeeded ) if ( !getEditor().GetLastCreatedElems().IsEmpty() && theElemGroupNeeded )
{ {
SMESH::long_array_var anIds = GetLastCreatedElems(); SMESH::long_array_var anIds = GetLastCreatedElems();

View File

@ -37,6 +37,7 @@
#include "SMESH_PythonDump.hxx" #include "SMESH_PythonDump.hxx"
#include "SMESH_MeshEditor.hxx" #include "SMESH_MeshEditor.hxx"
#include <list> #include <list>
#include <string>
class SMESH_Mesh_i; class SMESH_Mesh_i;
@ -897,7 +898,7 @@ private: //!< private methods
void dumpGroupsList(SMESH::TPythonDump & theDumpPython, void dumpGroupsList(SMESH::TPythonDump & theDumpPython,
const SMESH::ListOfGroups * theGroupList); const SMESH::ListOfGroups * theGroupList);
string generateGroupName(const string& thePrefix); std::string generateGroupName(const std::string& thePrefix);
void prepareIdSource(SMESH::SMESH_IDSource_ptr theObject); void prepareIdSource(SMESH::SMESH_IDSource_ptr theObject);

View File

@ -45,6 +45,8 @@
#include <sstream> #include <sstream>
#include <set> #include <set>
using namespace std;
using SMESH::TPythonDump; using SMESH::TPythonDump;
using SMESH::TVar; using SMESH::TVar;

View File

@ -54,6 +54,7 @@
#include CORBA_SERVER_HEADER(SALOME_Session) #include CORBA_SERVER_HEADER(SALOME_Session)
using namespace std;
#define MYDEBUGOUT(msg) //std::cout << msg << std::endl; #define MYDEBUGOUT(msg) //std::cout << msg << std::endl;
@ -62,7 +63,7 @@ namespace
enum { GroupOnFilter_OutOfDate = -1 }; enum { GroupOnFilter_OutOfDate = -1 };
// a map to count not yet loaded meshes // a map to count not yet loaded meshes
static map< int, int > theStudyIDToMeshCounter; static std::map< int, int > theStudyIDToMeshCounter;
//================================================================================ //================================================================================
/*! /*!
@ -72,8 +73,8 @@ namespace
void meshInfoLoaded( SMESH_Mesh_i* mesh ) void meshInfoLoaded( SMESH_Mesh_i* mesh )
{ {
map< int, int >::iterator id2counter = std::map< int, int >::iterator id2counter =
theStudyIDToMeshCounter.insert( make_pair( (int) mesh->GetStudyId(), 0 )).first; theStudyIDToMeshCounter.insert( std::make_pair( (int) mesh->GetStudyId(), 0 )).first;
id2counter->second++; id2counter->second++;
} }
//================================================================================ //================================================================================
@ -88,7 +89,7 @@ namespace
{ {
if ( --theStudyIDToMeshCounter[ (int) mesh->GetStudyId() ] == 0 ) if ( --theStudyIDToMeshCounter[ (int) mesh->GetStudyId() ] == 0 )
{ {
string tmpDir = SALOMEDS_Tool::GetDirFromPath( hdfFile ); std::string tmpDir = SALOMEDS_Tool::GetDirFromPath( hdfFile );
SALOMEDS::ListOfFileNames_var aFiles = new SALOMEDS::ListOfFileNames; SALOMEDS::ListOfFileNames_var aFiles = new SALOMEDS::ListOfFileNames;
aFiles->length(2); aFiles->length(2);
@ -109,7 +110,7 @@ namespace
class SignalToGUI class SignalToGUI
{ {
string _messagePrefix; std::string _messagePrefix;
SALOME::Session_var _session; SALOME::Session_var _session;
public: public:
SignalToGUI( SMESH_Mesh_i* mesh ) SignalToGUI( SMESH_Mesh_i* mesh )
@ -127,7 +128,7 @@ namespace
_messagePrefix = "SMESH/mesh_loading/"; _messagePrefix = "SMESH/mesh_loading/";
_messagePrefix += meshEntry.in(); _messagePrefix += meshEntry.in();
string msgToGUI = _messagePrefix + "/"; std::string msgToGUI = _messagePrefix + "/";
msgToGUI += SMESH_Comment( mesh->NbNodes() ); msgToGUI += SMESH_Comment( mesh->NbNodes() );
msgToGUI += "/"; msgToGUI += "/";
msgToGUI += SMESH_Comment( mesh->NbElements() ); msgToGUI += SMESH_Comment( mesh->NbElements() );
@ -140,7 +141,7 @@ namespace
{ {
if ( !_messagePrefix.empty() ) if ( !_messagePrefix.empty() )
{ {
string msgToGUI = _messagePrefix + "/stop"; std::string msgToGUI = _messagePrefix + "/stop";
_session->emitMessageOneWay( msgToGUI.c_str()); _session->emitMessageOneWay( msgToGUI.c_str());
_messagePrefix.clear(); _messagePrefix.clear();
} }
@ -173,7 +174,7 @@ namespace
SMDS_PositionPtr vertexPosition() const { return SMDS_PositionPtr( new SMDS_VertexPosition); } SMDS_PositionPtr vertexPosition() const { return SMDS_PositionPtr( new SMDS_VertexPosition); }
SMDS_PositionPtr defaultPosition() const { return SMDS_SpacePosition::originSpacePosition(); } SMDS_PositionPtr defaultPosition() const { return SMDS_SpacePosition::originSpacePosition(); }
typedef SMDS_PositionPtr (PositionCreator:: * FmakePos)() const; typedef SMDS_PositionPtr (PositionCreator:: * FmakePos)() const;
vector<FmakePos> myFuncTable; std::vector<FmakePos> myFuncTable;
}; };
//================================================================================ //================================================================================
@ -182,12 +183,12 @@ namespace
*/ */
//================================================================================ //================================================================================
vector<int> getSimpleSubMeshIds( SMESHDS_Mesh* meshDS, int shapeId ) std::vector<int> getSimpleSubMeshIds( SMESHDS_Mesh* meshDS, int shapeId )
{ {
vector<int> ids; std::vector<int> ids;
list<TopoDS_Shape> shapeQueue( 1, meshDS->IndexToShape( shapeId )); std::list<TopoDS_Shape> shapeQueue( 1, meshDS->IndexToShape( shapeId ));
list<TopoDS_Shape>::iterator shape = shapeQueue.begin(); std::list<TopoDS_Shape>::iterator shape = shapeQueue.begin();
for ( ; shape != shapeQueue.end(); ++shape ) for ( ; shape != shapeQueue.end(); ++shape )
{ {
if ( shape->IsNull() ) continue; if ( shape->IsNull() ) continue;
@ -222,10 +223,10 @@ namespace
*/ */
//================================================================================ //================================================================================
typedef map< MED::EGeometrieElement, SMDSAbs_EntityType > Tmed2smeshElemTypeMap; typedef std::map< MED::EGeometrieElement, SMDSAbs_EntityType > Tmed2smeshElemTypeMap;
const Tmed2smeshElemTypeMap& med2smeshElemTypeMap() const Tmed2smeshElemTypeMap& med2smeshElemTypeMap()
{ {
static map< MED::EGeometrieElement, SMDSAbs_EntityType> med2smeshTypes; static Tmed2smeshElemTypeMap med2smeshTypes;
if ( med2smeshTypes.empty() ) if ( med2smeshTypes.empty() )
{ {
for ( int iG = 0; iG < SMDSEntity_Last; ++iG ) for ( int iG = 0; iG < SMDSEntity_Last; ++iG )
@ -233,7 +234,7 @@ namespace
SMDSAbs_EntityType smdsType = (SMDSAbs_EntityType) iG; SMDSAbs_EntityType smdsType = (SMDSAbs_EntityType) iG;
MED::EGeometrieElement medType = MED::EGeometrieElement medType =
(MED::EGeometrieElement) DriverMED::GetMedGeoType( smdsType ); (MED::EGeometrieElement) DriverMED::GetMedGeoType( smdsType );
med2smeshTypes.insert( make_pair( medType, smdsType )); med2smeshTypes.insert( std::make_pair( medType, smdsType ));
} }
} }
return med2smeshTypes; return med2smeshTypes;
@ -254,7 +255,7 @@ namespace
// change at insertion of new items in the middle. // change at insertion of new items in the middle.
//const vector<MED::EGeometrieElement>& medTypes = mesh2medElemType(); //const vector<MED::EGeometrieElement>& medTypes = mesh2medElemType();
vector<int> data; std::vector<int> data;
for ( size_t i = 0; i < meshInfo->length(); ++i ) for ( size_t i = 0; i < meshInfo->length(); ++i )
if ( meshInfo[i] > 0 ) if ( meshInfo[i] > 0 )
@ -298,7 +299,7 @@ void SMESH_PreMeshInfo::hdf2meshInfo( const std::string& name,
// // array->GetDim( datasetSize ); // // array->GetDim( datasetSize );
// int size = dataset->GetSize(); // int size = dataset->GetSize();
vector<int> info( SMDSEntity_Last * 2, 0 ); std::vector<int> info( SMDSEntity_Last * 2, 0 );
dataset->ReadFromDisk( &info[0] ); dataset->ReadFromDisk( &info[0] );
dataset->CloseOnDisk(); dataset->CloseOnDisk();
@ -429,7 +430,7 @@ bool SMESH_PreMeshInfo::readPreInfoFromHDF()
group_i->changePreMeshInfo() = newInstance(); group_i->changePreMeshInfo() = newInstance();
if ( SMESHDS_GroupBase* group = group_i->GetGroupDS() ) if ( SMESHDS_GroupBase* group = group_i->GetGroupDS() )
{ {
const string name = group->GetStoreName(); const std::string name = group->GetStoreName();
group_i->changePreMeshInfo()->hdf2meshInfo( name, infoHdfGroup ); group_i->changePreMeshInfo()->hdf2meshInfo( name, infoHdfGroup );
} }
} }
@ -499,7 +500,7 @@ void SMESH_PreMeshInfo::readGroupInfo()
if ( _mesh->_mapGroups.empty() ) return; if ( _mesh->_mapGroups.empty() ) return;
// make SMESH_PreMeshInfo of groups // make SMESH_PreMeshInfo of groups
map< string, SMESH_PreMeshInfo* > name2GroupInfo; map< std::string, SMESH_PreMeshInfo* > name2GroupInfo;
map<int, SMESH::SMESH_GroupBase_ptr>::const_iterator i2group = _mesh->_mapGroups.begin(); map<int, SMESH::SMESH_GroupBase_ptr>::const_iterator i2group = _mesh->_mapGroups.begin();
for ( ; i2group != _mesh->_mapGroups.end(); ++i2group ) for ( ; i2group != _mesh->_mapGroups.end(); ++i2group )
{ {
@ -510,8 +511,8 @@ void SMESH_PreMeshInfo::readGroupInfo()
group_i->changePreMeshInfo() = info; group_i->changePreMeshInfo() = info;
if ( SMESHDS_Group* group = dynamic_cast< SMESHDS_Group* >( group_i->GetGroupDS() )) if ( SMESHDS_Group* group = dynamic_cast< SMESHDS_Group* >( group_i->GetGroupDS() ))
{ {
string name = group->GetStoreName(); std::string name = group->GetStoreName();
name2GroupInfo.insert( make_pair( name, info )); name2GroupInfo.insert( std::make_pair( name, info ));
info->_isInfoOk = true; info->_isInfoOk = true;
} }
} }
@ -534,8 +535,8 @@ void SMESH_PreMeshInfo::readGroupInfo()
vector< SMESH_PreMeshInfo* >& grInfoVec = famId2grInfo[ medFamInfo->GetId() ]; vector< SMESH_PreMeshInfo* >& grInfoVec = famId2grInfo[ medFamInfo->GetId() ];
for ( int iG = 0; iG < nbGroups; ++iG ) for ( int iG = 0; iG < nbGroups; ++iG )
{ {
const string grName = medFamInfo->GetGroupName( iG ); const std::string grName = medFamInfo->GetGroupName( iG );
map< string, SMESH_PreMeshInfo* >::iterator n2i = name2GroupInfo.find( grName ); map< std::string, SMESH_PreMeshInfo* >::iterator n2i = name2GroupInfo.find( grName );
if ( n2i != name2GroupInfo.end() ) if ( n2i != name2GroupInfo.end() )
grInfoVec.push_back( n2i->second ); grInfoVec.push_back( n2i->second );
} }
@ -560,14 +561,14 @@ void SMESH_PreMeshInfo::readGroupInfo()
f2infos = famId2grInfo.find( famNums[i] ); f2infos = famId2grInfo.find( famNums[i] );
if ( f2infos == famId2grInfo.end() ) if ( f2infos == famId2grInfo.end() )
f2infos = famId2grInfo.insert f2infos = famId2grInfo.insert
( make_pair( famNums[i], vector< SMESH_PreMeshInfo*>())).first; ( std::make_pair( famNums[i], vector< SMESH_PreMeshInfo*>())).first;
} }
vector< SMESH_PreMeshInfo* >& infoVec = f2infos->second ; vector< SMESH_PreMeshInfo* >& infoVec = f2infos->second ;
for ( size_t j = 0; j < infoVec.size(); ++j ) for ( size_t j = 0; j < infoVec.size(); ++j )
infoVec[j]->_elemCounter++; infoVec[j]->_elemCounter++;
} }
// pass _elemCounter to a real elem type // pass _elemCounter to a real elem type
map< string, SMESH_PreMeshInfo* >::iterator n2i = name2GroupInfo.begin(); map< std::string, SMESH_PreMeshInfo* >::iterator n2i = name2GroupInfo.begin();
for ( ; n2i != name2GroupInfo.end(); ++n2i ) for ( ; n2i != name2GroupInfo.end(); ++n2i )
{ {
SMESH_PreMeshInfo* info = n2i->second; SMESH_PreMeshInfo* info = n2i->second;
@ -618,7 +619,7 @@ void SMESH_PreMeshInfo::readSubMeshInfo()
for ( int isNode = 0; isNode < 2; ++isNode ) for ( int isNode = 0; isNode < 2; ++isNode )
{ {
string aDSName( isNode ? "Node Submeshes" : "Element Submeshes"); std::string aDSName( isNode ? "Node Submeshes" : "Element Submeshes");
if ( aGroup->ExistInternalObject( (char*) aDSName.c_str() )) if ( aGroup->ExistInternalObject( (char*) aDSName.c_str() ))
{ {
// read sub-mesh id of all nodes or elems // read sub-mesh id of all nodes or elems
@ -893,7 +894,7 @@ void SMESH_PreMeshInfo::readSubMeshes(DriverMED_R_SMESHDS_Mesh* reader) const
SMDS_ElemIteratorPtr eIt = meshDS->elementsIterator(); SMDS_ElemIteratorPtr eIt = meshDS->elementsIterator();
for ( int isNode = 0; isNode < 2; ++isNode ) for ( int isNode = 0; isNode < 2; ++isNode )
{ {
string aDSName( isNode ? "Node Submeshes" : "Element Submeshes"); std::string aDSName( isNode ? "Node Submeshes" : "Element Submeshes");
if ( aGroup->ExistInternalObject( (char*) aDSName.c_str() )) if ( aGroup->ExistInternalObject( (char*) aDSName.c_str() ))
{ {
HDFdataset* aDataset = new HDFdataset( (char*) aDSName.c_str(), aGroup ); HDFdataset* aDataset = new HDFdataset( (char*) aDSName.c_str(), aGroup );

View File

@ -58,6 +58,7 @@
#include <set> #include <set>
#include <vector> #include <vector>
using namespace std;
#ifdef _DEBUG_ #ifdef _DEBUG_
// #define DEB_FACES // #define DEB_FACES

View File

@ -57,15 +57,15 @@ public:
private: private:
bool findBoxFaces( const TopoDS_Shape& shape, bool findBoxFaces( const TopoDS_Shape& shape,
list< _QuadFaceGrid >& boxFaceContainer, std::list< _QuadFaceGrid >& boxFaceContainer,
SMESH_Mesh& mesh, SMESH_Mesh& mesh,
_QuadFaceGrid * & fBottom, _QuadFaceGrid * & fBottom,
_QuadFaceGrid * & fTop, _QuadFaceGrid * & fTop,
_QuadFaceGrid * & fFront, _QuadFaceGrid * & fFront,
_QuadFaceGrid * & fBack, _QuadFaceGrid * & fBack,
_QuadFaceGrid * & fLeft, _QuadFaceGrid * & fLeft,
_QuadFaceGrid * & fRight); _QuadFaceGrid * & fRight);
}; };
#endif #endif

View File

@ -56,6 +56,8 @@
#include "utilities.h" #include "utilities.h"
using namespace std;
//================================================================================ //================================================================================
/*! /*!
* \brief Constructor of a side of one edge * \brief Constructor of a side of one edge
@ -71,7 +73,7 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace,
const bool theIgnoreMediumNodes, const bool theIgnoreMediumNodes,
SMESH_ProxyMesh::Ptr theProxyMesh) SMESH_ProxyMesh::Ptr theProxyMesh)
{ {
list<TopoDS_Edge> edges(1,theEdge); std::list<TopoDS_Edge> edges(1,theEdge);
*this = StdMeshers_FaceSide( theFace, edges, theMesh, theIsForward, *this = StdMeshers_FaceSide( theFace, edges, theMesh, theIsForward,
theIgnoreMediumNodes, theProxyMesh ); theIgnoreMediumNodes, theProxyMesh );
} }
@ -82,12 +84,12 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace,
*/ */
//================================================================================ //================================================================================
StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace, StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace,
list<TopoDS_Edge>& theEdges, std::list<TopoDS_Edge>& theEdges,
SMESH_Mesh* theMesh, SMESH_Mesh* theMesh,
const bool theIsForward, const bool theIsForward,
const bool theIgnoreMediumNodes, const bool theIgnoreMediumNodes,
SMESH_ProxyMesh::Ptr theProxyMesh) SMESH_ProxyMesh::Ptr theProxyMesh)
{ {
int nbEdges = theEdges.size(); int nbEdges = theEdges.size();
myEdge.resize ( nbEdges ); myEdge.resize ( nbEdges );
@ -112,7 +114,7 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace,
SMESHDS_Mesh* meshDS = myProxyMesh->GetMeshDS(); SMESHDS_Mesh* meshDS = myProxyMesh->GetMeshDS();
int nbDegen = 0; int nbDegen = 0;
list<TopoDS_Edge>::iterator edge = theEdges.begin(); std::list<TopoDS_Edge>::iterator edge = theEdges.begin();
for ( int index = 0; edge != theEdges.end(); ++index, ++edge ) for ( int index = 0; edge != theEdges.end(); ++index, ++edge )
{ {
int i = theIsForward ? index : nbEdges-index-1; int i = theIsForward ? index : nbEdges-index-1;
@ -302,8 +304,8 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(UVPtStructVec& theSideNodes,
*/ */
//================================================================================ //================================================================================
const vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst, const std::vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst,
double constValue) const double constValue) const
{ {
if ( myPoints.empty() ) if ( myPoints.empty() )
{ {

View File

@ -166,7 +166,7 @@ bool StdMeshers_Geometric1D::SetParametersByMesh(const SMESH_Mesh* theMesh,
const TopoDS_Edge& edge = TopoDS::Edge( edgeMap( i )); const TopoDS_Edge& edge = TopoDS::Edge( edgeMap( i ));
BRepAdaptor_Curve C( edge ); BRepAdaptor_Curve C( edge );
vector< double > params; std::vector< double > params;
if ( SMESH_Algo::GetNodeParamOnEdge( theMesh->GetMeshDS(), edge, params )) if ( SMESH_Algo::GetNodeParamOnEdge( theMesh->GetMeshDS(), edge, params ))
{ {
nbEdges++; nbEdges++;

View File

@ -33,6 +33,8 @@
#include <limits> #include <limits>
using namespace std;
// Define error message and _MYDEBUG_ if needed // Define error message and _MYDEBUG_ if needed
#ifdef _DEBUG_ #ifdef _DEBUG_
#define BAD_MESH_ERR \ #define BAD_MESH_ERR \

View File

@ -270,7 +270,7 @@ private:
TParam2ColumnMap* myParamToColumnMap; TParam2ColumnMap* myParamToColumnMap;
PSurface mySurface; PSurface mySurface;
TopoDS_Edge myBaseEdge; TopoDS_Edge myBaseEdge;
map< int, PSurface > myShapeID2Surf; std::map< int, PSurface > myShapeID2Surf;
// first and last normalized params and orientaion for each component or it-self // first and last normalized params and orientaion for each component or it-self
std::vector< std::pair< double, double> > myParams; // select my columns in myParamToColumnMap std::vector< std::pair< double, double> > myParams; // select my columns in myParamToColumnMap
bool myIsForward; bool myIsForward;

View File

@ -57,6 +57,7 @@
namespace TAssocTool = StdMeshers_ProjectionUtils; namespace TAssocTool = StdMeshers_ProjectionUtils;
using namespace std;
//======================================================================= //=======================================================================
//function : StdMeshers_Projection_3D //function : StdMeshers_Projection_3D

View File

@ -61,6 +61,8 @@
#include <list> #include <list>
#include <vector> #include <vector>
using namespace std;
//================================================================================ //================================================================================
/*! /*!
* \brief 1D algo * \brief 1D algo

View File

@ -82,7 +82,7 @@ struct FaceQuadStruct
return GetUVPtStruct()[ to-nbNodeOut-(IsReversed() ? -1 : +1)]; return GetUVPtStruct()[ to-nbNodeOut-(IsReversed() ? -1 : +1)];
} }
// some sortcuts // some sortcuts
const vector<UVPtStruct>& GetUVPtStruct(bool isXConst=0, double constValue=0) const const std::vector<UVPtStruct>& GetUVPtStruct(bool isXConst=0, double constValue=0) const
{ return nbNodeOut ? { return nbNodeOut ?
grid->SimulateUVPtStruct( NbPoints()-nbNodeOut-1, isXConst, constValue ) : grid->SimulateUVPtStruct( NbPoints()-nbNodeOut-1, isXConst, constValue ) :
grid->GetUVPtStruct( isXConst, constValue ); grid->GetUVPtStruct( isXConst, constValue );

View File

@ -58,13 +58,14 @@ StdMeshers_SegmentAroundVertex_0D::~StdMeshers_SegmentAroundVertex_0D()
//purpose : //purpose :
//======================================================================= //=======================================================================
bool StdMeshers_SegmentAroundVertex_0D::CheckHypothesis(SMESH_Mesh& aMesh, bool StdMeshers_SegmentAroundVertex_0D::
const TopoDS_Shape& aShape, CheckHypothesis(SMESH_Mesh& aMesh,
SMESH_Hypothesis::Hypothesis_Status& aStatus) const TopoDS_Shape& aShape,
SMESH_Hypothesis::Hypothesis_Status& aStatus)
{ {
list <const SMESHDS_Hypothesis * >::const_iterator itl; std::list <const SMESHDS_Hypothesis * >::const_iterator itl;
const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape); const std::list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
if ( hyps.size() == 0 ) if ( hyps.size() == 0 )
{ {
aStatus = SMESH_Hypothesis::HYP_MISSING; aStatus = SMESH_Hypothesis::HYP_MISSING;

View File

@ -178,8 +178,8 @@ void StdMeshers_CartesianParameters3D_i::SetGridSpacing(const SMESH::string_arra
CORBA::Short axis) CORBA::Short axis)
throw (SALOME::SALOME_Exception) throw (SALOME::SALOME_Exception)
{ {
vector<string> funVec; std::vector<std::string> funVec;
vector<double> pointVec; std::vector<double> pointVec;
_array2vec( spaceFunctions, funVec, (const char*) ); _array2vec( spaceFunctions, funVec, (const char*) );
_array2vec( internalPoints, pointVec, ); _array2vec( internalPoints, pointVec, );
@ -209,8 +209,8 @@ void StdMeshers_CartesianParameters3D_i::GetGridSpacing(SMESH::string_array_out
{ {
ASSERT( myBaseImpl ); ASSERT( myBaseImpl );
try { try {
vector<string> funVec; std::vector<std::string> funVec;
vector<double> pointVec; std::vector<double> pointVec;
this->GetImpl()->GetGridSpacing( funVec, pointVec, axis ); this->GetImpl()->GetGridSpacing( funVec, pointVec, axis );
xSpaceFunctions = new SMESH::string_array(); xSpaceFunctions = new SMESH::string_array();
@ -394,8 +394,8 @@ StdMeshers_CartesianParameters3D_i::ComputeCoordinates(CORBA::Double
const char* axisName ) const char* axisName )
throw (SALOME::SALOME_Exception) throw (SALOME::SALOME_Exception)
{ {
vector<string> xFuns; std::vector<std::string> xFuns;
vector<double> xPoints, coords; std::vector<double> xPoints, coords;
_array2vec( spaceFuns, xFuns, (const char*) ); _array2vec( spaceFuns, xFuns, (const char*) );
_array2vec( points, xPoints, ); _array2vec( points, xPoints, );

View File

@ -111,7 +111,7 @@ public:
std::string str; std::string str;
if (stream >> str) { if (stream >> str) {
if ( StudyContext* myStudyContext = gen->GetCurrentStudyContext() ) { if ( StudyContext* myStudyContext = gen->GetCurrentStudyContext() ) {
string ior = myStudyContext->getIORbyOldId( atoi( str.c_str() )); std::string ior = myStudyContext->getIORbyOldId( atoi( str.c_str() ));
if ( !ior.empty() ) if ( !ior.empty() )
return TInterface::_narrow(gen->GetORB()->string_to_object( ior.c_str() )); return TInterface::_narrow(gen->GetORB()->string_to_object( ior.c_str() ));
} }

View File

@ -79,7 +79,7 @@ void StdMeshers_Reversible1D_i::SetReversedEdges( const SMESH::long_array& theId
void StdMeshers_Reversible1D_i::SetObjectEntry( const char* theEntry ) void StdMeshers_Reversible1D_i::SetObjectEntry( const char* theEntry )
{ {
string entry(theEntry); // actually needed as theEntry is spoiled by moment of dumping std::string entry(theEntry); // actually needed as theEntry is spoiled by moment of dumping
try { try {
this->GetImpl()->SetObjectEntry( entry.c_str() ); this->GetImpl()->SetObjectEntry( entry.c_str() );
// Update Python script // Update Python script