generalization, now used for F_i
This commit is contained in:
parent
a98ae267a0
commit
aa215ff81e
|
@ -440,9 +440,10 @@ class ConfigMaterial(Config):
|
||||||
"""
|
"""
|
||||||
N,n,shaped = 1,1,{}
|
N,n,shaped = 1,1,{}
|
||||||
|
|
||||||
|
dim_map = {'O':-1,'F_i':-2}
|
||||||
for k,v in kwargs.items():
|
for k,v in kwargs.items():
|
||||||
shaped[k] = np.array(v)
|
shaped[k] = np.array(v)
|
||||||
s = shaped[k].shape[:-1] if k=='O' else shaped[k].shape
|
s = shaped[k].shape[:dim_map.get(k,None)]
|
||||||
N = max(N,s[0]) if len(s)>0 else N
|
N = max(N,s[0]) if len(s)>0 else N
|
||||||
n = max(n,s[1]) if len(s)>1 else n
|
n = max(n,s[1]) if len(s)>1 else n
|
||||||
|
|
||||||
|
@ -451,8 +452,9 @@ class ConfigMaterial(Config):
|
||||||
if 'v' not in kwargs:
|
if 'v' not in kwargs:
|
||||||
shaped['v'] = np.broadcast_to(1/n,(N,n))
|
shaped['v'] = np.broadcast_to(1/n,(N,n))
|
||||||
|
|
||||||
|
shape_map = {'O':(N,n,4),'F_i':(N,n,3,3)}
|
||||||
for k,v in shaped.items():
|
for k,v in shaped.items():
|
||||||
target = (N,n,4) if k=='O' else (N,n)
|
target = shape_map.get(k,(N,n))
|
||||||
obj = np.broadcast_to(v.reshape(util.shapeshifter(v.shape,target,mode='right')),target)
|
obj = np.broadcast_to(v.reshape(util.shapeshifter(v.shape,target,mode='right')),target)
|
||||||
for i in range(N):
|
for i in range(N):
|
||||||
if k in ['phase','O','v']:
|
if k in ['phase','O','v']:
|
||||||
|
|
Loading…
Reference in New Issue