21 ExpressionPtr offset_selection;
22 std::set<std::string> offset_output_tag;
23 std::set<std::string> protected_tags;
26 double target_distance;
27 double target_distance_rel;
31 bool throw_on_nonconvergence;
35 double envelope_size_rel;
41 double offset_dhat_factor;
59 double front_conv_rel;
75 bool front_normal_projection =
true;
93 int offset_residual_samples;
95 std::string output_path;
100 int phi_grid_resolution;
107 double ab_smooth_tol;
131 double min_edge_length;
132 double min_edge_length_rel;
136 double min_sizing_scalar;
137 double max_sizing_scalar;
141 double sizing_gradation;
150 for (
const std::string& tag : json_params[
"offset_output_tags"]) {
151 if (tag ==
"ambient") {
153 "'ambient' tag cannot be given explicitly to offset_output_tags, ignoring. To "
154 "set offset to 'ambient', pass offset_output_tags=[].");
157 offset_output_tag.insert(tag);
159 for (
const std::string& tag : json_params[
"protected_tags"]) {
160 if (tag ==
"ambient") {
161 logger().warn(
"'ambient' tag cannot be protected, ignoring.");
164 protected_tags.insert(tag);
166 offset_in = json_params[
"offset_in"];
167 offset_out = json_params[
"offset_out"];
168 target_distance = json_params[
"target_distance"];
169 target_distance_rel = json_params[
"target_distance_rel"];
170 throw_on_nonconvergence = json_params[
"throw_on_nonconvergence"];
171 envelope_size = json_params[
"envelope_size"];
172 envelope_size_rel = json_params[
"envelope_size_rel"];
173 offset_dhat_factor = json_params[
"offset_dhat_factor"];
175 front_conv_rel = json_params[
"front_conv_rel"];
177 offset_residual_samples = json_params[
"offset_residual_samples"];
179 sorted_marching = json_params[
"sorted_marching"];
180 output_path = json_params[
"output"];
181 save_vtu = json_params[
"save_vtu"];
182 phi_grid_resolution = json_params[
"phi_grid_resolution"];
184 num_threads = json_params[
"num_threads"];
187 ab_smooth_tol = json_params[
"ab_smooth_tol"];
191 min_edge_length = json_params[
"min_edge_length"];
192 min_edge_length_rel = json_params[
"min_edge_length_rel"];
194 min_sizing_scalar = json_params[
"min_sizing_scalar"];
195 max_sizing_scalar = json_params[
"max_sizing_scalar"];
196 sizing_gradation = json_params[
"sizing_gradation"];
199 debug_output = json_params[
"DEBUG_output"];
201 lr = json_params[
"length_rel"];
202 l = json_params[
"length"];
203 stop_energy = json_params[
"stop_energy"];
205 interleaved_smoothing = json_params[
"interleaved_smoothing"];
206 interleaved_smoothing_passes = json_params[
"interleaved_smoothing_passes"];
220 stuck_refine_stall_eps = json_params[
"stuck_refine_stall_eps"];
221 stuck_refine_cooldown = json_params[
"stuck_refine_cooldown"];
222 stuck_refine_num_worst = json_params[
"stuck_refine_num_worst"];
223 stuck_refine_rings = json_params[
"stuck_refine_rings"];
224 stuck_refine_factor = json_params[
"stuck_refine_factor"];
225 stuck_refine_min_scalar = json_params[
"stuck_refine_min_scalar"];
226 stuck_refine_gradation = json_params[
"stuck_refine_gradation"];
227 stuck_refine_force_split = json_params[
"stuck_refine_force_split"];
228 front_normal_projection = json_params[
"front_normal_projection"];
235 w_amips = json_params[
"w_amips"];
241 perform_sanity_checks = json_params[
"perform_sanity_checks"];
244 void init(
const VectorXd& min_,
const VectorXd& max_)
253 preserve_topology =
true;
259 if (target_distance > 0) {
260 target_distance_rel = target_distance / diag_l;
262 target_distance = target_distance_rel * diag_l;
267 if (envelope_size > 0) {
268 envelope_size_rel = envelope_size / diag_l;
270 envelope_size = envelope_size_rel * diag_l;
275 if (min_edge_length_rel < 0) {
280 if (min_edge_length < 0) {
281 min_edge_length = min_edge_length_rel * target_distance;
283 min_edge_length_rel = min_edge_length / std::max(target_distance, 1e-16);