Skip to content

Commit

Permalink
Work on composite Basis for nonlinear mortaring
Browse files Browse the repository at this point in the history
  • Loading branch information
kinnala committed Apr 16, 2024
1 parent 9c87116 commit fad6a9c
Showing 1 changed file with 20 additions and 0 deletions.
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

0 comments on commit fad6a9c

Please sign in to comment.