# -*- coding: utf-8 -*-
"""
  multipoint_beam_group.py generated by WhatsOpt 1.8.2
"""
from optparse import OptionParser
from openmdao.api import Problem
from openmdao.api import NonlinearBlockGS, ScipyKrylov

# from openmdao_extensions.reckless_nonlinear_block_gs import RecklessNonlinearBlockGS
from multipoint_beam_group_base import (
    MultipointBeamGroupBase,
    MultipointBeamGroupFactoryBase,
)


class MultipointBeamGroup(MultipointBeamGroupBase):
    """An OpenMDAO component to encapsulate MultipointBeamGroup analysis"""

    def __init__(self, **kwargs):
        super(MultipointBeamGroup, self).__init__(**kwargs)

        # Example of manual solver adjusments (imports should be adjusted accordingly)
        # self.nonlinear_solver = NewtonSolver()
        # self.nonlinear_solver.options['maxiter'] = 20
        # self.linear_solver = DirectSolver()

    def setup(self):
        super(MultipointBeamGroup, self).setup()


class MultipointBeamGroupFactory(MultipointBeamGroupFactoryBase):
    """A factory to create disciplines of MultipointBeamGroup analysis"""

    pass


if __name__ == "__main__":
    parser = OptionParser()
    parser.add_option(
        "-n",
        "--no-n2",
        action="store_false",
        dest="n2_view",
        default=True,
        help="display N2 openmdao viewer",
    )
    (options, args) = parser.parse_args()

    problem = Problem()
    problem.model = MultipointBeamGroup()

    problem.setup()
    problem.final_setup()

    if options.n2_view:
        from openmdao.visualization.n2_viewer.n2_viewer import n2

        n2(problem)
