Skip to content

Variable number of arguments, or partially modified variables on Tape. #7

Open
@rainwoodman

Description

@rainwoodman

How do we write the Force operator as separate operations?

code.Paint()
for d in range(3):
    code.MeshForce(d)
    code.ReadOut(d, acc='acc')

The problem is acc is modified in place, and we need to save three copies on the tape, each of which 2/3 is not useful.

code.Paint()
for d in range(3):
    code.MeshForce(d)
    code.ReadOut(d, acc='acc-%d' % d)
code.Concatenate(src=['acc-%d' for d in range(3)], out='acc')

This is cleaner on the tape, but require us to be able to handle list of arguments, and require us to be aware of types of arguments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions