void Assembly::addJacobianNeighbor(SparseMatrix<Number> & jacobian, unsigned int ivar, unsigned int jvar, const DofMap & dof_map, std::vector<dof_id_type> & dof_indices, std::vector<dof_id_type> & neighbor_dof_indices) { DenseMatrix<Number> & kee = jacobianBlock(ivar, jvar); DenseMatrix<Number> & ken = jacobianBlockNeighbor(Moose::ElementNeighbor, ivar, jvar); DenseMatrix<Number> & kne = jacobianBlockNeighbor(Moose::NeighborElement, ivar, jvar); DenseMatrix<Number> & knn = jacobianBlockNeighbor(Moose::NeighborNeighbor, ivar, jvar); std::vector<dof_id_type> di(dof_indices); std::vector<dof_id_type> dn(neighbor_dof_indices); // stick it into the matrix dof_map.constrain_element_matrix(kee, di, false); dof_map.constrain_element_matrix(ken, di, dn, false); dof_map.constrain_element_matrix(kne, dn, di, false); dof_map.constrain_element_matrix(knn, dn, false); Real scaling_factor = _sys.getVariable(_tid, ivar).scalingFactor(); if (scaling_factor != 1.0) { _tmp_Ke = ken; _tmp_Ke *= scaling_factor; jacobian.add_matrix(_tmp_Ke, di, dn); _tmp_Ke = kne; _tmp_Ke *= scaling_factor; jacobian.add_matrix(_tmp_Ke, dn, di); _tmp_Ke = knn; _tmp_Ke *= scaling_factor; jacobian.add_matrix(_tmp_Ke, dn); } else { jacobian.add_matrix(ken, di, dn); jacobian.add_matrix(kne, dn, di); jacobian.add_matrix(knn, dn); } }
void Assembly::addJacobianBlock(SparseMatrix<Number> & jacobian, unsigned int ivar, unsigned int jvar, const DofMap & dof_map, std::vector<dof_id_type> & dof_indices) { DenseMatrix<Number> & ke = jacobianBlock(ivar, jvar); // stick it into the matrix std::vector<dof_id_type> di(dof_indices); dof_map.constrain_element_matrix(ke, di, false); Real scaling_factor = _sys.getVariable(_tid, ivar).scalingFactor(); if (scaling_factor != 1.0) { _tmp_Ke = ke; _tmp_Ke *= scaling_factor; jacobian.add_matrix(_tmp_Ke, di); } else jacobian.add_matrix(ke, di); }