iam-git / WellMet (public) (License: MIT) (since 2021-08-31) (hash sha1)
WellMet is pure Python framework for spatial structural reliability analysis. Or, more specifically, for "failure probability estimation and detection of failure surfaces by adaptive sequential decomposition of the design domain".
List of commits:
Subject Hash Author Date (UTC)
voronoi: WIP 29c59822f96df4efd6d1c6555a6fa083a869a2c8 I am 2022-11-28 11:14:50
voronoi: WIP, clean up 8e776235f7603a9bc7f3d8254976224a81bb153e I am 2022-11-27 19:56:34
voronoi: WIP 41e506eacb502853a1cf70023e7b276539579af7 I am 2022-11-27 13:03:08
convex_hull: optimize orth basis generation 4ebfde2955aa792fb31075bf9ac8af718ae07b29 I am 2022-11-26 15:35:21
voronoi: WIP 8f7f3bca7c4333ab579e057438c8c64208d1f60e I am 2022-11-26 11:22:55
voronoi: remove the code already moved to wireframe module fe57b4b699e8689d35afb510f704019152566f09 I am 2022-11-25 09:25:55
qt_gui.qt_pairwise.ContactWidget: show Qhull request at most once. db6af332a70786759692175384f4b7e779b4caca I am 2022-11-16 13:26:04
wireframe.LinearSolver: polytope handle hotfix bc48de3193ce9be482cc4dd068a26f48ea1e0203 I am 2022-11-16 13:24:41
qt_gui.qt_pairwise.ContactWidget: add LP methods 8dbd480ca80aabe1c7e0e689780767b78c86c1d1 I am 2022-11-16 11:33:32
wireframe: implement two LP solvers 8aecd55104ce85ccccf872ebef0052a5937415b5 I am 2022-11-16 11:32:31
qt_gui.qt_pairwise.ContactWidget: add Gabriel adjacency 86eaf302b176612fad072a2248e2c724d32be755 I am 2022-11-16 06:17:53
wireframe: implement Gabriel adjacency f0a74b4f28cec6c2ddc68d6811e0a812fc829d63 I am 2022-11-16 06:16:58
qt_gui.qt_pairwise.ContactWidget: reflect updated wireframe b00a9be23d92d999e0020426a7a5caa1206c5862 I am 2022-11-16 03:56:57
wireframe: implement LocalizedHull class 95c19144c5144461db241df1b2bd20d8950c8d57 I am 2022-11-16 03:55:59
qt_gui.qt_pairwise.ContactWidget: polish UI bd48c8a6342e20dac1d635b963dd44e62c371379 I am 2022-11-13 20:03:39
wireframe: add convex_slice() method efada4c62f88b6106c687217472e0b8c52374fed I am 2022-11-13 19:51:49
qt_gui.qt_pairwise.ContactWidget: finish widget and clean up 10753a104879d6b9c109735e959b18b5a60a4616 I am 2022-11-10 05:02:01
wireframe: finish and clean up module. implement DirectContact. f7ff9c02f25a3ed8fe04e99036da69766afa5a49 I am 2022-11-10 04:58:58
qt_gui.qt_pairwise.ContactWidget: implement Qhull check e362df1f8b87ab7c6a27643cd6f4091b9caec9a3 I am 2022-11-09 21:35:10
wireframe: add Qframe class cf52d85dd1663537cd8c52a98514c7d041913979 I am 2022-11-09 21:34:12
Commit 29c59822f96df4efd6d1c6555a6fa083a869a2c8 - voronoi: WIP
Author: I am
Author date (UTC): 2022-11-28 11:14
Committer name: I am
Committer date (UTC): 2022-11-28 11:14
Parent(s): 8e776235f7603a9bc7f3d8254976224a81bb153e
Signer:
Signing key:
Signing status: N
Tree: 49835fbb4be7f17bd33053886e5af4a482de389a
File Lines added Lines deleted
wellmet/voronoi.py 54 106
File wellmet/voronoi.py changed (mode: 100644) (index 63d0374..05813bf)
... ... class TwoPoints:
242 242 #č tak patří hledané do poloprostoru "i" #č tak patří hledané do poloprostoru "i"
243 243 mask = (points @ self.normal_vector) < self.delimit mask = (points @ self.normal_vector) < self.delimit
244 244
245
246 self.tree_i = KDTree(points[mask])
247 self.tree_j = KDTree(points[~mask])
245 #č vypnu optimizace KD stromu.
246 #č Netestoval však, zda je to skutečně rychlejší.
247 self.tree_i = KDTree(points[mask], compact_nodes=False, balanced_tree=False)
248 self.tree_j = KDTree(points[~mask], compact_nodes=False, balanced_tree=False)
248 249 #č neznám convinient cestu pro získaní #č neznám convinient cestu pro získaní
249 250 #č tamtamtoho indexu na maskovaném poli #č tamtamtoho indexu na maskovaném poli
250 251 #č np.ma mně příjde zbytečným #č np.ma mně příjde zbytečným
 
