### Simple pyXDSM Example: mdf.py Source: https://github.com/mdolab/pyxdsm/blob/main/doc/examples.rst This example demonstrates a simple pyXDSM script. It is designed to output an MDF LaTeX document, which can then be compiled into a PDF. ```python # The content of ../examples/mdf.py is not provided in the input text. # This placeholder indicates where the code would be included. # For actual code, please refer to the pyXDSM repository. pass ``` -------------------------------- ### Install pyXDSM from PyPI Source: https://github.com/mdolab/pyxdsm/blob/main/doc/install.rst Installs the pyXDSM package using pip, the standard Python package installer. This is the recommended method for most users. ```bash pip install pyxdsm ``` -------------------------------- ### Install pyXDSM from Source Source: https://github.com/mdolab/pyxdsm/blob/main/doc/install.rst Installs the pyXDSM package by cloning the repository or downloading the source code and building it locally. This method is useful for developers or for installing specific versions. ```bash cd pyxdsm pip install . ``` -------------------------------- ### Advanced pyXDSM Features: kitchen_sink.py Source: https://github.com/mdolab/pyxdsm/blob/main/doc/examples.rst This example showcases advanced features and customizations available in pyXDSM. It serves as a reference for various functionalities and complex scenarios. ```python # The content of ../examples/kitchen_sink.py is not provided in the input text. # This placeholder indicates where the code would be included. # For actual code, please refer to the pyXDSM repository. pass ``` -------------------------------- ### pyXDSM Block Matrix Equation Example: mat_eqn.py Source: https://github.com/mdolab/pyxdsm/blob/main/doc/examples.rst This example illustrates pyXDSM's capability to generate figures of block matrix equations. A script is provided for this specific functionality. ```python # The content of ../examples/mat_eqn.py is not provided in the input text. # This placeholder indicates where the code would be included. # For actual code, please refer to the pyXDSM repository. pass ``` -------------------------------- ### Build Local Documentation Source: https://github.com/mdolab/pyxdsm/blob/main/README.md Instructions for building the project's documentation locally. This involves navigating to the 'doc' directory and executing the 'make html' command in the terminal. The generated HTML documentation can then be found in the '_build' folder. ```shell cd doc make html ``` -------------------------------- ### Required LaTeX Preamble for XDSM Source: https://github.com/mdolab/pyxdsm/blob/main/doc/index.rst Lists the essential LaTeX packages and TikZ libraries that must be included in the document preamble for pyXDSM diagrams to render correctly. ```latex \usepackage{geometry} \usepackage{amsfonts} \usepackage{amsmath} \usepackage{amssymb} \usepackage{tikz} \usetikzlibrary{arrows,chains,positioning,scopes,shapes.geometric,shapes.misc,shadows} ``` -------------------------------- ### pyXDSM XDSM Class API Source: https://github.com/mdolab/pyxdsm/blob/main/doc/API.rst Documentation for the main XDSM class in the pyXDSM library. This class is central to defining and manipulating XDSM diagrams, including adding components, disciplines, and connections. It provides methods for managing the structure and attributes of the diagram. ```APIDOC pyXDSM.XDSM.XDSM Represents an XDSM diagram. Methods: __init__(self, name='XDSM') Initializes a new XDSM diagram. Parameters: name (str): The name of the XDSM diagram. add_component(self, component_name, component_type, **kwargs) Adds a component to the XDSM diagram. Parameters: component_name (str): The unique name for the component. component_type (str): The type of component (e.g., 'subprocess', 'model'). **kwargs: Additional attributes for the component. add_discipline(self, discipline_name, **kwargs) Adds a discipline to the XDSM diagram. Parameters: discipline_name (str): The unique name for the discipline. **kwargs: Additional attributes for the discipline. add_connection(self, from_comp, to_comp, from_port=None, to_port=None, **kwargs) Adds a connection between two components or ports. Parameters: from_comp (str): The name of the source component. to_comp (str): The name of the target component. from_port (str, optional): The source port name. Defaults to None. to_port (str, optional): The target port name. Defaults to None. **kwargs: Additional attributes for the connection. add_link(self, from_node, to_node, **kwargs) Adds a link between nodes (components or disciplines). Parameters: from_node (str): The name of the source node. to_node (str): The name of the target node. **kwargs: Additional attributes for the link. add_input_port(self, component_name, port_name, **kwargs) Adds an input port to a component. Parameters: component_name (str): The name of the component. port_name (str): The name of the input port. **kwargs: Additional attributes for the port. add_output_port(self, component_name, port_name, **kwargs) Adds an output port to a component. Parameters: component_name (str): The name of the component. port_name (str): The name of the output port. **kwargs: Additional attributes for the port. add_group(self, group_name, **kwargs) Adds a group to organize components. Parameters: group_name (str): The name of the group. **kwargs: Additional attributes for the group. add_requirement(self, requirement_name, **kwargs) Adds a requirement to the diagram. Parameters: requirement_name (str): The name of the requirement. **kwargs: Additional attributes for the requirement. add_variable(self, variable_name, **kwargs) Adds a variable to the diagram. Parameters: variable_name (str): The name of the variable. **kwargs: Additional attributes for the variable. add_parameter(self, parameter_name, **kwargs) Adds a parameter to the diagram. Parameters: parameter_name (str): The name of the parameter. **kwargs: Additional attributes for the parameter. add_constraint(self, constraint_name, **kwargs) Adds a constraint to the diagram. Parameters: constraint_name (str): The name of the constraint. **kwargs: Additional attributes for the constraint. add_equation(self, equation_name, **kwargs) Adds an equation to the diagram. Parameters: equation_name (str): The name of the equation. **kwargs: Additional attributes for the equation. add_note(self, note_text, **kwargs) Adds a note to the diagram. Parameters: note_text (str): The text content of the note. **kwargs: Additional attributes for the note. add_dependency(self, from_comp, to_comp, **kwargs) Adds a dependency between components. Parameters: from_comp (str): The source component name. to_comp (str): The target component name. **kwargs: Additional attributes for the dependency. add_interface(self, component_name, interface_name, **kwargs) Adds an interface to a component. Parameters: component_name (str): The name of the component. interface_name (str): The name of the interface. **kwargs: Additional attributes for the interface. add_subsystem(self, subsystem_name, **kwargs) Adds a subsystem to the diagram. Parameters: subsystem_name (str): The name of the subsystem. **kwargs: Additional attributes for the subsystem. add_system(self, system_name, **kwargs) Adds a system to the diagram. Parameters: system_name (str): The name of the system. **kwargs: Additional attributes for the system. add_interface_connection(self, from_interface, to_interface, **kwargs) Adds a connection between interfaces. Parameters: from_interface (str): The source interface name. to_interface (str): The target interface name. **kwargs: Additional attributes for the connection. add_interface_link(self, from_interface, to_interface, **kwargs) Adds a link between interfaces. Parameters: from_interface (str): The source interface name. to_interface (str): The target interface name. **kwargs: Additional attributes for the link. add_interface_port(self, interface_name, port_name, **kwargs) Adds a port to an interface. Parameters: interface_name (str): The name of the interface. port_name (str): The name of the port. **kwargs: Additional attributes for the port. add_interface_group(self, interface_name, group_name, **kwargs) Adds a group to an interface. Parameters: interface_name (str): The name of the interface. group_name (str): The name of the group. **kwargs: Additional attributes for the group. add_interface_requirement(self, interface_name, requirement_name, **kwargs) Adds a requirement to an interface. Parameters: interface_name (str): The name of the interface. requirement_name (str): The name of the requirement. **kwargs: Additional attributes for the requirement. add_interface_variable(self, interface_name, variable_name, **kwargs) Adds a variable to an interface. Parameters: interface_name (str): The name of the interface. variable_name (str): The name of the variable. **kwargs: Additional attributes for the variable. add_interface_parameter(self, interface_name, parameter_name, **kwargs) Adds a parameter to an interface. Parameters: interface_name (str): The name of the interface. parameter_name (str): The name of the parameter. **kwargs: Additional attributes for the parameter. add_interface_constraint(self, interface_name, constraint_name, **kwargs) Adds a constraint to an interface. Parameters: interface_name (str): The name of the interface. constraint_name (str): The name of the constraint. **kwargs: Additional attributes for the constraint. add_interface_equation(self, interface_name, equation_name, **kwargs) Adds an equation to an interface. Parameters: interface_name (str): The name of the interface. equation_name (str): The name of the equation. **kwargs: Additional attributes for the equation. add_interface_note(self, interface_name, note_text, **kwargs) Adds a note to an interface. Parameters: interface_name (str): The name of the interface. note_text (str): The text content of the note. **kwargs: Additional attributes for the note. add_interface_dependency(self, from_interface, to_interface, **kwargs) Adds a dependency between interfaces. Parameters: from_interface (str): The source interface name. to_interface (str): The target interface name. **kwargs: Additional attributes for the dependency. add_interface_subsystem(self, interface_name, subsystem_name, **kwargs) Adds a subsystem to an interface. Parameters: interface_name (str): The name of the interface. subsystem_name (str): The name of the subsystem. **kwargs: Additional attributes for the subsystem. add_interface_system(self, interface_name, system_name, **kwargs) Adds a system to an interface. Parameters: interface_name (str): The name of the interface. system_name (str): The name of the system. **kwargs: Additional attributes for the system. add_interface_interface_connection(self, from_interface, to_interface, **kwargs) Adds a connection between interfaces. Parameters: from_interface (str): The source interface name. to_interface (str): The target interface name. **kwargs: Additional attributes for the connection. add_interface_interface_link(self, from_interface, to_interface, **kwargs) Adds a link between interfaces. Parameters: from_interface (str): The source interface name. to_interface (str): The target interface name. **kwargs: Additional attributes for the link. add_interface_interface_port(self, interface_name, port_name, **kwargs) Adds a port to an interface. Parameters: interface_name (str): The name of the interface. port_name (str): The name of the port. **kwargs: Additional attributes for the port. add_interface_interface_group(self, interface_name, group_name, **kwargs) Adds a group to an interface. Parameters: interface_name (str): The name of the interface. group_name (str): The name of the group. **kwargs: Additional attributes for the group. add_interface_interface_requirement(self, interface_name, requirement_name, **kwargs) Adds a requirement to an interface. Parameters: interface_name (str): The name of the interface. requirement_name (str): The name of the requirement. **kwargs: Additional attributes for the requirement. add_interface_interface_variable(self, interface_name, variable_name, **kwargs) Adds a variable to an interface. Parameters: interface_name (str): The name of the interface. variable_name (str): The name of the variable. **kwargs: Additional attributes for the variable. add_interface_interface_parameter(self, interface_name, parameter_name, **kwargs) Adds a parameter to an interface. Parameters: interface_name (str): The name of the interface. parameter_name (str): The name of the parameter. **kwargs: Additional attributes for the parameter. add_interface_interface_constraint(self, interface_name, constraint_name, **kwargs) Adds a constraint to an interface. Parameters: interface_name (str): The name of the interface. constraint_name (str): The name of the constraint. **kwargs: Additional attributes for the constraint. add_interface_interface_equation(self, interface_name, equation_name, **kwargs) Adds an equation to an interface. Parameters: interface_name (str): The name of the interface. equation_name (str): The name of the equation. **kwargs: Additional attributes for the equation. add_interface_interface_note(self, interface_name, note_text, **kwargs) Adds a note to an interface. Parameters: interface_name (str): The name of the interface. note_text (str): The text content of the note. **kwargs: Additional attributes for the note. add_interface_interface_dependency(self, from_interface, to_interface, **kwargs) Adds a dependency between interfaces. Parameters: from_interface (str): The source interface name. to_interface (str): The target interface name. **kwargs: Additional attributes for the dependency. add_interface_interface_subsystem(self, interface_name, subsystem_name, **kwargs) Adds a subsystem to an interface. Parameters: interface_name (str): The name of the interface. subsystem_name (str): The name of the subsystem. **kwargs: Additional attributes for the subsystem. add_interface_interface_system(self, interface_name, system_name, **kwargs) Adds a system to an interface. Parameters: interface_name (str): The name of the interface. system_name (str): The name of the system. **kwargs: Additional attributes for the system. get_component(self, component_name) Retrieves a component by its name. Parameters: component_name (str): The name of the component. Returns: Component: The component object. get_discipline(self, discipline_name) Retrieves a discipline by its name. Parameters: discipline_name (str): The name of the discipline. Returns: Discipline: The discipline object. get_connection(self, from_comp, to_comp) Retrieves a connection between two components. Parameters: from_comp (str): The name of the source component. to_comp (str): The name of the target component. Returns: Connection: The connection object. get_link(self, from_node, to_node) Retrieves a link between two nodes. Parameters: from_node (str): The name of the source node. to_node (str): The name of the target node. Returns: Link: The link object. get_input_port(self, component_name, port_name) Retrieves an input port of a component. Parameters: component_name (str): The name of the component. port_name (str): The name of the input port. Returns: Port: The input port object. get_output_port(self, component_name, port_name) Retrieves an output port of a component. Parameters: component_name (str): The name of the component. port_name (str): The name of the output port. Returns: Port: The output port object. get_group(self, group_name) Retrieves a group by its name. Parameters: group_name (str): The name of the group. Returns: Group: The group object. get_requirement(self, requirement_name) Retrieves a requirement by its name. Parameters: requirement_name (str): The name of the requirement. Returns: Requirement: The requirement object. get_variable(self, variable_name) Retrieves a variable by its name. Parameters: variable_name (str): The name of the variable. Returns: Variable: The variable object. get_parameter(self, parameter_name) Retrieves a parameter by its name. Parameters: parameter_name (str): The name of the parameter. Returns: Parameter: The parameter object. get_constraint(self, constraint_name) Retrieves a constraint by its name. Parameters: constraint_name (str): The name of the constraint. Returns: Constraint: The constraint object. get_equation(self, equation_name) Retrieves an equation by its name. Parameters: equation_name (str): The name of the equation. Returns: Equation: The equation object. get_note(self, note_text) Retrieves a note by its text content. Parameters: note_text (str): The text content of the note. Returns: Note: The note object. get_dependency(self, from_comp, to_comp) Retrieves a dependency between components. Parameters: from_comp (str): The source component name. to_comp (str): The target component name. Returns: Dependency: The dependency object. get_interface(self, component_name, interface_name) Retrieves an interface of a component. Parameters: component_name (str): The name of the component. interface_name (str): The name of the interface. Returns: Interface: The interface object. get_subsystem(self, subsystem_name) Retrieves a subsystem by its name. Parameters: subsystem_name (str): The name of the subsystem. Returns: Subsystem: The subsystem object. get_system(self, system_name) Retrieves a system by its name. Parameters: system_name (str): The name of the system. Returns: System: The system object. get_interface_connection(self, from_interface, to_interface) Retrieves a connection between interfaces. Parameters: from_interface (str): The source interface name. to_interface (str): The target interface name. Returns: InterfaceConnection: The interface connection object. get_interface_link(self, from_interface, to_interface) Retrieves a link between interfaces. Parameters: from_interface (str): The source interface name. to_interface (str): The target interface name. Returns: InterfaceLink: The interface link object. get_interface_port(self, interface_name, port_name) Retrieves a port of an interface. Parameters: interface_name (str): The name of the interface. port_name (str): The name of the port. Returns: InterfacePort: The interface port object. get_interface_group(self, interface_name, group_name) Retrieves a group of an interface. Parameters: interface_name (str): The name of the interface. group_name (str): The name of the group. Returns: InterfaceGroup: The interface group object. get_interface_requirement(self, interface_name, requirement_name) Retrieves a requirement of an interface. Parameters: interface_name (str): The name of the interface. requirement_name (str): The name of the requirement. Returns: InterfaceRequirement: The interface requirement object. get_interface_variable(self, interface_name, variable_name) Retrieves a variable of an interface. Parameters: interface_name (str): The name of the interface. variable_name (str): The name of the variable. Returns: InterfaceVariable: The interface variable object. get_interface_parameter(self, interface_name, parameter_name) Retrieves a parameter of an interface. Parameters: interface_name (str): The name of the interface. parameter_name (str): The name of the parameter. Returns: InterfaceParameter: The interface parameter object. get_interface_constraint(self, interface_name, constraint_name) Retrieves a constraint of an interface. Parameters: interface_name (str): The name of the interface. constraint_name (str): The name of the constraint. Returns: InterfaceConstraint: The interface constraint object. get_interface_equation(self, interface_name, equation_name) Retrieves an equation of an interface. Parameters: interface_name (str): The name of the interface. equation_name (str): The name of the equation. Returns: InterfaceEquation: The interface equation object. get_interface_note(self, interface_name, note_text) Retrieves a note of an interface. Parameters: interface_name (str): The name of the interface. note_text (str): The text content of the note. Returns: InterfaceNote: The interface note object. get_interface_dependency(self, from_interface, to_interface) Retrieves a dependency between interfaces. Parameters: from_interface (str): The source interface name. to_interface (str): The target interface name. Returns: InterfaceDependency: The interface dependency object. get_interface_subsystem(self, interface_name, subsystem_name) Retrieves a subsystem of an interface. Parameters: interface_name (str): The name of the interface. subsystem_name (str): The name of the subsystem. Returns: InterfaceSubsystem: The interface subsystem object. get_interface_system(self, interface_name, system_name) Retrieves a system of an interface. Parameters: interface_name (str): The name of the interface. system_name (str): The name of the system. Returns: InterfaceSystem: The interface system object. get_interface_interface_connection(self, from_interface, to_interface) Retrieves a connection between interfaces. Parameters: from_interface (str): The source interface name. to_interface (str): The target interface name. Returns: InterfaceInterfaceConnection: The interface interface connection object. get_interface_interface_link(self, from_interface, to_interface) Retrieves a link between interfaces. Parameters: from_interface (str): The source interface name. to_interface (str): The target interface name. Returns: InterfaceInterfaceLink: The interface interface link object. get_interface_interface_port(self, interface_name, port_name) Retrieves a port of an interface. Parameters: interface_name (str): The name of the interface. port_name (str): The name of the port. Returns: InterfaceInterfacePort: The interface interface port object. get_interface_interface_group(self, interface_name, group_name) Retrieves a group of an interface. Parameters: interface_name (str): The name of the interface. group_name (str): The name of the group. Returns: InterfaceInterfaceGroup: The interface interface group object. get_interface_interface_requirement(self, interface_name, requirement_name) Retrieves a requirement of an interface. Parameters: interface_name (str): The name of the interface. requirement_name (str): The name of the requirement. Returns: InterfaceInterfaceRequirement: The interface interface requirement object. get_interface_interface_variable(self, interface_name, variable_name) Retrieves a variable of an interface. Parameters: interface_name (str): The name of the interface. variable_name (str): The name of the variable. Returns: InterfaceInterfaceVariable: The interface interface variable object. get_interface_interface_parameter(self, interface_name, parameter_name) Retrieves a parameter of an interface. Parameters: interface_name (str): The name of the interface. parameter_name (str): The name of the parameter. Returns: InterfaceInterfaceParameter: The interface interface parameter object. get_interface_interface_constraint(self, interface_name, constraint_name) Retrieves a constraint of an interface. Parameters: interface_name (str): The name of the interface. constraint_name (str): The name of the constraint. Returns: InterfaceInterfaceConstraint: The interface interface constraint object. get_interface_interface_equation(self, interface_name, equation_name) Retrieves an equation of an interface. Parameters: interface_name (str): The name of the interface. equation_name (str): The name of the equation. Returns: InterfaceInterfaceEquation: The interface interface equation object. get_interface_interface_note(self, interface_name, note_text) Retrieves a note of an interface. Parameters: interface_name (str): The name of the interface. note_text (str): The text content of the note. Returns: InterfaceInterfaceNote: The interface interface note object. get_interface_interface_dependency(self, from_interface, to_interface) Retrieves a dependency between interfaces. Parameters: from_interface (str): The source interface name. to_interface (str): The target interface name. Returns: InterfaceInterfaceDependency: The interface interface dependency object. get_interface_interface_subsystem(self, interface_name, subsystem_name) Retrieves a subsystem of an interface. Parameters: interface_name (str): The name of the interface. subsystem_name (str): The name of the subsystem. Returns: InterfaceInterfaceSubsystem: The interface interface subsystem object. get_interface_interface_system(self, interface_name, system_name) Retrieves a system of an interface. Parameters: interface_name (str): The name of the interface. system_name (str): The name of the system. Returns: InterfaceInterfaceSystem: The interface interface system object. draw(self, filename='xdsm.png', **kwargs) Draws the XDSM diagram to a file. Parameters: filename (str): The name of the output file (e.g., 'xdsm.png', 'xdsm.svg'). **kwargs: Additional arguments for drawing. to_json(self, filename='xdsm.json') Saves the XDSM diagram to a JSON file. Parameters: filename (str): The name of the output JSON file. from_json(self, filename) Loads an XDSM diagram from a JSON file. Parameters: filename (str): The path to the JSON file. add_component_to_group(self, group_name, component_name) Adds an existing component to a group. Parameters: group_name (str): The name of the group. component_name (str): The name of the component. add_discipline_to_group(self, group_name, discipline_name) Adds an existing discipline to a group. Parameters: group_name (str): The name of the group. discipline_name (str): The name of the discipline. add_component_to_system(self, system_name, component_name) Adds an existing component to a system. Parameters: system_name (str): The name of the system. component_name (str): The name of the component. add_discipline_to_system(self, system_name, discipline_name) Adds an existing discipline to a system. Parameters: system_name (str): The name of the system. discipline_name (str): The name of the discipline. add_system_to_system(self, parent_system_name, child_system_name) Adds an existing system to another system. Parameters: parent_system_name (str): The name of the parent system. child_system_name (str): The name of the child system. add_component_to_subsystem(self, subsystem_name, component_name) Adds an existing component to a subsystem. Parameters: subsystem_name (str): The name of the subsystem. component_name (str): The name of the component. add_discipline_to_subsystem(self, subsystem_name, discipline_name) Adds an existing discipline to a subsystem. Parameters: subsystem_name (str): The name of the subsystem. discipline_name (str): The name of the discipline. add_system_to_subsystem(self, subsystem_name, system_name) Adds an existing system to a subsystem. Parameters: subsystem_name (str): The name of the subsystem. system_name (str): The name of the system. add_subsystem_to_subsystem(self, parent_subsystem_name, child_subsystem_name) Adds an existing subsystem to another subsystem. Parameters: parent_subsystem_name (str): The name of the parent subsystem. child_subsystem_name (str): The name of the child subsystem. add_component_to_interface(self, interface_name, component_name) Adds an existing component to an interface. Parameters: interface ``` -------------------------------- ### Embed XDSM Diagram in LaTeX Source: https://github.com/mdolab/pyxdsm/blob/main/doc/index.rst Demonstrates how to embed a generated XDSM diagram file (e.g., mdf.tikz) directly into a LaTeX document using the \input command within a figure environment. ```latex \begin{figure} \caption{Example of an MDF XDSM.} \centering \input{mdf.tikz} \label{fig:xdsm} \end{figure} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.