pyviewfactor 0.1.1__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyviewfactor
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: A python library to calculate numerically exact radiation view factors between planar faces.
5
5
  Home-page: https://gitlab.com/arep-dev/pyViewFactor/
6
6
  Author: Mateusz BOGDAN, Edouard WALTHER, Marc ALECIAN, Mina CHAPON
@@ -1,5 +1,5 @@
1
1
  """Version info for pyViewFactor"""
2
- version_info = 0, 1, 1
2
+ version_info = 0, 1, 3
3
3
 
4
4
  # Nice string for the version
5
5
  __version__ = '.'.join(map(str, version_info))
@@ -82,7 +82,7 @@ def trunc(values, decs=0):
82
82
  return np.trunc(values * factor) / factor
83
83
 
84
84
 
85
- def get_visibility(c1, c2, strict=False, print_warning=False, rounding_decimal=1):
85
+ def get_visibility(c1, c2, strict=False, print_warning=False, rounding_decimal=6):
86
86
  """Facets visibility:
87
87
 
88
88
  A test to check if two facets can "see" each other, taking the normals
@@ -497,7 +497,7 @@ def compute_viewfactor_core(cell_1_points, cell_2_points,
497
497
  return total if total > 0 else 0.0
498
498
 
499
499
 
500
- def compute_viewfactor(cell_1, cell_2, epsilon=0.001, rounding_decimal=6):
500
+ def compute_viewfactor(cell_1, cell_2, epsilon=0.00001, rounding_decimal=6):
501
501
  """
502
502
  Compute the radiation view factor from cell_2 to cell_1 using contour integration.
503
503
 
@@ -553,8 +553,10 @@ def compute_viewfactor(cell_1, cell_2, epsilon=0.001, rounding_decimal=6):
553
553
 
554
554
 
555
555
  def compute_viewfactor_matrix(mesh, obstacle=None,
556
- use_reciprocity=True, visibility_kwargs=None,
557
- obstruction_kwargs=None, n_jobs=1):
556
+ use_reciprocity=True,
557
+ visibility_kwargs=None, obstruction_kwargs=None,
558
+ skip_visibility=False, skip_obstruction=False,
559
+ n_jobs=1):
558
560
  """
559
561
  Compute the view factor matrix for all faces in a mesh, skipping
560
562
  pairs that are not mutually visible or are obstructed.
@@ -637,21 +639,36 @@ def compute_viewfactor_matrix(mesh, obstacle=None,
637
639
 
638
640
  # Helper to compute a single pair
639
641
  def _compute_pair(i, j):
640
- f_i, f_j = faces[i], faces[j]
641
- # visibility
642
- vis, _ = get_visibility(f_i, f_j, **visibility_kwargs)
643
- if not vis:
644
- return (i, j, 0.0)
645
- # obstruction over all obstacles
646
- if obstacles and _is_blocked(f_i, f_j):
647
- return (i, j, 0.0)
648
- # compute view factor
642
+ """
643
+ Compute a single pair (i,j) in the view‐factor matrix:
644
+ - Optionally cull by visibility (skip_visibility)
645
+ - Optionally cull by one or more obstacles
646
+ - Compute F_ij and F_ji (via reciprocity or explicit)
647
+ Always returns (i, j, F_ij, F_ji).
648
+ """
649
+ f_i = faces[i]
650
+ f_j = faces[j]
651
+
652
+ # 1) Visibility cull
653
+ if not skip_visibility:
654
+ vis, _ = get_visibility(f_i, f_j, **(visibility_kwargs or {}))
655
+ if not vis:
656
+ return i, j, 0.0, 0.0
657
+
658
+ # 2) Obstruction cull (all obstacles must be clear)
659
+ if obstacles:
660
+ for obs in obstacles:
661
+ vis_obs, _ = get_obstruction(f_i, f_j, obs, **(obstruction_kwargs or {}))
662
+ if not vis_obs:
663
+ return i, j, 0.0, 0.0
664
+
665
+ # 3) Compute the view factor
649
666
  F_ij = compute_viewfactor(f_i, f_j)
650
667
  if use_reciprocity:
651
- F_ji = (areas[i] / areas[j]) * F_ij
668
+ F_ji = F_ij * (areas[i] / areas[j])
652
669
  else:
653
670
  F_ji = compute_viewfactor(f_j, f_i)
654
- return (i, j, F_ij, F_ji)
671
+ return i, j, F_ij, F_ji
655
672
 
656
673
  # Prepare all unique pairs
657
674
  pairs = [(i, j) for i in range(n) for j in range(i + 1, n)]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyviewfactor
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: A python library to calculate numerically exact radiation view factors between planar faces.
5
5
  Home-page: https://gitlab.com/arep-dev/pyViewFactor/
6
6
  Author: Mateusz BOGDAN, Edouard WALTHER, Marc ALECIAN, Mina CHAPON
File without changes
File without changes
File without changes
File without changes