def check_get_names_used1(): # . L . . . . . . . \ Parallel2 % R[kg]×(R[N]×R[N]) -> R[kg]×R[W] I = PosetProduct(R[kg],PosetProduct(R[N],R[N]){actuati # on/_prod1},R[N²]) names: [('actuation', '_prod1')] # . L . . . . . . . . \ Id(R[kg]) I = R[kg] # . L . . . . . . . . \ Series: % R[N]×R[N] -> R[W] I = PosetProduct(PosetProduct(R[N],R[N]){actuation/_prod1},R[N²]) nam # es: [('actuation', '_prod1'), ('actuation', '_mult1')] # . L . . . . . . . . . \ ProductN(R[N]×R[N] -> R[N²]) named: ('actuation', '_prod1') I = PosetProduct(R[N],R[N]) # . L . . . . . . . . . \ GenericUnary(<mcdp_lang.misc_math.MultValue instance at 0x10d8dcbd8>) named: ('actuation', '_mult1 # ') I = R[N²] att = MCDPConstants.ATTRIBUTE_NDP_RECURSIVE_NAME S1 = parse_poset('N') setattr(S1, att, ('S1', )) S2 = parse_poset('kg') setattr(S2, att, ('S2', )) S12 = PosetProduct((S1, S2)) names = get_names_used(S12) assert names == [('S1', ), ('S2', )], names P = parse_poset('J x W') setattr(P, att, ('prod', )) S, _pack, _unpack = get_product_compact(P, S12) print S.__repr__() assert get_names_used(S) == [('prod', ), ('S1', ), ('S2', )]
def check_get_names_used1(): # . L . . . . . . . \ Parallel2 % R[kg]×(R[N]×R[N]) -> R[kg]×R[W] I = PosetProduct(R[kg],PosetProduct(R[N],R[N]){actuati # on/_prod1},R[N²]) names: [('actuation', '_prod1')] # . L . . . . . . . . \ Id(R[kg]) I = R[kg] # . L . . . . . . . . \ Series: % R[N]×R[N] -> R[W] I = PosetProduct(PosetProduct(R[N],R[N]){actuation/_prod1},R[N²]) nam # es: [('actuation', '_prod1'), ('actuation', '_mult1')] # . L . . . . . . . . . \ ProductN(R[N]×R[N] -> R[N²]) named: ('actuation', '_prod1') I = PosetProduct(R[N],R[N]) # . L . . . . . . . . . \ GenericUnary(<mcdp_lang.misc_math.MultValue instance at 0x10d8dcbd8>) named: ('actuation', '_mult1 # ') I = R[N²] S1 = parse_poset('N') setattr(S1, ATTRIBUTE_NDP_RECURSIVE_NAME, ('S1',)) S2 = parse_poset('kg') setattr(S2, ATTRIBUTE_NDP_RECURSIVE_NAME, ('S2',)) S12 = PosetProduct((S1, S2)) names = get_names_used(S12) assert names == [('S1',), ('S2',)], names P = parse_poset('J x W') setattr(P, ATTRIBUTE_NDP_RECURSIVE_NAME, ('prod',)) S, _pack, _unpack = get_product_compact(P, S12) print S.__repr__() assert get_names_used(S) == [('prod',), ('S1',), ('S2',)]
def _get_product(self): if not hasattr(self, 'prod'): self.prod = _, _, _ = get_product_compact(self.M1, self.M2) assert hasattr(self, 'prod') return self.prod