pyviewfactor 0.1.10__tar.gz → 0.1.11__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.
Files changed (23) hide show
  1. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/PKG-INFO +1 -1
  2. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/pyviewfactor/_version.py +1 -1
  3. pyviewfactor-0.1.10/pyviewfactor/LAST_BKP_nanpyviewfactor.py → pyviewfactor-0.1.11/pyviewfactor/pyviewfactor.py +23 -19
  4. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/pyviewfactor.egg-info/PKG-INFO +1 -1
  5. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/pyviewfactor.egg-info/SOURCES.txt +1 -1
  6. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/LICENSE.txt +0 -0
  7. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/README.md +0 -0
  8. /pyviewfactor-0.1.10/pyviewfactor/pyviewfactor.py → /pyviewfactor-0.1.11/pyviewfactor/11pyviewfactor.py +0 -0
  9. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/pyviewfactor/OLD.py +0 -0
  10. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/pyviewfactor/__init__.py +0 -0
  11. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/pyviewfactor/pyviewfactor_906.py +0 -0
  12. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/pyviewfactor/pyviewfactor_v1.py +0 -0
  13. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/pyviewfactor/pyviewfactor_vis_obs_OK.py +0 -0
  14. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/pyviewfactor/pyviewfactorv2.py +0 -0
  15. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/pyviewfactor.egg-info/dependency_links.txt +0 -0
  16. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/pyviewfactor.egg-info/requires.txt +0 -0
  17. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/pyviewfactor.egg-info/top_level.txt +0 -0
  18. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/setup.cfg +0 -0
  19. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/setup.py +0 -0
  20. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/test/__init__.py +0 -0
  21. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/test/test_utils.py +0 -0
  22. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/test/test_view_factor.py +0 -0
  23. {pyviewfactor-0.1.10 → pyviewfactor-0.1.11}/test/test_visibility_obstruction.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyviewfactor
3
- Version: 0.1.10
3
+ Version: 0.1.11
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, 10
2
+ version_info = 0, 1, 11
3
3
 
4
4
  # Nice string for the version
5
5
  __version__ = ".".join(map(str, version_info))
@@ -17,7 +17,7 @@ class ProcessedGeometry:
17
17
  A lightweight structure to cache face geometry (points, normals, centroids, area)
18
18
  for high-performance view factor computation.
19
19
  """
20
- def __init__(self, mesh, rounding_decimal=6):
20
+ def __init__(self, mesh, rounding_decimal=8):
21
21
  self.rounding_decimal = rounding_decimal
22
22
  self.N = mesh.n_cells
23
23
  self.points = []
@@ -41,7 +41,7 @@ class ProcessedGeometry:
41
41
  norm = np.cross(v1, v2)
42
42
  self.normals[i] = norm / np.linalg.norm(norm)
43
43
 
44
- self.areas[i] = 0.5 * np.linalg.norm(np.cross(pts[1] - pts[0], pts[2] - pts[0])) if pts.shape[0] == 3 else polygon_area(np.round(face.points, rounding_decimal))
44
+ self.areas[i] = polygon_area(np.round(face.points, rounding_decimal))
45
45
 
46
46
  def get_face(self, i):
47
47
  return self.points[i]
@@ -446,7 +446,7 @@ def trunc(values, decs=0):
446
446
  # #########################
447
447
 
448
448
  # Visibility
449
- def get_visibility(c1, c2, strict=False, print_warning=False, rounding_decimal=6):
449
+ def get_visibility(c1, c2, strict=False, print_warning=False, rounding_decimal=8):
450
450
  """Facets visibility:
451
451
 
452
452
  A test to check if two facets can "see" each other, taking the normals
