ianhinder / Kranc

A Mathematica package for generating code for solving time dependent partial differential equations
http://kranccode.org
GNU General Public License v2.0
29 stars 10 forks source link

Allow predicates for accessing grid functions #3

Open eschnett opened 14 years ago

eschnett commented 14 years ago

Teach Kranc that certain grid functions may have predicates. They can only be accessed if a certain parameter or grid scalar is set; otherwise, these grid functions cannot be accessed are are assumed to have the value zero.

This is useful e.g. for TmunuBase.

ianhinder commented 13 years ago

Would a good alternative be to check for storage for those variables instead of having a separate parameter or grid scalar? Which option would be better? Since the numerical value probably doesn't matter for these variables, the only problem they could cause would be a segfault due to lack of storage. This would mean you didn't need to communicate to Kranc a controlling parameter or grid scalar, just the fact that these variables should be assumed to be zero if they don't have storage.

ianhinder commented 13 years ago

There is now an internal mechanism to only access certain grid function if a certain variable is set. This is currently used for the Jacobians and the stress-energy hack. What we need now is a nice interface for the user to indicate that certain variables should be treated in this way.

eschnett commented 13 years ago

This mechanism should exist already in Cactus, i.e. conditional inheritance. But alas, it doesn't.

eschnett commented 13 years ago

Querying storage is not a good idea. Someone may allocate storage for all variables, and this should not affect the behaviour .