Merge lp:~als88/fenics-plasticity/plasticity_with_local_size into lp:fenics-plasticity

Proposed by Antony Siahaan
Status: Merged
Merge reported by: Garth Wells
Merged at revision: not available
Proposed branch: lp:~als88/fenics-plasticity/plasticity_with_local_size
Merge into: lp:fenics-plasticity
Diff against target: 43 lines (+7/-4)
2 files modified
src/IPData.cpp (+3/-2)
src/IPData.h (+4/-2)
To merge this branch: bzr merge lp:~als88/fenics-plasticity/plasticity_with_local_size
Reviewer Review Type Date Requested Status
Garth Wells Pending
Review via email: mp+153325@code.launchpad.net

Commit message

MPI is now working in fenics-plasticity.

Description of the change

Change in IPData.cpp and IPData.h to enable parallel execution :
- using local_size() method instead of size() method for vector object.
- using get_local() method instead of gather() method for vector object.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/IPData.cpp'
--- src/IPData.cpp 2013-02-26 11:20:02 +0000
+++ src/IPData.cpp 2013-03-14 10:55:25 +0000
@@ -46,7 +46,7 @@
46void HistoryData::get_old_values(dolfin::GenericVector& vector)46void HistoryData::get_old_values(dolfin::GenericVector& vector)
47{47{
48 // Check that size are equal becore setting values.48 // Check that size are equal becore setting values.
49 assert(vector.size() == _old_vals.size());49 assert(vector.local_size() == _old_vals.size());
50 vector.set(&_old_vals[0], _old_vals.size(), &_dofs[0]);50 vector.set(&_old_vals[0], _old_vals.size(), &_dofs[0]);
51}51}
52//-----------------------------------------------------------------------------52//-----------------------------------------------------------------------------
@@ -204,7 +204,8 @@
204 _element_dofs = _u_dofmap.cell_dofs(cell.index());204 _element_dofs = _u_dofmap.cell_dofs(cell.index());
205205
206 // Get displacements at nodes on element206 // Get displacements at nodes on element
207 _vector.gather(_element_vals, _element_dofs);207 //_vector.gather(_element_vals, _element_dofs);
208 _vector.get_local(&(_element_vals[0]), _element_dofs.size(), &(_element_dofs[0]));
208209
209 // Tabulate coordinates of quadrature points on current cell210 // Tabulate coordinates of quadrature points on current cell
210 _q_dofmap.tabulate_coordinates(_coordinates, _ufc_cell);211 _q_dofmap.tabulate_coordinates(_coordinates, _ufc_cell);
211212
=== modified file 'src/IPData.h'
--- src/IPData.h 2012-12-30 12:20:58 +0000
+++ src/IPData.h 2013-03-14 10:55:25 +0000
@@ -89,13 +89,15 @@
89 /// Update local armadillo data structure from associated function vector89 /// Update local armadillo data structure from associated function vector
90 void update_arma(arma::mat& matrix) const90 void update_arma(arma::mat& matrix) const
91 {91 {
92 _vector.gather(_ip_values, _ip_dofs);92 // _vector.gather(_ip_values, _ip_dofs);
93 _vector.get_local(&(_ip_values[0]), _ip_dofs.size(), &(_ip_dofs[0]));
93 local_to_arma(matrix);94 local_to_arma(matrix);
94 }95 }
9596
96 void update_arma(arma::vec& vector) const97 void update_arma(arma::vec& vector) const
97 {98 {
98 _vector.gather(_ip_values, _ip_dofs);99 //_vector.gather(_ip_values, _ip_dofs);
100 _vector.get_local(&(_ip_values[0]), _ip_dofs.size(), &(_ip_dofs[0]));
99 local_to_arma(vector);101 local_to_arma(vector);
100 }102 }
101103

Subscribers

People subscribed via source and target branches