Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

just pass vectors through to the PETSc interface #183

Merged
merged 1 commit into from Dec 10, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/numerics/petsc_vector.C
Expand Up @@ -212,8 +212,14 @@ void PetscVector<T>::add_vector (const std::vector<T>& v,
this->_restore_array();
libmesh_assert_equal_to (v.size(), dof_indices.size());

for (unsigned int i=0; i<v.size(); i++)
this->add (dof_indices[i], v[i]);
PetscErrorCode ierr=0;
const PetscInt * i_val = reinterpret_cast<const PetscInt*>(&dof_indices[0]);
const PetscScalar * petsc_value = static_cast<const PetscScalar*>(&v[0]);

ierr = VecSetValues (_vec, v.size(), i_val, petsc_value, ADD_VALUES);
LIBMESH_CHKERRABORT(ierr);

this->_is_closed = false;
}


Expand Down