Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:03

0001 #!/bin/bash -l 
0002 
0003 import numpy as np, textwrap
0004 from opticks.CSG.CSGFoundry import CSGFoundry
0005 
0006 if __name__ == '__main__':
0007     cf = CSGFoundry.Load("$FOLD") 
0008     print(repr(cf))
0009 
0010     boundary = cf.node[:,1,2].view(np.int32) 
0011 
0012     u_bnd, n_bnd = np.unique(boundary, return_counts=True )
0013     order = np.argsort(n_bnd)[::-1]
0014 
0015     bn = cf.sim.stree.standard.bnd_names
0016     l_bnd = bn[u_bnd]
0017 
0018     abn = cf.sim.stree.standard.bnd_names
0019     idx = np.arange(len(abn))
0020 
0021     compare_stree = False
0022     if compare_stree:
0023         ## compare bnd_names between the GGeo stree and the standard one
0024         ## TODO: get rid of the GGeo stree ?
0025         bbn = cf.sim.extra.GGeo.bnd_names
0026         wdif = np.where( abn != bbn )[0]   
0027         # same counts and isur suppression off no-RINDEX is the only difference when OSUR is disabled
0028         # large number of osur are different when OSUR is enabled
0029         assert len(abn) == len(bbn)
0030         EXPR = filter(None,textwrap.dedent(r"""
0031         np.c_[u_bnd,n_bnd,l_bnd][order]
0032         np.c_[idx,cf.sim.extra.GGeo.bnd_names,cf.sim.stree.standard.bnd_names]
0033         wdif
0034         np.c_[cf.sim.extra.GGeo.bnd_names,cf.sim.stree.standard.bnd_names][wdif]
0035         """).split())
0036     else:
0037         EXPR = filter(None,textwrap.dedent(r"""
0038         np.c_[u_bnd,n_bnd,l_bnd][order]
0039         np.c_[idx,cf.sim.stree.standard.bnd_names]
0040         """).split())
0041     pass
0042 
0043     for expr in EXPR:
0044         print("\n")
0045         print(expr)
0046         print(repr(eval(expr)))
0047     pass
0048     pass     
0049     print(cf.descSolids())   
0050 pass 
0051 
0052