You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
546 B
Common Lisp

/*
* Apply PEC and preconditioner.
*
* Template parameters:
* ctype name of complex type (eg. cdouble)
* pec false iff no PEC anyhwere
*
* Arguments:
* ctype *E (output) E-field
* ctype *Pr Entries of (diagonal) right preconditioner matrix
* ctype *p (input vector)
*
*/
//Defines to clean up operation names
#define ctype {{ctype}}_t
#define zero {{ctype}}_new(0.0, 0.0)
#define mul {{ctype}}_mul
{%- if pec -%}
if (pec[i] != 0) {
E[i] = zero;
} else
{%- endif -%}
{
E[i] = mul(Pr[i], p[i]);
}