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

Extra functionality of Tensor class #631

Merged
merged 1 commit into from Mar 2, 2015
Merged

Conversation

davydden
Copy link
Member

@davydden davydden commented Mar 2, 2015

the two commits are currently part of https://github.com/dealii/dealii/pull/621/commits
Wolfang wanted at least one of them to be in separate PR, thus I create it.

inline
Number contract (const Tensor<1,dim,Number> &src1,
const Tensor<1,dim,Number> &src2)
const Tensor<1,dim,OtherNumber> &src2)
Copy link
Member

@bangerth bangerth Mar 2, 2015

Choose a reason for hiding this comment

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

The return type of this should now be typename ProductType<Number,OtherNumber>::type. Same in the operator*.

@bangerth
Copy link
Member

bangerth commented Mar 2, 2015

I don't recall the conversation about this. Where do you need the add functions?

@davydden
Copy link
Member Author

davydden commented Mar 2, 2015

There was no conversation about the add function, but I use it heavily in the PR cited above, see davydden@2e30cc3

@davydden
Copy link
Member Author

davydden commented Mar 2, 2015

I think add() shall be quicker than something like

derivatives[q_point] += value *
typename ProductType<Number,dealii::Tensor<order,spacedim> >::type(*shape_derivative_ptr++);

as it shall not require a temporary object.

@bangerth
Copy link
Member

bangerth commented Mar 2, 2015

This is for small objects with a handful of elements. The compiler will optimize all of this out -- let's not worry about these micro-optimizations unless we have evidence that they are necessary.

So I would vote to just leave the existing code of the form

derivatives[q_point] += value *
typename ProductType<Number,dealii::Tensor<order,spacedim> >::type(*shape_derivative_ptr++);

in place. There is a cost to adding member functions (as this discussion shows) and it doesn't seem worth it at this point.

@davydden
Copy link
Member Author

davydden commented Mar 2, 2015

ok

@davydden
Copy link
Member Author

davydden commented Mar 2, 2015

will check that it compiles...

@davydden
Copy link
Member Author

davydden commented Mar 2, 2015

builds fine.

@bangerth
Copy link
Member

bangerth commented Mar 2, 2015

Looks good.

bangerth added a commit that referenced this issue Mar 2, 2015
Extra functionality of Tensor class
@bangerth bangerth merged commit e71080c into dealii:master Mar 2, 2015
1 check passed
@davydden
Copy link
Member Author

davydden commented Feb 21, 2016

in reference to #2033

@davydden davydden deleted the tensor branch May 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants