X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2FNETGENPlugin%2FNETGENPlugin_NETGEN_1D2D3D_SA.cxx;fp=src%2FNETGENPlugin%2FNETGENPlugin_NETGEN_1D2D3D_SA.cxx;h=1ae83b4c81efcdba5e2be36a0a903eff6fa90ac8;hb=c56027a4a2806b9372c4a6b0eab3daa6510ebde2;hp=bcaa38cf8575034ad0a003aad72089a01bc307c1;hpb=add7adb35572254bc69daef739811c7f37485662;p=plugins%2Fnetgenplugin.git diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_1D2D3D_SA.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_1D2D3D_SA.cxx index bcaa38c..1ae83b4 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_1D2D3D_SA.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_1D2D3D_SA.cxx @@ -72,6 +72,28 @@ NETGENPlugin_NETGEN_1D2D3D_SA::~NETGENPlugin_NETGEN_1D2D3D_SA() { } +/** + * @brief Check presence and content of orientation file. Implemented for completness and future reference. + * + * @param element_orientation_file Binary file containing the orientation of surface elemnts + * @return true, false + */ +bool NETGENPlugin_NETGEN_1D2D3D_SA::checkOrientationFile( const std::string element_orientation_file ) +{ + if(element_orientation_file.empty()){ + MESSAGE("No element orientation file"); + return true; + } else { + MESSAGE("Reading from elements from file: " << element_orientation_file); + // By construction the orientation file written by Remote version has a zero written to mark no need of orientation in 2D meshing + int nbElement; + std::ifstream df(element_orientation_file, ios::binary|ios::in); + df.read((char*)&nbElement, sizeof(int)); + df.close(); + return (nbElement == 0); + } +} + /** * @brief fill plugin hypothesis from the netgen_params structure * @@ -341,17 +363,24 @@ int NETGENPlugin_NETGEN_1D2D3D_SA::run(const std::string input_mesh_file, netgen_params myParams; importNetgenParams(hypo_file, myParams); fillHyp(myParams); + int ret = 1; - int ret = Compute( *myMesh, myShape, new_element_file, !output_mesh_file.empty(), dim ); - if(ret){ - std::cerr << "Meshing failed" << std::endl; - return ret; - } + if ( checkOrientationFile(element_orientation_file) ) + { + ret = Compute( *myMesh, myShape, new_element_file, !output_mesh_file.empty(), dim ); + if(ret){ + std::cerr << "Meshing failed" << std::endl; + return ret; + } - if(!output_mesh_file.empty()){ - std::string meshName = "MESH"; - SMESH_DriverMesh::exportMesh(output_mesh_file, *myMesh, meshName); + if(!output_mesh_file.empty()){ + std::string meshName = "MESH"; + SMESH_DriverMesh::exportMesh(output_mesh_file, *myMesh, meshName); + } } + else + std::cerr << "For NETGENPlugin_NETGEN_1D2D3D_SA, orientation file should be market with 0 or be empty!" << std::endl; + return ret; }