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

FEEvaluationData: add virtual destructor #14190

Merged
merged 1 commit into from Aug 23, 2022

Conversation

peterrum
Copy link
Member

... to be able to cast to FEEvaluation.

@kronbichler
Copy link
Member

Can you give an example use case? I assume you want to dynamic_cast to a certain case with an priori unknown number of components, e.g., from several objects with different numbers of components in a vector, so the dynamic cast should help you to infer the right template parameter for the actual evaluator?

@peterrum
Copy link
Member Author

In my use case, I would like to have a FEEvaluation instance in class, however, I don't know at compile time how many components it needs.

@peterrum
Copy link
Member Author

@kronbichler I have added a test!

Copy link
Member

@kronbichler kronbichler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this sounds reasonable. As I always forget these things, can you check the number of additional instructions to be handled for construction and destruction when the class gets virtual? Not that one or two instructions (as I hope) matter much against the ~100 instructions we already have, but we should ensure it does not allocate/deallocate memory.

@kronbichler
Copy link
Member

Failing test is unrelated.

@kronbichler kronbichler merged commit 55ce20b into dealii:master Aug 23, 2022
@kronbichler
Copy link
Member

I checked the instructions and it seems we spend one instruction in the constructor and zero in the destructor if we create an immediate object (on the stack), but there is a deallocation for dynamically allocated objects (e.g. inside a vector or shared/unique pointer).

mkghadban pushed a commit to OpenFCST/dealii that referenced this pull request Sep 8, 2022
FEEvaluationData: add virtual destructor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants