示例#1
0
文件: light.py 项目: DrXav/scanalea
def caribu(scene, source = (1,(0,0,-1)), infinity=False):
    c_scene = CaribuScene()
    idmap = c_scene.add_Shapes(scene)
    c_scene.addSources(source)
    output = c_scene.runCaribu(infinity=infinity)
    results = c_scene.output_by_id(output, idmap)['Eabsm2']
    return c_scene, results
示例#2
0
def run_caribu(sources, scene_geometry, output_by_triangle=False):
    """ 
    Calls Caribu for differents energy sources

    :Parameters:
    ------------
    - `sources` (int)
    - `scene_geometry`
    - `output_by_triangle` (bool) 
        Default 'False'. Return is done by id of geometry. If 'True', return is done by triangle. 

    :Returns:
    ---------
    - 'out_moy' (dict)
        A dict of intercepted variable (energy) per id
    - 'out_tri' (dict) only if output_by_triangle = True, return a tuple (out_moy, out_tri)
        A dict of intercepted variable (energy) per triangle
    """
    c_scene = CaribuScene()
    shapes = [geom2shape(k, v) for k, v in scene_geometry.items()]
    idmap = c_scene.add_Shapes(shapes)
    c_scene.addSources(sources)
    output = c_scene.runCaribu(infinity=False)
    out_moy = c_scene.output_by_id(output, idmap)
    if output_by_triangle:
        out_tri = c_scene.output_by_id(output, idmap, aggregate=False)
        indices = c_scene.scene_ids
        return out_moy, out_tri, indices
    else:
        return out_moy
示例#3
0
def run_caribu(sources, scene_geometry, output_by_triangle = False):
    """ 
    Calls Caribu for differents energy sources

    :Parameters:
    ------------
    - `sources` (int)
    - `scene_geometry`
    - `output_by_triangle` (bool) 
        Default 'False'. Return is done by id of geometry. If 'True', return is done by triangle. 

    :Returns:
    ---------
    - 'out_moy' (dict)
        A dict of intercepted variable (energy) per id
    - 'out_tri' (dict) only if output_by_triangle = True, return a tuple (out_moy, out_tri)
        A dict of intercepted variable (energy) per triangle
    """
    c_scene = CaribuScene()
    shapes=[geom2shape(k,v) for k,v in scene_geometry.iteritems()]
    idmap = c_scene.add_Shapes(shapes)    
    c_scene.addSources(sources)
    output = c_scene.runCaribu(infinity=False)
    out_moy = c_scene.output_by_id(output, idmap)
    if output_by_triangle:
        out_tri = c_scene.output_by_id(output, idmap, aggregate = False)
        indices = c_scene.scene_ids
        return out_moy, out_tri, indices
    else:
        return out_moy
示例#4
0
def caribu(scene, source=(1, (0, 0, -1)), infinity=False):
    c_scene = CaribuScene()
    idmap = c_scene.add_Shapes(scene)
    c_scene.addSources(source)
    output = c_scene.runCaribu(infinity=infinity)
    results = c_scene.output_by_id(output, idmap)['Eabsm2']
    return c_scene, results
示例#5
0
 def compute_exposed_area(slices):
     cyl = Cylinder(radius, height, False, slices)
     cyl_rotated = AxisRotated((0, 1, 0), pi / 2., cyl)
     scene = {1: cyl_rotated}
     sources = diffuse_source(1)
     c_scene = CaribuScene()
     idmap = c_scene.add_Shapes(scene)
     c_scene.addSources(sources)
     output = c_scene.runCaribu(infinity=False)
     out = c_scene.output_by_id(output, idmap)
     star = out['Ei'].values()[0]
     area = out['Area'].values()[0]
     exposed_area = star * area
     return exposed_area
示例#6
0
 def compute_exposed_area(slices):
     cyl = Cylinder(radius, height, False, slices)
     cyl_rotated = AxisRotated((0,1,0), pi/2., cyl)
     scene = {1: cyl_rotated}
     sources = diffuse_source(1)
     c_scene = CaribuScene()
     idmap = c_scene.add_Shapes(scene)
     c_scene.addSources(sources)
     output = c_scene.runCaribu(infinity=False)
     out = c_scene.output_by_id(output, idmap)
     star = out['Ei'].values()[0]
     area = out['Area'].values()[0]
     exposed_area = star * area
     return exposed_area