Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constructor of "TensorMeshHierarchy" cannot take a non-const dimension value as the input parameter #132

Open
lwan86 opened this issue Jun 16, 2021 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@lwan86
Copy link

lwan86 commented Jun 16, 2021

I need to read a variable from a bp file and then compress it. The dimension of that variable cannot be known until we read it. However, the input parameter "shape" of the constructor of "TensorMeshHierarchy" needs to be an "std::array", which requires const dimension. Why do we have to use the "std::array" here?

@ben-e-whitney ben-e-whitney added the question Further information is requested label Jul 12, 2021
@ben-e-whitney
Copy link
Collaborator

The underlying problem is that TensorMeshHierarchy is templated on the dimension N. I don't quite remember the original rationale for making N a template parameter rather than a normal data member; maybe it had something to do with the original API, or maybe I was just trying to make development easier by avoiding problems caused by mismatched dimensions. I don't see any reason we can't make N a data member, change all the std::arrays to std::vectors, etc. It would require changing the API, though, so it won't happen quickly. In the meantime, maybe you can use a switch statement like we do here.

Will we have the same problem with the datatype? Is the precision of the variable known before it's read?

@ben-e-whitney ben-e-whitney self-assigned this Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants