The bilinear-form consists of a couple of integrators acting on the
domain or on the boundary. It has a reference to the finite element space
it is defined on. The sparse matrices are stored in the bilinear-form object.
template <typename SCAL = double>
void BilinearForm :: Assemble ()
{
ARRAY<int> dnums;
Matrix<SCAL> Matrix elmat;
ElementTransformation eltrans;
int ndof = fespace.GetNDof();
BaseMatrix & mat = GetMatrix();
mat = 0.0;
LocalHeap locheap (1000000);
// assembling of volume terms
int ne = ma.GetNE();
for (int i = 0; i < ne; i++)
{
locheap.CleanUp();
if (!fespace.DefinedOn (ma.GetElIndex (i))) continue;
ma.GetElementTransformation (i, eltrans);
const FiniteElement & fel = fespace.GetFE (i);
fespace.GetDofNrs (i, dnums);
for (int j = 0; j < parts.Size(); j++)
{
const BilinearFormIntegrator & bfi = *parts.Get(j);
if (bfi.BoundaryForm()) continue;
bfi.AssembleElementMatrix (fel, eltrans, elmat, &locheap);
fespace.TransformMatrix (i, elmat);
mat->AddElementMatrix (dnums, elmat);
}
}
// assembling of surface terms
int nse = ma.GetNSE();
for (int i = 0; i < nse; i++)
{
locheap.CleanUp();
if (!fespace.DefinedOnBoundary (ma.GetSElIndex (i))) continue;
ma.GetSurfaceElementTransformation (i, eltrans);
const FiniteElement & fel = fespace.GetSFE (i);
fespace.GetSDofNrs (i, dnums);
for (int j = 1; j <= parts.Size(); j++)
{
const BilinearFormIntegrator & bfi = *parts.Get(j);
if (!bfi.BoundaryForm()) continue;
bfi.AssembleElementMatrix (fel, eltrans, elmat, &locheap);
fespace.TransformSurfMatrix (i, elmat);
mat->AddElementMatrix (dnums, elmat);
}
}
}
Alphabetic index Hierarchy of classes