From: vsr Date: Tue, 27 Oct 2020 15:37:59 +0000 (+0300) Subject: fight warnings c++17, additional corrections X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fvuzlov%2Fsuppress_warnings;p=plugins%2Fhybridplugin.git fight warnings c++17, additional corrections --- diff --git a/src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx b/src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx index 0e99ccf..714f732 100644 --- a/src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx @@ -988,7 +988,7 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, do { myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *))); bool okToCreate = true; - double itemX,itemY,itemZ,itemSize = 0; + double itemX=0.,itemY=0.,itemZ=0.,itemSize = 0; // todo: itemX, itemY, itemZ must be explicitly initialized to avoid warning (see below) QString itemEntry, itemGroupName = QString(""); // bool itemIsCompound; int rowCount = myEnforcedTableWidget->rowCount(); @@ -1036,7 +1036,7 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, do break; - if (( !isCompound && ((itemX == x) && (itemY == y) && (itemZ == z))) || /*( (itemEntry.toStdString() != "") && */ (itemEntry.toStdString() == geomEntry)/*)*/) { + if (( !isCompound && ((itemX == x) && (itemY == y) && (itemZ == z))) || /*( (itemEntry.toStdString() != "") && */ (itemEntry.toStdString() == geomEntry)/*)*/) { // todo: itemX, itemY, itemZ must be explicitly initialized to avoid warning (see above) // update size if (itemSize != size) { myEnforcedTableWidget->item(row, ENF_VER_SIZE_COLUMN)->setData( Qt::EditRole, QVariant(size)); @@ -1782,7 +1782,7 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi _PTR(SObject) aSObj = aStudy->FindObjectID(enfMesh->entry.c_str()); SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface( aSObj ); - SMESH::ElementType elementType; + SMESH::ElementType elementType = SMESH::NODE; // todo: elementType must be explicitly initialized to avoid warning (see below) switch(enfMesh->elementType) { case 0: elementType = SMESH::NODE; @@ -1797,7 +1797,7 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi break; } - ok = h->p_SetEnforcedMesh(theSource, elementType, enfMesh->name.c_str(), enfMesh->groupName.c_str()); + ok = h->p_SetEnforcedMesh(theSource, elementType, enfMesh->name.c_str(), enfMesh->groupName.c_str()); // todo: elementType must be explicitly initialized to avoid warning (see above) } // for } // try // catch(const std::exception& ex) { diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx index d3fe429..af748c7 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx @@ -335,7 +335,7 @@ static bool readGMFFile(MG_HYBRID_API* MGOutput, std::vector & aFaceGroupByHybridId, std::set & groupsToRemove, bool toMakeGroupsOfDomains=false, - bool toMeshHoles=true) + bool /*toMeshHoles*/=true) { std::string tmpStr; SMESHDS_Mesh* theMeshDS = theHelper->GetMeshDS(); @@ -378,15 +378,15 @@ static bool readGMFFile(MG_HYBRID_API* MGOutput, theFaceByHybridId.clear(); } - int nbMeshNodes = theMeshDS->NbNodes(); int nbInitialNodes = theNodeByHybridId.size(); +#ifdef _DEBUG_ + int nbMeshNodes = theMeshDS->NbNodes(); const bool isQuadMesh = theHelper->GetMesh()->NbEdges( ORDER_QUADRATIC ) || theHelper->GetMesh()->NbFaces( ORDER_QUADRATIC ) || theHelper->GetMesh()->NbVolumes( ORDER_QUADRATIC ); -#ifdef _DEBUG_ std::cout << "theNodeByHybridId.size(): " << nbInitialNodes << std::endl; std::cout << "theHelper->GetMesh()->NbNodes(): " << nbMeshNodes << std::endl; std::cout << "isQuadMesh: " << isQuadMesh << std::endl; diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx index 22de54e..7980520 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx @@ -279,7 +279,7 @@ void HYBRIDPlugin_Hypothesis::SetToMeshHoles(bool toMesh) //function : GetToMeshHoles //======================================================================= -bool HYBRIDPlugin_Hypothesis::GetToMeshHoles(bool checkFreeOption) const +bool HYBRIDPlugin_Hypothesis::GetToMeshHoles(bool /*checkFreeOption*/) const { return myToMeshHoles; } @@ -2279,7 +2279,7 @@ bool HYBRIDPlugin_Hypothesis::HasOptionDefined( const std::string& optionName ) { GetOptionValue( optionName, &isDefault ); } - catch ( std::invalid_argument ) + catch ( std::invalid_argument& ) { return false; } diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx index 3274d1a..6100657 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx @@ -591,7 +591,7 @@ void HYBRIDPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const cha try { valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue ); } - catch ( std::invalid_argument ) { + catch ( std::invalid_argument& ) { } if ( valueChanged ) { diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.hxx b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.hxx index 370d173..93af230 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.hxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.hxx @@ -159,14 +159,14 @@ class HYBRIDPLUGIN_EXPORT HYBRIDPlugin_Hypothesis_i: void SetToRemoveCentralPoint(CORBA::Boolean toRemove); CORBA::Boolean GetToRemoveCentralPoint(); - void SetOptionValue(const char* optionName, const char* optionValue) ; - char* GetOptionValue(const char* optionName) ; + void SetOptionValue(const char* optionName, const char* optionValue); + char* GetOptionValue(const char* optionName); void UnsetOption(const char* optionName); HYBRIDPlugin::string_array* GetOptionValues(); HYBRIDPlugin::string_array* GetAdvancedOptionValues(); - void SetOptionValues(const HYBRIDPlugin::string_array& options) ; + void SetOptionValues(const HYBRIDPlugin::string_array& options); void SetAdvancedOptionValues(const HYBRIDPlugin::string_array& options); void AddOption(const char* optionName, const char* optionValue); @@ -174,7 +174,7 @@ class HYBRIDPLUGIN_EXPORT HYBRIDPlugin_Hypothesis_i: /*! * To set hiden/undocumented/advanced options */ - void SetAdvancedOption(const char* theOptAndVals ) ; + void SetAdvancedOption(const char* theOptAndVals ); char* GetAdvancedOption(); void SetTextOption(const char* option); char* GetTextOption(); @@ -226,30 +226,29 @@ class HYBRIDPLUGIN_EXPORT HYBRIDPlugin_Hypothesis_i: */ bool p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x = 0, CORBA::Double y = 0, CORBA::Double z = 0, const char* theVertexName = "", const char* theVertexEntry = "", const char* theGroupName = "", - CORBA::Boolean isCompound = false) - ; - bool SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size) ; - bool SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName) ; - bool SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName) ; - bool SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName) ; - bool SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size) ; - bool SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName) ; - CORBA::Double GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) ; - CORBA::Double GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex) ; - bool RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) ; - bool RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex) ; + CORBA::Boolean isCompound = false); + bool SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size); + bool SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName); + bool SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName); + bool SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName); + bool SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size); + bool SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName); + CORBA::Double GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z); + CORBA::Double GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex); + bool RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z); + bool RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex); HYBRIDPlugin::HYBRIDEnforcedVertexList* GetEnforcedVertices(); void ClearEnforcedVertices(); /*! * To set an enforced mesh */ - bool p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, const char* theName="", const char* theGroupName="") ; - bool SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType) ; - bool SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, const char* theGroupName) ; + bool p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, const char* theName="", const char* theGroupName=""); + bool SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType); + bool SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, const char* theGroupName); /* OBSOLETE FUNCTIONS */ - bool SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, double /*size*/) ; - bool SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, double /*size*/, const char* theGroupName) ; + bool SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, double size); + bool SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, double size, const char* theGroupName); /* OBSOLETE FUNCTIONS */ HYBRIDPlugin::HYBRIDEnforcedMeshList* GetEnforcedMeshes(); diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_i.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_i.cxx index c083361..628162b 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_i.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_i.cxx @@ -58,7 +58,6 @@ extern "C" // Hypothesis else if (strcmp(aHypName, "HYBRID_Parameters") == 0) aCreator = new HYBRIDPlugin_Creator_i; - /*else ;*/ return aCreator; } diff --git a/src/HYBRIDPlugin/MG_HYBRID_API.cxx b/src/HYBRIDPlugin/MG_HYBRID_API.cxx index c5d360b..fb5856a 100644 --- a/src/HYBRIDPlugin/MG_HYBRID_API.cxx +++ b/src/HYBRIDPlugin/MG_HYBRID_API.cxx @@ -340,7 +340,7 @@ struct MG_HYBRID_API::LibData } void ReadPrismNodes( int* node1, int* node2, int* node3, int* node4, - int* node5, int* node6, int* domain ) + int* node5, int* node6, int* /*domain*/ ) { integer vtx[6]; status_t ret = mesh_get_prism_vertices( _hybrid_mesh, _count, vtx); @@ -362,6 +362,27 @@ struct MG_HYBRID_API::LibData ++_count; } + void ReadPyramidNodes( int* node1, int* node2, int* node3, int* node4, int* node5, int* domain ) + { + integer vtx[6]; + status_t ret = mesh_get_pyramid_vertices( _hybrid_mesh, _count, vtx); + if (ret != STATUS_OK) MG_Error( "unable to get resulting pyramid" ); + + *node1 = vtx[0]; + *node2 = vtx[1]; + *node3 = vtx[2]; + *node4 = vtx[3]; + *node5 = vtx[4]; + + integer tag; + ret = mesh_get_pyramid_tag( _hybrid_mesh, _count, &tag ); + if (ret != STATUS_OK) MG_Error( "unable to get resulting pyramid tag" ); + + *domain = tag; + + ++_count; + } + void ReadCorner( int* node ) { if ( _count <= ReadNbCorners() ) @@ -407,7 +428,7 @@ struct MG_HYBRID_API::LibData _nbRequiredTria = nb; } - void AddNode( double x, double y, double z, int domain ) + void AddNode( double x, double y, double z, int /*domain*/ ) { _xyz.push_back( x ); _xyz.push_back( y ); @@ -709,6 +730,14 @@ bool MG_HYBRID_API::LibData::Compute() return true; } +#else // ifdef USE_MG_LIBS + +struct MG_HYBRID_API::LibData // to avoid compiler warnings +{ + volatile bool& _cancelled_flag; + double& _progress; + LibData(volatile bool& cancelled_flag, double& progress): _cancelled_flag{cancelled_flag}, _progress{progress} {} +}; #endif // ifdef USE_MG_LIBS @@ -722,9 +751,9 @@ bool MG_HYBRID_API::LibData::Compute() MG_HYBRID_API::MG_HYBRID_API(volatile bool& cancelled_flag, double& progress) { _useLib = false; + _libData = new LibData( cancelled_flag, progress ); #ifdef USE_MG_LIBS _useLib = true; - _libData = new LibData( cancelled_flag, progress ); _libData->Init(); if ( getenv("MG_HYBRID_USE_EXE")) _useLib = false; diff --git a/src/HYBRIDPlugin/MG_HYBRID_API.hxx b/src/HYBRIDPlugin/MG_HYBRID_API.hxx index 2d9b132..8ae635f 100644 --- a/src/HYBRIDPlugin/MG_HYBRID_API.hxx +++ b/src/HYBRIDPlugin/MG_HYBRID_API.hxx @@ -59,7 +59,7 @@ public: int GmfOpenMesh(const char* theFile, int rdOrWr, int * ver, int * dim); int GmfStatKwd( int iMesh, GmfKwdCod what ); void GmfGotoKwd( int iMesh, GmfKwdCod what ); - void GmfGetLin( int iMesh, GmfKwdCod what, int* nbNodes, int* faceInd, int* ori, int* domain, int /*dummy*/ ); + void GmfGetLin( int iMesh, GmfKwdCod what, int* nbNodes, int* faceInd, int* ori, int* domain, int dummy ); void GmfGetLin(int iMesh, GmfKwdCod what, float* x, float* y, float *z, int* domain ); void GmfGetLin(int iMesh, GmfKwdCod what, double* x, double* y, double *z, int* domain ); void GmfGetLin(int iMesh, GmfKwdCod what, int* node );