HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = YES
CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
+COLLABORATION_GRAPH = NO
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = YES
//purpose :
//=======================================================================
-SMDS_EdgePosition::SMDS_EdgePosition(const int aEdgeId,
- const double aUParam):SMDS_Position(aEdgeId), myUParameter(aUParam)
+SMDS_EdgePosition::SMDS_EdgePosition(const double aUParam): myUParameter(aUParam)
{
- //MESSAGE("********************************* SMDS_EdgePosition "<< aEdgeId << " " << myUParameter);
-}
-
-//=======================================================================
-//function : Coords
-//purpose :
-//=======================================================================
-
-const double *SMDS_EdgePosition::Coords() const
-{
- static double origin[]={0,0,0};
- MESSAGE("SMDS_EdgePosition::Coords not implemented");
- return origin;
+ //MESSAGE("********************************* SMDS_EdgePosition " << myUParameter);
}
/**
{
public:
- SMDS_EdgePosition(const int aEdgeId=0, const double aUParam=0);
- const virtual double * Coords() const;
+ SMDS_EdgePosition(const double aUParam=0);
SMDS_TypeOfPosition GetTypeOfPosition() const;
void SetUParameter(double aUparam);
double GetUParameter() const;
//purpose :
//=======================================================================
-SMDS_FacePosition::SMDS_FacePosition(const int aEdgeId,
- const double aUParam,
+SMDS_FacePosition::SMDS_FacePosition(const double aUParam,
const double aVParam)
- :SMDS_Position(aEdgeId),
- myUParameter(aUParam),myVParameter(aVParam)
+ : myUParameter(aUParam),myVParameter(aVParam)
{
//MESSAGE("******************************************************** SMDS_FacePosition");
}
-//=======================================================================
-//function : Coords
-//purpose :
-//=======================================================================
-const double *SMDS_FacePosition::Coords() const
-{
- static double origin[]={0,0,0};
- MESSAGE("SMDS_EdgePosition::Coords not implemented");
- return origin;
-}
-
/**
*/
SMDS_TypeOfPosition SMDS_FacePosition::GetTypeOfPosition() const
{
public:
- SMDS_FacePosition(int aFaceId=0, double aUParam=0,
- double aVParam=0);
- const virtual double * Coords() const;
+ SMDS_FacePosition(double aUParam=0, double aVParam=0);
SMDS_TypeOfPosition GetTypeOfPosition() const;
void SetUParameter(double aUparam);
void SetVParameter(double aVparam);
myHasConstructionEdges(false), myHasConstructionFaces(false),
myHasInverseElements(true),
myNodeMin(0), myNodeMax(0),
- myNodePool(0), myEdgePool(0), myFacePool(0), myVolumePool(0)
+ myNodePool(0), myEdgePool(0), myFacePool(0), myVolumePool(0),
+ myModified(false), myRemovedNodes(false), myChangedNodes(false),
+ xmin(0), xmax(0), ymin(0), ymax(0), zmin(0), zmax(0)
{
myMeshId = _meshList.size(); // --- index of the mesh to push back in the vector
MESSAGE("myMeshId=" << myMeshId);
}
myNodeIDFactory->adjustMaxId(ID);
SMDS_MeshNode * node = myNodePool->getNew();
- node->init(ID, myMeshId, -1, x, y, z);
+ node->init(ID, myMeshId, 0, x, y, z);
if (ID >= myNodes.size())
{
myNodes.resize(ID+SMDS_Mesh::chunkSize, 0);
myNodes[ID] = node;
myNodeIDFactory->BindID(ID,node);
myInfo.myNbNodes++;
+ myModified = true;
+ this->adjustBoundingBox(x, y, z);
return node;
}else
return NULL;
while(itc!=myChildren.end())
(*itc)->Clear();
+ myModified = false;
+ myRemovedNodes = false;
+ myChangedNodes = false;
+ xmin = 0; xmax = 0;
+ ymin = 0; ymax = 0;
+ zmin = 0; zmax = 0;
+
myInfo.Clear();
myGrid->Initialize();
return myCellIdSmdsToVtk[smdsid];
throw SALOME_Exception(LOCALIZED ("smds id out of bounds"));
}
+
+void SMDS_Mesh::updateBoundingBox()
+{
+ xmin = 0; xmax = 0;
+ ymin = 0; ymax = 0;
+ zmin = 0; zmax = 0;
+ vtkPoints *points = myGrid->GetPoints();
+ int myNodesSize = this->myNodes.size();
+ for (int i = 0; i < myNodesSize; i++)
+ {
+ if (SMDS_MeshNode *n = myNodes[i])
+ {
+ double coords[3];
+ points->GetPoint(n->myVtkID, coords);
+ if (coords[0] < xmin) xmin = coords[0];
+ else if (coords[0] > xmax) xmax = coords[0];
+ if (coords[1] < ymin) ymin = coords[1];
+ else if (coords[1] > ymax) ymax = coords[1];
+ if (coords[2] < zmin) zmin = coords[2];
+ else if (coords[2] > zmax) zmax = coords[2];
+ }
+ }
+}
+
+double SMDS_Mesh::getMaxDim()
+{
+ double dmax = 1.e-3;
+ if ((xmax - xmin) > dmax) dmax = xmax -xmin;
+ if ((ymax - ymin) > dmax) dmax = ymax -ymin;
+ if ((zmax - zmin) > dmax) dmax = zmax -zmin;
+ MESSAGE("getMaxDim " << dmax);
+ return dmax;
+}
class SMDS_EXPORT SMDS_Mesh:public SMDS_MeshObject{
public:
+ friend class SMDS_MeshIDFactory;
+ friend class SMDS_MeshNodeIDFactory;
friend class SMDS_MeshElementIDFactory;
friend class SMDS_MeshVolumeVtkNodes;
+ friend class SMDS_MeshNode;
SMDS_Mesh();
typedef std::vector<SMDS_MeshCell *> SetOfCells;
void updateNodeMinMax();
+ void updateBoundingBox();
+ double getMaxDim();
int fromVtkToSmds(int vtkid);
int fromSmdsToVtk(int smdsid);
myCells.resize(ID+SMDS_Mesh::chunkSize,0);
};
+ inline void adjustBoundingBox(double x, double y, double z)
+ {
+ if (x > xmax) xmax = x;
+ else if (x < xmin) xmin = x;
+ if (y > ymax) ymax = y;
+ else if (y < ymin) ymin = y;
+ if (z > zmax) zmax = z;
+ else if (z < zmin) zmin = z;
+ };
+
// Fields PRIVATE
//! index of this SMDS_mesh in the static vector<SMDS_Mesh*> _meshList
bool myHasConstructionEdges;
bool myHasConstructionFaces;
bool myHasInverseElements;
+
+ bool myModified; // any add remove or change of node or cell
+ bool myRemovedNodes;
+ bool myChangedNodes;
+ double xmin;
+ double xmax;
+ double ymin;
+ double ymax;
+ double zmin;
+ double zmax;
};
using namespace std;
-SMDS_MeshElement::SMDS_MeshElement(int ID):myID(ID), myMeshId(-1), myShapeId(-1), myIdInShape(-1)
+SMDS_MeshElement::SMDS_MeshElement(int ID):myID(ID), myMeshId(-1), myShapeId(0), myIdInShape(-1)
{
}
friend SMDS_EXPORT bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement* elem);
friend class SMDS_Mesh;
friend class SMESHDS_Mesh;
+ friend class SMESHDS_SubMesh;
+ friend class SMDS_MeshElementIDFactory;
// ===========================
// Access to nodes by index
*/
int GetNodeIndex( const SMDS_MeshNode* node ) const;
- //inline int getId() const {return myID; };
inline ShortType getMeshId() const {return myMeshId; };
inline ShortType getshapeId() const {return myShapeId; };
- inline void setShapeId(ShortType shapeId) {myShapeId = shapeId; };
inline int getIdInShape() const { return myIdInShape; };
- inline void setIdInShape(int id) { myIdInShape = id; };
-
- inline void setVtkId(int vtkId)
- {
- myVtkID = vtkId;
- }
-
- inline int getVtkId() const
- {
- return myVtkID;
- }
+ inline int getVtkId() const { return myVtkID; };
protected:
inline void setId(int id) {myID = id; };
+ inline void setShapeId(ShortType shapeId) {myShapeId = shapeId; };
+ inline void setIdInShape(int id) { myIdInShape = id; };
+ inline void setVtkId(int vtkId) { myVtkID = vtkId; };
SMDS_MeshElement(int ID=-1);
- SMDS_MeshElement(int id, ShortType meshId, ShortType shapeId=-1);
+ SMDS_MeshElement(int id, ShortType meshId, ShortType shapeId = 0);
virtual void Print(std::ostream & OS) const;
//! Element index in vector SMDS_Mesh::myNodes or SMDS_Mesh::myCells
int myID;
-
- // index in vtkUnstructuredGrid
+ //! index in vtkUnstructuredGrid
int myVtkID;
-
//! SMDS_Mesh identification in SMESH
ShortType myMeshId;
-
- //! SubShape and SubMesh identification in SMESHDS (not in use?)
+ //! SubShape and SubMesh identification in SMESHDS
ShortType myShapeId;
-
//! Element index in SMESHDS_SubMesh vector
int myIdInShape;
};
}
}
}
+ myMesh->myModified = true;
}
void SMDS_MeshIDFactory::Clear()
//purpose :
//=======================================================================
SMDS_MeshNode::SMDS_MeshNode() :
- SMDS_MeshElement(-1, -1, -1),
+ SMDS_MeshElement(-1, -1, 0),
myPosition(SMDS_SpacePosition::originSpacePosition())
{
nbNodes++;
return 1;
}
-
double* SMDS_MeshNode::getCoord() const
{
return SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetPoint(myVtkID);
//* resize the vtkPoints structure every SMDS_Mesh::chunkSize points
void SMDS_MeshNode::setXYZ(double x, double y, double z)
{
- vtkPoints *points = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetPoints();
+ SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
+ vtkPoints *points = mesh->getGrid()->GetPoints();
points->InsertPoint(myVtkID, x, y, z);
+ mesh->adjustBoundingBox(x, y, z);
+ mesh->myChangedNodes = true;
+ mesh->myModified = true;
}
SMDSAbs_ElementType SMDS_MeshNode::GetType() const
friend class SMDS_Mesh;
friend class ObjectPool<SMDS_MeshNode>;
- double* getCoord() const;
void Print(std::ostream & OS) const;
double X() const;
double Y() const;
bool emptyInverseElements();
void setXYZ(double x, double y, double z);
- /*!
- * \brief Return node by its index
- * \param ind - node index
- * \retval const SMDS_MeshNode* - the node
- */
- //virtual const SMDS_MeshNode* GetNode(const int) const { return this; }
static int nbNodes;
protected:
virtual ~SMDS_MeshNode();
void init(int id, int meshId, int shapeId = -1, double x=0, double y=0, double z=0);
inline void setVtkId(int vtkId) { myVtkID = vtkId; };
+ double* getCoord() const;
SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const;
void SMDS_MeshNodeIDFactory::ReleaseID(const int ID)
{
SMDS_MeshIDFactory::ReleaseID(ID);
+ myMesh->myRemovedNodes = true;
if (ID == myMax)
myMax = 0; // --- force updateMinMax
if (ID == myMin)
//purpose :
//=======================================================================
-SMDS_Position::SMDS_Position(int aShapeId) :myShapeId(aShapeId)
+SMDS_Position::SMDS_Position()
{
- //MESSAGE("########################## SMDS_Position " << myShapeId);
-}
-
-//=======================================================================
-//function : SetShapeId
-//purpose :
-//=======================================================================
-
-void SMDS_Position::SetShapeId(int aShapeId)
-{
- //MESSAGE("############################## SetShapeId "<< aShapeId);
- myShapeId = aShapeId;
-}
-
-//=======================================================================
-//function : GetShapeId
-//purpose :
-//=======================================================================
-
-int SMDS_Position::GetShapeId() const
-{
- //MESSAGE("################################# GetShapeId " << myShapeId);
- return myShapeId;
+ //MESSAGE("########################## SMDS_Position ");
}
//=======================================================================
{
public:
- const virtual double * Coords() const = 0;
virtual SMDS_TypeOfPosition GetTypeOfPosition() const = 0;
virtual int GetDim() const;
- void SetShapeId(int aShapeId);
- int GetShapeId() const;
virtual ~SMDS_Position() {}
protected:
- SMDS_Position(int aShapeId);
-
- private:
- int myShapeId;
+ SMDS_Position();
};
SMDS_SpacePosition* SMDS_SpacePosition::_originPosition = new SMDS_SpacePosition();
-SMDS_SpacePosition::SMDS_SpacePosition(double x, double y, double z):
- SMDS_Position(0)
+SMDS_SpacePosition::SMDS_SpacePosition(double x, double y, double z)
{
}
-const double* SMDS_SpacePosition::Coords() const
-{
- static double origin[]={0,0,0};
- return origin;
-}
-
SMDS_TypeOfPosition SMDS_SpacePosition::GetTypeOfPosition() const
{
return SMDS_TOP_3DSPACE;
public:
SMDS_SpacePosition(double x=0, double y=0, double z=0);
- const virtual double * Coords() const;
virtual inline SMDS_TypeOfPosition GetTypeOfPosition() const;
static SMDS_PositionPtr originSpacePosition();
private:
//purpose :
//=======================================================================
-SMDS_VertexPosition:: SMDS_VertexPosition(const int aVertexId)
- :SMDS_Position(aVertexId)
+SMDS_VertexPosition:: SMDS_VertexPosition()
{
//MESSAGE("*********************************************** SMDS_VertexPosition " << aVertexId);
}
-//=======================================================================
-//function : Coords
-//purpose :
-//=======================================================================
-
-const double *SMDS_VertexPosition::Coords() const
-{
- const static double origin[]={0,0,0};
- //MESSAGE("######################### SMDS_VertexPosition::Coords not implemented");
- return origin;
-}
-
-
SMDS_TypeOfPosition SMDS_VertexPosition::GetTypeOfPosition() const
{
//MESSAGE("################################################# GetTypeOfPosition");
public:
SMDS_TypeOfPosition GetTypeOfPosition() const;
- SMDS_VertexPosition(int aVertexId=0);
- const double *Coords() const;
+ SMDS_VertexPosition();
};
#endif
vtkIdType npts = 0;
vtkIdType* pts = 0;
grid->GetCellPoints(myVtkID, npts, pts);
+ //MESSAGE("IsMediumNode " << npts << " " << (node->getVtkId() == pts[npts-1]));
return ((npts == 3) && (node->getVtkId() == pts[2]));
}
rankFirstMedium = 4; // medium nodes are of rank 4,5,6,7
break;
default:
+ //MESSAGE("wrong element type " << aVtkType);
return false;
}
vtkIdType npts = 0;
{
if (pts[rank] == nodeId)
{
+ //MESSAGE("rank " << rank << " is medium node " << (rank < rankFirstMedium));
if (rank < rankFirstMedium)
return false;
else
{
int nf = nbNodesPerFace[i];
ptIds.push_back(nf);
- double a[3];
- double b[3];
- double c[3];
- grid->GetPoints()->GetPoint(nodeIds[k], a);
- grid->GetPoints()->GetPoint(nodeIds[k + 1], b);
- grid->GetPoints()->GetPoint(nodeIds[k + 2], c);
- bool isFaceForward = this->isForward(a, b, c, center);
+// double a[3];
+// double b[3];
+// double c[3];
+// grid->GetPoints()->GetPoint(nodeIds[k], a);
+// grid->GetPoints()->GetPoint(nodeIds[k + 1], b);
+// grid->GetPoints()->GetPoint(nodeIds[k + 2], c);
+// bool isFaceForward = this->isForward(a, b, c, center);
+ bool isFaceForward = true;
//MESSAGE("isFaceForward " << i << " " << isFaceForward);
vtkIdType *facePts = &nodeIds[k];
if (isFaceForward)
fPos = dynamic_cast< const SMDS_FacePosition* >( pos );
}
else if ( pos->GetTypeOfPosition() == SMDS_TOP_VERTEX ) {
- vID = pos->GetShapeId();
+ vID = node->getshapeId();
}
}
if ( fPos || ( !normalOK && vID )) {
if ( isNodes ) {
const SMDS_MeshNode* node = cast2Node( elem );
if ( node->GetPosition()->GetTypeOfPosition() == SMDS_TOP_VERTEX )
- if ( int aShapeID = node->GetPosition()->GetShapeId() )
+ if ( int aShapeID = node->getshapeId() )
if ( SMESH_subMesh * sm = GetMesh()->GetSubMeshContaining( aShapeID ) )
smmap.insert( sm );
}
if ( aMesh->ShapeToMesh().IsNull() )
return 0;
- if ( theElem->GetType() == SMDSAbs_Node ) {
- const SMDS_PositionPtr& aPosition =
- static_cast<const SMDS_MeshNode*>( theElem )->GetPosition();
- if ( aPosition )
- return aPosition->GetShapeId();
- else
- return 0;
- }
+ if ( theElem->GetType() == SMDSAbs_Node )
+ {
+ int aShapeID = theElem->getshapeId();
+ if (aShapeID <= 0)
+ return 0;
+ else
+ return aShapeID;
+ }
TopoDS_Shape aShape; // the shape a node is on
SMDS_ElemIteratorPtr nodeIt = theElem->nodesIterator();
while ( nodeIt->more() ) {
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
- const SMDS_PositionPtr& aPosition = node->GetPosition();
- if ( aPosition ) {
- int aShapeID = aPosition->GetShapeId();
+ int aShapeID = node->getshapeId();
+ if (aShapeID > 0) {
SMESHDS_SubMesh * sm = aMesh->MeshElements( aShapeID );
if ( sm ) {
if ( sm->Contains( theElem ))
break;
}
case SMDS_TOP_EDGE: {
- TopoDS_Shape S = aMesh->IndexToShape( pos->GetShapeId() );
+ TopoDS_Shape S = aMesh->IndexToShape( node->getshapeId() );
Handle(Geom2d_Curve) pcurve;
if ( !S.IsNull() && S.ShapeType() == TopAbs_EDGE )
pcurve = BRep_Tool::CurveOnSurface( TopoDS::Edge( S ), face, f,l );
break;
}
case SMDS_TOP_VERTEX: {
- TopoDS_Shape S = aMesh->IndexToShape( pos->GetShapeId() );
+ TopoDS_Shape S = aMesh->IndexToShape( node->getshapeId() );
if ( !S.IsNull() && S.ShapeType() == TopAbs_VERTEX )
uv = BRep_Tool::Parameters( TopoDS::Vertex( S ), face ).XY();
break;
if ( node_uv != uvMap.end() ) {
gp_XY* uv = node_uv->second;
node->SetPosition
- ( SMDS_PositionPtr( new SMDS_FacePosition( *fId, uv->X(), uv->Y() )));
+ ( SMDS_PositionPtr( new SMDS_FacePosition( uv->X(), uv->Y() )));
}
}
const int nbSteps,
SMESH_SequenceOfElemPtr& srcElements)
{
+ MESSAGE("sweepElement " << nbSteps);
SMESHDS_Mesh* aMesh = GetMeshDS();
// Loop on elem nodes:
const int theFlags,
const double theTolerance)
{
+ MESSAGE("ExtrusionSweep " << theMakeGroups << " " << theFlags << " " << theTolerance);
myLastCreatedElems.Clear();
myLastCreatedNodes.Clear();
for ( ; nIt != mediumNodes.end(); ++nIt ) {
const SMDS_MeshNode* n = *nIt;
if ( n->NbInverseElements() == 0 ) {
- if ( n->GetPosition()->GetShapeId() != theShapeID )
+ if ( n->getshapeId() != theShapeID )
meshDS->RemoveFreeNode( n, meshDS->MeshElements
- ( n->GetPosition()->GetShapeId() ));
+ ( n->getshapeId() ));
else
meshDS->RemoveFreeNode( n, theSm );
}
TopoDS_Shape SMESH_MesherHelper::GetSubShapeByNode(const SMDS_MeshNode* node,
SMESHDS_Mesh* meshDS)
{
- int shapeID = node->GetPosition()->GetShapeId();
+ int shapeID = node->getshapeId();
if ( 0 < shapeID && shapeID <= meshDS->MaxShapeIndex() )
return meshDS->IndexToShape( shapeID );
else
// edge and retrieve value from this pcurve
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(n->GetPosition());
- int edgeID = Pos->GetShapeId();
+ int edgeID = n->getshapeId();
TopoDS_Edge E = TopoDS::Edge(GetMeshDS()->IndexToShape(edgeID));
double f, l, u = epos->GetUParameter();
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
}
else if(Pos->GetTypeOfPosition()==SMDS_TOP_VERTEX)
{
- if ( int vertexID = n->GetPosition()->GetShapeId() ) {
+ if ( int vertexID = n->getshapeId() ) {
const TopoDS_Vertex& V = TopoDS::Vertex(GetMeshDS()->IndexToShape(vertexID));
try {
uv = BRep_Tool::Parameters( V, F );
const double tol,
const bool force) const
{
- if ( force || !myOkNodePosShapes.count( n->GetPosition()->GetShapeId() ))
+ if ( force || !myOkNodePosShapes.count( n->getshapeId() ))
{
+ double toldis = tol;
+ double tolmin = 1.e-7*myMesh->GetMeshDS()->getMaxDim(); // nodes coordinates are stored in float format
+ if (toldis < tolmin) toldis = tolmin;
// check that uv is correct
TopLoc_Location loc;
Handle(Geom_Surface) surface = BRep_Tool::Surface( F,loc );
if ( !loc.IsIdentity() ) nodePnt.Transform( loc.Transformation().Inverted() );
if ( Precision::IsInfinite( uv.X() ) ||
Precision::IsInfinite( uv.Y() ) ||
- nodePnt.Distance( surface->Value( uv.X(), uv.Y() )) > tol )
+ nodePnt.Distance( surface->Value( uv.X(), uv.Y() )) > toldis )
{
// uv incorrect, project the node to surface
GeomAPI_ProjectPointOnSurf& projector = GetProjector( F, loc, tol );
}
Quantity_Parameter U,V;
projector.LowerDistanceParameters(U,V);
- if ( nodePnt.Distance( surface->Value( U, V )) > tol )
+ if ( nodePnt.Distance( surface->Value( U, V )) > toldis )
{
MESSAGE( "SMESH_MesherHelper::CheckNodeUV(), invalid projection" );
return false;
}
else if ( uv.Modulus() > numeric_limits<double>::min() )
{
- ((SMESH_MesherHelper*) this)->myOkNodePosShapes.insert( n->GetPosition()->GetShapeId() );
+ ((SMESH_MesherHelper*) this)->myOkNodePosShapes.insert( n->getshapeId() );
}
}
return true;
else
{
SMESHDS_Mesh * meshDS = GetMeshDS();
- int vertexID = pos->GetShapeId();
+ int vertexID = n->getshapeId();
const TopoDS_Vertex& V = TopoDS::Vertex(meshDS->IndexToShape(vertexID));
param = BRep_Tool::Parameter( V, E );
}
double f,l; BRep_Tool::Range( E, f,l );
bool force = ( param < f-tol || param > l+tol );
if ( !force && pos->GetTypeOfPosition()==SMDS_TOP_EDGE )
- force = ( GetMeshDS()->ShapeToIndex( E ) != pos->GetShapeId() );
+ force = ( GetMeshDS()->ShapeToIndex( E ) != n->getshapeId() );
*check = CheckNodeU( E, n, param, tol, force );
}
const double tol,
const bool force) const
{
- if ( force || !myOkNodePosShapes.count( n->GetPosition()->GetShapeId() ))
+ if ( force || !myOkNodePosShapes.count( n->getshapeId() ))
{
double toldis = tol;
- // TODO if (toldis < 5.e-5) toldis = 5.e-5; // nodes coordinates are stored in float format
+ double tolmin = 1.e-7*myMesh->GetMeshDS()->getMaxDim(); // nodes coordinates are stored in float format
+ if (toldis < tolmin) toldis = tolmin;
// check that u is correct
TopLoc_Location loc; double f,l;
Handle(Geom_Curve) curve = BRep_Tool::Curve( E,loc,f,l );
}
else if ( fabs( u ) > numeric_limits<double>::min() )
{
- ((SMESH_MesherHelper*) this)->myOkNodePosShapes.insert( n->GetPosition()->GetShapeId() );
+ ((SMESH_MesherHelper*) this)->myOkNodePosShapes.insert( n->getshapeId() );
}
if (( u < f-tol || u > l+tol ) && force )
{
if( myShape.IsNull() )
{
if( Pos1->GetTypeOfPosition()==SMDS_TOP_FACE ) {
- faceID = Pos1->GetShapeId();
+ faceID = n1->getshapeId();
}
else if( Pos2->GetTypeOfPosition()==SMDS_TOP_FACE ) {
- faceID = Pos2->GetShapeId();
+ faceID = n2->getshapeId();
}
if( Pos1->GetTypeOfPosition()==SMDS_TOP_EDGE ) {
- edgeID = Pos1->GetShapeId();
+ edgeID = n1->getshapeId();
}
if( Pos2->GetTypeOfPosition()==SMDS_TOP_EDGE ) {
- edgeID = Pos2->GetShapeId();
+ edgeID = n2->getshapeId();
}
}
// get positions of the given nodes on shapes
{
if ( uvOK[0] && uvOK[1] )
{
- if ( IsDegenShape( Pos1->GetShapeId() ))
+ if ( IsDegenShape( n1->getshapeId() ))
if ( myParIndex & U_periodic ) uv[0].SetCoord( 1, uv[1].Coord( 1 ));
else uv[0].SetCoord( 2, uv[1].Coord( 2 ));
- else if ( IsDegenShape( Pos2->GetShapeId() ))
+ else if ( IsDegenShape( n2->getshapeId() ))
if ( myParIndex & U_periodic ) uv[1].SetCoord( 1, uv[0].Coord( 1 ));
else uv[1].SetCoord( 2, uv[0].Coord( 2 ));
while ( nIt->more() )
{
const SMDS_MeshNode* node = smdsNode( nIt->next() );
- SMDS_PositionPtr pos = node->GetPosition();
- if ( !pos || !pos->GetShapeId() ) {
+ if (node->getshapeId() <0) {
return false;
}
}
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 );
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 );
if ( !i_sub->second->IsComplexSubmesh() ) {
SMDS_NodeIteratorPtr nIt = i_sub->second->GetNodes();
while ( nIt->more() )
- nIt->next()->GetPosition()->SetShapeId( 0 );
+ i_sub->second->RemoveNode(nIt->next(), false);
}
}
// - sub-meshes
{
SMESHDS_SubMesh* subMesh=0;
map<int,SMESHDS_SubMesh*>::iterator SubIt =
- myShapeIndexToSubMesh.find( n->GetPosition()->GetShapeId() );
+ myShapeIndexToSubMesh.find( n->getshapeId() );
if ( SubIt != myShapeIndexToSubMesh.end() )
subMesh = SubIt->second;
else
if ( Index != myCurSubID ) {
map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.find( Index );
if ( it == myShapeIndexToSubMesh.end() )
- it = myShapeIndexToSubMesh.insert( make_pair(Index, new SMESHDS_SubMesh() )).first;
+ it = myShapeIndexToSubMesh.insert( make_pair(Index, new SMESHDS_SubMesh(this, Index) )).first;
myCurSubMesh = it->second;
myCurSubID = Index;
myCurSubShape.Nullify(); // myCurSubShape no more corresponds to submesh
return false;
}
-namespace {
-
- //================================================================================
- /*!
- * \brief Creates a node position in volume
- */
- //================================================================================
-
- inline SMDS_PositionPtr volumePosition(int volId)
- {
- SMDS_SpacePosition* pos = new SMDS_SpacePosition();
- pos->SetShapeId( volId );
- return SMDS_PositionPtr(pos);
- }
-}
-
//=======================================================================
//function : SetNodeOnVolume
//purpose :
const TopoDS_Shell & S)
{
if ( add( aNode, getSubmesh(S) ))
- aNode->SetPosition ( volumePosition( myCurSubID ));
+ aNode->SetPosition ( SMDS_SpacePosition::originSpacePosition() );
}
+
//=======================================================================
//function : SetNodeOnVolume
//purpose :
const TopoDS_Solid & S)
{
if ( add( aNode, getSubmesh(S) ))
- aNode->SetPosition ( volumePosition( myCurSubID ));
+ aNode->SetPosition ( SMDS_SpacePosition::originSpacePosition() );
}
//=======================================================================
double v)
{
if ( add( aNode, getSubmesh(S) ))
- aNode->SetPosition(SMDS_PositionPtr(new SMDS_FacePosition(myCurSubID, u, v)));
+ aNode->SetPosition(SMDS_PositionPtr(new SMDS_FacePosition( u, v)));
}
//=======================================================================
double u)
{
if ( add( aNode, getSubmesh(S) ))
- aNode->SetPosition(SMDS_PositionPtr(new SMDS_EdgePosition(myCurSubID, u)));
+ aNode->SetPosition(SMDS_PositionPtr(new SMDS_EdgePosition(u)));
}
//=======================================================================
const TopoDS_Vertex & S)
{
if ( add( aNode, getSubmesh(S) ))
- aNode->SetPosition(SMDS_PositionPtr(new SMDS_VertexPosition(myCurSubID)));
+ aNode->SetPosition(SMDS_PositionPtr(new SMDS_VertexPosition()));
}
//=======================================================================
//=======================================================================
void SMESHDS_Mesh::UnSetNodeOnShape(const SMDS_MeshNode* aNode)
{
- if ( aNode && aNode->GetPosition() ) {
- map<int,SMESHDS_SubMesh*>::iterator it =
- myShapeIndexToSubMesh.find( aNode->GetPosition()->GetShapeId() );
- if ( it != myShapeIndexToSubMesh.end() )
- it->second->RemoveNode( aNode, /*deleted=*/false );
- }
+ int shapeId = aNode->getshapeId();
+ if (shapeId >= 0)
+ {
+ map<int, SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.find(shapeId);
+ if (it != myShapeIndexToSubMesh.end())
+ it->second->RemoveNode(aNode, /*deleted=*/false);
+ }
}
//=======================================================================
TShapeIndexToSubMesh::iterator anIter = myShapeIndexToSubMesh.find(Index);
if (anIter == myShapeIndexToSubMesh.end())
{
- SM = new SMESHDS_SubMesh();
+ SM = new SMESHDS_SubMesh(this, Index);
myShapeIndexToSubMesh[Index]=SM;
}
else
//=======================================================================
void SMESHDS_Mesh::SetNodeInVolume(const SMDS_MeshNode* aNode, int Index)
{
+ //add(aNode, getSubmesh(Index));
if ( add( aNode, getSubmesh( Index )))
- ((SMDS_MeshNode*) aNode)->SetPosition( volumePosition( Index ));
+ ((SMDS_MeshNode*) aNode)->SetPosition( SMDS_SpacePosition::originSpacePosition());
}
//=======================================================================
{
//Set Position on Node
if ( add( aNode, getSubmesh( Index )))
- aNode->SetPosition(SMDS_PositionPtr(new SMDS_FacePosition(Index, u, v)));
+ aNode->SetPosition(SMDS_PositionPtr(new SMDS_FacePosition( u, v)));
}
//=======================================================================
{
//Set Position on Node
if ( add( aNode, getSubmesh( Index )))
- aNode->SetPosition(SMDS_PositionPtr(new SMDS_EdgePosition(Index, u)));
+ aNode->SetPosition(SMDS_PositionPtr(new SMDS_EdgePosition(u)));
}
//=======================================================================
{
//Set Position on Node
if ( add( aNode, getSubmesh( Index )))
- aNode->SetPosition(SMDS_PositionPtr(new SMDS_VertexPosition(Index)));
+ aNode->SetPosition(SMDS_PositionPtr(new SMDS_VertexPosition()));
}
//=======================================================================
this->myScript->SetModified(true); // notify GUI client for buildPrs when update
- // ---TODO: myNodes, myElements in submeshes
+ // --- compact list myNodes and myElements in submeshes
- // map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.begin();
- // for(; it != myShapeIndexToSubMesh.end(); ++it)
- // {
- // (*it).second->compactList(idNodesOldToNew, newNodeSize, idCellsOldToNew, newCellSize);
- // }
+ map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.begin();
+ for(; it != myShapeIndexToSubMesh.end(); ++it)
+ {
+ (*it).second->compactList();
+ }
}
//Update or build submesh
std::map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.find( Index );
if ( it == myShapeIndexToSubMesh.end() )
- it = myShapeIndexToSubMesh.insert( std::make_pair(Index, new SMESHDS_SubMesh() )).first;
+ it = myShapeIndexToSubMesh.insert( std::make_pair(Index, new SMESHDS_SubMesh(this, Index) )).first;
it->second->AddNode( aNode ); // add aNode to submesh
}
// $Header:
//
#include "SMESHDS_SubMesh.hxx"
+#include "SMESHDS_Mesh.hxx"
#include "utilities.h"
#include "SMDS_SetIterator.hxx"
using namespace std;
-SMESHDS_SubMesh::SMESHDS_SubMesh()
+SMESHDS_SubMesh::SMESHDS_SubMesh(SMESHDS_Mesh *parent, int index)
{
+ myParent = parent;
myElements.clear();
myNodes.clear();
+ myIndex = index;
myUnusedIdNodes = 0;
myUnusedIdElements = 0;
}
throw SALOME_Exception(LOCALIZED("add element in subshape already belonging to a subshape"));
}
SMDS_MeshElement* elem = (SMDS_MeshElement*) (ME);
+ elem->setShapeId(myIndex);
elem->setIdInShape(myElements.size());
myElements.push_back(ME);
}
//=======================================================================
bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME, bool isElemDeleted)
{
-// MESSAGE("--------------------------------------> RemoveElement " << isElemDeleted);
-// if ( !IsComplexSubmesh() && NbElements() ) {
-
- if (!isElemDeleted) // alive element has valid ID and can be found
- {
- int idInSubShape = ME->getIdInShape();
- //MESSAGE("SMESHDS_SubMesh::RemoveElement " << idInSubShape << " " << ME->GetID() << " " << myUnusedIdElements);
- assert(idInSubShape >= 0);
- assert(idInSubShape < myElements.size());
- myElements[idInSubShape] = 0; // this vector entry is no more used
- myUnusedIdElements++;
- return true;
- }
-
-
-// --- strange ?
-// TElemSet::iterator e = myElements.begin(), eEnd = myElements.end();
-// for ( ; e != eEnd; ++e )
-// if ( ME == *e ) {
-// myElements.erase( e );
-// return true;
-// }
-// }
-
+ // MESSAGE("--------------------------------------> RemoveElement " << isElemDeleted);
+ if (!IsComplexSubmesh())
+ {
+ if (!isElemDeleted) // alive element has valid ID and can be found
+ {
+ int idInSubShape = ME->getIdInShape();
+ //MESSAGE("SMESHDS_SubMesh::RemoveElement " << idInSubShape << " " << ME->GetID() << " " << myUnusedIdElements);
+ assert(idInSubShape >= 0);
+ assert(idInSubShape < myElements.size());
+ SMDS_MeshElement* elem = (SMDS_MeshElement*) (ME);
+ elem->setShapeId(0);
+ elem->setIdInShape(-1);
+ myElements[idInSubShape] = 0; // this vector entry is no more used
+ myUnusedIdElements++;
+ return true;
+ }
+ MESSAGE("Try to remove an already deleted element from a submesh ");
+ return false;
+ }
+ MESSAGE("Try to remove an element from a complex submesh ");
return false;
}
if ( !IsComplexSubmesh() )
{
int idInSubShape = N->getIdInShape();
- assert(idInSubShape == -1);
+ int shapeId = N->getshapeId();
+ if ((shapeId > 0) && (idInSubShape >= 0))
+ {
+ MESSAGE("========== AddNode already belonging to other subShape " << N->GetID());
+ // OK for vertex nodes
+ //this->getParent()->UnSetNodeOnShape(N);
+ }
SMDS_MeshNode* node = (SMDS_MeshNode*)(N);
+ node->setShapeId(myIndex);
node->setIdInShape(myNodes.size());
myNodes.push_back(N);
}
+ MESSAGE("try to add node in a complex submesh " << N->GetID());
}
//=======================================================================
bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N, bool isNodeDeleted)
{
-// if ( !IsComplexSubmesh() && NbNodes() ) {
-
- if (!isNodeDeleted) // alive node has valid ID and can be found
- {
- int idInSubShape = N->getIdInShape();
- //MESSAGE("SMESHDS_SubMesh::RemoveNode " << idInSubShape << " " << N->GetID());
- assert(idInSubShape >= 0);
- assert(idInSubShape < myNodes.size());
- myNodes[idInSubShape] = 0; // this vector entry is no more used
- myUnusedIdNodes++;
- return true;
- }
-
-// --- strange ?
-// TElemSet::iterator e = myNodes.begin(), eEnd = myNodes.end();
-// for ( ; e != eEnd; ++e )
-// if ( N == *e ) {
-// myNodes.erase( e );
-// return true;
-// }
-// }
-
+ if (!IsComplexSubmesh())
+ {
+ if (!isNodeDeleted) // alive node has valid ID and can be found
+ {
+ int idInSubShape = N->getIdInShape();
+ int shapeId = N->getshapeId();
+ MESSAGE("SMESHDS_SubMesh::RemoveNode " << shapeId << " " << idInSubShape << " " << N->GetID());
+ //assert(idInSubShape >= 0);
+ //assert(idInSubShape < myNodes.size());
+ SMDS_MeshNode* node = (SMDS_MeshNode*) (N);
+ node->setShapeId(0);
+ node->setIdInShape(-1);
+ myNodes[idInSubShape] = 0; // this vector entry is no more used
+ myUnusedIdNodes++;
+ return true;
+ }
+ MESSAGE("Try to remove an already deleted node from a submesh");
+ return false;
+ }
+ MESSAGE("Try to remove a node from a complex submesh");
return false;
}
//=======================================================================
int SMESHDS_SubMesh::NbElements() const
{
+ //MESSAGE(this << " NbElements " << IsComplexSubmesh() << " " << myElements.size() - myUnusedIdElements);
if ( !IsComplexSubmesh() )
return myElements.size() - myUnusedIdElements;
int SMESHDS_SubMesh::NbNodes() const
{
- if ( !IsComplexSubmesh() )
- return myNodes.size() - myUnusedIdNodes;
+ //MESSAGE(this << " NbNodes " << IsComplexSubmesh() << " " << myNodes.size() - myUnusedIdNodes);
+ if ( !IsComplexSubmesh() )
+ return myNodes.size() - myUnusedIdNodes;
int nbElems = 0;
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
protected:
typename TSET::const_iterator _it, _end;
TSET _table;
-// int _ind;
public:
MySetIterator(const TSET& table)
-// : _it(table.begin()), _end(table.end())
{
-// MESSAGE("table.size()="<< table.size());
- _table = table;
- _it = _table.begin();
- _end = _table.end();
-// for (int i=0; i< _table.size(); i++)
-// if (_table[i]) { MESSAGE("_table["<< i << "]="<< _table[i]);}
-// else
-// { MESSAGE("_table["<< i << "]=NULL"); }
-// _ind = 0;
+ _table = table;
+ _it = _table.begin();
+ _end = _table.end();
+ while ((_it != _end) && (*_it == 0))
+ _it++;
}
virtual bool more()
{
- while((_it != _end) && (*_it == 0))
- {
+ while ((_it != _end) && (*_it == 0))
_it++;
-// _ind++;
- }
-// MESSAGE("more _ind=" << _ind);
return (_it != _end);
}
virtual ELEM next()
{
- ELEM e=*_it;
-// if (e) { MESSAGE("next _ind=" << _ind << " *_it=" << *_it);}
-// else { MESSAGE("next _ind=" << _ind << " *_it=NULL");}
-// _ind++;
- _it++;
- return e;
+ ELEM e = *_it;
+ _it++;
+ return e;
}
};
{
// DO NOT TRY TO FIND A REMOVED ELEMENT !!
//if ( IsComplexSubmesh() || !ME )
- if (!ME )
+ if (!ME)
return false;
- if ( IsComplexSubmesh() )
- {
- set<const SMESHDS_SubMesh*>::const_iterator aSubIt = mySubMeshes.begin();
- for ( ; aSubIt != mySubMeshes.end(); aSubIt++ )
- if ( (*aSubIt)->Contains( ME ))
- return true;
- return false;
- }
+ if (IsComplexSubmesh())
+ {
+ set<const SMESHDS_SubMesh*>::const_iterator aSubIt = mySubMeshes.begin();
+ for (; aSubIt != mySubMeshes.end(); aSubIt++)
+ if ((*aSubIt)->Contains(ME))
+ return true;
+ return false;
+ }
- if ( ME->GetType() == SMDSAbs_Node )
+ if (ME->GetType() == SMDSAbs_Node)
{
int idInShape = ME->getIdInShape();
if ((idInShape >= 0) && (idInShape < myNodes.size()))
- if (myNodes[idInShape] == ME) return true;
+ if (myNodes[idInShape] == ME)
+ return true;
}
else
{
int idInShape = ME->getIdInShape();
if ((idInShape >= 0) && (idInShape < myElements.size()))
- if (myElements[idInShape] == ME) return true;
+ if (myElements[idInShape] == ME)
+ return true;
}
- return false;
+ return false;
}
//=======================================================================
{
myElements.clear();
myNodes.clear();
+ myUnusedIdNodes = 0;
+ myUnusedIdElements = 0;
SMESHDS_SubMeshIteratorPtr sub = GetSubMeshIterator();
while ( sub->more() ) {
if ( SMESHDS_SubMesh* sm = (SMESHDS_SubMesh*) sub->next())
void SMESHDS_SubMesh::compactList()
{
- // todo : compact vector of nodes and elements
+ MESSAGE("compactList old: nodes " << myNodes.size() << " elements " << myElements.size());
+ std::vector<const SMDS_MeshElement*> newElems;
+ newElems.clear();
+ for (int i = 0; i < myElements.size(); i++)
+ if (myElements[i])
+ {
+ SMDS_MeshElement* elem = (SMDS_MeshElement*)myElements[i];
+ elem->setIdInShape(newElems.size());
+ newElems.push_back(elem);
+ }
+ myElements.swap(newElems);
+ myUnusedIdElements = 0;
+
+ std::vector<const SMDS_MeshNode*> newNodes;
+ newNodes.clear();
+ for (int i = 0; i < myNodes.size(); i++)
+ if (myNodes[i])
+ {
+ SMDS_MeshNode* node = (SMDS_MeshNode*)myNodes[i];
+ node->setIdInShape(newNodes.size());
+ newNodes.push_back(node);
+ }
+ myNodes.swap(newNodes);
+ myUnusedIdNodes = 0;
+ //MESSAGE("compactList new: nodes " << myNodes.size() << " elements " << myElements.size());
}
typedef SMDS_Iterator<const SMESHDS_SubMesh*> SMESHDS_SubMeshIterator;
typedef boost::shared_ptr< SMESHDS_SubMeshIterator > SMESHDS_SubMeshIteratorPtr;
+class SMESHDS_Mesh;
+
class SMESHDS_EXPORT SMESHDS_SubMesh
{
public:
- SMESHDS_SubMesh();
+ SMESHDS_SubMesh(SMESHDS_Mesh *parent, int index);
bool IsComplexSubmesh() const { return !mySubMeshes.empty(); }
int getSize();
void compactList();
- private:
+ inline SMESHDS_Mesh *getParent() {return myParent; };
+ private:
+ SMESHDS_Mesh * myParent;
std::vector<const SMDS_MeshElement*> myElements;
std::vector<const SMDS_MeshNode*> myNodes;
int myUnusedIdNodes;
int myUnusedIdElements;
+ int myIndex;
std::set<const SMESHDS_SubMesh*> mySubMeshes;
};
// add
if ( isNode ) {
SMDS_PositionPtr pos = aPositionCreator.MakePosition( smType[ smID ]);
- pos->SetShapeId( smID );
SMDS_MeshNode* node = const_cast<SMDS_MeshNode*>( static_cast<const SMDS_MeshNode*>( elem ));
node->SetPosition( pos );
sm->AddNode( node );
{
if ( SMDS_PositionPtr pos = aNode->GetPosition() )
{
- aNodePosition->shapeID = pos->GetShapeId();
+ aNodePosition->shapeID = aNode->getshapeId();
switch ( pos->GetTypeOfPosition() ) {
case SMDS_TOP_EDGE:
aNodePosition->shapeType = GEOM::EDGE;
// try to find node
const SMDS_MeshNode* aNode = aSMESHDS_Mesh->FindNode(id);
if(aNode) {
- SMDS_PositionPtr pos = aNode->GetPosition();
- if(!pos)
- return -1;
- else
- return pos->GetShapeId();
+ return aNode->getshapeId();
}
return -1;
case SMDS_TOP_EDGE:
// In order to detect degenerated faces easily, we replace
// nodes on a degenerated edge by node on the vertex of that edge
- if ( myTool->IsDegenShape( uvPt->node->GetPosition()->GetShapeId() ))
+ if ( myTool->IsDegenShape( uvPt->node->getshapeId() ))
{
- int edgeID = uvPt->node->GetPosition()->GetShapeId();
+ int edgeID = uvPt->node->getshapeId();
SMESH_subMesh* edgeSM = myTool->GetMesh()->GetSubMeshContaining( edgeID );
SMESH_subMeshIteratorPtr smIt = edgeSM->getDependsOnIterator( /*includeSelf=*/0,
/*complexShapeFirst=*/0);
int m = *mIt;
if ( iW && !VWMap.IsEmpty()) { // except outer wire
// avoid passing same uv point for a vertex common to 2 wires
- int vID = mefistoToDS[m]->GetPosition()->GetShapeId();
+ int vID = mefistoToDS[m]->getshapeId();
TopoDS_Vertex V = TopoDS::Vertex( myTool->GetMeshDS()->IndexToShape( vID ));
if ( fixCommonVertexUV( uvslf[m], V, F, VWMap, *myTool->GetMesh(),
scalex, scaley, _quadraticMesh )) {
if ( !myBlock.ComputeParameters( topCoords, topParams, ID_TOP_FACE, topParams ))
return error(TCom("Can't compute normalized parameters ")
<< "for node " << column.back()->GetID()
- << " on the face #"<< column.back()->GetPosition()->GetShapeId() );
+ << " on the face #"<< column.back()->getshapeId() );
}
// vertical loop
botSMDS->NbElements() != topSMDS->NbElements() ||
botSMDS->NbNodes() != topSMDS->NbNodes())
{
+ MESSAGE("nb elem bot " << botSMDS->NbElements() << " top " << topSMDS->NbElements());
+ MESSAGE("nb node bot " << botSMDS->NbNodes() << " top " << topSMDS->NbNodes());
if ( myBlock.HasNotQuadElemOnTop() )
return error(TCom("Mesh on faces #") << botSM->GetId()
<<" and #"<< topSM->GetId() << " seems different" );
}
myNotQuadOnTop = ( nbNotQuadMeshed > 1 );
+ MESSAGE("myNotQuadOnTop " << myNotQuadOnTop << " nbNotQuadMeshed " << nbNotQuadMeshed);
// ----------------------------------------------------------
// columns for vertices
// 1
const SMDS_MeshNode* n0 = faceColumns.begin()->second.front();
- id = n0->GetPosition()->GetShapeId();
+ id = n0->getshapeId();
myShapeIndex2ColumnMap[ id ] = make_pair( & faceColumns, isForward );
// 2
const SMDS_MeshNode* n1 = faceColumns.rbegin()->second.front();
- id = n1->GetPosition()->GetShapeId();
+ id = n1->getshapeId();
myShapeIndex2ColumnMap[ id ] = make_pair( & faceColumns, isForward );
// SHOWYXZ("\np1 F "<<iE, gpXYZ(faceColumns.begin()->second.front() ));
// SHOWYXZ("p2 F "<<iE, gpXYZ(faceColumns.rbegin()->second.front() ));
// columns for vertices
const SMDS_MeshNode* n0 = cols->begin()->second.front();
- id = n0->GetPosition()->GetShapeId();
+ id = n0->getshapeId();
myShapeIndex2ColumnMap[ id ] = make_pair( cols, isForward );
const SMDS_MeshNode* n1 = cols->rbegin()->second.front();
- id = n1->GetPosition()->GetShapeId();
+ id = n1->getshapeId();
myShapeIndex2ColumnMap[ id ] = make_pair( cols, !isForward );
}
}
const TNodeColumn* StdMeshers_PrismAsBlock::GetNodeColumn(const SMDS_MeshNode* node) const
{
- int sID = node->GetPosition()->GetShapeId();
+ int sID = node->getshapeId();
map<int, pair< TParam2ColumnMap*, bool > >::const_iterator col_frw =
myShapeIndex2ColumnMap.find( sID );
const SMDS_MeshElement* f = ( iF ? f2 : f1 );
for ( int i = 0; !notSeamNode[ iF ] && i < f->NbNodes(); ++i ) {
const SMDS_MeshNode* node = f->GetNode( i );
- if ( !helper->IsSeamShape( node->GetPosition()->GetShapeId() ))
+ if ( !helper->IsSeamShape( node->getshapeId() ))
notSeamNode[ iF ] = node;
}
}
const TAssocTool::TShapeShapeMap& shape2ShapeMap)
{
MESSAGE("projectPartner");
- const double tol = 1e-6;
+ const double tol = 1.e-7*srcMesh->GetMeshDS()->getMaxDim();
gp_Trsf trsf; // transformation to get location of target nodes from source ones
if ( tgtFace.IsPartner( srcFace ))
{
case 0: pOK = true; break;
- case 1: pOK = ( srcPP[0].SquareDistance( p ) > tol ); break;
+ case 1: pOK = ( srcPP[0].SquareDistance( p ) > 10*tol ); break;
case 2:
{
gp_Vec p0p1( srcPP[0], srcPP[1] ), p0p( srcPP[0], p );
- pOK = !p0p1.IsParallel( p0p, tol );
- // TODO angle pOK = !p0p1.IsParallel( p0p, 3.14/6 );
+ // pOK = !p0p1.IsParallel( p0p, tol );
+ pOK = !p0p1.IsParallel( p0p, 3.14/20 ); // angle min 18 degrees
break;
}
}
{
double srcDist = srcPP[0].Distance( p );
double eTol = BRep_Tool::Tolerance( TopoDS::Edge( tgtShape ));
+ if (eTol < tol) eTol = tol;
SMDS_NodeIteratorPtr nItT = tgtSmds->GetNodes();
while ( nItT->more() && !pOK )
{
if ( !tgtEdge.IsPartner( srcEdge.Current() ))
{
- // check that transormation is OK by three nodes
+ // check that transformation is OK by three nodes
gp_Pnt p0S = SMESH_MeshEditor::TNodeXYZ( (srcNodes.begin()) ->second);
gp_Pnt p1S = SMESH_MeshEditor::TNodeXYZ( (srcNodes.rbegin()) ->second);
gp_Pnt p2S = SMESH_MeshEditor::TNodeXYZ( (++srcNodes.begin())->second);
gp_Pnt p1T = SMESH_MeshEditor::TNodeXYZ( (tgtNodes.rbegin()) ->second);
gp_Pnt p2T = SMESH_MeshEditor::TNodeXYZ( (++tgtNodes.begin())->second);
- // transform source points, they must coinside with target ones
+ // transform source points, they must coincide with target ones
if ( p0T.SquareDistance( p0S.Transformed( trsf )) > tol ||
p1T.SquareDistance( p1S.Transformed( trsf )) > tol ||
p2T.SquareDistance( p2S.Transformed( trsf )) > tol )
// prepare the helper adding quadratic elements if necessary
SMESH_MesherHelper helper( *tgtMesh );
+ helper.SetSubShape( tgtFace );
helper.IsQuadraticSubMesh( tgtFace );
helper.SetElementsOnShape( true );
while ( nodeIt->more() ) // loop on nodes of the source element
{
const SMDS_MeshNode* srcNode = (const SMDS_MeshNode*) nodeIt->next();
+ if (elem->IsMediumNode(srcNode))
+ continue;
srcN_tgtN = src2tgtNodes.insert( make_pair( srcNode, nullNode )).first;
if ( srcN_tgtN->second == nullNode )
{
tgtFaceNodes.push_back( srcN_tgtN->second );
}
// create a new face (with reversed orientation)
- if ( tgtFaceNodes.size() == 3 )
- helper.AddFace( tgtFaceNodes[0],tgtFaceNodes[2],tgtFaceNodes[1]);
- else
- helper.AddFace( tgtFaceNodes[0],tgtFaceNodes[3],tgtFaceNodes[2],tgtFaceNodes[1]);
+ //MESSAGE("tgtFaceNodes.size() " << tgtFaceNodes.size());
+ switch (tgtFaceNodes.size())
+ {
+ case 3:
+ case 6:
+ helper.AddFace(tgtFaceNodes[0], tgtFaceNodes[2], tgtFaceNodes[1]);
+ break;
+ case 4:
+ case 8:
+ helper.AddFace(tgtFaceNodes[0], tgtFaceNodes[3], tgtFaceNodes[2], tgtFaceNodes[1]);
+ break;
+ }
}
return true;
}