Model#
- class modularbuildingpy.core._model.Model(name=None, directory=None, **kwargs)#
Bases:
objectThis is the main class for ModularBuildingPy. When it is initialized, it creates an instance of the following classes:
Analyze
Design (Not implemented yet!)
Generate
Material
PostProcess
Important
It is expected that the user will only instantiate this class. The user can access the instances of the
Analyze,Design,Generate,Material, andPostProcessclasses using the following methods:- get_post_process()#
Returns the instance of the
PostProcessclass.
- Parameters:
name (str) – Name of the model.
directory (str) – Path to save the files and results of the model.
- Keyword Arguments:
kwargs_logger (dict, optional) –
Keyword arguments for logger.
Available keywords:
console: Logging level for console. Default is"info".Available options are:
"debug","info","warning","error","critical"file: Logging level for file. Default is"debug".Available options are:
"debug","info","warning","error","critical"mode: Mode for file logging. Default is"w".Available options are:
"w"for write,"a"for append
kwargs_generate (dict, optional) –
Keyword arguments for Generate class.
Available keywords:
nprocs(int): Number of processes to use for parallel computing.
Warning
Currently, only
nprocs = 1is supported.nprocsgreater than 1 will be ignored.kwargs_analyze (dict, optional) –
Keyword arguments for Analyze class.
Available keywords:
nprocs(int): Number of processes to use for parallel computing.
Warning
Make sure that
nprocsis not greater than the number of cores in your computer. Otherwise, it will raise an error.kwargs_design (dict, optional) – Keyword arguments for Design class. Currently, this class is not implemented.
kwargs_postprocess (dict, optional) –
Keyword arguments for PostProcess class.
Available keywords:
nprocs(int): Number of processes to use for parallel computing.
Warning
Make sure that
nprocsis not greater than the number of cores in your computer. Otherwise, it will raise an error.
- Returns:
None
Examples
Here is an example of how to initialize Model class:
import modularbuildingpy as mbpy model = mbpy.Model( name="test", directory="/home/test", kwargs_logger={"console": "info", "file": "debug", "mode": "w"}, kwargs_generate={"nprocs": 1}, kwargs_analyze={"nprocs": 1}, kwargs_design={"nprocs": 1}, kwargs_postprocess={"nprocs": 1}, ) analyze = model.get_analyze() design = model.get_design() generate = model.get_generate() material = model.get_material() post_process = model.get_post_process()