← Back to team overview

ffc team mailing list archive

Re: [Branch ~ffc-core/ffc/dev] Rev 1452: Activate remove_unused in tabulate_tensor and fix but in remove_unused.

 

On Wed, Jan 13, 2010 at 09:14:10PM -0000, noreply@xxxxxxxxxxxxx wrote:
> ------------------------------------------------------------
> revno: 1452
> committer: Anders Logg <logg@xxxxxxxxx>
> branch nick: ffc-dev
> timestamp: Wed 2010-01-13 22:11:43 +0100
> message:
>   Activate remove_unused in tabulate_tensor and fix but in remove_unused.
> modified:

Typo, should be butt.

--
Anders


>   ffc/cpp.py
>   ffc/tensor/tensorgenerator.py
>
>

> === modified file 'ffc/cpp.py'
> --- ffc/cpp.py	2010-01-13 18:41:12 +0000
> +++ ffc/cpp.py	2010-01-13 21:11:43 +0000
> @@ -544,7 +544,7 @@
>      variables = {}
>
>      # List of variable names (so we can search them in order)
> -    variable_names = [variable_name for variable_name in used_set]
> +    variable_names = []
>
>      # Examine code line by line
>      lines = code.split("\n")
> @@ -582,19 +582,18 @@
>              if _variable_in_line(variable_name, line) and line_number > declaration_line:
>                  variables[variable_name] = (declaration_line, used_lines + [line_number])
>
> -    # Reverse the order of the variable names (to catch variables used
> -    # only by variables that are removed)
> +    # Reverse the order of the variable names to catch variables used
> +    # only by variables that are removed
>      variable_names.reverse()
>
> -    # Remove declarations that are not used (need to search backwards)
> +    # Remove declarations that are not used
>      removed_lines = []
>      for variable_name in variable_names:
>          (declaration_line, used_lines) = variables[variable_name]
>          for line in removed_lines:
>              if line in used_lines:
>                  used_lines.remove(line)
> -        if used_lines == []:
> -            print variable_name
> +        if used_lines == [] and not variable_name in used_set:
>              debug("Removing unused variable: %s" % variable_name)
>              #lines[declaration_line] = "// " + lines[declaration_line]
>              lines[declaration_line] = None
>
> === modified file 'ffc/tensor/tensorgenerator.py'
> --- ffc/tensor/tensorgenerator.py	2010-01-13 20:54:22 +0000
> +++ ffc/tensor/tensorgenerator.py	2010-01-13 21:11:43 +0000
> @@ -84,7 +84,7 @@
>      j_code = codesnippets.jacobian[ir.geometric_dimension] % {"restriction": ""}
>
>      # Remove unused declarations from Jacobian code
> -    #jacobi_code = remove_unused(j_code, j_set)
> +    jacobi_code = remove_unused(j_code, j_set)
>
>      # FIXME: Missing stuff from old generate_jacobian
>
>

Attachment: signature.asc
Description: Digital signature