int WAVESHAPE::run() { for (int i = 0; i < framesToRun(); i++) { if (--branch <= 0) { doupdate(); branch = skip; } float sig = osc->next(); float wsig = wshape(sig * index, xferfunc, lenxfer); // dc blocking filter float osig = a1 * z1; z1 = b1 * z1 + wsig; osig += a0 * z1; float out[2]; out[0] = osig * amp; if (outputChannels() == 2) { out[1] = (1.0 - spread) * out[0]; out[0] *= spread; } rtaddout(out); increment(); } return framesToRun(); }
void FluxTraceBoundary<D> :: T_CalcElementMatrix (const FiniteElement & base_fel, const ElementTransformation & eltrans, FlatMatrix<SCAL> elmat, LocalHeap & lh) const { const CompoundFiniteElement & cfel // product space = dynamic_cast<const CompoundFiniteElement&> (base_fel); // This FE is already multiplied by normal: const HDivNormalFiniteElement<D-1> & fel_q = // q.n space dynamic_cast<const HDivNormalFiniteElement<D-1>&> (cfel[GetInd1()]); const ScalarFiniteElement<D-1> & fel_w = // w space dynamic_cast<const ScalarFiniteElement<D-1>&> (cfel[GetInd2()]); elmat = SCAL(0.0); IntRange rq = cfel.GetRange(GetInd1()); IntRange rw = cfel.GetRange(GetInd2()); int ndofq = rq.Size(); int ndofw = rw.Size(); FlatMatrix<SCAL> submat(ndofw, ndofq, lh); submat = SCAL(0.0); FlatVector<> qshape(fel_q.GetNDof(), lh); FlatVector<> wshape(fel_w.GetNDof(), lh); const IntegrationRule ir(fel_q.ElementType(), fel_q.Order() + fel_w.Order()); for (int i = 0 ; i < ir.GetNIP(); i++) { MappedIntegrationPoint<D-1,D> mip(ir[i], eltrans); SCAL cc = coeff_c -> T_Evaluate<SCAL>(mip); fel_q.CalcShape (ir[i], qshape); // mapped q.n-shape is simply reference q.n-shape / measure qshape *= 1.0/mip.GetMeasure(); fel_w.CalcShape (ir[i], wshape); submat += (cc*mip.GetWeight()) * wshape * Trans(qshape); } elmat.Rows(rw).Cols(rq) += submat; elmat.Rows(rq).Cols(rw) += Conj(Trans(submat)); }