Hi Matthew and Timo,
there is a new problem for me to solve and so a new question for you
I would like to consider an integral operator which is not implemented yet, so e.g. something like
(K\phi)(x) = \int_\varGamma k(x,y)\phi(y) d(y)
with k(x,y)= \sin(|x-y|)/|x-y| or even more complicated
(K\phi)(x)=\int_\varGamma k(x,y, \phi(y)) d(y)
with k(x,y,\phi)= \sin(|x-y|)/|x-y| ((x-y)\cdot \phi )\phi.
Do you know a possibility to implement sth like that? For a start the easier version would be ok.
Probably an efficient way to implement this would be to define my own integral operator, how would that work?
I already tried sth inefficient like
phi=bempp.api.GridFunction(rwg_space, fun=phi_fun, dual_space=rwg_space)
mass = bempp.api.operators.boundary.sparse.identity(rwg_space, rwg_space, rwg_space).weak_form()
@bempp.api.complex_callable
def operator_fun(x, n, domain_index, result):
@bempp.api.complex_callable
def kernel_fun(xx,n,domain_index,result):
result[:]= np.array([np.sin(np.abs(x-xx))/np.abs(x-xx),0,0])
kernel=bempp.api.GridFunction(rwg_space, fun=kernel_function, dual_space=rwg_space)
res=kernel.coefficients.dot(mass*phi.coefficients)
result[:] = np.array([res,0,0])
operator_applied = bempp.api.GridFunction(rwg_space, fun=operator_fun, dual_space=rwg_space)
But it throws the error
TypingError: Failed in nopython mode pipeline (step: convert make_function into JIT functions)
TypingError: Failed in nopython mode pipeline (step: convert make_function into JIT functions)
Cannot capture the non-constant value associated with variable 'x' in a function that will escape.
File "<ipython-input-67-74e0f7e2f0e4>", line 4:
def operator_fun(x, n, domain_index, result):
<source elided>
@bempp.api.complex_callable
^
and if I replace xx by x only in line 4
def kernel_fun(x,n,domain_index,result):
it throws
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Untyped global name 'rwg_space': cannot determine Numba type of <class 'bempp.api.space.space.FunctionSpace'>
Am I not allowed to use bempp commands inside a bempp.api.complex_callable ?
Thank you very much for some hints and help,
Jan