On 5/1/23 18:20, Corbin Foucart wrote:

I have done some preliminary benchmarking of the code and indeed this operation is not anywhere close to a bottleneck--I was asking primarily out of curiosity, as I'm refactoring the code and was considering what return type of an abstract representation of the flux makes sense in terms of class design. In light of your answer it seems that a view-based design doesn't make a lot of sense, and I might as well return a Tensor object directly, as that's the easiest for user code to work with.

Indeed.

Tensors store their data as regular class members, rather than as pointers to the heap. They are relatively small objects, and it is generally very cheap to work with these kinds of objects because the compiler can either place them on the stack or, oftentimes, even in registers. It is probably 2 orders more expensive to operate on data that is dynamically allocated on the heap.

Best
 W.

--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 [email protected]
                           www: http://www.math.colostate.edu/~bangerth/


--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/69589f55-2ed4-05e3-a169-14a19d719b8d%40colostate.edu.

Reply via email to