当前位置: 首页>>代码示例>>Python>>正文


Python ExprEvaluator._invalid_expression_error方法代码示例

本文整理汇总了Python中openmdao.main.expreval.ExprEvaluator._invalid_expression_error方法的典型用法代码示例。如果您正苦于以下问题:Python ExprEvaluator._invalid_expression_error方法的具体用法?Python ExprEvaluator._invalid_expression_error怎么用?Python ExprEvaluator._invalid_expression_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openmdao.main.expreval.ExprEvaluator的用法示例。


在下文中一共展示了ExprEvaluator._invalid_expression_error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from openmdao.main.expreval import ExprEvaluator [as 别名]
# 或者: from openmdao.main.expreval.ExprEvaluator import _invalid_expression_error [as 别名]
    def __init__(self, lhs, comparator, rhs, scope, jacs=None):
        self.lhs = ExprEvaluator(lhs, scope=scope)
        self._pseudo = None
        self.pcomp_name = None
        unresolved_vars = self.lhs.get_unresolved()

        if unresolved_vars:
            msg = "Left hand side of constraint '{0}' has invalid variables {1}"
            expression = ' '.join((lhs, comparator, rhs))

            raise ExprEvaluator._invalid_expression_error(unresolved_vars,
                                                          expr=expression,
                                                          msg=msg)
        self.rhs = ExprEvaluator(rhs, scope=scope)
        unresolved_vars = self.rhs.get_unresolved()

        if unresolved_vars:
            msg = "Right hand side of constraint '{0}' has invalid variables {1}"
            expression = ' '.join((lhs, comparator, rhs))

            raise ExprEvaluator._invalid_expression_error(unresolved_vars,
                                                          expr=expression,
                                                          msg=msg)
        self.comparator = comparator
        self._size = None

        # Linear flag: constraints are nonlinear by default
        self.linear = False

        # User-defined jacobian function
        self.jacs = jacs

        self._create_pseudo()
开发者ID:ChanChiChoi,项目名称:OpenMDAO-Framework,代码行数:35,代码来源:hasconstraints.py

示例2: __init__

# 需要导入模块: from openmdao.main.expreval import ExprEvaluator [as 别名]
# 或者: from openmdao.main.expreval.ExprEvaluator import _invalid_expression_error [as 别名]
    def __init__(self, lhs, comparator, rhs, scope):
        self.lhs = ExprEvaluator(lhs, scope=scope)
        unresolved_vars = self.lhs.get_unresolved()

        if unresolved_vars:
            msg = "Left hand side of constraint '{0}' has invalid variables {1}"
            expression = ' '.join([lhs, comparator, rhs])

            raise ExprEvaluator._invalid_expression_error(unresolved_vars, expr=expression, msg=msg)


        self.rhs = ExprEvaluator(rhs, scope=scope)
        unresolved_vars = self.rhs.get_unresolved()

        if unresolved_vars:
            msg = "Right hand side of constraint '{0}' has invalid variables {1}"
            expression = ' '.join([lhs, comparator, rhs])

            raise ExprEvaluator._invalid_expression_error(unresolved_vars, expr=expression, msg=msg)

        self.comparator = comparator
        self.pcomp_name = None
        self._size = None
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:25,代码来源:hasconstraints.py


注:本文中的openmdao.main.expreval.ExprEvaluator._invalid_expression_error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。