@@ -544,7 +544,7 @@ def get_visibility(c1, c2, strict=False, print_warning=False, rounding_decimal=6
544
544
  return True, ""
545
545
 
546
546
 
547
- def get_visibility_from_cache(i, j, cache, strict=False, print_warning=False, rounding_decimal=6):
547
+ def get_visibility_from_cache(i, j, cache, strict=False, print_warning=False, rounding_decimal=8):
548
548
  """
549
549
  Check visibility (normals/orientation only) between faces i and j, using FaceCache.
550
550
  """
@@ -862,13 +862,13 @@ def _compute_viewfactor_gauss_legendre(pts1, pts2, constante):
862
862
  spq = scal[i, j]
863
863
  total += _integrand_gauss_legendre(nq, np_, sqpq, sqpp, spq, nqp)
864
864
  vf = max(0.0,total / constante)
865
-
865
+ return vf
866
866
 
867
867
 
868
868
  # #########################
869
869
  # MAIN INTEGRATION FUNCTION
870
870
 
871
- def compute_viewfactor(cell1, cell2, *, epsilon=1e-6, rounding_decimal=6):
871
+ def compute_viewfactor(cell1, cell2, *, epsilon=1e-6, rounding_decimal=8):
872
872
  """
873
873
  Compute the view factor between two planar facets, choosing the best integrator.
874
874
 
@@ -933,7 +933,7 @@ def compute_viewfactor(cell1, cell2, *, epsilon=1e-6, rounding_decimal=6):
933
933
 
934
934
 
935
935
  # @njit(parallel=True)
936
- def batch_compute_viewfactors(pts1_arr, nverts1, pts2_arr, nverts2, const_arr):
936
+ def batch_compute_viewfactors(pts1_arr, nverts1, pts2_arr, nverts2, const_arr, verbose=False):
937
937
  """
938
938
  Batch Gauss–Legendre view factor computation for arbitrary n-gon pairs.
939
939
 
@@ -958,7 +958,7 @@ def batch_compute_viewfactors(pts1_arr, nverts1, pts2_arr, nverts2, const_arr):
958
958
  N = pts1_arr.shape[0]
959
959
  vf = np.zeros(N, dtype=np.float64)
960
960
  # for k in prange(N):
961
- for k in tqdm(range(N), desc="GL integration", total=N):
961
+ for k in tqdm(range(N), desc="[PVF] > GL batch integration", total=N, disable=(not verbose)):
962
962
  n1 = nverts1[k]
963
963
  n2 = nverts2[k]
964
964
  VF = _compute_viewfactor_gauss_legendre(
@@ -1084,9 +1084,9 @@ def compute_viewfactor_matrix(
1084
1084
  skip_obstruction=False,
1085
1085
  strict_visibility=False,
1086
1086
  strict_obstruction=False,
1087
- rounding_decimal=6,
1087
+ rounding_decimal=8,
1088
1088
  epsilon=1e-6,
1089
- n_jobs=1
1089
+ verbose=False
1090
1090
  ):
1091
1091
  """
1092
1092
  Compute the full view-factor matrix for all faces in `mesh`.
@@ -1145,8 +1145,11 @@ def compute_viewfactor_matrix(
1145
1145
  disconnected_pairs.append((i, j))
1146
1146
 
1147
1147
  # TOUCHING: Each pair via dblquad, epsilon offset
1148
- print(f"> Touching pairs: {len(touching_pairs)}")
1149
- for i, j in tqdm(touching_pairs, desc="vis / obs / dblquad int. ", ):
1148
+ N_touching = len(touching_pairs)
1149
+ if verbose:
1150
+ print(f"\n[PVF] >>> Touching pairs: {N_touching}")
1151
+
1152
+ for i, j in tqdm(touching_pairs, desc="[PVF] > Vis, Obs & dblquad int.", disable=(not verbose), total=N_touching):
1150
1153
  # (A) Optional visibility test
1151
1154
  if not skip_visibility:
1152
1155
  vis, _ = get_visibility_from_cache(i, j, pg, strict=strict_visibility, rounding_decimal=rounding_decimal)
@@ -1180,10 +1183,11 @@ def compute_viewfactor_matrix(
1180
1183
  vf = _compute_viewfactor_dblquad(pts1, pts2_adj, constante)
1181
1184
  F[i, j] = vf
1182
1185
  if use_reciprocity:
1183
- F[j, i] = vf * (pg.get_area(i) / pg.get_area(j))
1186
+ F[j, i] = vf * (pg.get_area(j) / pg.get_area(i))
1184
1187
 
1185
1188
  # DISCONNECTED: Use batch Gauss-Legendre for speed
1186
- print(f"> Disconnected pairs (batch): {len(disconnected_pairs)}")
1189
+ if verbose:
1190
+ print(f"\n[PVF] >>> Disconnected pairs (batch): {len(disconnected_pairs)}")
1187
1191
  Kd = len(disconnected_pairs)
1188
1192
  if Kd > 0:
1189
1193
  max_v1 = max(pg.get_face(i).shape[0] for i, _ in disconnected_pairs)
@@ -1194,7 +1198,7 @@ def compute_viewfactor_matrix(
1194
1198
  nverts2 = np.zeros(Kd, dtype=np.int32)
1195
1199
  const_arr = np.zeros(Kd, dtype=np.float64)
1196
1200
  valid_mask = np.ones(Kd, dtype=bool)
1197
- for k, (i, j) in enumerate(tqdm(disconnected_pairs, desc="Batch vis / obs")):
1201
+ for k, (i, j) in enumerate(tqdm(disconnected_pairs, desc="[PVF] > Batch Vis / Obs", disable=(not verbose), total=Kd)):
1198
1202
  # (A) Optional visibility test
1199
1203
  if not skip_visibility:
1200
1204
  vis, _ = get_visibility_from_cache(i, j, pg, strict=strict_visibility, rounding_decimal=rounding_decimal)
@@ -1222,7 +1226,7 @@ def compute_viewfactor_matrix(
1222
1226
  const_arr[k] = 4.0 * np.pi * pg.get_area(j)
1223
1227
  # Batch computation (for all valid pairs)
1224
1228
  vf_arr = np.zeros(Kd, dtype=np.float64)
1225
-
1229
+
1226
1230
  idxs = np.flatnonzero(valid_mask)
1227
1231
  M = len(idxs)
1228
1232
  if M == 0:
@@ -1247,16 +1251,16 @@ def compute_viewfactor_matrix(
1247
1251
  packed_nverts1,
1248
1252
  packed_pts2,
1249
1253
  packed_nverts2,
1250
- packed_const
1254
+ packed_const,
1255
+ verbose=True
1251
1256
  )
1252
1257
  vf_arr[idxs] = vf_valid
1253
- print("> Actual batch computation")
1254
1258
  for idx, k in enumerate(idxs):
1255
1259
  i, j = disconnected_pairs[k]
1256
1260
  fij = vf_valid[idx]
1257
1261
  F[i, j] = fij
1258
1262
  if use_reciprocity:
1259
- F[j, i] = fij * (pg.get_area(i) / pg.get_area(j))
1263
+ F[j, i] = fij * (pg.get_area(j) / pg.get_area(i))
1260
1264
 
1261
1265
  return F
1262
1266
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyviewfactor
3
- Version: 0.1.10
3
+ Version: 0.1.11
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
@@ -2,7 +2,7 @@ LICENSE.txt
2
2
  README.md
3
3
  setup.cfg
4
4
  setup.py
5
- pyviewfactor/LAST_BKP_nanpyviewfactor.py
5
+ pyviewfactor/11pyviewfactor.py
6
6
  pyviewfactor/OLD.py
7
7
  pyviewfactor/__init__.py
8
8
  pyviewfactor/_version.py
File without changes
File without changes
File without changes
File without changes