... ... class TwoPoints:
367 368 else: else:
368 369 return False, None, None return False, None, None
369 370
370
371
372 # @staticmethod
373 # def _first_query(center, points, nodes, order):
374 #
375 # d1 = np.empty((len(nodes), 1), dtype=float, order=order)
376 # d2 = np.full((len(nodes), 1), np.inf, dtype=float, order=order)
377 # cdist(nodes, [center], 'sqeuclidean', out=d1)
378 # mask = np.isfinite(d1)
379 #
380 # n = len(mask[mask])
381 # #d2 = np.full((n, 1), np.inf, dtype=float, order=order)
382 # d3 = np.empty((n, 1), dtype=float, order=order)
383 #
384 # for point in reversed(points):
385 # cdist(nodes[mask[:,0]], np.atleast_2d(point), 'sqeuclidean', out=d3)
386 #
387 # np.fmin(d2[mask[:,0]], d3, out=d2[mask[:,0]])
388 # mask[mask[:,0]] &= d1[mask[:,0]] <= d3
389 #
390 # n = len(mask[mask])
391 # if n == 0:
392 # break
393 # d3.resize((n, 1), refcheck=False)
394 # return mask, d1, d2
395 #
396 # @staticmethod
397 # def _second_query(center, points, nodes, order):
398 #
399 # d1 = np.empty((len(nodes), 1), dtype=float, order=order)
400 # cdist(nodes, [center], 'sqeuclidean', out=d1)
401 # mask = np.isfinite(d1)
402 # n = len(mask[mask])
403 # d3 = np.empty((n, 1), dtype=float, order=order)
404 #
405 # for point in reversed(points):
406 # cdist(nodes[mask[:,0]], np.atleast_2d(point), 'sqeuclidean', out=d3)
407 #
408 # mask[mask[:,0]] &= d1[mask[:,0]] <= d3
409 #
410 # n = len(mask[mask])
411 # if n == 0:
412 # break
413 # d3.resize((n, 1), refcheck=False)
414 # return mask, d1
415 371
416 372
417 373
 
... ... class ContactVoronoi:
614 570 """ """
615 571 ## checklist ## checklist
616 572 self.couples # dict of active contacts {couple_indices: list of node idxs} self.couples # dict of active contacts {couple_indices: list of node idxs}
617 self.couples_stats = {}
618 573 self.mixed_couples = {} ##č pár slovníků reprezentativních sad vzorků self.mixed_couples = {} ##č pár slovníků reprezentativních sad vzorků
619 574 self.red_couples = {} ## {couple_indices: nodes} self.red_couples = {} ## {couple_indices: nodes}
620 575 self._add_indices_to_update(j) self._add_indices_to_update(j)
 
... ... class ContactVoronoi:
723 678 for k in range(j+1, self._nsim): for k in range(j+1, self._nsim):
724 679 self._indices_to_update.add((k, j)) self._indices_to_update.add((k, j))
725 680
726 def _recommend_to_integration(self, nodes_idx):
727
681
682 def _recommend_to_integration(self, nodes):
728 683 # -1 = 'outside', 0=success, 1=failure, 2=mix # -1 = 'outside', 0=success, 1=failure, 2=mix
729 couple = self.nodes[nodes_idx].couple
730 if self.nodes[nodes_idx].event_id == 2:
731 self.mixed_couples[couple] = nodes_idx
684 if nodes.event_id == 2:
685 self.mixed_couples[nodes.couple] = nodes
732 686 else: else:
733 self.red_couples[couple] = nodes_idx
687 self.red_couples[nodes.couple] = nodes
734 688
735
736 # def _check_undiscovered(self, gmask, ii, dd, nodes_model, h_pdf=None):
737 # """
738 # č logika celé třídy je, že máme-li příslušné kontaktu bodíky,
739 # č tak stojí za to je uložit.
740 # """
741 # couples = self.couples
742 #
743 # iim = ii[gmask] #č dovezli nám nedodělané zboží
744 #
745 # #č vymaskovat čerstvé víno
746 # mask = np.all(iim < self._nsim, axis=1)
747 # iim = iim[mask] #č chcu/nechcu globální masku
748 # #č vymaskovat zelené kontakty
749 # in_failure = np.isin(iim, self.failure_points)
750 # has_failure = in_failure.any(axis=1)
751 # iim = iim[has_failure]
752 #
753 # #č zbytečnost
754 # if not iim.size: # if empty
755 # return None
756 #
757 # #č min-max nepočítá se zadarmo
758 # #č nejdřív projedeme smyčkou část,
759 # #č kde je první index větší a pak ten zbytek
760 # mask = iim[:0] > iim[:1]
761 # for i, j in iim[mask]:
762 # if (i, j) not in couples:
763 # #č ok. Ten vzacnej případ nastal.
764 # #č kašleme na masky, posíláme všechno na explore
765 # self._explore(couple, ii, dd, nodes_model, h_pdf)
766 #
767 # for j, i in iim[~mask]:
768 # if (i, j) not in couples:
769 # #č ok. Ten vzacnej případ nastal.
770 # #č kašleme na masky, posíláme všechno na explore
771 # self._explore(couple, ii, dd, nodes_model, h_pdf)
772 689
773 690
774 691
 
