diff --git a/frads/__init__.py b/frads/__init__.py index 31d0f67..05c92ce 100755 --- a/frads/__init__.py +++ b/frads/__init__.py @@ -82,7 +82,16 @@ from .utils import gen_grid, unpack_primitives -from .window import create_glazing_system, Gap, Gas, GlazingSystem, AIR, ARGON, KRYPTON, XENON +from .window import ( + create_glazing_system, + Gap, + Gas, + GlazingSystem, + AIR, + ARGON, + KRYPTON, + XENON, +) __version__ = "1.1.0" diff --git a/frads/methods.py b/frads/methods.py index e056e2e..b5df323 100755 --- a/frads/methods.py +++ b/frads/methods.py @@ -45,7 +45,6 @@ from scipy.sparse import csr_matrix - logger: logging.Logger = logging.getLogger("frads.methods") @@ -840,11 +839,20 @@ def generate_matrices(self, view_matrices: bool = True): return if view_matrices: for _, mtx in self.view_window_matrices.items(): - mtx.generate(self.config.settings.view_window_matrix) + mtx.generate( + self.config.settings.view_window_matrix, + nproc=self.config.settings.num_processors, + ) for _, mtx in self.sensor_window_matrices.items(): - mtx.generate(self.config.settings.sensor_window_matrix) + mtx.generate( + self.config.settings.sensor_window_matrix, + nproc=self.config.settings.num_processors, + ) for _, mtx in self.daylight_matrices.items(): - mtx.generate(self.config.settings.daylight_matrix) + mtx.generate( + self.config.settings.daylight_matrix, + nproc=self.config.settings.num_processors, + ) if self.config.settings.save_matrices: self.save_matrices() @@ -1042,14 +1050,16 @@ def calculate_edgps( """ # generate octree with bsdf stdins = [] - stdins.append(gen_perez_sky( - date_time, - self.wea_metadata.latitude, - self.wea_metadata.longitude, - self.wea_metadata.timezone, - dirnorm=dni, - diffhor=dhi, - )) + stdins.append( + gen_perez_sky( + date_time, + self.wea_metadata.latitude, + self.wea_metadata.longitude, + self.wea_metadata.timezone, + dirnorm=dni, + diffhor=dhi, + ) + ) for wname, sname in bsdf.items(): if (_gms := self.config.model.materials.glazing_materials) != {}: gmaterial = _gms[sname] @@ -1342,12 +1352,22 @@ def generate_matrices(self): logger.info("Generating matrices...") logger.info("Step 1/5: Generating view matrices...") for mtx in self.view_window_matrices.values(): - mtx.generate(self.config.settings.view_window_matrix, memmap=True) + mtx.generate( + self.config.settings.view_window_matrix, + memmap=True, + nproc=self.config.settings.num_processors, + ) for mtx in self.sensor_window_matrices.values(): - mtx.generate(self.config.settings.sensor_window_matrix) + mtx.generate( + self.config.settings.sensor_window_matrix, + nproc=self.config.settings.num_processors, + ) logger.info("Step 2/5: Generating daylight matrices...") for mtx in self.daylight_matrices.values(): - mtx.generate(self.config.settings.daylight_matrix) + mtx.generate( + self.config.settings.daylight_matrix, + nproc=self.config.settings.num_processors, + ) logger.info("Step 3/5: Generating direct view matrices...") for _, mtx in self.view_window_direct_matrices.items(): mtx.generate(["-ab", "1"], sparse=True) diff --git a/frads/window.py b/frads/window.py index e0fcc58..3fc2773 100644 --- a/frads/window.py +++ b/frads/window.py @@ -151,7 +151,6 @@ def from_json(cls, path: Union[str, Path]): gap_instances.append(Gap(gas=gas_instances, **gap)) return cls(layers=layer_instances, gaps=gap_instances, **data) - def get_brtdfunc(self) -> pr.Primitive: """Get a BRTDfunc primitive for the glazing system.""" if any(layer.product_type != "glazing" for layer in self.layers):