# Path: sucemfem/Forms.py
# class NullForm(object):
# class GalerkinInteriorForms(object):
# class EMGalerkinInteriorForms(GalerkinInteriorForms):
# class CombineGalerkinForms(object):
#     def __add__(self, other):
#     def set_material_functions(self, material_functions):
#     def set_function_space(self, function_space):
#     def get_mass_form(self):
#     def get_stiffness_form(self):
#     def get_mass_form(self):
#     def get_stiffness_form(self):
#     def set_interior_forms(self, interior_forms):
#     def set_boundary_conditions(self, boundary_conditions):
#     def get_combined_forms(self):
#         V = self.function_space = function_space


from sucemfem import Forms
        self.boundary_conditions = {}
        
    def add_boundary_condition(self, boundary_condition):
        bc_num = boundary_condition.region_number
        # boundary condition numbers have to be unique
        assert(bc_num not in self.boundary_conditions)
        self.boundary_conditions[bc_num] = boundary_condition

    def apply_essential(self, A, b=None):
        """
        Apply essential boundary conditions to system matrix A and optional RHS b
        """
        for bc_num, bc in self.boundary_conditions.items():
            apply_fn = bc.get_essential_application_func()
            if b: apply_fn(A, b)
            else: apply_fn(A)

    def get_linear_form(self):
        """Get boundary conditions contribution to RHS linear form
        """
        lin_form = Forms.NullForm()
        for bc_num, bc in self.boundary_conditions.items():
            lin_form = lin_form + bc.get_linear_form()

        return lin_form

    def get_bilinear_form(self):
        """Get boundary conditions contribution to bilinear form
        """


# Path: sucemfem/Forms.py
# class NullForm(object):
# class GalerkinInteriorForms(object):
# class EMGalerkinInteriorForms(GalerkinInteriorForms):
# class CombineGalerkinForms(object):
#     def __add__(self, other):
#     def set_material_functions(self, material_functions):
#     def set_function_space(self, function_space):
#     def get_mass_form(self):
#     def get_stiffness_form(self):
#     def get_mass_form(self):
#     def get_stiffness_form(self):
#     def set_interior_forms(self, interior_forms):
#     def set_boundary_conditions(self, boundary_conditions):
#     def get_combined_forms(self):
#         V = self.function_space = function_space


# Path: sucemfem/BoundaryConditions/container.py
from sucemfem import Forms

        self.boundary_conditions = {}
        
    def add_boundary_condition(self, boundary_condition):
        bc_num = boundary_condition.region_number
        # boundary condition numbers have to be unique
        assert(bc_num not in self.boundary_conditions)
        self.boundary_conditions[bc_num] = boundary_condition

    def apply_essential(self, A, b=None):
        """
        Apply essential boundary conditions to system matrix A and optional RHS b
        """
        for bc_num, bc in self.boundary_conditions.items():
            apply_fn = bc.get_essential_application_func()
            if b: apply_fn(A, b)
            else: apply_fn(A)

    def get_linear_form(self):
        """Get boundary conditions contribution to RHS linear form
        """
        lin_form = Forms.NullForm()
        for bc_num, bc in self.boundary_conditions.items():
            lin_form = lin_form + bc.get_linear_form()

        return lin_form

    def get_bilinear_form(self):
        """Get boundary conditions contribution to bilinear form
        """


        bilin_form = Forms.NullForm()