|
@@ -79,7 +79,9 @@ boostJsonObject::~boostJsonObject()
|
|
*/
|
|
*/
|
|
void boostJsonObject::FromJson(std::string msg)
|
|
void boostJsonObject::FromJson(std::string msg)
|
|
{
|
|
{
|
|
|
|
+ cout<<"__________________________"<<endl;
|
|
cout<<msg<<endl;
|
|
cout<<msg<<endl;
|
|
|
|
+ cout<<"__________________________"<<endl;
|
|
stringstream msgs(msg);
|
|
stringstream msgs(msg);
|
|
boost::property_tree::ptree root;
|
|
boost::property_tree::ptree root;
|
|
boost::property_tree::read_json(msgs,root);//boost 方法
|
|
boost::property_tree::read_json(msgs,root);//boost 方法
|
|
@@ -503,14 +505,16 @@ void boostJsonObject::FromParamJson(string param)
|
|
|
|
|
|
try{
|
|
try{
|
|
boost::property_tree::ptree tetra_data = root.get_child("tetraParam");
|
|
boost::property_tree::ptree tetra_data = root.get_child("tetraParam");
|
|
-
|
|
|
|
- da_struct->TetraParam_ = true;
|
|
|
|
- da_struct->tetraParam->components = tetra_data.get<std::string>("components");
|
|
|
|
- da_struct->tetraParam->gradation = tetra_data.get<std::string>("gradation");
|
|
|
|
- da_struct->tetraParam->min_size = tetra_data.get<std::string>("min_size");
|
|
|
|
- da_struct->tetraParam->max_size = tetra_data.get<std::string>("max_size");
|
|
|
|
- da_struct->style = 1;
|
|
|
|
-
|
|
|
|
|
|
+ if(!tetra_data.empty()){
|
|
|
|
+ da_struct->TetraParam_ = true;
|
|
|
|
+ da_struct->tetraParam->components = tetra_data.get<std::string>("components");
|
|
|
|
+ da_struct->tetraParam->gradation = tetra_data.get<std::string>("gradation");
|
|
|
|
+ da_struct->tetraParam->min_size = tetra_data.get<std::string>("min_size");
|
|
|
|
+ da_struct->tetraParam->max_size = tetra_data.get<std::string>("max_size");
|
|
|
|
+ da_struct->style = 1;
|
|
|
|
+ }else{
|
|
|
|
+ da_struct->TetraParam_ = false;
|
|
|
|
+ }
|
|
}catch(myException &ex){
|
|
}catch(myException &ex){
|
|
std::cout<<"-----no TetraParam-----"<<std::endl;
|
|
std::cout<<"-----no TetraParam-----"<<std::endl;
|
|
throw myException("tetraParam miss some parameters!");
|
|
throw myException("tetraParam miss some parameters!");
|
|
@@ -519,9 +523,13 @@ void boostJsonObject::FromParamJson(string param)
|
|
|
|
|
|
try{
|
|
try{
|
|
boost::property_tree::ptree hexa_data = root.get_child("hexaParam");
|
|
boost::property_tree::ptree hexa_data = root.get_child("hexaParam");
|
|
- da_struct->HexaParam_ = true;
|
|
|
|
- da_struct->hexaParam->components = hexa_data.get<std::string>("components");
|
|
|
|
- da_struct->style = 2;
|
|
|
|
|
|
+ if(!hexa_data.empty()){
|
|
|
|
+ da_struct->HexaParam_ = true;
|
|
|
|
+ da_struct->hexaParam->components = hexa_data.get<std::string>("components");
|
|
|
|
+ da_struct->style = 2;
|
|
|
|
+ }else{
|
|
|
|
+ da_struct->HexaParam_ = false;
|
|
|
|
+ }
|
|
}catch(myException &ex){
|
|
}catch(myException &ex){
|
|
std::cout<<"-----no HexaParam-----"<<std::endl;
|
|
std::cout<<"-----no HexaParam-----"<<std::endl;
|
|
throw myException("hexaParam miss some parameters!");
|
|
throw myException("hexaParam miss some parameters!");
|
|
@@ -530,13 +538,17 @@ void boostJsonObject::FromParamJson(string param)
|
|
|
|
|
|
try{
|
|
try{
|
|
boost::property_tree::ptree hybrid_data = root.get_child("hybridParam");
|
|
boost::property_tree::ptree hybrid_data = root.get_child("hybridParam");
|
|
- da_struct->HybridParaml_ = true;
|
|
|
|
- da_struct->hybridParam->HybridStyle = hybrid_data.get<std::string>("element_generation");
|
|
|
|
- da_struct->style = 3;
|
|
|
|
- da_struct->hybridParam->number_of_boundary_layers = hybrid_data.get<std::string>("number_of_boundary_layers");
|
|
|
|
- da_struct->hybridParam->normal_direction = hybrid_data.get<std::string>("normal_direction");
|
|
|
|
- da_struct->hybridParam->boundary_layer_global_initial_height = hybrid_data.get<std::string>("boundary_layer_global_initial_height");
|
|
|
|
- da_struct->hybridParam->boundary_layer_geometric_progression = hybrid_data.get<std::string>("boundary_layer_geometric_progression");
|
|
|
|
|
|
+ if(!hybrid_data.empty()){
|
|
|
|
+ da_struct->HybridParaml_ = true;
|
|
|
|
+ da_struct->hybridParam->HybridStyle = hybrid_data.get<std::string>("element_generation");
|
|
|
|
+ da_struct->style = 3;
|
|
|
|
+ da_struct->hybridParam->number_of_boundary_layers = hybrid_data.get<std::string>("number_of_boundary_layers");
|
|
|
|
+ da_struct->hybridParam->normal_direction = hybrid_data.get<std::string>("normal_direction");
|
|
|
|
+ da_struct->hybridParam->boundary_layer_global_initial_height = hybrid_data.get<std::string>("boundary_layer_global_initial_height");
|
|
|
|
+ da_struct->hybridParam->boundary_layer_geometric_progression = hybrid_data.get<std::string>("boundary_layer_geometric_progression");
|
|
|
|
+ }else{
|
|
|
|
+ da_struct->HybridParaml_ = false;
|
|
|
|
+ }
|
|
}catch(myException &ex){
|
|
}catch(myException &ex){
|
|
std::cout<<"-----no HybridParam-----"<<std::endl;
|
|
std::cout<<"-----no HybridParam-----"<<std::endl;
|
|
throw myException("hybridParam miss some parameters!");
|
|
throw myException("hybridParam miss some parameters!");
|