def transform_multidim_to_1d_ref(aref, dimension_dict):
dims = []<EOL>name = aref<EOL>while type(name) is c_ast.ArrayRef:<EOL><INDENT>dims.append(name.subscript)<EOL>name = name.name<EOL><DEDENT>subscript_list = []<EOL>for i, d in enumerate(dims):<EOL><INDENT>if i == <NUM_LIT:0>:<EOL><INDENT>subscript_list.append(d)<EOL><DEDENT>else:<EOL><INDENT>subscript_list.append(c_ast.BinaryOp('<STR_LIT:*>', d, reduce(<EOL>lambda l, r: c_ast.BinaryOp('<STR_LIT:*>', l, r),<EOL>dimension_dict[name.name][-<NUM_LIT:1>:-i-<NUM_LIT:1>:-<NUM_LIT:1>])))<EOL><DEDENT><DEDENT>aref.subscript = reduce(<EOL>lambda l, r: c_ast.BinaryOp('<STR_LIT:+>', l, r), subscript_list)<EOL>aref.name = name<EOL>
Transform ast of multidimensional reference to a single dimension reference.

In-place operation!