PR: correct some warnings

This commit is contained in:
prascle 2010-11-30 22:35:24 +00:00
parent 8fa039a796
commit 2e16ca1281
18 changed files with 147 additions and 63 deletions

View File

@ -2588,8 +2588,8 @@ bool RangeOfIds::SetRangeStr( const TCollection_AsciiString& theStr )
while ( aMinStr.Search( "-" ) != -1 ) aMinStr.RemoveAll( '-' ); while ( aMinStr.Search( "-" ) != -1 ) aMinStr.RemoveAll( '-' );
while ( aMaxStr.Search( "-" ) != -1 ) aMaxStr.RemoveAll( '-' ); while ( aMaxStr.Search( "-" ) != -1 ) aMaxStr.RemoveAll( '-' );
if ( !aMinStr.IsEmpty() && !aMinStr.IsIntegerValue() || if ( (!aMinStr.IsEmpty() && !aMinStr.IsIntegerValue()) ||
!aMaxStr.IsEmpty() && !aMaxStr.IsIntegerValue() ) (!aMaxStr.IsEmpty() && !aMaxStr.IsIntegerValue()) )
return false; return false;
myMin.Append( aMinStr.IsEmpty() ? IntegerFirst() : aMinStr.IntegerValue() ); myMin.Append( aMinStr.IsEmpty() ? IntegerFirst() : aMinStr.IntegerValue() );
@ -2635,7 +2635,7 @@ bool RangeOfIds::IsSatisfy( long theId )
else else
{ {
const SMDS_MeshElement* anElem = myMesh->FindElement( theId ); const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
if ( anElem == 0 || myType != anElem->GetType() && myType != SMDSAbs_All ) if ( anElem == 0 || (myType != anElem->GetType() && myType != SMDSAbs_All ))
return false; return false;
} }
@ -2826,8 +2826,8 @@ bool LogicalOR::IsSatisfy( long theId )
return return
myPredicate1 && myPredicate1 &&
myPredicate2 && myPredicate2 &&
myPredicate1->IsSatisfy( theId ) || (myPredicate1->IsSatisfy( theId ) ||
myPredicate2->IsSatisfy( theId ); myPredicate2->IsSatisfy( theId ));
} }

View File

@ -384,13 +384,14 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
if ( aMeshDimension == 2 && anIsZDimension ) // 2D only if mesh is in XOY plane if ( aMeshDimension == 2 && anIsZDimension ) // 2D only if mesh is in XOY plane
aMeshDimension = 3; aMeshDimension = 3;
// PAL18941(a saved study with a mesh belong Z is opened and the mesh is belong X) // PAL18941(a saved study with a mesh belong Z is opened and the mesh is belong X)
if ( aMeshDimension == 1 && !anIsXDimension ) // 1D only if mesh is along OX if ( aMeshDimension == 1 && !anIsXDimension ) {// 1D only if mesh is along OX
if ( anIsYDimension ) { if ( anIsYDimension ) {
aMeshDimension = 2; aMeshDimension = 2;
anIsXDimension = true; anIsXDimension = true;
} else { } else {
aMeshDimension = 3; aMeshDimension = 3;
} }
}
} }
SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator(/*idInceasingOrder=*/true); SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator(/*idInceasingOrder=*/true);
@ -430,7 +431,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
int myFacesDefaultFamilyId = 0; int myFacesDefaultFamilyId = 0;
int myVolumesDefaultFamilyId = 0; int myVolumesDefaultFamilyId = 0;
int nbNodes = myMesh->NbNodes(); int nbNodes = myMesh->NbNodes();
int nb0DElements = myMesh->Nb0DElements(); //int nb0DElements = myMesh->Nb0DElements();
int nbEdges = myMesh->NbEdges(); int nbEdges = myMesh->NbEdges();
int nbFaces = myMesh->NbFaces(); int nbFaces = myMesh->NbFaces();
int nbVolumes = myMesh->NbVolumes(); int nbVolumes = myMesh->NbVolumes();

View File

@ -540,7 +540,7 @@ bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
int nbNodes = anElem->NbNodes(); int nbNodes = anElem->NbNodes();
if ( theEdgeNum < 0 || theEdgeNum > 3 || nbNodes != 3 && nbNodes != 4 || theEdgeNum > nbNodes ) if ( theEdgeNum < 0 || theEdgeNum > 3 || (nbNodes != 3 && nbNodes != 4) || theEdgeNum > nbNodes )
return false; return false;
vector<int> anIds( nbNodes ); vector<int> anIds( nbNodes );
@ -642,6 +642,7 @@ bool SMESH_MeshObj::NulData()
myEmptyGrid->BuildLinks(); myEmptyGrid->BuildLinks();
} }
myGrid->ShallowCopy(myEmptyGrid); myGrid->ShallowCopy(myEmptyGrid);
return true;
} }
//================================================================================= //=================================================================================
// function : GetElemDimension // function : GetElemDimension

