Thanks Daniel. Is the following understanding correct?

All the operations made on CellVariables will be stored as
binaryOperatorVariables. The operation is not actually conducted, until the
result is requested by numpy.array() or .value operation. It's like the
operations are just doing book keeping of the account, but the
numpy.array() method encash the final values.  Even though, the operators
will work the same on CellVariables as on numpy arrays.

Thank you.

Best regards,
Rose



On Fri, Jan 24, 2014 at 4:23 PM, Daniel Wheeler
<[email protected]>wrote:

> On Fri, Jan 24, 2014 at 3:36 PM, yuan wang <[email protected]> wrote:
> > Dear fipyers,
> >
> > Is it possible to assign the value of the product of two Cellvariables
> onto
> > one CellVariable in a succinct way. For example, a, b, c are
> CellVariables.
> > I wrote something like a = b*c, but it does not work. An error pop up
> > saying, "TypeError: The value of an `_OperatorVariable` cannot be
> assigned".
> > The RHS became a binary operator variable and I have to write a.value =
> > (b*c).value to work it out.
>
> > Is there a simpler to work around this?
>
> I think that
>
>      a[:] = b * c
>
> should make "a.value" an actual array. Also you can always get the
> array value by simply forcing with "numpy.array(b * c)", which
> removing any vestiges of FiPy from the object.
>
> There may be a good reason to make the assignment, but it might also
> indicate that there is a better way.
>
> --
> Daniel Wheeler
> _______________________________________________
> fipy mailing list
> [email protected]
> http://www.ctcms.nist.gov/fipy
>   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>



-- 
Yuan (Rose) Wang
PhD Candidate, Tufts University
Cellphone: 617-699-8006
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to