[pyfr] 29/88: Cache the list of stored quadrature rules.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Nov 16 12:05:27 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository pyfr.

commit 0490ff599a598fac33f7be1d1662adfe4ae079f9
Author: Freddie Witherden <freddie at witherden.org>
Date:   Thu Apr 28 21:26:56 2016 -0700

    Cache the list of stored quadrature rules.
    
    This should improve post-processing performance on large clusters
    where directory listings are not cached.
---
 pyfr/quadrules/__init__.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pyfr/quadrules/__init__.py b/pyfr/quadrules/__init__.py
index 585703f..0130091 100644
--- a/pyfr/quadrules/__init__.py
+++ b/pyfr/quadrules/__init__.py
@@ -45,7 +45,11 @@ class BaseTabulatedQuadRule(object):
 class BaseStoredQuadRule(BaseTabulatedQuadRule):
     @classmethod
     def _iter_rules(cls):
-        for path in resource_listdir(__name__, cls.shape):
+        rpaths = getattr(cls, '_rpaths', None)
+        if rpaths is None:
+            cls._rpaths = rpaths = resource_listdir(__name__, cls.shape)
+
+        for path in rpaths:
             m = re.match(r'([a-zA-Z0-9\-~+]+)-n(\d+)'
                          r'(?:-d(\d+))?(?:-([spu]+))?\.txt$', path)
             if m:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pyfr.git



More information about the debian-science-commits mailing list