View File

@ -420,7 +420,7 @@ int SMDS_Down1D::computeFaces(int* pts, int* vtkIds, int nbcells, int* downFaces
{ {
int volId = _grid->CellIdToDownId(vtkId); int volId = _grid->CellIdToDownId(vtkId);
SMDS_Downward * downvol = _grid->getDownArray(vtkType); SMDS_Downward * downvol = _grid->getDownArray(vtkType);
const int *downIds = downvol->getDownCells(volId); //const int *downIds = downvol->getDownCells(volId);
const unsigned char* downTypesVol = downvol->getDownTypes(volId); const unsigned char* downTypesVol = downvol->getDownTypes(volId);
int nbFaces = downvol->getNumberOfDownCells(volId); int nbFaces = downvol->getNumberOfDownCells(volId);
const int* faceIds = downvol->getDownCells(volId); const int* faceIds = downvol->getDownCells(volId);

View File

@ -269,7 +269,7 @@ SMDS_Mesh0DElement* SMDS_Mesh::Add0DElementWithID(const SMDS_MeshNode * n, int I
//MESSAGE("Add0DElementWithID" << ID) //MESSAGE("Add0DElementWithID" << ID)
SMDS_Mesh0DElement * el0d = new SMDS_Mesh0DElement(n); SMDS_Mesh0DElement * el0d = new SMDS_Mesh0DElement(n);
if (myElementIDFactory->BindID(ID, el0d)) { if (myElementIDFactory->BindID(ID, el0d)) {
SMDS_MeshNode *node = const_cast<SMDS_MeshNode*>(n); //SMDS_MeshNode *node = const_cast<SMDS_MeshNode*>(n);
//node->AddInverseElement(el0d);// --- fait avec BindID //node->AddInverseElement(el0d);// --- fait avec BindID
adjustmyCellsCapacity(ID); adjustmyCellsCapacity(ID);
myCells[ID] = el0d; myCells[ID] = el0d;
@ -2988,8 +2988,10 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
//MESSAGE("SMDS_Mesh::RemoveElement " << elem->getVtkId() << " " << removenodes); //MESSAGE("SMDS_Mesh::RemoveElement " << elem->getVtkId() << " " << removenodes);
// get finite elements built on elem // get finite elements built on elem
set<const SMDS_MeshElement*> * s1; set<const SMDS_MeshElement*> * s1;
if (elem->GetType() == SMDSAbs_0DElement || elem->GetType() == SMDSAbs_Edge && !hasConstructionEdges() if ( (elem->GetType() == SMDSAbs_0DElement)
|| elem->GetType() == SMDSAbs_Face && !hasConstructionFaces() || elem->GetType() == SMDSAbs_Volume) || ((elem->GetType() == SMDSAbs_Edge) && !hasConstructionEdges())
|| ((elem->GetType() == SMDSAbs_Face) && !hasConstructionFaces())
|| (elem->GetType() == SMDSAbs_Volume) )
{ {
s1 = new set<const SMDS_MeshElement*> (); s1 = new set<const SMDS_MeshElement*> ();
s1->insert(elem); s1->insert(elem);

View File

@ -32,10 +32,6 @@
#include "SMDS_Mesh.hxx" #include "SMDS_Mesh.hxx"
#include <vtkUnstructuredGrid.h> #include <vtkUnstructuredGrid.h>
#define protected public
#include <vtkCellLinks.h>
#define protected protected
#include "utilities.h" #include "utilities.h"
#include "Utils_SALOME_Exception.hxx" #include "Utils_SALOME_Exception.hxx"
#include <cassert> #include <cassert>
@ -73,12 +69,13 @@ void SMDS_MeshNode::init(int id, int meshId, int shapeId, double x, double y, do
myIdInShape = -1; myIdInShape = -1;
//MESSAGE("Node " << myID << " " << myVtkID << " (" << x << ", " << y << ", " << z << ")"); //MESSAGE("Node " << myID << " " << myVtkID << " (" << x << ", " << y << ", " << z << ")");
SMDS_Mesh* mesh = SMDS_Mesh::_meshList[myMeshId]; SMDS_Mesh* mesh = SMDS_Mesh::_meshList[myMeshId];
vtkUnstructuredGrid * grid = mesh->getGrid(); SMDS_UnstructuredGrid * grid = mesh->getGrid();
vtkPoints *points = grid->GetPoints(); vtkPoints *points = grid->GetPoints();
points->InsertPoint(myVtkID, x, y, z); points->InsertPoint(myVtkID, x, y, z);
vtkCellLinks *cellLinks = grid->GetCellLinks(); SMDS_CellLinks *cellLinks = dynamic_cast<SMDS_CellLinks*>(grid->GetCellLinks());
if (myVtkID >=cellLinks->Size) assert(cellLinks);
cellLinks->Resize(myVtkID+SMDS_Mesh::chunkSize); if (myVtkID >= cellLinks->GetLinksSize())
cellLinks->ResizeL(myVtkID+SMDS_Mesh::chunkSize);
} }
SMDS_MeshNode::~SMDS_MeshNode() SMDS_MeshNode::~SMDS_MeshNode()

View File

@ -15,6 +15,31 @@
using namespace std; using namespace std;
SMDS_CellLinks* SMDS_CellLinks::New()
{
MESSAGE("SMDS_CellLinks::New");
return new SMDS_CellLinks();
}
vtkCellLinks::Link* SMDS_CellLinks::ResizeL(vtkIdType sz)
{
return vtkCellLinks::Resize(sz);
}
vtkIdType SMDS_CellLinks::GetLinksSize()
{
return this->Size;
}
SMDS_CellLinks::SMDS_CellLinks() :
vtkCellLinks()
{
}
SMDS_CellLinks::~SMDS_CellLinks()
{
}
SMDS_UnstructuredGrid* SMDS_UnstructuredGrid::New() SMDS_UnstructuredGrid* SMDS_UnstructuredGrid::New()
{ {
MESSAGE("SMDS_UnstructuredGrid::New"); MESSAGE("SMDS_UnstructuredGrid::New");
@ -697,7 +722,7 @@ void SMDS_UnstructuredGrid::BuildDownwardConnectivity(bool withEdges)
int faceId2 = downFaces[idf]; int faceId2 = downFaces[idf];
int faceType = downTypes[idf]; int faceType = downTypes[idf];
//ASSERT(_downArray[faceType]); //ASSERT(_downArray[faceType]);
SMDS_Down2D* downFace2 = static_cast<SMDS_Down2D*> (_downArray[faceType]); //SMDS_Down2D* downFace2 = static_cast<SMDS_Down2D*> (_downArray[faceType]);
_downArray[vtkEdgeType]->addUpCell(connEdgeId, faceId2, faceType); _downArray[vtkEdgeType]->addUpCell(connEdgeId, faceId2, faceType);
_downArray[faceType]->addDownCell(faceId2, connEdgeId, vtkEdgeType); _downArray[faceType]->addDownCell(faceId2, connEdgeId, vtkEdgeType);
// MESSAGE(" From face t:" << vtkFaceType << " " << faceId << // MESSAGE(" From face t:" << vtkFaceType << " " << faceId <<
@ -839,3 +864,17 @@ int SMDS_UnstructuredGrid::getOrderedNodesOfFace(int vtkVolId, std::vector<int>&
return orderedNodes.size(); return orderedNodes.size();
} }
void SMDS_UnstructuredGrid::BuildLinks()
{
// Remove the old links if they are already built
if (this->Links)
{
this->Links->UnRegister(this);
}
this->Links = SMDS_CellLinks::New();
this->Links->Allocate(this->GetNumberOfPoints());
this->Links->Register(this);
this->Links->BuildLinks(this, this->Connectivity);
this->Links->Delete();
}

View File

@ -9,6 +9,7 @@
#define _SMDS_UNSTRUCTUREDGRID_HXX #define _SMDS_UNSTRUCTUREDGRID_HXX
#include <vtkUnstructuredGrid.h> #include <vtkUnstructuredGrid.h>
#include <vtkCellLinks.h>
#include "chrono.hxx" #include "chrono.hxx"
#include <vector> #include <vector>
@ -30,6 +31,17 @@
class SMDS_Downward; class SMDS_Downward;
class SMDS_Mesh; class SMDS_Mesh;
class SMDS_CellLinks: public vtkCellLinks
{
public:
vtkCellLinks::Link* ResizeL(vtkIdType sz);
vtkIdType GetLinksSize();
static SMDS_CellLinks* New();
protected:
SMDS_CellLinks();
~SMDS_CellLinks();
};
class SMDS_UnstructuredGrid: public vtkUnstructuredGrid class SMDS_UnstructuredGrid: public vtkUnstructuredGrid
{ {
public: public:
@ -53,6 +65,7 @@ public:
void GetNodeIds(std::set<int>& nodeSet, int downId, unsigned char downType); void GetNodeIds(std::set<int>& nodeSet, int downId, unsigned char downType);
void ModifyCellNodes(int vtkVolId, std::map<int, int> localClonedNodeIds); void ModifyCellNodes(int vtkVolId, std::map<int, int> localClonedNodeIds);
int getOrderedNodesOfFace(int vtkVolId, std::vector<int>& orderedNodes); int getOrderedNodesOfFace(int vtkVolId, std::vector<int>& orderedNodes);
void BuildLinks();
vtkCellLinks* GetLinks() vtkCellLinks* GetLinks()
{ {
return Links; return Links;

View File

@ -171,6 +171,7 @@ bool SMDS_VtkVolume::vtkOrder(const SMDS_MeshNode* nodes[], const int nbNodes)
default: default:
break; break;
} }
return true;
} }
SMDS_VtkVolume::~SMDS_VtkVolume() SMDS_VtkVolume::~SMDS_VtkVolume()
@ -355,7 +356,7 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetFaceNode(const int face_ind, const int n
/*! polyhedron only, /*! polyhedron only,
* return number of nodes for each face * return number of nodes for each face
*/ */
const std::vector<int> & SMDS_VtkVolume::GetQuantities() const const std::vector<int> SMDS_VtkVolume::GetQuantities() const
{ {
vector<int> quantities; vector<int> quantities;
quantities.clear(); quantities.clear();

View File

@ -45,7 +45,7 @@ public:
static bool isForward(double* a,double* b,double* c,double* d); static bool isForward(double* a,double* b,double* c,double* d);
int NbUniqueNodes() const; int NbUniqueNodes() const;
SMDS_ElemIteratorPtr uniqueNodesIterator() const; SMDS_ElemIteratorPtr uniqueNodesIterator() const;
const std::vector<int> & GetQuantities() const; const std::vector<int> GetQuantities() const;
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const; virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const; virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;

View File

@ -133,36 +133,43 @@ SMESH_MeshEditor::AddElement(const vector<const SMDS_MeshNode*> & node,
SMESHDS_Mesh* mesh = GetMeshDS(); SMESHDS_Mesh* mesh = GetMeshDS();
switch ( type ) { switch ( type ) {
case SMDSAbs_0DElement: case SMDSAbs_0DElement:
if ( nbnode == 1 ) if ( nbnode == 1 ) {
if ( ID >= 0 ) e = mesh->Add0DElementWithID(node[0], ID); if ( ID >= 0 ) e = mesh->Add0DElementWithID(node[0], ID);
else e = mesh->Add0DElement (node[0] ); else e = mesh->Add0DElement (node[0] );
}
break; break;
case SMDSAbs_Edge: case SMDSAbs_Edge:
if ( nbnode == 2 ) if ( nbnode == 2 ) {
if ( ID >= 0 ) e = mesh->AddEdgeWithID(node[0], node[1], ID); if ( ID >= 0 ) e = mesh->AddEdgeWithID(node[0], node[1], ID);
else e = mesh->AddEdge (node[0], node[1] ); else e = mesh->AddEdge (node[0], node[1] );
else if ( nbnode == 3 ) }
else if ( nbnode == 3 ) {
if ( ID >= 0 ) e = mesh->AddEdgeWithID(node[0], node[1], node[2], ID); if ( ID >= 0 ) e = mesh->AddEdgeWithID(node[0], node[1], node[2], ID);
else e = mesh->AddEdge (node[0], node[1], node[2] ); else e = mesh->AddEdge (node[0], node[1], node[2] );
}
break; break;
case SMDSAbs_Face: case SMDSAbs_Face:
if ( !isPoly ) { if ( !isPoly ) {
if (nbnode == 3) if (nbnode == 3) {
if ( ID >= 0 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], ID); if ( ID >= 0 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], ID);
else e = mesh->AddFace (node[0], node[1], node[2] ); else e = mesh->AddFace (node[0], node[1], node[2] );
else if (nbnode == 4) }
else if (nbnode == 4) {
if ( ID >= 0 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], node[3], ID); if ( ID >= 0 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], node[3], ID);
else e = mesh->AddFace (node[0], node[1], node[2], node[3] ); else e = mesh->AddFace (node[0], node[1], node[2], node[3] );
else if (nbnode == 6) }
else if (nbnode == 6) {
if ( ID >= 0 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], node[3], if ( ID >= 0 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], node[3],
node[4], node[5], ID); node[4], node[5], ID);
else e = mesh->AddFace (node[0], node[1], node[2], node[3], else e = mesh->AddFace (node[0], node[1], node[2], node[3],
node[4], node[5] ); node[4], node[5] );
else if (nbnode == 8) }
else if (nbnode == 8) {
if ( ID >= 0 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], node[3], if ( ID >= 0 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7], ID); node[4], node[5], node[6], node[7], ID);
else e = mesh->AddFace (node[0], node[1], node[2], node[3], else e = mesh->AddFace (node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7] ); node[4], node[5], node[6], node[7] );
}
} else { } else {
if ( ID >= 0 ) e = mesh->AddPolygonalFaceWithID(node, ID); if ( ID >= 0 ) e = mesh->AddPolygonalFaceWithID(node, ID);
else e = mesh->AddPolygonalFace (node ); else e = mesh->AddPolygonalFace (node );
@ -170,32 +177,37 @@ SMESH_MeshEditor::AddElement(const vector<const SMDS_MeshNode*> & node,
break; break;
case SMDSAbs_Volume: case SMDSAbs_Volume:
if ( !isPoly ) { if ( !isPoly ) {
if (nbnode == 4) if (nbnode == 4) {
if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], ID); if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], ID);
else e = mesh->AddVolume (node[0], node[1], node[2], node[3] ); else e = mesh->AddVolume (node[0], node[1], node[2], node[3] );
else if (nbnode == 5) }
else if (nbnode == 5) {
if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3],
node[4], ID); node[4], ID);
else e = mesh->AddVolume (node[0], node[1], node[2], node[3], else e = mesh->AddVolume (node[0], node[1], node[2], node[3],
node[4] ); node[4] );
else if (nbnode == 6) }
else if (nbnode == 6) {
if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3],
node[4], node[5], ID); node[4], node[5], ID);
else e = mesh->AddVolume (node[0], node[1], node[2], node[3], else e = mesh->AddVolume (node[0], node[1], node[2], node[3],
node[4], node[5] ); node[4], node[5] );
else if (nbnode == 8) }
else if (nbnode == 8) {
if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7], ID); node[4], node[5], node[6], node[7], ID);
else e = mesh->AddVolume (node[0], node[1], node[2], node[3], else e = mesh->AddVolume (node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7] ); node[4], node[5], node[6], node[7] );
else if (nbnode == 10) }
else if (nbnode == 10) {
if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7], node[4], node[5], node[6], node[7],
node[8], node[9], ID); node[8], node[9], ID);
else e = mesh->AddVolume (node[0], node[1], node[2], node[3], else e = mesh->AddVolume (node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7], node[4], node[5], node[6], node[7],
node[8], node[9] ); node[8], node[9] );
else if (nbnode == 13) }
else if (nbnode == 13) {
if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7], node[4], node[5], node[6], node[7],
node[8], node[9], node[10],node[11], node[8], node[9], node[10],node[11],
@ -204,7 +216,8 @@ SMESH_MeshEditor::AddElement(const vector<const SMDS_MeshNode*> & node,
node[4], node[5], node[6], node[7], node[4], node[5], node[6], node[7],
node[8], node[9], node[10],node[11], node[8], node[9], node[10],node[11],
node[12] ); node[12] );
else if (nbnode == 15) }
else if (nbnode == 15) {
if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7], node[4], node[5], node[6], node[7],
node[8], node[9], node[10],node[11], node[8], node[9], node[10],node[11],
@ -213,7 +226,8 @@ SMESH_MeshEditor::AddElement(const vector<const SMDS_MeshNode*> & node,
node[4], node[5], node[6], node[7], node[4], node[5], node[6], node[7],
node[8], node[9], node[10],node[11], node[8], node[9], node[10],node[11],
node[12],node[13],node[14] ); node[12],node[13],node[14] );
else if (nbnode == 20) }
else if (nbnode == 20) {
if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7], node[4], node[5], node[6], node[7],
node[8], node[9], node[10],node[11], node[8], node[9], node[10],node[11],
@ -224,6 +238,7 @@ SMESH_MeshEditor::AddElement(const vector<const SMDS_MeshNode*> & node,
node[8], node[9], node[10],node[11], node[8], node[9], node[10],node[11],
node[12],node[13],node[14],node[15], node[12],node[13],node[14],node[15],
node[16],node[17],node[18],node[19] ); node[16],node[17],node[18],node[19] );
}
} }
} }
if ( e ) myLastCreatedElems.Append( e ); if ( e ) myLastCreatedElems.Append( e );
@ -531,12 +546,14 @@ bool SMESH_MeshEditor::InverseDiag (const SMDS_MeshElement * theTria1,
// find indices of 1,2 and of A,B in theTria1 // find indices of 1,2 and of A,B in theTria1
int iA = 0, iB = 0, i1 = 0, i2 = 0; int iA = 0, iB = 0, i1 = 0, i2 = 0;
for ( i = 0; i < 6; i++ ) { for ( i = 0; i < 6; i++ ) {
if ( sameInd [ i ] == 0 ) if ( sameInd [ i ] == 0 ) {
if ( i < 3 ) i1 = i; if ( i < 3 ) i1 = i;
else i2 = i; else i2 = i;
else if (i < 3) }
else if (i < 3) {
if ( iA ) iB = i; if ( iA ) iB = i;
else iA = i; else iA = i;
}
} }
// nodes 1 and 2 should not be the same // nodes 1 and 2 should not be the same
if ( aNodes[ i1 ] == aNodes[ i2 ] ) if ( aNodes[ i1 ] == aNodes[ i2 ] )
@ -623,7 +640,7 @@ static bool findTriangles(const SMDS_MeshNode * theNode1,
it = theNode2->GetInverseElementIterator(SMDSAbs_Face); it = theNode2->GetInverseElementIterator(SMDSAbs_Face);
while (it->more()) { while (it->more()) {
const SMDS_MeshElement* elem = it->next(); const SMDS_MeshElement* elem = it->next();
if ( emap.find( elem ) != emap.end() ) if ( emap.find( elem ) != emap.end() ) {
if ( theTria1 ) { if ( theTria1 ) {
// theTria1 must be element with minimum ID // theTria1 must be element with minimum ID
if( theTria1->GetID() < elem->GetID() ) { if( theTria1->GetID() < elem->GetID() ) {
@ -638,6 +655,7 @@ static bool findTriangles(const SMDS_MeshNode * theNode1,
else { else {
theTria1 = elem; theTria1 = elem;
} }
}
} }
return ( theTria1 && theTria2 ); return ( theTria1 && theTria2 );
} }
@ -1998,7 +2016,7 @@ double getAngle(const SMDS_MeshElement * tr1,
int i = 0, iDiag = -1; int i = 0, iDiag = -1;
while ( it->more()) { while ( it->more()) {
const SMDS_MeshElement *n = it->next(); const SMDS_MeshElement *n = it->next();
if ( n == n1 || n == n2 ) if ( n == n1 || n == n2 ) {
if ( iDiag < 0) if ( iDiag < 0)
iDiag = i; iDiag = i;
else { else {
@ -2008,6 +2026,7 @@ double getAngle(const SMDS_MeshElement * tr1,
nFirst[ t ] = n; nFirst[ t ] = n;
break; break;
} }
}
i++; i++;
} }
} }
@ -5535,12 +5554,12 @@ SMESH_MeshEditor::Transform (TIDSortedElemSet & theElems,
// Regular elements // Regular elements
int* i = index[ FORWARD ]; int* i = index[ FORWARD ];
if ( needReverse && nbNodes > 2) // reverse mirrored faces and volumes if ( needReverse && nbNodes > 2) {// reverse mirrored faces and volumes
if ( elemType == SMDSAbs_Face ) if ( elemType == SMDSAbs_Face )
i = index[ REV_FACE ]; i = index[ REV_FACE ];
else else
i = index[ nbNodes - 4 ]; i = index[ nbNodes - 4 ];
}
if(elem->IsQuadratic()) { if(elem->IsQuadratic()) {
static int anIds[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; static int anIds[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
i = anIds; i = anIds;
@ -7024,12 +7043,12 @@ bool SMESH_MeshEditor::isOut( const SMDS_MeshElement* element, const gp_Pnt& poi
vector<const SMDS_MeshNode*> nodeList; vector<const SMDS_MeshNode*> nodeList;
SMDS_ElemIteratorPtr nodeIt = element->nodesIterator(); SMDS_ElemIteratorPtr nodeIt = element->nodesIterator();
if ( element->IsQuadratic() ) if ( element->IsQuadratic() ) {
if (const SMDS_VtkFace* f=dynamic_cast<const SMDS_VtkFace*>(element)) if (const SMDS_VtkFace* f=dynamic_cast<const SMDS_VtkFace*>(element))
nodeIt = f->interlacedNodesElemIterator(); nodeIt = f->interlacedNodesElemIterator();
else if (const SMDS_VtkEdge* e =dynamic_cast<const SMDS_VtkEdge*>(element)) else if (const SMDS_VtkEdge* e =dynamic_cast<const SMDS_VtkEdge*>(element))
nodeIt = e->interlacedNodesElemIterator(); nodeIt = e->interlacedNodesElemIterator();
}
while ( nodeIt->more() ) while ( nodeIt->more() )
{ {
const SMDS_MeshNode* node = cast2Node( nodeIt->next() ); const SMDS_MeshNode* node = cast2Node( nodeIt->next() );
@ -7826,7 +7845,7 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
} }
} }
else { else {
int elemId = elem->GetID(); //int elemId = elem->GetID();
//MESSAGE("Change regular element or polygon " << elemId); //MESSAGE("Change regular element or polygon " << elemId);
SMDSAbs_ElementType etyp = elem->GetType(); SMDSAbs_ElementType etyp = elem->GetType();
uniqueNodes.resize(nbUniqueNodes); uniqueNodes.resize(nbUniqueNodes);

View File

@ -860,12 +860,14 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1,
{ {
if ( uvOK[0] && uvOK[1] ) if ( uvOK[0] && uvOK[1] )
{ {
if ( IsDegenShape( n1->getshapeId() )) if ( IsDegenShape( n1->getshapeId() )) {
if ( myParIndex & U_periodic ) uv[0].SetCoord( 1, uv[1].Coord( 1 )); if ( myParIndex & U_periodic ) uv[0].SetCoord( 1, uv[1].Coord( 1 ));
else uv[0].SetCoord( 2, uv[1].Coord( 2 )); else uv[0].SetCoord( 2, uv[1].Coord( 2 ));
else if ( IsDegenShape( n2->getshapeId() )) }
else if ( IsDegenShape( n2->getshapeId() )) {
if ( myParIndex & U_periodic ) uv[1].SetCoord( 1, uv[0].Coord( 1 )); if ( myParIndex & U_periodic ) uv[1].SetCoord( 1, uv[0].Coord( 1 ));
else uv[1].SetCoord( 2, uv[0].Coord( 2 )); else uv[1].SetCoord( 2, uv[0].Coord( 2 ));
}
TopLoc_Location loc; TopLoc_Location loc;
Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc); Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc);
@ -1586,7 +1588,7 @@ bool SMESH_MesherHelper::IsSubShape( const TopoDS_Shape& shape, SMESH_Mesh* aMes
return return
aMesh->GetMeshDS()->ShapeToIndex( shape ) || aMesh->GetMeshDS()->ShapeToIndex( shape ) ||
// PAL16202 // PAL16202
shape.ShapeType() == TopAbs_COMPOUND && aMesh->GetMeshDS()->IsGroupOfSubShapes( shape ); (shape.ShapeType() == TopAbs_COMPOUND && aMesh->GetMeshDS()->IsGroupOfSubShapes( shape ));
} }
//================================================================================ //================================================================================
@ -1954,7 +1956,7 @@ namespace { // Structures used by FixQuadraticElements()
// propagate from quadrangle to neighbour faces // propagate from quadrangle to neighbour faces
if ( link->MediumPos() >= pos ) { if ( link->MediumPos() >= pos ) {
int nbLinkFaces = link->_faces.size(); int nbLinkFaces = link->_faces.size();
if ( nbLinkFaces == 4 || nbLinkFaces < 4 && link->OnBoundary()) { if ( nbLinkFaces == 4 || (nbLinkFaces < 4 && link->OnBoundary())) {
// hexahedral mesh or boundary quadrangles - goto a continous face // hexahedral mesh or boundary quadrangles - goto a continous face
if ( const QFace* f = link->GetContinuesFace( this )) if ( const QFace* f = link->GetContinuesFace( this ))
return f->GetLinkChain( *chLink, chain, pos, error ); return f->GetLinkChain( *chLink, chain, pos, error );

View File

@ -1529,11 +1529,12 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
ComputeSubMeshStateEngine( CHECK_COMPUTE_STATE ); ComputeSubMeshStateEngine( CHECK_COMPUTE_STATE );
break; break;
case CHECK_COMPUTE_STATE: case CHECK_COMPUTE_STATE:
if ( !IsMeshComputed() ) if ( !IsMeshComputed() ) {
if (_algoState == HYP_OK) if (_algoState == HYP_OK)
_computeState = READY_TO_COMPUTE; _computeState = READY_TO_COMPUTE;
else else
_computeState = NOT_READY; _computeState = NOT_READY;
}
break; break;
default: default:
ASSERT(0); ASSERT(0);

View File

@ -66,13 +66,14 @@ class MyIterator: public SMDS_ElemIterator
MyIterator(SMDSAbs_ElementType type, const SMESHDS_SubMesh* subMesh) MyIterator(SMDSAbs_ElementType type, const SMESHDS_SubMesh* subMesh)
: myType(type), myElem(0) : myType(type), myElem(0)
{ {
if ( subMesh ) if ( subMesh ) {
if ( myType == SMDSAbs_Node ) if ( myType == SMDSAbs_Node )
myNodeIt = subMesh->GetNodes(); myNodeIt = subMesh->GetNodes();
else { else {
myElemIt = subMesh->GetElements(); myElemIt = subMesh->GetElements();
next(); next();
} }
}
} }
bool more() bool more()
{ {

View File

@ -1065,10 +1065,12 @@ void SMESHDS_Mesh::UnSetMeshElementOnShape(const SMDS_MeshElement * elem,
map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.find( Index ); map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.find( Index );
if ( it != myShapeIndexToSubMesh.end() ) if ( it != myShapeIndexToSubMesh.end() )
if ( elem->GetType() == SMDSAbs_Node ) {
it->second->RemoveNode( static_cast<const SMDS_MeshNode* >( elem ), /*deleted=*/false ); if (elem->GetType() == SMDSAbs_Node)
else it->second->RemoveNode(static_cast<const SMDS_MeshNode*> (elem), /*deleted=*/false);
it->second->RemoveElement( elem, /*deleted=*/false ); else
it->second->RemoveElement(elem, /*deleted=*/false);
}
} }
//======================================================================= //=======================================================================

View File

@ -140,7 +140,7 @@ bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N, bool isNodeDeleted)
// if (!isNodeDeleted) // alive node has valid ID and can be found // if (!isNodeDeleted) // alive node has valid ID and can be found
// { // {
int idInSubShape = N->getIdInShape(); int idInSubShape = N->getIdInShape();
int shapeId = N->getshapeId(); //int shapeId = N->getshapeId();
//MESSAGE("in "<< myIndex << " RemoveNode " << shapeId << " " << idInSubShape << " " << N->GetID()); //MESSAGE("in "<< myIndex << " RemoveNode " << shapeId << " " << idInSubShape << " " << N->GetID());
SMDS_MeshNode* node = (SMDS_MeshNode*) (N); SMDS_MeshNode* node = (SMDS_MeshNode*) (N);
node->setShapeId(0); node->setShapeId(0);

View File

@ -1026,7 +1026,7 @@ void StdMeshers_Hexa_3D::GetConv2DCoefs(const faceQuadStruct & quad,
VB = quad.side[0]->LastVertex(); VB = quad.side[0]->LastVertex();
int a1, b1, c1, a2, b2, c2; int a1, b1, c1, a2, b2, c2;
if (VA.IsSame(V0)) if (VA.IsSame(V0)) {
if (VB.IsSame(V1)) if (VB.IsSame(V1))
{ {
a1 = 1; a1 = 1;
@ -1046,7 +1046,8 @@ void StdMeshers_Hexa_3D::GetConv2DCoefs(const faceQuadStruct & quad,
b2 = 0; b2 = 0;
c2 = 0; // x c2 = 0; // x
} }
if (VA.IsSame(V1)) }
if (VA.IsSame(V1)) {
if (VB.IsSame(V2)) if (VB.IsSame(V2))
{ {
a1 = 0; a1 = 0;
@ -1066,7 +1067,8 @@ void StdMeshers_Hexa_3D::GetConv2DCoefs(const faceQuadStruct & quad,
b2 = 1; b2 = 1;
c2 = 0; // y c2 = 0; // y
} }
if (VA.IsSame(V2)) }
if (VA.IsSame(V2)) {
if (VB.IsSame(V3)) if (VB.IsSame(V3))
{ {
a1 = -1; a1 = -1;
@ -1086,7 +1088,8 @@ void StdMeshers_Hexa_3D::GetConv2DCoefs(const faceQuadStruct & quad,
b2 = 0; b2 = 0;
c2 = 1; // 1-x c2 = 1; // 1-x
} }
if (VA.IsSame(V3)) }
if (VA.IsSame(V3)) {
if (VB.IsSame(V0)) if (VB.IsSame(V0))
{ {
a1 = 0; a1 = 0;
@ -1106,6 +1109,7 @@ void StdMeshers_Hexa_3D::GetConv2DCoefs(const faceQuadStruct & quad,
b2 = -1; b2 = -1;
c2 = 1; // 1-y c2 = 1; // 1-y
} }
}
// MESSAGE("X = " << c1 << "+ " << a1 << "*x + " << b1 << "*y"); // MESSAGE("X = " << c1 << "+ " << a1 << "*x + " << b1 << "*y");
// MESSAGE("Y = " << c2 << "+ " << a2 << "*x + " << b2 << "*y"); // MESSAGE("Y = " << c2 << "+ " << a2 << "*x + " << b2 << "*y");
conv.a1 = a1; conv.a1 = a1;

View File

@ -1000,13 +1000,14 @@ bool StdMeshers_RadialQuadrangle_1D2D::computeLayerPositions(const gp_Pnt&
} }
if ( hyp1D ) // try to compute with hyp1D if ( hyp1D ) // try to compute with hyp1D
{ {
if ( !TNodeDistributor::GetDistributor(*mesh)->Compute( myLayerPositions,p1,p2,*mesh,hyp1D )) if ( !TNodeDistributor::GetDistributor(*mesh)->Compute( myLayerPositions,p1,p2,*mesh,hyp1D )) {
if ( myDistributionHypo ) { // bad hyp assigned if ( myDistributionHypo ) { // bad hyp assigned
return error( TNodeDistributor::GetDistributor(*mesh)->GetComputeError() ); return error( TNodeDistributor::GetDistributor(*mesh)->GetComputeError() );
} }
else { else {
// bad hyp found, its Ok, lets try with default nb of segnents // bad hyp found, its Ok, lets try with default nb of segnents
} }
}
} }
if ( myLayerPositions.empty() ) // try to use nb of layers if ( myLayerPositions.empty() ) // try to use nb of layers