From: Christophe Bourcier Date: Mon, 27 May 2024 13:03:48 +0000 (+0200) Subject: Adding more messages X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ef6a15b6ead9fc1560af24b56badcebaa2626ee1;p=plugins%2Fhybridplugin.git Adding more messages --- diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx index a8723a1..5deb73a 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx @@ -2266,7 +2266,8 @@ std::string HYBRIDPlugin_Hypothesis::GetOptionValue(const std::string& optionNam op_val = _customOption2value.find(optionName); if (op_val == _customOption2value.end()) { - std::string msg = "Unknown MG-Tetra option: <" + optionName + ">"; + std::string msg = "Unknown MG-Hybrid option: <" + optionName + ">"; + std::cout << msg << std::endl; throw std::invalid_argument(msg); } } @@ -2279,6 +2280,7 @@ std::string HYBRIDPlugin_Hypothesis::GetOptionValue(const std::string& optionNam if (op_val != _defaultOptionValues.end()) val = op_val->second; } + std::cout << "GetOptionValue " << optionName << " = " << val << std::endl; return val; } diff --git a/src/HYBRIDPlugin/MG_HYBRID_API.cxx b/src/HYBRIDPlugin/MG_HYBRID_API.cxx index 01ccb1a..38c778a 100644 --- a/src/HYBRIDPlugin/MG_HYBRID_API.cxx +++ b/src/HYBRIDPlugin/MG_HYBRID_API.cxx @@ -111,6 +111,7 @@ struct MG_HYBRID_API::LibData { SMESH_Comment msg("\nMeshGems error. "); msg << txt << "\n"; + std::cout << msg; AddError( msg.c_str() ); } @@ -125,9 +126,7 @@ struct MG_HYBRID_API::LibData bool SetParam( const std::string& param, const std::string& value ) { status_t ret = hybrid_set_param( _session, param.c_str(), value.c_str() ); -#ifdef _DEBUG_ - //std::cout << param << " = " << value << std::endl; -#endif + std::cout << param << " = " << value << std::endl; return ( ret == STATUS_OK ); } @@ -152,13 +151,25 @@ struct MG_HYBRID_API::LibData status_t ret; int tag = stoi(s); if ( param=="boundary_layer_imprinting_tags" ) + { ret = hybrid_set_boundary_layer_imprinting_tag(_session, tag); + std::cout << "imprinting_tag " << tag << std::endl; + } else if ( param=="boundary_layer_snapping_tags" ) + { ret = hybrid_set_boundary_layer_snapping_tag(_session, tag); + std::cout << "snapping_tag " << tag << std::endl; + } else if ( param=="boundary_layer_surface_tags" ) + { ret = hybrid_set_initial_height_on_surface_tag(_session, tag, stod(size)); + std::cout << "surface_tag: " << tag << " , hegith: " << stod(size) << std::endl; + } if ( ret != STATUS_OK ) + { + std::cout << "PBBBBBBBBBBBBBBBBBBBBBB STATUS not OK "; return false; + } } return true; } @@ -688,6 +699,39 @@ namespace // functions called by MG library to exchange with the application status_t my_message_cb(message_t * msg, void *user_data) { char *desc; + integer e, n, m; + integer i, i_data[10]; + real r_data[10]; + n = m = 0; + message_get_description(msg, &desc); + message_get_number(msg, &e); + + if (e < 0) { + printf("mg-hybrid ERROR %i : %s", MESHGEMS_ABS_CODE(e), desc); + message_get_integer_data_count(msg, &n); + message_get_real_data_count(msg, &m); + printf("MGMESSAGE %i ", e); + printf(" %i", n); + if (n > 0) { + message_get_integer_data(msg, 1, n, i_data); + for (i = 0; i < n; i++) + printf(" %i", i_data[i]); + } + printf(" %i", m); + if (m > 0) { + message_get_real_data(msg, 1, m, r_data); + for (i = 0; i < m; i++) + printf(" %f", r_data[i]); + } + printf(" \n"); + + } + if (e >= 0) { + if (e == 0) + printf("\rmg-hybrid info : %s", desc); + else + printf("mg-hybrid info %i : %s", MESHGEMS_CODE(e), desc); + } message_get_description(msg, &desc); MG_HYBRID_API::LibData* data = (MG_HYBRID_API::LibData *) user_data;