From: bph Date: Fri, 9 Dec 2011 15:30:37 +0000 (+0000) Subject: fixed : set MESSAGE() in DEBUG mode only X-Git-Tag: V6_5_0a1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=88d66ef7ddf05657ecc55284b43af0c62413e9f0;p=plugins%2Fhexablockplugin.git fixed : set MESSAGE() in DEBUG mode only --- diff --git a/src/GUI/HEXABLOCKPluginGUI_HypothesisCreator.cxx b/src/GUI/HEXABLOCKPluginGUI_HypothesisCreator.cxx index 968246a..7c234d9 100755 --- a/src/GUI/HEXABLOCKPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/HEXABLOCKPluginGUI_HypothesisCreator.cxx @@ -56,6 +56,13 @@ #include #include +#ifdef _DEBUG_ +static int MYDEBUG = 1; +#else +static int MYDEBUG = 0; +#endif + + // tabs enum { STD_TAB = 0, @@ -159,7 +166,7 @@ void DoubleLineEditDelegate::setModelData(QWidget *editor, QAbstractItemModel *m if (ok) { model->setData(index, value, Qt::EditRole); - MESSAGE("Value " << value << " was set at index(" << index.row() << "," << index.column() << ")"); + if(MYDEBUG) MESSAGE("Value " << value << " was set at index(" << index.row() << "," << index.column() << ")"); } } @@ -373,9 +380,11 @@ bool HEXABLOCKPluginGUI_HypothesisCreator::smpVertexExists(double x, double y, d // MESSAGE("Found y value " << y << " at row " << i); double myZ = mySmpModel->data(mySmpModel->index(i, ENF_VER_Z_COLUMN)).toDouble(); if (myZ == z) { - MESSAGE("Found x value " << x << " at row " << i); - MESSAGE("Found y value " << y << " at row " << i); - MESSAGE("Found z value " << z << " at row " << i); + if (MYDEBUG){ + MESSAGE("Found x value " << x << " at row " << i); + MESSAGE("Found y value " << y << " at row " << i); + MESSAGE("Found z value " << z << " at row " << i); + } return true; } } @@ -398,7 +407,7 @@ bool HEXABLOCKPluginGUI_HypothesisCreator::checkVertexIsDefined() void HEXABLOCKPluginGUI_HypothesisCreator::onVertexBtnClicked() { - MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::onVertexBtnClicked()"); + if (MYDEBUG) MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::onVertexBtnClicked()"); const int row = mySmpModel->rowCount() ; double x = myXCoord->text().toDouble(); double y = myYCoord->text().toDouble(); @@ -445,7 +454,7 @@ void HEXABLOCKPluginGUI_HypothesisCreator::onRemoveVertexBtnClicked() it.toBack(); while ( it.hasPrevious() ) { row = it.previous(); - MESSAGE("delete row #"<< row); + if (MYDEBUG) MESSAGE("delete row #"<< row); mySmpModel->removeRow(row ); } myEnforcedTableView->clearSelection(); @@ -467,7 +476,7 @@ void HEXABLOCKPluginGUI_HypothesisCreator::updateWidgets() bool HEXABLOCKPluginGUI_HypothesisCreator::checkParams(QString& msg) const { - MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::checkParams"); + if (MYDEBUG) MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::checkParams"); if ( !QFileInfo( myWorkingDir->text().trimmed() ).isWritable() ) { SUIT_MessageBox::warning( dlg(), @@ -481,7 +490,7 @@ bool HEXABLOCKPluginGUI_HypothesisCreator::checkParams(QString& msg) const void HEXABLOCKPluginGUI_HypothesisCreator::retrieveParams() const { - MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::retrieveParams"); + if (MYDEBUG) MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::retrieveParams"); HEXABLOCKHypothesisData data; readParamsFromHypo( data ); @@ -529,7 +538,7 @@ void HEXABLOCKPluginGUI_HypothesisCreator::retrieveParams() const mySmpModel->setData(mySmpModel->index(row, ENF_VER_SIZE_COLUMN),size); mySmpModel->setItem( row, ENF_VER_SIZE_COLUMN, new QStandardItem(QString::number(size)) ); - MESSAGE("Row " << row << ": (" << x << ","<< y << ","<< z << ") ="<< size); + if (MYDEBUG) MESSAGE("Row " << row << ": (" << x << ","<< y << ","<< z << ") ="<< size); row++; } @@ -539,7 +548,7 @@ void HEXABLOCKPluginGUI_HypothesisCreator::retrieveParams() const QString HEXABLOCKPluginGUI_HypothesisCreator::storeParams() const { - MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::storeParams"); + if (MYDEBUG) MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::storeParams"); HEXABLOCKHypothesisData data; readParamsFromWidgets( data ); storeParamsToHypo( data ); @@ -599,13 +608,13 @@ QString HEXABLOCKPluginGUI_HypothesisCreator::storeParams() const valStr += ";"; } valStr += " #END ENFORCED VERTICES#"; - MESSAGE(valStr.toStdString()); + if (MYDEBUG) MESSAGE(valStr.toStdString()); return valStr; } bool HEXABLOCKPluginGUI_HypothesisCreator::readParamsFromHypo( HEXABLOCKHypothesisData& h_data ) const { - MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::readParamsFromHypo"); + if (MYDEBUG) MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::readParamsFromHypo"); HEXABLOCKPlugin::HEXABLOCKPlugin_Hypothesis_var h = HEXABLOCKPlugin::HEXABLOCKPlugin_Hypothesis::_narrow( initParamsHypothesis() ); @@ -646,7 +655,7 @@ bool HEXABLOCKPluginGUI_HypothesisCreator::readParamsFromHypo( HEXABLOCKHypothes bool HEXABLOCKPluginGUI_HypothesisCreator::storeParamsToHypo( const HEXABLOCKHypothesisData& h_data ) const { - MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::storeParamsToHypo"); + if (MYDEBUG) MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::storeParamsToHypo"); HEXABLOCKPlugin::HEXABLOCKPlugin_Hypothesis_var h = HEXABLOCKPlugin::HEXABLOCKPlugin_Hypothesis::_narrow( hypothesis() ); @@ -744,7 +753,7 @@ bool HEXABLOCKPluginGUI_HypothesisCreator::storeParamsToHypo( const HEXABLOCKHyp bool HEXABLOCKPluginGUI_HypothesisCreator::readParamsFromWidgets( HEXABLOCKHypothesisData& h_data ) const { - MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::readParamsFromWidgets"); + if (MYDEBUG) MESSAGE("HEXABLOCKPluginGUI_HypothesisCreator::readParamsFromWidgets"); h_data.myName = myName ? myName->text() : ""; h_data.myToMeshHoles = myToMeshHolesCheck->isChecked(); h_data.myMaximumMemory = myMaximumMemoryCheck->isChecked() ? myMaximumMemorySpin->value() : -1; @@ -766,7 +775,7 @@ bool HEXABLOCKPluginGUI_HypothesisCreator::readParamsFromWidgets( HEXABLOCKHypot myVertex.push_back(mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble()); myVertex.push_back(mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble()); myVertex.push_back(mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble()); - MESSAGE("Add new enforced vertex (" << myVertex[0] << ", " + if (MYDEBUG) MESSAGE("Add new enforced vertex (" << myVertex[0] << ", " << myVertex[1] << ", " << myVertex[2] << ") = " << myVertex[3]); diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_FromSkin_3D.cxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_FromSkin_3D.cxx index a22c2b7..ddfa110 100755 --- a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_FromSkin_3D.cxx +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_FromSkin_3D.cxx @@ -49,7 +49,7 @@ #ifdef _DEBUG_ static int MYDEBUG = 1; #else -static int MYDEBUG = 1; +static int MYDEBUG = 0; #endif @@ -984,14 +984,14 @@ SMESH_HexaFromSkin_3D::SMESH_HexaFromSkin_3D(int hypId, int studyId, SMESH_Gen* :SMESH_3D_Algo(hypId, studyId, gen), _doc( doc ) { - MESSAGE("SMESH_HexaFromSkin_3D::SMESH_HexaFromSkin_3D"); + if(MYDEBUG) MESSAGE("SMESH_HexaFromSkin_3D::SMESH_HexaFromSkin_3D"); _name = "HexaFromSkin_3D"; } SMESH_HexaFromSkin_3D::~SMESH_HexaFromSkin_3D() { - MESSAGE("SMESH_HexaFromSkin_3D::~SMESH_HexaFromSkin_3D"); + if(MYDEBUG) MESSAGE("SMESH_HexaFromSkin_3D::~SMESH_HexaFromSkin_3D"); } //================================================================================ diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK.cxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK.cxx index 2e025c8..a2f4bc3 100755 --- a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK.cxx +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK.cxx @@ -47,7 +47,11 @@ using namespace std; +#ifdef _DEBUG_ +static int MYDEBUG = 1; +#else static int MYDEBUG = 0; +#endif //============================================================================= /*! @@ -58,7 +62,7 @@ static int MYDEBUG = 0; HEXABLOCKPlugin_HEXABLOCK::HEXABLOCKPlugin_HEXABLOCK(int hypId, int studyId, SMESH_Gen* gen) : SMESH_3D_Algo(hypId, studyId, gen) { - MESSAGE("HEXABLOCKPlugin_HEXABLOCK::HEXABLOCKPlugin_HEXABLOCK"); + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::HEXABLOCKPlugin_HEXABLOCK"); _name = "HEXABLOCK_3D"; _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type _compatibleHypothesis.push_back("HEXABLOCK_Parameters"); @@ -78,7 +82,7 @@ HEXABLOCKPlugin_HEXABLOCK::HEXABLOCKPlugin_HEXABLOCK(int hypId, int studyId, SME HEXABLOCKPlugin_HEXABLOCK::~HEXABLOCKPlugin_HEXABLOCK() { - MESSAGE("HEXABLOCKPlugin_HEXABLOCK::~HEXABLOCKPlugin_HEXABLOCK"); + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::~HEXABLOCKPlugin_HEXABLOCK"); } //============================================================================= @@ -109,7 +113,7 @@ bool HEXABLOCKPlugin_HEXABLOCK::CheckHypothesis ( SMESH_Mesh& aMesh, //============================================================================= bool HEXABLOCKPlugin_HEXABLOCK::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theShape) { - MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute with a shape"); + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute with a shape"); SMESHDS_Mesh* meshDS = theMesh.GetMeshDS(); if ( (_iShape == 0) && (_nbShape == 0) ) { @@ -151,7 +155,7 @@ bool HEXABLOCKPlugin_HEXABLOCK::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& bool HEXABLOCKPlugin_HEXABLOCK::Compute(SMESH_Mesh& theMesh, SMESH_MesherHelper* aHelper) { - MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute without a shape"); + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute without a shape"); switch (_hyp->GetDimension()) { case 0 : return( Compute0D(theMesh) ); @@ -170,7 +174,7 @@ bool HEXABLOCKPlugin_HEXABLOCK::Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, MapShapeNbElems& aResMap) { - MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Evaluate: do nothing"); + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Evaluate: do nothing"); return true; } @@ -182,14 +186,15 @@ bool HEXABLOCKPlugin_HEXABLOCK::Evaluate(SMESH_Mesh& aMesh, //============================================================================= bool HEXABLOCKPlugin_HEXABLOCK::Compute3D(SMESH_Mesh& theMesh) { - MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute 3D"); + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute 3D Begin"); SMESH_HexaBlocks hexaBuilder(theMesh); HEXA_NS::Document* doc = _hyp->GetDocument(); hexaBuilder.computeDoc(doc); - hexaBuilder.buildGroups(doc); + hexaBuilder.buildGroups(doc); + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute 3D End"); return true; } @@ -201,7 +206,7 @@ bool HEXABLOCKPlugin_HEXABLOCK::Compute3D(SMESH_Mesh& theMesh) { bool HEXABLOCKPlugin_HEXABLOCK::Compute2D(SMESH_Mesh& theMesh) { - MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute 2D"); + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute 2D"); HEXA_NS::Document* doc = _hyp->GetDocument(); SMESH_HexaBlocks hexaBuilder(theMesh); @@ -322,7 +327,7 @@ bool HEXABLOCKPlugin_HEXABLOCK::Compute2D(SMESH_Mesh& theMesh) bool HEXABLOCKPlugin_HEXABLOCK::Compute1D(SMESH_Mesh& theMesh) { - MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute 1D"); + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute 1D"); HEXA_NS::Document* doc = _hyp->GetDocument(); SMESH_HexaBlocks hexaBuilder(theMesh); @@ -363,7 +368,7 @@ bool HEXABLOCKPlugin_HEXABLOCK::Compute1D(SMESH_Mesh& theMesh) bool HEXABLOCKPlugin_HEXABLOCK::Compute0D(SMESH_Mesh& theMesh) { - MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute 0D"); + if(MYDEBUG) MESSAGE("HEXABLOCKPlugin_HEXABLOCK::Compute 0D"); HEXA_NS::Document* doc = _hyp->GetDocument(); SMESH_HexaBlocks hexaBuilder(theMesh); diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK_i.cxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK_i.cxx index 7dbbd51..451e1a7 100755 --- a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK_i.cxx +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_HEXABLOCK_i.cxx @@ -29,6 +29,12 @@ #include "utilities.h" +#ifdef _DEBUG_ +static int MYDEBUG = 1; +#else +static int MYDEBUG = 0; +#endif + using namespace std; //============================================================================= @@ -47,7 +53,7 @@ HEXABLOCKPlugin_HEXABLOCK_i::HEXABLOCKPlugin_HEXABLOCK_i (PortableServer::POA_pt SMESH_Algo_i( thePOA ), SMESH_3D_Algo_i( thePOA ) { - MESSAGE( "HEXABLOCKPlugin_HEXABLOCK_i::HEXABLOCKPlugin_HEXABLOCK_i" ); + if(MYDEBUG) MESSAGE( "HEXABLOCKPlugin_HEXABLOCK_i::HEXABLOCKPlugin_HEXABLOCK_i" ); myBaseImpl = new ::HEXABLOCKPlugin_HEXABLOCK (theGenImpl->GetANewId(), theStudyId, theGenImpl ); @@ -63,7 +69,7 @@ HEXABLOCKPlugin_HEXABLOCK_i::HEXABLOCKPlugin_HEXABLOCK_i (PortableServer::POA_pt HEXABLOCKPlugin_HEXABLOCK_i::~HEXABLOCKPlugin_HEXABLOCK_i() { - MESSAGE( "HEXABLOCKPlugin_HEXABLOCK_i::~HEXABLOCKPlugin_HEXABLOCK_i" ); + if(MYDEBUG) MESSAGE( "HEXABLOCKPlugin_HEXABLOCK_i::~HEXABLOCKPlugin_HEXABLOCK_i" ); } //============================================================================= @@ -76,7 +82,7 @@ HEXABLOCKPlugin_HEXABLOCK_i::~HEXABLOCKPlugin_HEXABLOCK_i() ::HEXABLOCKPlugin_HEXABLOCK* HEXABLOCKPlugin_HEXABLOCK_i::GetImpl() { - MESSAGE( "HEXABLOCKPlugin_HEXABLOCK_i::GetImpl" ); + if(MYDEBUG) MESSAGE( "HEXABLOCKPlugin_HEXABLOCK_i::GetImpl" ); return ( ::HEXABLOCKPlugin_HEXABLOCK* )myBaseImpl; } diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis_i.cxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis_i.cxx index 2dae39a..a57656b 100755 --- a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis_i.cxx +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_Hypothesis_i.cxx @@ -32,6 +32,12 @@ #include #include +#ifdef _DEBUG_ +static int MYDEBUG = 1; +#else +static int MYDEBUG = 0; +#endif + //======================================================================= //function : HEXABLOCKPlugin_Hypothesis_i //======================================================================= @@ -42,7 +48,7 @@ HEXABLOCKPlugin_Hypothesis_i::HEXABLOCKPlugin_Hypothesis_i (PortableServer::POA_ : SALOME::GenericObj_i( thePOA ), SMESH_Hypothesis_i( thePOA ) { - MESSAGE( "HEXABLOCKPlugin_Hypothesis_i::HEXABLOCKPlugin_Hypothesis_i" ); + if(MYDEBUG) MESSAGE( "HEXABLOCKPlugin_Hypothesis_i::HEXABLOCKPlugin_Hypothesis_i" ); myBaseImpl = new ::HEXABLOCKPlugin_Hypothesis (theGenImpl->GetANewId(), theStudyId, theGenImpl); @@ -55,7 +61,7 @@ HEXABLOCKPlugin_Hypothesis_i::HEXABLOCKPlugin_Hypothesis_i (PortableServer::POA_ HEXABLOCKPlugin_Hypothesis_i::~HEXABLOCKPlugin_Hypothesis_i() { - MESSAGE( "HEXABLOCKPlugin_Hypothesis_i::~HEXABLOCKPlugin_Hypothesis_i" ); + if(MYDEBUG) MESSAGE( "HEXABLOCKPlugin_Hypothesis_i::~HEXABLOCKPlugin_Hypothesis_i" ); } //============================================================================= diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_i.cxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_i.cxx index 1a6c369..c11a001 100755 --- a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_i.cxx +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_i.cxx @@ -30,6 +30,14 @@ #include "HEXABLOCKPlugin_HEXABLOCK_i.hxx" #include "HEXABLOCKPlugin_Hypothesis_i.hxx" + +#ifdef _DEBUG_ +static int MYDEBUG = 1; +#else +static int MYDEBUG = 0; +#endif + + using namespace std; template class HEXABLOCKPlugin_Creator_i:public HypothesisCreator_i @@ -49,7 +57,7 @@ extern "C" HEXABLOCKPLUGIN_EXPORT GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName) { - MESSAGE("GetHypothesisCreator " << aHypName); + if(MYDEBUG) MESSAGE("GetHypothesisCreator " << aHypName); GenericHypothesisCreator_i* aCreator = 0; diff --git a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_mesh.cxx b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_mesh.cxx index 62aec92..95a1bf0 100755 --- a/src/HEXABLOCKPlugin/HEXABLOCKPlugin_mesh.cxx +++ b/src/HEXABLOCKPlugin/HEXABLOCKPlugin_mesh.cxx @@ -91,7 +91,7 @@ #ifdef _DEBUG_ static int MYDEBUG = 1; #else -static int MYDEBUG = 1; +static int MYDEBUG = 0; #endif @@ -190,7 +190,7 @@ bool SMESH_HexaBlocks::computeVertexByAssoc(HEXA_NS::Vertex& vx) // ASSERT(ok); if (!ok) throw (SALOME_Exception(LOCALIZED("vertex association : shape2coord() error "))); newNode = _theMeshDS->AddNode(x, y, z); - if (_node.count(&vx) >= 1 ) MESSAGE("_node : ALREADY"); + if (_node.count(&vx) >= 1 and MYDEBUG) MESSAGE("_node : ALREADY"); _node[&vx] = newNode;//needed in computeEdge() _vertex[newNode] = &vx; @@ -220,7 +220,7 @@ bool SMESH_HexaBlocks::computeVertexByModel(HEXA_NS::Vertex& vx) newNode = _theMeshDS->AddNode(x, y, z); - if (_node.count(&vx) >= 1 ) MESSAGE("_node : ALREADY"); + if (_node.count(&vx) >= 1 and MYDEBUG) MESSAGE("_node : ALREADY"); _node[&vx] = newNode;//needed in computeEdge() _vertex[newNode] = &vx; if (MYDEBUG){ @@ -969,7 +969,7 @@ bool SMESH_HexaBlocks::_computeQuadInit( } } if ( S1 != nodesOnQuad[0][0] ){ - MESSAGE("ZZZZZZZZZZZZZZZZ quadID = "<>>>>>>>"); + if(MYDEBUG) MESSAGE("_addGroups() : end >>>>>>>>"); } // --------------------------------------------------------------