1 // Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : NETGENPlugin_DriverParam.hxx
24 // Author : Yoann AUDOUIN, EDF
27 #include "NETGENPlugin_DriverParam.hxx"
36 * @brief Print content of a netgen_params
38 * @param aParams The object to display
40 void printNetgenParams(netgen_params& aParams){
41 std::cout << "has_netgen_param: " << aParams.has_netgen_param << std::endl;
42 std::cout << "maxh: " << aParams.maxh << std::endl;
43 std::cout << "minh: " << aParams.minh << std::endl;
44 std::cout << "segmentsperedge: " << aParams.segmentsperedge << std::endl;
45 std::cout << "grading: " << aParams.grading << std::endl;
46 std::cout << "curvaturesafety: " << aParams.curvaturesafety << std::endl;
47 std::cout << "secondorder: " << aParams.secondorder << std::endl;
48 std::cout << "quad: " << aParams.quad << std::endl;
49 std::cout << "optimize: " << aParams.optimize << std::endl;
50 std::cout << "fineness: " << aParams.fineness << std::endl;
51 std::cout << "uselocalh: " << aParams.uselocalh << std::endl;
52 std::cout << "merge_solids: " << aParams.merge_solids << std::endl;
53 std::cout << "chordalError: " << aParams.chordalError << std::endl;
54 std::cout << "optsteps2d: " << aParams.optsteps2d << std::endl;
55 std::cout << "optsteps3d: " << aParams.optsteps3d << std::endl;
56 std::cout << "elsizeweight: " << aParams.elsizeweight << std::endl;
57 std::cout << "opterrpow: " << aParams.opterrpow << std::endl;
58 std::cout << "delaunay: " << aParams.delaunay << std::endl;
59 std::cout << "checkoverlap: " << aParams.checkoverlap << std::endl;
60 std::cout << "checkchartboundary: " << aParams.checkchartboundary << std::endl;
61 std::cout << "closeedgefac: " << aParams.closeedgefac << std::endl;
62 std::cout << "nbThreadMesher: " << aParams.nbThreads << std::endl;
63 std::cout << "has_local_size: " << aParams.has_local_size << std::endl;
64 std::cout << "meshsizefilename: " << aParams.meshsizefilename << std::endl;
65 std::cout << "has_maxelementvolume_hyp: " << aParams.has_maxelementvolume_hyp << std::endl;
66 std::cout << "maxElementVolume: " << aParams.maxElementVolume << std::endl;
67 std::cout << "has_LengthFromEdges_hyp: " << aParams.has_LengthFromEdges_hyp << std::endl;
71 * @brief Import a param_file into a netgen_params structure
73 * @param param_file Name of the file
74 * @param aParams Structure to fill
76 void importNetgenParams(const std::string param_file, netgen_params& aParams){
77 std::ifstream myfile(param_file);
80 std::getline(myfile, line);
81 aParams.has_netgen_param = std::stoi(line);
82 std::getline(myfile, line);
83 aParams.maxh = std::stod(line);
84 std::getline(myfile, line);
85 aParams.minh = std::stod(line);
86 std::getline(myfile, line);
87 aParams.segmentsperedge = std::stod(line);
88 std::getline(myfile, line);
89 aParams.grading = std::stod(line);
90 std::getline(myfile, line);
91 aParams.curvaturesafety = std::stod(line);
92 std::getline(myfile, line);
93 aParams.secondorder = std::stoi(line);
94 std::getline(myfile, line);
95 aParams.quad = std::stoi(line);
96 std::getline(myfile, line);
97 aParams.optimize = std::stoi(line);
98 std::getline(myfile, line);
99 aParams.fineness = std::stoi(line);
100 std::getline(myfile, line);
101 aParams.uselocalh = std::stoi(line);
102 std::getline(myfile, line);
103 aParams.merge_solids = std::stoi(line);
104 std::getline(myfile, line);
105 aParams.chordalError = std::stod(line);
106 std::getline(myfile, line);
107 aParams.optsteps2d = std::stoi(line);
108 std::getline(myfile, line);
109 aParams.optsteps3d = std::stoi(line);
110 std::getline(myfile, line);
111 aParams.elsizeweight = std::stod(line);
112 std::getline(myfile, line);
113 aParams.opterrpow = std::stoi(line);
114 std::getline(myfile, line);
115 aParams.delaunay = std::stoi(line);
116 std::getline(myfile, line);
117 aParams.checkoverlap = std::stoi(line);
118 std::getline(myfile, line);
119 aParams.checkchartboundary = std::stoi(line);
120 std::getline(myfile, line);
121 aParams.closeedgefac = std::stoi(line);
122 std::getline(myfile, line);
123 aParams.nbThreads = std::stoi(line);
124 std::getline(myfile, line);
125 aParams.has_local_size = std::stoi(line);
126 std::getline(myfile, line);
127 aParams.meshsizefilename = line;
128 std::getline(myfile, line);
129 aParams.has_maxelementvolume_hyp = std::stoi(line);
130 std::getline(myfile, line);
131 aParams.maxElementVolume = std::stod(line);
132 std::getline(myfile, line);
133 aParams.maxElementVolume = std::stoi(line);
138 * @brief Writes the content of a netgen_param into a file
140 * @param param_file the file
141 * @param aParams the object
143 void exportNetgenParams(const std::string param_file, netgen_params& aParams){
144 std::ofstream myfile(param_file);
145 myfile << aParams.has_netgen_param << std::endl;
146 myfile << aParams.maxh << std::endl;
147 myfile << aParams.minh << std::endl;
148 myfile << aParams.segmentsperedge << std::endl;
149 myfile << aParams.grading << std::endl;
150 myfile << aParams.curvaturesafety << std::endl;
151 myfile << aParams.secondorder << std::endl;
152 myfile << aParams.quad << std::endl;
153 myfile << aParams.optimize << std::endl;
154 myfile << aParams.fineness << std::endl;
155 myfile << aParams.uselocalh << std::endl;
156 myfile << aParams.merge_solids << std::endl;
157 myfile << aParams.chordalError << std::endl;
158 myfile << aParams.optsteps2d << std::endl;
159 myfile << aParams.optsteps3d << std::endl;
160 myfile << aParams.elsizeweight << std::endl;
161 myfile << aParams.opterrpow << std::endl;
162 myfile << aParams.delaunay << std::endl;
163 myfile << aParams.checkoverlap << std::endl;
164 myfile << aParams.checkchartboundary << std::endl;
165 myfile << aParams.closeedgefac << std::endl;
166 myfile << aParams.nbThreads << std::endl;
167 myfile << aParams.has_local_size << std::endl;
168 myfile << aParams.meshsizefilename << std::endl;
169 myfile << aParams.has_maxelementvolume_hyp << std::endl;
170 myfile << aParams.maxElementVolume << std::endl;
171 myfile << aParams.has_LengthFromEdges_hyp << std::endl;