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

Support composite Basis (e.g., for mortaring) #1122

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions skfem/assembly/basis/abstract_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,3 +451,23 @@ def draw(self, visuals='matplotlib', **kwargs):
logger.warning("First argument, 'visuals', must be a string.")
mod = importlib.import_module('skfem.visuals.{}'.format(visuals))
return mod.draw(self, **kwargs)

def __mul__(self, other):
from copy import deepcopy
assert len(self.basis) == len(other.basis)
basis = []
element_dofs = []
for itr in range(len(self.basis)):
basis.append((self.basis[itr][0], other.basis[0][0].zeros()))
element_dofs.append(self.element_dofs[itr])
for itr in range(len(other.basis)):
basis.append((self.basis[0][0].zeros(), other.basis[itr][0]))
element_dofs.append(other.element_dofs[itr] + self.N)
out = deepcopy(self)
out.basis = basis
out.dofs.N = self.N + other.N
out.Nbfun = self.Nbfun + other.Nbfun
out._element_dofs = element_dofs
out.interpolate = lambda w: (self.interpolate(w[:self.N]),
other.interpolate(w[self.N:]))
return out
Loading