Example #1
0
 def contains_convolve_call(cls, variable: VariableSymbol) -> bool:
     """
     Indicates whether the declaring rhs of this variable symbol has a convolve() in it.
     :return: True if contained, otherwise False.
     """
     if not variable.get_declaring_expression():
         return False
     else:
         for func in variable.get_declaring_expression().get_function_calls():
             if func.get_name() == PredefinedFunctions.CONVOLVE:
                 return True
     return False
Example #2
0
    def print_vector_declaration(self, variable: VariableSymbol) -> str:
        """
        Prints the vector declaration
        :param variable: Vector variable
        :return: the corresponding vector declaration statement
        """
        assert isinstance(variable, VariableSymbol), \
            '(PyNestML.CodeGeneration.Printer) No or wrong type of variable symbol provided (%s)!' % type(variable)

        decl_str = self.print_origin(variable) + variable.get_symbol_name() + \
            ".resize(" + self.print_vector_size_parameter(variable) + ", " + \
            self.print_expression(variable.get_declaring_expression()) + \
            ");"
        return decl_str