@Override
 public void setDOF(DOF trialDOF, DOF testDOF) {
   this.trialDOF = trialDOF;
   this.testDOF = testDOF;
   if (trialDOF != null) {
     this.u = trialDOF.getSSF();
     this.uDOFLocalIndex = trialDOF.getLocalIndex();
   }
   if (testDOF != null) {
     this.v = testDOF.getSSF();
     this.vDOFLocalIndex = testDOF.getLocalIndex();
   }
 }
 public void imposeDirichletCondition(SparseBlockMatrix BM, SparseBlockVector BV, Function diri) {
   ElementList eList = mesh.getElementList();
   int nNode = mesh.getNodeList().size();
   for (int i = 1; i <= eList.size(); i++) {
     Element e = eList.at(i);
     DOFList DOFs = e.getAllDOFList(DOFOrder.NEFV);
     for (int j = 1; j <= DOFs.size(); j++) {
       DOF dof = DOFs.at(j);
       GeoEntity ge = dof.getOwner();
       if (ge instanceof Node) {
         Node n = (Node) ge;
         if (n.getNodeType() == NodeType.Dirichlet) {
           Variable v = Variable.createFrom(diri, n, 0);
           setDirichlet(BM, BV, dof.getGlobalIndex(), diri.value(v));
           setDirichlet(BM, BV, nNode + dof.getGlobalIndex(), diri.value(v));
           setDirichlet(BM, BV, nNode * 2 + dof.getGlobalIndex(), diri.value(v));
         }
       }
     }
   }
 }