cd4186d816ef7482e64fe66c671fba9578eae19b,brian2/codegen/generators/GSL_generator.py,GSLCodeGenerator,get_dimension_code,#GSLCodeGenerator#,122

Before Change


        end_function = self.get_syntax("end_function")
        code = "\n{start_function}int set_dimension(size_t * dimension){open_function}".format(start_function=start_function,
                                                                                            open_function=open_function)
        code += "\n\tdimension[0] = {diff_num}{end_statement}".format(diff_num=diff_num, end_statement=end_statement)
        code += "\n\treturn GSL_SUCCESS{end_statement}\n".format(end_statement=end_statement)
        code += end_function
        return code

    def yvector_code(self, diff_vars):
        start_function = self.get_syntax("start_function")
        open_function = self.get_syntax("open_function")

After Change


        return to_replace

    def get_dimension_code(self, diff_num):
        code = ["\n{start_function}int set_dimension(size_t * dimension){open_function}"]
        code += ["\tdimension[0] = %d{end_statement}"%diff_num]
        code += ["\treturn GSL_SUCCESS{end_statement}"]
        return ("\n").join(code).format(**self.syntax)

    def yvector_code(self, diff_vars):
        allocate_y = ["\n{start_function}double* assign_memory_y(){open_function}"]
        allocate_y += ["\treturn {open_cast}double *{close_cast} malloc(%d*sizeof(double))"%len(diff_vars)]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: brian-team/brian2
Commit Name: cd4186d816ef7482e64fe66c671fba9578eae19b
Time: 2017-07-20
Author: charleetje@gmail.com
File Name: brian2/codegen/generators/GSL_generator.py
Class Name: GSLCodeGenerator
Method Name: get_dimension_code


Project Name: brian-team/brian2
Commit Name: 25ca9c249fd3e11bb166b42ffeb2433036964bd1
Time: 2017-07-05
Author: charleetje@gmail.com
File Name: brian2/codegen/generators/GSL_generator.py
Class Name: GSLWeaveCodeGenerator
Method Name: write_dataholder


Project Name: brian-team/brian2
Commit Name: 25ca9c249fd3e11bb166b42ffeb2433036964bd1
Time: 2017-07-05
Author: charleetje@gmail.com
File Name: brian2/codegen/generators/GSL_generator.py
Class Name: GSLWeaveCodeGenerator
Method Name: unpack_namespace