... ... class ContactVoronoi:
790 707 #č 2. seznam může být prazdný i když by neměl #č 2. seznam může být prazdný i když by neměl
791 708 if not idx_list: if not idx_list:
792 709 self.couples.pop(couple_indices) self.couples.pop(couple_indices)
793 assert couple_indices not in self.mixed_couples
794 assert couple_indices not in self.red_couples
710 print("ContactVoronoi: empty list found for ", couple_indices)
711 print(self.mixed_couples.pop(couple_indices, None))
712 print(self.red_couples.pop(couple_indices, None))
795 713 return -2 return -2
796 714
797 #3. v seznamu je jen chudý první bodík, který se ani neintegruje
715 ##č 2.5 v seznamu je jen chudý první bodík, který se ani neintegruje
716
717 #č Pokud pár je červený, tak stačí zkontrolovat jen reprezentativní sadu
798 718
799 719
800 720 #č u smíšených může být potřeba zkontorlovat všechy sady bodíků #č u smíšených může být potřeba zkontorlovat všechy sady bodíků
801 #č kvůli garancim pro skříňku
802 KDTree(m, compact_nodes=False, balanced_tree=False).query(nodes_model, k=[2], p=self.p_norm)
803 mask = np.zeros(blabla, dtype=bool)
804 mask[self._nsim:] = True
805 mask[i] = True
806 mask[j] = True
721 #č kvůli garancim skříňce
722
723
724
725
726
727 def _check_nodes(self, nodes):
728 "returns status, masked_nodes"
729 #č co všechno se tu může dít?
730 #č 1. nic se nezměnilo, všechny bodíky pořad patří k páru
731 #č 2. Pozor, změna! Některé bodíky odpadly
732 #č 3. Padla celá sada bodů.
733
734 #č bodíky musí mít konečné souřadnice - ony prošly KD stromem
735 #č vzorky - tím více
736 nodes_model = getattr(nodes, self.model_space)
737 d3 = np.min(cdist(nodes_model, self.points[self._nsim:]), axis=1)
738 mask = nodes.d2 <= d3
739
740 if not np.any(mask):
741 return 3, None
742 elif np.all(mask):
743 return 1, nodes
744 else:
745 del nodes.p_inside
746 del nodes.p_fv
747 del nodes.p_fw
748 return 2, nodes[mask]
749
750 #č invalidace sady?
751 # update score?
807 752
808 753
809 754 def invalidate_couple(self, couple_indices): def invalidate_couple(self, couple_indices):
 
... ... class ContactVoronoi:
823 768 ##č (snad jediné místo kde tuhle funkci voláme) ##č (snad jediné místo kde tuhle funkci voláme)
824 769 self._add_indices_to_update(j) self._add_indices_to_update(j)
825 770
826 ##č (ten bodík by neměl být omylem doporučen k integraci)
771
827 772 ##nodes.w = 0 ##nodes.w = 0
828 773 ##nodes.p_couple = 0 ##nodes.p_couple = 0
829 774 #č nsim score #č nsim score
 
... ... class ContactVoronoi:
832 777 #č 2 ~p_couple #č 2 ~p_couple
833 778 #č chcu, aby score byl měnší jak u připadného skutečného bodíku. #č chcu, aby score byl měnší jak u připadného skutečného bodíku.
834 779 nodes.score = -1 #č není špatný score nodes.score = -1 #č není špatný score
780
781 #č chcu zjednodušit logiku.
782 #č Pokud máme pouze jeden bodík, tak snad i bude nejlepším?
783 #č Nechť veškeré couples v třídě budou konzistentní.
784 #č dočasně nejlepší tenhlensten, tak ho doporučíme k integraci
785 self._recommend_to_integration(nodes)
835 786
836 787
837 788 #č a teď deme vzorkovat #č a teď deme vzorkovat
 
... ... class ContactVoronoi:
872 823 #č Možná TrueIS by si mohl s tím poradit, ale #č Možná TrueIS by si mohl s tím poradit, ale
873 824 #č zde je to totálná zbytečnost #č zde je to totálná zbytečnost
874 825 # -1 = 'outside', 0=success, 1=failure, 2=mix # -1 = 'outside', 0=success, 1=failure, 2=mix
875 if event_id == 2:
876 self.mixed_couples[nodes.couple] = best_nodes
877 else:
878 self.red_couples[nodes.couple] = best_nodes
826 self._recommend_to_integration(best_nodes)
879 827
880 828
881 829
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/iam-git/WellMet

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/iam-git/WellMet

Clone this repository using git:
git clone git://git.rocketgit.com/user/iam-git/WellMet

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main