-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2010 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
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// File : SMESH_Pattern.hxx
// Created : Mon Aug 2 10:30:00 2004
// Author : Edward AGAPOV (eap)
#include "SMESH_MesherHelper.hxx"
#include "SMESH_subMesh.hxx"
+#include <Basics_Utils.hxx>
#include "utilities.h"
using namespace std;
{
MESSAGE("Load( file ) ");
+ Kernel_Utils::Localizer loc;
+
// file structure:
// ! This is a comment
bool SMESH_Pattern::Save (ostream& theFile)
{
MESSAGE(" ::Save(file) " );
+
+ Kernel_Utils::Localizer loc;
+
if ( !IsLoaded() ) {
MESSAGE(" Pattern not loaded ");
return setErrorCode( ERR_SAVE_NOT_LOADED );
while ( nIt->more() )
{
const SMDS_MeshNode* node = smdsNode( nIt->next() );
- SMDS_PositionPtr pos = node->GetPosition();
- if ( !pos || !pos->GetShapeId() ) {
+ if (node->getshapeId() <1) {
return false;
}
}
{
const SMDS_MeshNode* node = smdsNode( nIt->next() );
const SMDS_EdgePosition* epos =
- static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
+ static_cast<const SMDS_EdgePosition*>(node->GetPosition());
double u = epos->GetUParameter();
paramNodeMap.insert( make_pair( u, node ));
}
}
paramNodeMap.insert( make_pair( u, node ));
}
- }
+
+ //rnv : To fix the bug IPAL21999 Pattern Mapping - New - collapse of pattern mesh
+ if ( paramNodeMap.size() != eSubMesh->NbNodes() )
+ return setErrorCode(ERR_UNEXPECTED);
+ }
+
// put U in [0,1] so that the first key-point has U==0
bool isSeam = helper.IsRealSeam( edge );
double du = l - f;
p->myInitUV = project( node, projector );
else {
const SMDS_FacePosition* pos =
- static_cast<const SMDS_FacePosition*>(node->GetPosition().get());
+ static_cast<const SMDS_FacePosition*>(node->GetPosition());
p->myInitUV.SetCoord( pos->GetUParameter(), pos->GetVParameter() );
}
p->myInitXYZ.SetCoord( p->myInitUV.X(), p->myInitUV.Y(), 0 );
const SMDS_MeshNode* node = smdsNode( nIt->next() );
iPoint = nodePointIDMap[ node ]; // point index of interest
// for a node on a seam edge there are two points
- if ( helper.IsRealSeam( node->GetPosition()->GetShapeId() ) &&
+ if ( helper.IsRealSeam( node->getshapeId() ) &&
( n_id = closeNodePointIDMap.find( node )) != not_found )
{
TPoint & p1 = myPoints[ iPoint ];
// find node not on a seam edge
while ( nIt2->more() && !notSeamNode ) {
const SMDS_MeshNode* n = smdsNode( nIt2->next() );
- if ( !helper.IsSeamShape( n->GetPosition()->GetShapeId() ))
+ if ( !helper.IsSeamShape( n->getshapeId() ))
notSeamNode = n;
}
gp_Pnt2d uv = helper.GetNodeUV( theFace, node, notSeamNode );
{
const SMDS_MeshNode* node = smdsNode( nIt->next() );
const SMDS_EdgePosition* epos =
- static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
+ static_cast<const SMDS_EdgePosition*>(node->GetPosition());
double u = ( epos->GetUParameter() - f ) / ( l - f );
(*pIt)->myInitXYZ.SetCoord( iCoord, isForward ? u : 1 - u );
}
vector<int>& theQuantity)
{
bool makePoly = false;
-// cout << "FROM FACE NODES: " <<endl;
-// for ( int i = 0; i < theNbBndNodes; ++i )
-// cout << theBndNodes[ i ];
- set< const SMDS_MeshNode* > bndNodeSet;
- for ( int i = 0; i < theNbBndNodes; ++i )
- bndNodeSet.insert( theBndNodes[ i ]);
+ set< const SMDS_MeshNode* > bndNodeSet( theBndNodes, theBndNodes + theNbBndNodes);
map< TNodeSet, list< list< int > > >::iterator nn_IdList;
if ( !myIs2D ) { // for 2D, merge only edges
nn_IdList = myIdsOnBoundary.find( bndNodeSet );
if ( nn_IdList != myIdsOnBoundary.end() ) {
- makePoly = true;
list< int > & faceIds = nn_IdList->second.front();
- ids.insert( faceIds.begin(), faceIds.end() );
+ if ( !faceIds.empty() ) {
+ makePoly = true;
+ ids.insert( faceIds.begin(), faceIds.end() );
+ }
}
}
- //bool hasIdsInFace = !ids.empty();
// add ids on links and bnd nodes
int lastFreeId = Max( myXYZIdToNodeMap.rbegin()->first, theNodes.size() );
bndId = nn_IdList->second.front().front();
ids.insert( bndId );
}
- else
+ else {
myXYZIdToNodeMap.insert( make_pair( bndId, theBndNodes[ iN ] ));
+ }
faceDef.push_back( bndId );
// add ids on a link
TNodeSet linkNodes;
linkNodes.insert( theBndNodes[ iN ]);
- linkNodes.insert( theBndNodes[ iN + 1 == theNbBndNodes ? 0 : iN + 1 ]);
+ linkNodes.insert( theBndNodes[ (iN + 1) % theNbBndNodes] );
nn_IdList = myIdsOnBoundary.find( linkNodes );
if ( nn_IdList != myIdsOnBoundary.end() ) {
- makePoly = true;
list< int > & linkIds = nn_IdList->second.front();
- ids.insert( linkIds.begin(), linkIds.end() );
- if ( isReversed( theBndNodes[ iN ], linkIds ))
- faceDef.insert( faceDef.end(), linkIds.begin(), linkIds.end() );
- else
- faceDef.insert( faceDef.end(), linkIds.rbegin(), linkIds.rend() );
+ if ( !linkIds.empty() )
+ {
+ makePoly = true;
+ ids.insert( linkIds.begin(), linkIds.end() );
+ if ( isReversed( theBndNodes[ iN ], linkIds ))
+ faceDef.insert( faceDef.end(), linkIds.begin(), linkIds.end() );
+ else
+ faceDef.insert( faceDef.end(), linkIds.rbegin(), linkIds.rend() );
+ }
}
}
{
if ( !checkedVolDefs.insert( *pIdList ).second )
continue; // skip already checked volume definition
- vector< int > idVec;
- idVec.reserve( (*pIdList)->size() );
- idVec.insert( idVec.begin(), (*pIdList)->begin(), (*pIdList)->end() );
+ vector< int > idVec( (*pIdList)->begin(), (*pIdList)->end() );
// loop on face defs of a volume
SMDS_VolumeTool::VolumeType volType = vol.GetType( idVec.size() );
if ( volType == SMDS_VolumeTool::UNKNOWN )
}
if ( !defsAdded ) {
theQuantity.push_back( faceDef.size() );
- theFaceDefs.splice( theFaceDefs.end(), faceDef, faceDef.begin(), faceDef.end() );
+ theFaceDefs.splice( theFaceDefs.end(), faceDef );
}
return makePoly;
point->myXYZ.Z());
nodesVector [ pIndex ] = node;
- if ( true /*subMeshDS*/ ) {
+ if ( !S.IsNull() /*subMeshDS*/ ) {
// !!!!! do not merge new nodes with ones existing on submeshes (see method comment)
switch ( S.ShapeType() ) {
case TopAbs_VERTEX: {
createElements( theMesh, nodesVector, myElemPointIDs, myElements );
}
+ aMeshDS->compactMesh();
+
// const map<int,SMESHDS_SubMesh*>& sm = aMeshDS->SubMeshes();
// map<int,SMESHDS_SubMesh*>::const_iterator i_sm = sm.begin();
// for ( ; i_sm != sm.end(); i_sm++ )
SMDS_ElemIteratorPtr noIt = elem->nodesIterator();
while ( noIt->more() ) {
SMDS_MeshNode* node = const_cast<SMDS_MeshNode*>(smdsNode( noIt->next() ));
- if (!node->GetPosition()->GetShapeId() &&
+ if (!node->getshapeId() &&
shellNodes.find( node ) == shellNodes.end() ) {
if ( S.ShapeType() == TopAbs_FACE )
aMeshDS->SetNodeOnFace( node, shapeID );
myShapeIDMap.Clear();
myShape.Nullify();
myNbKeyPntInBoundary.clear();
+
+ myXYZ.clear();
+ myElemXYZIDs.clear();
+ myXYZIdToNodeMap.clear();
+ myElements.clear();
+ myOrderedNodes.clear();
+ myPolyElems.clear();
+ myPolyElemXYZIDs.clear();
+ myPolyhedronQuantities.clear();
+ myIdsOnBoundary.clear();
+ myReverseConnectivity.clear();
}
//=======================================================================