From 65c1beab50fcec33a4e988c10b3fedb081543164 Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 19 May 2016 20:50:08 +0300 Subject: [PATCH] Fix regressions 1) 2D_mesh_QuadranglePreference_01/B5 ( StdMeshers_Quadrangle_2D.cxx ) 2) viscous_layers_01/B2, B8 ( StdMeshers_ViscousLayers.cxx ) + Fix compilation warning "variable may be used uninitialized" --- src/Controls/SMESH_Controls.cxx | 10 +-- src/MEDWrapper/Base/MED_Wrapper.cxx | 2 +- src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx | 2 +- src/OBJECT/SMESH_DeviceActor.cxx | 2 +- src/OBJECT/SMESH_ScalarBarActor.cxx | 4 +- src/SMESH/SMESH_MeshEditor.cxx | 12 +-- src/SMESH/SMESH_MesherHelper.cxx | 2 +- src/SMESH/SMESH_Pattern.cxx | 4 +- src/SMESHGUI/SMESHGUI.cxx | 8 +- .../SMESHGUI_AddQuadraticElementDlg.cxx | 10 +-- src/SMESHGUI/SMESHGUI_ClippingDlg.cxx | 8 +- src/SMESHGUI/SMESHGUI_GroupDlg.cxx | 2 +- src/SMESHGUI/SMESHGUI_MeshInfo.cxx | 4 +- src/SMESHGUI/SMESHGUI_SewingDlg.cxx | 2 +- src/SMESHUtils/SMESH_Block.cxx | 5 +- src/SMESHUtils/SMESH_MeshAlgos.cxx | 2 +- src/SMESH_I/SMESH_Gen_i.cxx | 2 +- src/SMESH_I/SMESH_Mesh_i.cxx | 4 +- src/StdMeshers/StdMeshers_Cartesian_3D.cxx | 2 +- src/StdMeshers/StdMeshers_Penta_3D.cxx | 2 +- src/StdMeshers/StdMeshers_Prism_3D.cxx | 2 +- src/StdMeshers/StdMeshers_Quadrangle_2D.cxx | 18 +++-- src/StdMeshers/StdMeshers_Regular_1D.cxx | 2 +- src/StdMeshers/StdMeshers_ViscousLayers.cxx | 75 ++++++++++--------- src/StdMeshers/StdMeshers_ViscousLayers2D.cxx | 4 +- .../StdMeshersGUI_DistrPreview.cxx | 2 +- src/Tools/MeshCut/MeshCut_DC.cxx | 14 ++-- src/Tools/MeshCut/MeshCut_Fonctions.cxx | 2 +- src/Tools/MeshCut/MeshCut_Maillage.cxx | 18 ++--- src/Tools/MeshCut/MeshCut_Utils.cxx | 2 +- 30 files changed, 124 insertions(+), 104 deletions(-) diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx index 4ac7baab5..e4efffe41 100644 --- a/src/Controls/SMESH_Controls.cxx +++ b/src/Controls/SMESH_Controls.cxx @@ -1832,10 +1832,10 @@ void Length2D::GetValues(TValues& theValues) dynamic_cast(anElem); // use special nodes iterator SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator(); - long aNodeId[4]; + long aNodeId[4] = { 0,0,0,0 }; gp_Pnt P[4]; - double aLength; + double aLength = 0; const SMDS_MeshElement* aNode; if(anIter->more()){ aNode = anIter->next(); @@ -1957,7 +1957,7 @@ double MultiConnection2D::GetValue( long theElementId ) SMDS_ElemIteratorPtr anIter = aFaceElem->nodesIterator(); if (!anIter) break; - const SMDS_MeshNode *aNode, *aNode0; + const SMDS_MeshNode *aNode, *aNode0 = 0; TColStd_MapOfInteger aMap, aMapPrev; for (i = 0; i <= len; i++) { @@ -2038,7 +2038,7 @@ void MultiConnection2D::GetValues(MValues& theValues) (anElem)->interlacedNodesElemIterator(); else aNodesIter = anElem->nodesIterator(); - long aNodeId[3]; + long aNodeId[3] = {0,0,0}; //int aNbConnects=0; const SMDS_MeshNode* aNode0; @@ -2511,7 +2511,7 @@ void FreeEdges::GetBoreders(TBorders& theBorders) interlacedNodesElemIterator(); else aNodesIter = anElem->nodesIterator(); - long aNodeId[2]; + long aNodeId[2] = {0,0}; const SMDS_MeshElement* aNode; if(aNodesIter->more()){ aNode = aNodesIter->next(); diff --git a/src/MEDWrapper/Base/MED_Wrapper.cxx b/src/MEDWrapper/Base/MED_Wrapper.cxx index ad1a4fd52..745872228 100644 --- a/src/MEDWrapper/Base/MED_Wrapper.cxx +++ b/src/MEDWrapper/Base/MED_Wrapper.cxx @@ -644,7 +644,7 @@ namespace MED TIntVector aVec; aVec.resize(theMeshInfo->GetDim()); for(int aAxe=0;aAxeGetDim();aAxe++){ - ETable aATable; + ETable aATable = eCOOR_IND1; switch(aAxe){ case 0: aATable = eCOOR_IND1; diff --git a/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx b/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx index 0bbfb2148..934839742 100644 --- a/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx +++ b/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx @@ -2739,7 +2739,7 @@ namespace MED } if(aMaillageType == eSTRUCTURE && aGrilleType != eGRILLE_STANDARD){ - ETable aTable; + ETable aTable = eCOOR_IND1; for(med_int anAxis = 1; anAxis <= aMeshInfo.myDim; anAxis++){ switch(anAxis){ case 1 : diff --git a/src/OBJECT/SMESH_DeviceActor.cxx b/src/OBJECT/SMESH_DeviceActor.cxx index 5dcaf64f8..4520d9327 100644 --- a/src/OBJECT/SMESH_DeviceActor.cxx +++ b/src/OBJECT/SMESH_DeviceActor.cxx @@ -311,7 +311,7 @@ SMESH_DeviceActor vtkIdType aNbCells = aGrid->GetNumberOfCells(); aScalars->SetNumberOfComponents(1); aScalars->SetNumberOfTuples(aNbCells); - double* range;// = aScalars->GetRange(); + double* range = 0;// = aScalars->GetRange(); myVisualObj->UpdateFunctor(theFunctor); diff --git a/src/OBJECT/SMESH_ScalarBarActor.cxx b/src/OBJECT/SMESH_ScalarBarActor.cxx index 7b5eb231e..92a8a94b4 100644 --- a/src/OBJECT/SMESH_ScalarBarActor.cxx +++ b/src/OBJECT/SMESH_ScalarBarActor.cxx @@ -321,8 +321,8 @@ int SMESH_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) // rnv begin // Customization of the vtkScalarBarActor to show distribution histogram. bool distrVisibility = (numColors == (int)this->myNbValues.size()); - vtkPoints *distrPts; - vtkCellArray *distrPolys; + vtkPoints *distrPts = 0; + vtkCellArray *distrPolys = 0; vtkUnsignedCharArray *distColors = 0; int numDistrPts = 0, numPositiveVal=0, maxValue=0; if(!distrVisibility) diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index 82e091890..e4f2bda00 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -1512,7 +1512,7 @@ void SMESH_MeshEditor::QuadTo4Tri (TIDSortedElemSet & theElems) gp_XY uv [9]; uv[8] = gp_XY(0,0); gp_XYZ xyz[9]; vector< const SMDS_MeshNode* > nodes; - SMESHDS_SubMesh* subMeshDS; + SMESHDS_SubMesh* subMeshDS = 0; TopoDS_Face F; Handle(Geom_Surface) surface; TopLoc_Location loc; @@ -3249,7 +3249,7 @@ bool SMESH_MeshEditor::TriToQuad (TIDSortedElemSet & theElems, if ( startElem ) { // Get candidates to be fused const SMDS_MeshElement *tr1 = startElem, *tr2 = 0, *tr3 = 0; - const SMESH_TLink *link12, *link13; + const SMESH_TLink *link12 = 0, *link13 = 0; startElem = 0; ASSERT( mapEl_setLi.find( tr1 ) != mapEl_setLi.end() ); set< SMESH_TLink >& setLi = mapEl_setLi[ tr1 ]; @@ -8203,7 +8203,7 @@ SMESH_MeshEditor::SewFreeBorder (const SMDS_MeshNode* theBordFirstNode, //const SMDS_MeshNode* faceNodes[ 4 ]; const SMDS_MeshNode* sideNode; - const SMDS_MeshElement* sideElem; + const SMDS_MeshElement* sideElem = 0; const SMDS_MeshNode* prevSideNode = theSideFirstNode; const SMDS_MeshNode* prevBordNode = theBordFirstNode; nBordIt = bordNodes.begin(); @@ -8228,7 +8228,7 @@ SMESH_MeshEditor::SewFreeBorder (const SMDS_MeshNode* theBordFirstNode, { const SMDS_MeshElement* elem = invElemIt->next(); // prepare data for a loop on links coming to prevSideNode, of a face or a volume - int iPrevNode, iNode = 0, nbNodes = elem->NbNodes(); + int iPrevNode = 0, iNode = 0, nbNodes = elem->NbNodes(); vector< const SMDS_MeshNode* > faceNodes( nbNodes, (const SMDS_MeshNode*)0 ); bool isVolume = volume.Set( elem ); const SMDS_MeshNode** nodes = isVolume ? volume.GetNodes() : & faceNodes[0]; @@ -8776,7 +8776,7 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement* theElemen } // decide how to split a quadrangle: compare possible variants // and choose which of splits to be a quadrangle - int i1, i2, iSplit, nbSplits = nbLinkNodes - 1, iBestQuad; + int i1, i2, iSplit, nbSplits = nbLinkNodes - 1, iBestQuad = 0; if ( nbFaceNodes == 3 ) { iBestQuad = nbSplits; i4 = i3; @@ -10410,7 +10410,7 @@ void SMESH_MeshEditor::DoubleElements( const TIDSortedElemSet& theElements ) // get an element type and an iterator over elements - SMDSAbs_ElementType type; + SMDSAbs_ElementType type = SMDSAbs_All; SMDS_ElemIteratorPtr elemIt; vector< const SMDS_MeshElement* > allElems; if ( theElements.empty() ) diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 913362e11..35973eb99 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -1613,7 +1613,7 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1, // get type of shape for the new medium node int faceID = -1, edgeID = -1; - TopoDS_Edge E; double u [2]; + TopoDS_Edge E; double u [2] = {0.,0.}; TopoDS_Face F; gp_XY uv[2]; bool uvOK[2] = { true, true }; const bool useCurSubShape = ( !myShape.IsNull() && myShape.ShapeType() == TopAbs_EDGE ); diff --git a/src/SMESH/SMESH_Pattern.cxx b/src/SMESH/SMESH_Pattern.cxx index 0a50cd9dd..f38622a34 100644 --- a/src/SMESH/SMESH_Pattern.cxx +++ b/src/SMESH/SMESH_Pattern.cxx @@ -499,7 +499,7 @@ static gp_XY project (const SMDS_MeshNode* theNode, MESSAGE( "SMESH_Pattern: point projection FAILED"); return gp_XY(0.,0.); } - double u, v, minVal = DBL_MAX; + double u =0, v =0, minVal = DBL_MAX; for ( int i = theProjectorPS.NbExt(); i > 0; i-- ) if ( theProjectorPS.SquareDistance( i ) < minVal ) { minVal = theProjectorPS.SquareDistance( i ); @@ -2339,7 +2339,7 @@ bool SMESH_Pattern::sortSameSizeWires (TListOfEdgesList & theWire // " \t vertex: " << vGcVec[iW].X() << " " << vGcVec[iW].Y() << endl; double minDist = DBL_MAX; gp_XY & wGc = vGcVec[ iW ]; - int bIndex; + int bIndex = 0; for ( int iB = 0; iB < nbWires; iB++ ) { if ( bndFound[ iB ] ) continue; double dist = ( wGc - gcVec[ iB ] ).SquareModulus(); diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index fc3c33c04..d696c0ba2 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -608,7 +608,7 @@ namespace // Get parameters of export operation QString aFilename; - SMESH::MED_VERSION aFormat; + SMESH::MED_VERSION aFormat = SMESH::MED_V2_2; // Init the parameters with the default values bool aIsASCII_STL = true; bool toCreateGroups = false; @@ -6047,6 +6047,12 @@ void SMESHGUI::restoreVisualParameters (int savePoint) continue; TPlaneData aPlaneData; + aPlaneData.AbsoluteOrientation = false; + aPlaneData.RelativeOrientation = 0; + aPlaneData.Distance = aPlaneData.Angle[0] = aPlaneData.Angle[1] = 0; + aPlaneData.X = aPlaneData.Y = aPlaneData.Z = 0; + aPlaneData.Dx = aPlaneData.Dy = aPlaneData.Dz = 0; + aPlaneData.Id = aClippingPlaneId; ok = false; diff --git a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx index 97075dd5f..c24dbc4b3 100644 --- a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx @@ -537,7 +537,7 @@ void SMESHGUI_AddQuadraticElementDlg::Init() myNbMidFaceNodes = 0; myNbCenterNodes = 0; - int aNumRows; + int aNumRows = 0; switch (myGeomType) { case SMDSEntity_Quad_Edge: @@ -768,7 +768,7 @@ bool SMESHGUI_AddQuadraticElementDlg::ClickOnApply() } } - SMESH::ElementType anElementType; + SMESH::ElementType anElementType = SMESH::ALL; long anElemId = -1, nbElemsBefore = 0; SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); switch (myGeomType) { @@ -1055,7 +1055,7 @@ void SMESHGUI_AddQuadraticElementDlg::SelectionIntoArgument() // process groups if ( !myMesh->_is_nil() && myEntry != aCurrentEntry ) { - SMESH::ElementType anElementType; + SMESH::ElementType anElementType = SMESH::ALL; switch ( myGeomType ) { case SMDSEntity_Quad_Edge: anElementType = SMESH::EDGE; break; @@ -1371,8 +1371,8 @@ void SMESHGUI_AddQuadraticElementDlg::UpdateTable( bool theConersValidity ) for ( int row = 0; row < myTable->rowCount(); row++ ) myTable->item( row, 1 )->setText(""); - int* aFirstColIds; - int* aLastColIds; + int* aFirstColIds = 0; + int* aLastColIds = 0; switch (myGeomType) { case SMDSEntity_Quad_Edge: diff --git a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx index 371a0582a..e1047b874 100644 --- a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx @@ -766,7 +766,7 @@ bool SMESHGUI_ClippingDlg::AddPlane ( SMESH::TActorList theActorList, double aDir[2][3] = {{0, 0, 0}, {0, 0, 0}}; static double aCoeff = vtkMath::Pi()/180.0; - int anOrientation; + int anOrientation = 0; if ( thePlane->PlaneMode == SMESH::Absolute ) anOrientation = thePlane->myAbsoluteOrientation; else if ( thePlane->PlaneMode == SMESH::Relative ) @@ -1436,7 +1436,7 @@ void SMESHGUI_ClippingDlg::SetCurrentPlaneParam() static double aCoeff = vtkMath::Pi()/180.0; double aRot[2] = { getRotation1(), getRotation2() }; - int anOrient; + int anOrient = 0; if ( aPlane->PlaneMode == SMESH::Absolute ) anOrient = CBAbsoluteOrientation->currentIndex(); else if ( aPlane->PlaneMode == SMESH::Relative ) @@ -1623,8 +1623,8 @@ void SMESHGUI_ClippingDlg::absolutePlaneToRelative ( double theOrigin[3], double double eps = 0.0001; int anOrientation = CBRelativeOrientation->currentIndex(); - double aDirection[3]; - double aRotation1, aRotation2; + double aDirection[3] = { 0.,0.,0. }; + double aRotation1 = 0, aRotation2 = 0; switch( anOrientation ) { case 0: aDirection[0] = theDir[0] + eps; diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx index d954febb2..ea5c5fe03 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx @@ -936,7 +936,7 @@ bool SMESHGUI_GroupDlg::onApply() QStringList anEntryList; SMESH::SMESH_GroupBase_var resultGroup; - bool isCreation, isConversion = false; + bool isCreation = false, isConversion = false; SUIT_OverrideCursor wc; diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx index 1a55c37c1..27b0c85d1 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx @@ -1227,7 +1227,7 @@ void SMESHGUI_SimpleElemInfo::information( const QList& ids ) int shapeID = pos->shapeID; if ( shapeID > 0 ) { QString shapeType; - double u, v; + double u = 0, v = 0; switch ( pos->shapeType ) { case GEOM::EDGE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); @@ -1747,7 +1747,7 @@ void SMESHGUI_TreeElemInfo::information( const QList& ids ) int shapeID = pos->shapeID; if ( shapeID > 0 ) { QString shapeType; - double u, v; + double u = 0, v = 0; switch ( pos->shapeType ) { case GEOM::EDGE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); diff --git a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx index 458e93066..22253c4d6 100644 --- a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx @@ -1308,7 +1308,7 @@ bool SMESHGUI_SewingDlg::ClickOnApply() SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); int aConstructorId = GetConstructorId(); - SMESH::SMESH_MeshEditor::Sew_Error anError; + SMESH::SMESH_MeshEditor::Sew_Error anError = SMESH::SMESH_MeshEditor::SEW_OK; if (aConstructorId == 0) { diff --git a/src/SMESHUtils/SMESH_Block.cxx b/src/SMESHUtils/SMESH_Block.cxx index 986d55aea..90bd9bce6 100644 --- a/src/SMESHUtils/SMESH_Block.cxx +++ b/src/SMESHUtils/SMESH_Block.cxx @@ -930,6 +930,7 @@ void SMESH_Block::refineParametersOnFace( const gp_Pnt& thePoint, { // find UV of thePoint on the FACE Standard_Real U,V; + U=V=0; const TFace& tface = myFace[ theFaceID - ID_FirstF ]; if ( !tface.Surface() ) return; @@ -1778,7 +1779,7 @@ bool SMESH_Block::FindBlockShapes(const TopoDS_Shell& theShell, if ( V000.IsNull() ) { // find vertex 000 - the one with smallest coordinates - double minVal = DBL_MAX, minX, val; + double minVal = DBL_MAX, minX = DBL_MAX, val; for ( int i = 1; i <= 8; i++ ) { const TopoDS_Vertex& v = TopoDS::Vertex( vfMap.FindKey( i )); gp_Pnt P = BRep_Tool::Pnt( v ); @@ -1822,7 +1823,7 @@ bool SMESH_Block::FindBlockShapes(const TopoDS_Shell& theShell, return false; } TopTools_ListIteratorOfListOfShape f001It, f000It ( f000List ); - int i, j, iFound1, iFound2; + int i, j, iFound1=0, iFound2=0; for ( j = 0; f000It.More(); f000It.Next(), j++ ) { if ( NB_FACES_BY_VERTEX == 6 && j % 2 ) continue; // each face encounters twice diff --git a/src/SMESHUtils/SMESH_MeshAlgos.cxx b/src/SMESHUtils/SMESH_MeshAlgos.cxx index dfdaf42d9..a9ad04af5 100644 --- a/src/SMESHUtils/SMESH_MeshAlgos.cxx +++ b/src/SMESHUtils/SMESH_MeshAlgos.cxx @@ -1194,7 +1194,7 @@ bool SMESH_MeshAlgos::IsOut( const SMDS_MeshElement* element, const gp_Pnt& poin dist.back() = dist.front(); // find the closest intersection int iClosest = -1; - double rClosest, distClosest = 1e100;; + double rClosest = 0, distClosest = 1e100;; gp_Pnt pClosest; for ( i = 0; i < nbNodes; ++i ) { diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 32c05839a..a279a4ada 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -4485,7 +4485,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent, // --> try to find SUB-MESHES containers for each type of submesh for ( int j = GetSubMeshOnVertexTag(); j <= GetSubMeshOnCompoundTag(); j++ ) { - const char* name_meshgroup; + const char* name_meshgroup = 0; if ( j == GetSubMeshOnVertexTag() ) name_meshgroup = "SubMeshes On Vertex"; else if ( j == GetSubMeshOnEdgeTag() ) diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index 625537a1c..05043f6f2 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -4076,7 +4076,7 @@ SMESH::long_array* SMESH_Mesh_i::GetNodesId() SMESH::ElementType SMESH_Mesh_i::GetElementType( const CORBA::Long id, const bool iselem ) throw (SALOME::SALOME_Exception) { - SMESH::ElementType type; + SMESH::ElementType type = SMESH::ALL; SMESH_TRY; if ( _preMeshInfo ) @@ -4224,7 +4224,7 @@ SMESH::long_array* SMESH_Mesh_i::GetSubMeshNodesId(const CORBA::Long ShapeID, SMESH::ElementType SMESH_Mesh_i::GetSubMeshElementType(const CORBA::Long ShapeID) throw (SALOME::SALOME_Exception) { - SMESH::ElementType type; + SMESH::ElementType type = SMESH::ALL; SMESH_TRY; if ( _preMeshInfo ) diff --git a/src/StdMeshers/StdMeshers_Cartesian_3D.cxx b/src/StdMeshers/StdMeshers_Cartesian_3D.cxx index 749236780..adbeb5021 100644 --- a/src/StdMeshers/StdMeshers_Cartesian_3D.cxx +++ b/src/StdMeshers/StdMeshers_Cartesian_3D.cxx @@ -3050,7 +3050,7 @@ namespace _Node* orderNodes [20]; TGeomID orderShapeIDs[20]; size_t nbN = 0; - TGeomID id, *pID; + TGeomID id, *pID = 0; for ( e = edges.begin(); e != edges.end(); ++e ) { if (( id = _grid->_shapes.FindIndex( SMESH_MesherHelper::IthVertex( 0, *e ))) && diff --git a/src/StdMeshers/StdMeshers_Penta_3D.cxx b/src/StdMeshers/StdMeshers_Penta_3D.cxx index 69485a746..8a852edb9 100644 --- a/src/StdMeshers/StdMeshers_Penta_3D.cxx +++ b/src/StdMeshers/StdMeshers_Penta_3D.cxx @@ -1367,7 +1367,7 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes, // find the other edges of theFace and orientation of e1 TopoDS_Edge e1, e2, eTop; - bool rev1, CumOri = false; + bool rev1 = false, CumOri = false; TopExp_Explorer exp( theFace, TopAbs_EDGE ); int nbEdges = 0; for ( ; exp.More(); exp.Next() ) { diff --git a/src/StdMeshers/StdMeshers_Prism_3D.cxx b/src/StdMeshers/StdMeshers_Prism_3D.cxx index d60f1397e..d0c4410e7 100644 --- a/src/StdMeshers/StdMeshers_Prism_3D.cxx +++ b/src/StdMeshers/StdMeshers_Prism_3D.cxx @@ -3155,7 +3155,7 @@ bool StdMeshers_Prism_3D::initPrism(Prism_3D::TPrismTopo& thePrism, // find vertex 000 - the one with smallest coordinates (for easy DEBUG :-) TopoDS_Vertex V000; - double minVal = DBL_MAX, minX, val; + double minVal = DBL_MAX, minX = 0, val; for ( TopExp_Explorer exp( botSM->GetSubShape(), TopAbs_VERTEX ); exp.More(); exp.Next() ) { diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx index 989a2d501..955fc1147 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx @@ -519,7 +519,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, // for each node of the down edge find nearest node // in the first row of the regular grid and link them for (i = 0; i < stop; i++) { - const SMDS_MeshNode *a, *b, *c, *d; + const SMDS_MeshNode *a, *b, *c=0, *d; a = uv_e0[i].node; b = uv_e0[i + 1].node; gp_Pnt pb (b->X(), b->Y(), b->Z()); @@ -533,6 +533,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, } else { // find in the grid node c, nearest to the b + c = 0; double mind = RealLast(); for (int k = g; k <= iup; k++) { @@ -734,6 +735,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh, gp_Pnt pb (b->X(), b->Y(), b->Z()); // find node c in the grid, nearest to the b + c = 0; int near = g; if (i == stop - 1) { // up bondary reached c = quad->uv_grid[nbhoriz*(jup + 1) - 2].node; @@ -2138,7 +2140,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh, npl.Append(uv_el[i].normParam); } - int dl,dr; + int dl = 0, dr = 0; if (OldVersion) { // add some params to right and left after the first param // insert to right @@ -2380,7 +2382,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh, TColgp_SequenceOfXY UVtmp; double drparam = npr.Value(nr) - npr.Value(nnn-1); double dlparam = npl.Value(nnn) - npl.Value(nnn-1); - double y0,y1; + double y0 = 0, y1 = 0; for (i=1; i<=drl; i++) { // add existed nodes from right edge NodesC.SetValue(nb,i+1,uv_er[nnn+i-2].node); @@ -3296,7 +3298,11 @@ bool StdMeshers_Quadrangle_2D::computeReduced (SMESH_Mesh & aMesh, vector curr_base = uv_eb, next_base; - UVPtStruct nullUVPtStruct; nullUVPtStruct.node = 0; + UVPtStruct nullUVPtStruct; + nullUVPtStruct.node = 0; + nullUVPtStruct.x = nullUVPtStruct.y = nullUVPtStruct.u = nullUVPtStruct.y = 0; + nullUVPtStruct.param = 0; + int curr_base_len = nb; int next_base_len = 0; @@ -4108,7 +4114,7 @@ bool StdMeshers_Quadrangle_2D::check() StdMeshers_FaceSidePtr wire = wireVec[0]; // find a right angle VERTEX - int iVertex; + int iVertex = 0; double maxAngle = -1e100; for ( int i = 0; i < wire->NbEdges(); ++i ) { @@ -5145,6 +5151,8 @@ void StdMeshers_Quadrangle_2D::updateSideUV( FaceQuadStruct::Side& side, for ( iS = 0; iS < q->side.size(); ++iS ) if ( side.grid == q->side[ iS ].grid ) break; + if ( iS == q->side.size() ) + continue; bool isOut; if ( !q->side[ iS ].IsReversed() ) isOut = ( q->side[ iS ].from > iCur || q->side[ iS ].to-1 <= iCur ); diff --git a/src/StdMeshers/StdMeshers_Regular_1D.cxx b/src/StdMeshers/StdMeshers_Regular_1D.cxx index 7118e0a21..7025642b3 100644 --- a/src/StdMeshers/StdMeshers_Regular_1D.cxx +++ b/src/StdMeshers/StdMeshers_Regular_1D.cxx @@ -931,7 +931,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, case GEOMETRIC_1D: { - double a1 = _value[ BEG_LENGTH_IND ], an; + double a1 = _value[ BEG_LENGTH_IND ], an = 0; double q = _value[ END_LENGTH_IND ]; double U1 = theReverse ? l : f; diff --git a/src/StdMeshers/StdMeshers_ViscousLayers.cxx b/src/StdMeshers/StdMeshers_ViscousLayers.cxx index acb0a5640..1b4e6ab04 100644 --- a/src/StdMeshers/StdMeshers_ViscousLayers.cxx +++ b/src/StdMeshers/StdMeshers_ViscousLayers.cxx @@ -94,7 +94,7 @@ #include #ifdef _DEBUG_ -//#define __myDEBUG +#define __myDEBUG //#define __NOT_INVALIDATE_BAD_SMOOTH #endif @@ -2890,7 +2890,7 @@ bool _ViscousBuilder::findShapesToSmooth( _SolidData& data ) { TGeomID iV = getMeshDS()->ShapeToIndex( vIt.Value() ); vector<_LayerEdge*>& eV = edgesByGeom[ iV ]._edges; - if ( eV.empty() ) continue; + if ( eV.empty() || eV[0]->Is( _LayerEdge::MULTI_NORMAL )) continue; gp_Vec eDir = getEdgeDir( E, TopoDS::Vertex( vIt.Value() )); double angle = eDir.Angle( eV[0]->_normal ); double cosin = Cos( angle ); @@ -4727,39 +4727,42 @@ bool _ViscousBuilder::smoothAndCheck(_SolidData& data, continue; if ( eos._edges[i]->FindIntersection( *searcher, dist, data._epsilon, eos, &intFace )) { + return false; + // commented due to "Illegal hash-positionPosition" error in NETGEN + // on Debian60 on viscous_layers_01/B2 case // Collision; try to deflate _LayerEdge's causing it - badEdges.clear(); - badEdges.push_back( eos._edges[i] ); - eosC1[0] = & eos; - int nbBad = invalidateBadSmooth( data, helper, badEdges, eosC1, infStep ); - if ( nbBad > 0 ) - return false; + // badEdges.clear(); + // badEdges.push_back( eos._edges[i] ); + // eosC1[0] = & eos; + // int nbBad = invalidateBadSmooth( data, helper, badEdges, eosC1, infStep ); + // if ( nbBad > 0 ) + // return false; - badEdges.clear(); - if ( _EdgesOnShape* eof = data.GetShapeEdges( intFace->getshapeId() )) - { - if ( const _TmpMeshFace* f = dynamic_cast< const _TmpMeshFace*>( intFace )) - { - const SMDS_MeshElement* srcFace = - eof->_subMesh->GetSubMeshDS()->GetElement( f->getIdInShape() ); - SMDS_ElemIteratorPtr nIt = srcFace->nodesIterator(); - while ( nIt->more() ) - { - const SMDS_MeshNode* srcNode = static_cast( nIt->next() ); - TNode2Edge::iterator n2e = data._n2eMap.find( srcNode ); - if ( n2e != data._n2eMap.end() ) - badEdges.push_back( n2e->second ); - } - eosC1[0] = eof; - nbBad = invalidateBadSmooth( data, helper, badEdges, eosC1, infStep ); - if ( nbBad > 0 ) - return false; - } - } - if ( eos._edges[i]->FindIntersection( *searcher, dist, data._epsilon, eos, &intFace )) - return false; - else - continue; + // badEdges.clear(); + // if ( _EdgesOnShape* eof = data.GetShapeEdges( intFace->getshapeId() )) + // { + // if ( const _TmpMeshFace* f = dynamic_cast< const _TmpMeshFace*>( intFace )) + // { + // const SMDS_MeshElement* srcFace = + // eof->_subMesh->GetSubMeshDS()->GetElement( f->getIdInShape() ); + // SMDS_ElemIteratorPtr nIt = srcFace->nodesIterator(); + // while ( nIt->more() ) + // { + // const SMDS_MeshNode* srcNode = static_cast( nIt->next() ); + // TNode2Edge::iterator n2e = data._n2eMap.find( srcNode ); + // if ( n2e != data._n2eMap.end() ) + // badEdges.push_back( n2e->second ); + // } + // eosC1[0] = eof; + // nbBad = invalidateBadSmooth( data, helper, badEdges, eosC1, infStep ); + // if ( nbBad > 0 ) + // return false; + // } + // } + // if ( eos._edges[i]->FindIntersection( *searcher, dist, data._epsilon, eos, &intFace )) + // return false; + // else + // continue; } if ( !intFace ) { @@ -5387,7 +5390,7 @@ bool _Smoother1D::smoothComplexEdge( _SolidData& data, _offPoints[i]._len = avgLen; } - double fTol; + double fTol = 0; if ( !surface.IsNull() ) // project _offPoints to the FACE { fTol = 100 * BRep_Tool::Tolerance( F ); @@ -5414,7 +5417,7 @@ bool _Smoother1D::smoothComplexEdge( _SolidData& data, int i = _iSeg[ is2nd ]; int di = is2nd ? -1 : +1; bool projected = false; - double uOnSeg, uOnSegDiff, uOnSegBestDiff = Precision::Infinite(), uOnSegPrevDiff; + double uOnSeg, uOnSegDiff, uOnSegBestDiff = Precision::Infinite(), uOnSegPrevDiff = 0; int nbWorse = 0; do { gp_Vec v0p( _offPoints[i]._xyz, pExtreme[ is2nd ] ); @@ -8844,7 +8847,7 @@ bool _ViscousBuilder::refine(_SolidData& data) TopoDS_Edge geomEdge; TopoDS_Face geomFace; TopLoc_Location loc; - double f,l, u; + double f,l, u = 0; gp_XY uv; vector< gp_XYZ > pos3D; bool isOnEdge; diff --git a/src/StdMeshers/StdMeshers_ViscousLayers2D.cxx b/src/StdMeshers/StdMeshers_ViscousLayers2D.cxx index 111ea47cb..4e78b7157 100644 --- a/src/StdMeshers/StdMeshers_ViscousLayers2D.cxx +++ b/src/StdMeshers/StdMeshers_ViscousLayers2D.cxx @@ -300,6 +300,8 @@ namespace VISCOUS_2D double _D; // _vec1.Crossed( _vec2 ) double _param1, _param2; // intersection param on _seg1 and _seg2 + _SegmentIntersection(): _param1(0), _param2(0), _D(0) {} + bool Compute(const _Segment& seg1, const _Segment& seg2, bool seg2IsRay = false ) { // !!! If seg2IsRay, returns true at any _param2 !!! @@ -1819,7 +1821,7 @@ bool _ViscousBuilder2D::shrink() // x-x-x-x-----x-----x---- // | | | | e1 e2 e3 - int isRShrinkedForAdjacent; + int isRShrinkedForAdjacent = 0; UVPtStructVec nodeDataForAdjacent; for ( int isR = 0; isR < 2; ++isR ) { diff --git a/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx b/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx index 8b1aa911b..e6aaa2889 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx @@ -293,7 +293,7 @@ void StdMeshersGUI_DistrPreview::update() int size = graph.length()/2; double* x = new double[size], *y = new double[size]; - double min_x, max_x, min_y, max_y; + double min_x = 0, max_x = 0, min_y = 0, max_y = 0; for( int i=0; i