def __init__(self, a, L, u, bcs=None, form_compiler_parameters=None): """ Create linear variational problem a(u, v) = L(v). An optional argument bcs may be passed to specify boundary conditions. Another optional argument form_compiler_parameters may be specified to pass parameters to the form compiler. """ # Extract and check arguments u = _extract_u(u) bcs = _extract_bcs(bcs) # Store input UFL forms and solution Function self.a_ufl = a self.L_ufl = L self.u_ufl = u # Store form compiler parameters form_compiler_parameters = form_compiler_parameters or {} self.form_compiler_parameters = form_compiler_parameters # Wrap forms (and check if linear form L is empty) if L.empty(): L = cpp.Form(1, 0) else: L = Form(L, form_compiler_parameters=form_compiler_parameters) a = Form(a, form_compiler_parameters=form_compiler_parameters) # Initialize C++ base class cpp.LinearVariationalProblem.__init__(self, a, L, u, bcs)
def __init__(self, a, L=None, solver_type=cpp.LocalSolver.SolverType_LU): """Create a local (cell-wise) solver for a linear variational problem a(u, v) = L(v). """ # Store input UFL forms and solution Function self.a_ufl = a self.L_ufl = L # Wrap as DOLFIN forms a = Form(a) if L is None: # Initialize C++ base class cpp.LocalSolver.__init__(self, a, solver_type) else: if L.empty(): L = cpp.Form(1, 0) else: L = Form(L) # Initialize C++ base class cpp.LocalSolver.__init__(self, a, L, solver_type)