gemseo.utils.xdsmizer module#
Creation of a XDSM diagram from a scenario.
The XDSMizer
generates a JSON file.
The latter is used by the XDSMjs javascript library to produce an interactive web XDSM and by the pyxdsm python library to produce TIKZ and PDF versions of the XDSM.
For more information, see: A. B. Lambe and J. R. R. A. Martins, “Extensions to the Design Structure Matrix for the Description of Multidisciplinary Design, Analysis, and Optimization Processes”, Structural and Multidisciplinary Optimization, vol. 46, no. 2, p. 273-284, 2012.
- class XDSMizer(discipline, hashref='root', level=0, expected_workflow=None)[source]#
Bases:
object
Build the XDSM diagram of a discipline as a JSON structure.
- Parameters:
discipline (Discipline) -- The discipline to be represented as an XDSM diagram.
hashref (str) --
The keyword used in the JSON structure to reference the dictionary data structure whose keys are "nodes", "edges", "workflow" and "optpb".
By default it is set to "root".
level (int) --
The depth of the scenario. Root scenario is level 0.
By default it is set to 0.
expected_workflow (BaseCompositeExecSequence | None) -- The expected workflow, describing the sequence of execution of the different disciplines (
Discipline
,Scenario
,BaseMDA
, etc.)
- initialize(workflow=None)[source]#
Initialize the XDSM from a workflow.
The initialization also creates sub-XDSM diagram accordingly.
- Parameters:
workflow (BaseCompositeExecSequence | None) -- The composite execution sequence. If
None
, use the scenario's one.- Return type:
None
- monitor(directory_path='.', file_name='xdsm', log_workflow_status=False, save_pdf=False)[source]#
Generate XDSM json file on process status update.
- Parameters:
directory_path (str | Path) --
The path of the directory to save the files.
By default it is set to ".".
file_name (str) --
The file name to be suffixed by a file extension.
By default it is set to "xdsm".
log_workflow_status (bool) --
Whether to log the evolution of the workflow's status.
By default it is set to False.
save_pdf (bool) --
Whether to save the XDSM as a PDF file.
By default it is set to False.
- Return type:
None
- run(directory_path='.', file_name='xdsm', show_html=False, save_html=True, save_json=False, save_pdf=False, pdf_build=True, pdf_cleanup=True, pdf_batchmode=True)[source]#
Generate a XDSM diagram of the
scenario
.By default, a self-contained HTML file is generated, that can be viewed in a browser.
- Parameters:
directory_path (str | Path) --
The path of the directory to save the files.
By default it is set to ".".
file_name (str) --
The file name to be suffixed by a file extension.
By default it is set to "xdsm".
show_html (bool) --
Whether to open the web browser and display the XDSM.
By default it is set to False.
save_html (bool) --
Whether to save the XDSM as a HTML file.
By default it is set to True.
save_json (bool) --
Whether to save the XDSM as a JSON file.
By default it is set to False.
save_pdf (bool) --
Whether to save the XDSM as a PDF file; use
save_pdf=True
andpdf_build=False
to generate thefile_name.tex
andfile_name.tikz
files without building the PDF file.By default it is set to False.
pdf_build (bool) --
Whether to generate the PDF file when
save_pdf
isTrue
.By default it is set to True.
pdf_cleanup (bool) --
Whether to clean up the intermediate files (
file_name.tex
,file_name.tikz
and built files) used to build the PDF file.By default it is set to True.
pdf_batchmode (bool) --
Whether pdflatex is run in batchmode.
By default it is set to True.
- Returns:
A XDSM diagram.
- Return type:
- update(atom)[source]#
Generate a new XDSM regarding the atom status update.
- Parameters:
atom (ExecutionSequence) -- The process which status is monitored.
- Return type:
None
- expand(wks, to_id)[source]#
Expand the workflow structure as an ids structure using to_id mapping.
The expansion preserve the structure while replacing the object by its id in all case except when a tuple is encountered as cdr then the expansion transforms loop[A, (B,C)] in [idA, {'parallel': [idB, idC]}].