/// --- /// eliminate elements in the given number of iterations. /// --- /// "max_iter">maximum number of iterations. /// "lc_inds">list of indexes of loadcase from which the axial forces are taken. If tension elements shall survive /// the smallest normal force of all load-cases must be tensile. In the opposite case it it the other way round. /// "model">model to be modified. /// "elim_elements">list of elements that take part in the elimination procedure. /// "compr_survives">true if members under axial compression shall survive. /// "max_disp">out: maximum displacement of the manipulated structure. private static void eliminateElements( int max_iter, IEnumerable lc_inds, Model model, List elim_elements, bool compr_survives, out double max_disp) { max_disp = 0; for (int iter = 0; iter < max_iter; iter++) { feb.Deform analysis = new feb.Deform(model.febmodel); feb.Response response = new feb.Response(analysis); Utils.handleError(response.updateNodalDisplacements(), analysis); Utils.handleError(response.updateMemberForces(), analysis); var elim_list = new List>(); foreach (ModelElementStraightLine elem in elim_elements) { if (elem.IsActive) { var Nmin = double.MinValue; var Nmax = double.MinValue; foreach (var lc_ind in lc_inds) { elem.resultantCroSecForces(model, new LCSuperPosition(lc_ind, model), out double N, out double V, out double M); Nmin = Nmin < N ? Nmin : N; Nmax = Nmax > N ? Nmax : N; } if (compr_survives) { if (Nmax >= 0) { elim_list.Add(new Tuple(Nmax, elem)); } } else { if (Nmin <= 0) { elim_list.Add(new Tuple(-Nmin, elem)); } } } } if (elim_list.Count == 0) break; // determine number of elements to be set inactive int n_elim_elem = elim_list.Count / (max_iter - iter); n_elim_elem = n_elim_elem > 0 ? n_elim_elem : 1; // sort list of elements elim_list.Sort((p1, p2) => p2.Item1.CompareTo(p1.Item1)); // set elements inactive for (int i = 0; i < n_elim_elem; i++) { elim_list[i].Item2.set_is_active(model, false); } // tell the model that it has been changed model.febmodel.touch(); GC.KeepAlive(analysis); GC.KeepAlive(response); } feb.Deform post_analysis = new feb.DeformThII(model.febmodel); feb.Response post_response = new feb.Response(post_analysis); Utils.handleError(post_response.updateNodalDisplacements(), post_analysis); Utils.handleError(post_response.updateMemberForces(), post_analysis); max_disp = post_response.maxDisplacement(); // this guards the objects from being freed prematurely GC.KeepAlive(post_analysis); GC.KeepAlive(post_response); }