[Dune] Short question about quadrature

Jö Fahlke jorrit at jorrit.de
Sat Jul 18 01:24:57 CEST 2015


Am Fri, 17. Jul 2015, 21:50:49 +0200 schrieb christi at dune-project.org:
> Date: Fri, 17 Jul 2015 21:50:49 +0200
> From: christi at dune-project.org
> To: Aleksejs Fomins <aleksejs.fomins at lspr.ch>
> Cc: Dune <dune at dune-project.org>
> Subject: Re: [Dune] Short question about quadrature
> 
> Hi Aleksejs,
> 
> > 1) Is the above operation QuadratureRules::rule(gt, order) expensive to call every time or just the first time?
> 
> no

It is expensive the first time, when the quadrature rule is instantiated.
After that it is basically a lookup in three levels of some custom vector
class, protected by a once_flag at each level to make it thread safe.

> > 2) Thus, would one get performance advantage from initializing std::vector<QuadratureRule> for all rules that will ever be used in the code once?
> 
> no

That might improve things in two ways: speeding up the lookup (a three-level
lookup is probably slower then a one-level lookup in a std::vector), and
improving the heap layout of the quadrature rules for the purpose of caching
(that is tricky to get right, though).  But my bet is that you will hardly see
any benefit if you do this.

> > 3) Are the operations iter->position() and iter->weight() expensive for any of the quadratures? Would it make sense to pre-compute quadrature points themselves?

[Answered by Christi comprehensively]

If you want to look at some numbers of just how fast exactly the quadrature
rules are, I did some test when making them threadsafe:
https://dune-project.org/flyspray/index.php?getfile=1109 (that was part of
FS#1544:
https://dune-project.org/flyspray/index.php?do=details&task_id=1544).  That
buf also contains a patch with the benchmark program, which might come in
handy should you decide to go ahead despite our answers.

Regards,
Jö.

-- 
Jorrit (Jö) Fahlke, Institute for Computational und Applied Mathematics,
University of Münster, Orleans-Ring 10, D-48149 Münster
Tel: +49 251 83 35146 Fax: +49 251 83 32729

Das Erststudium soll bis zum berufsqualifizierenden Abschluss
gebührenfrei bleiben, also bis zur Erlangung der Taxi-Lizenz.
-- Akrützel, Ausgabe vom 16.5.2002 (www.akruetzel.de)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20150718/75276b1f/attachment.sig>


More information about the Dune mailing list