Skip to content

Checking on 0 vs 1 indexing for mesh elements using pyISSM #199

@fmccormack

Description

@fmccormack

I've run into the issue a few times where I've extracted a model from a larger domain (e.g. extracted only the grounded / floating elements from a domain that includes open ocean) to calculate something, then when I want to input the new calculation back into the larger domain I use something like :

md.friction.C[mds.mesh.extractedvertices-1] = mds.results.StressbalanceSolution.FrictionC

However, if you forget to put in that pesky "-1", you end up with all sorts of problems.

Would it be possible to revise whether it's better to 0 index or 1 index mesh elements in the user interface or behind the scenes. There's a benefit to 0 indexing in the user interface, and do the conversion in the backend when parsing to the C/C++. But either way, it would be good to make it more explicit and clear that the above code snippet won't give you what you want without the "-1".

Metadata

Metadata

Assignees

No one assigned

    Labels

    pyissmDefault label for all pyISSM issues

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions