Source code for simudo.fem.function_space_cache

from __future__ import print_function

import dolfin

__all__ = ['FunctionSpaceCache']

[docs]class FunctionSpaceCache(object): def __init__(self): self.spaces = {}
[docs] def FunctionSpace(self, mesh, element, constrained_domain=None): k = (mesh.id(), element, constrained_domain) v = self.spaces.get(k, None) if v is None: v = self.spaces[k] = dolfin.FunctionSpace( mesh, element, constrained_domain=constrained_domain) return v