Ejemplo n.º 1
0
def main(
    xblocks: int = Argument(..., help='Number of blocks in x direction.'),
    yblocks: int = Argument(..., help='Number of blocks in y direction.'),
    snapshots: int = Argument(
        ...,
        help=
        'Number of snapshots for basis generation per component. In total SNAPSHOTS^(XBLOCKS * YBLOCKS).'
    ),
    rbsize: int = Argument(..., help='Size of the reduced basis.'),
    grid: int = Option(60, help='Use grid with 2*NI*NI elements.'),
    product: Choices('euclidean h1') = Option(
        'h1',
        help=
        'Product w.r.t. which to orthonormalize and calculate Riesz representatives.'
    ),
    testing: bool = Option(
        False,
        help='Load the gui and exit right away (for functional testing).'),
):
    """Thermalblock demo with GUI."""

    if not testing:
        app = QtWidgets.QApplication(sys.argv)
        win = RBGui(xblocks, yblocks, snapshots, rbsize, grid, product)
        win.show()
        sys.exit(app.exec_())

    from pymor.discretizers.builtin.gui import qt
    qt._launch_qt_app(
        lambda: RBGui(xblocks, yblocks, snapshots, rbsize, grid, product),
        block=False)
Ejemplo n.º 2
0
        self.rom, self.reductor = greedy_data['rom'], reductor
        self.first = False

    def solve(self, mu):
        if self.first:
            self._first()
        return self.reductor.reconstruct(self.rom.solve(mu))


# noinspection PyShadowingNames
class DetailedSim(SimBase):
    def __init__(self, args):
        super().__init__(args)
        self.m.disable_caching()

    def solve(self, mu):
        return self.m.solve(mu)


if __name__ == '__main__':
    args = docopt(__doc__)
    testing = args['--testing']
    if not testing:
        app = QtWidgets.QApplication(sys.argv)
        win = RBGui(args)
        win.show()
        sys.exit(app.exec_())

    from pymor.discretizers.builtin.gui import qt
    qt._launch_qt_app(lambda: RBGui(args), block=False)