~ubuntu-branches/ubuntu/wily/dolfin/wily-proposed

« back to all changes in this revision

Viewing changes to dolfin/la/MUMPSLUSolver.cpp

  • Committer: Package Import Robot
  • Author(s): Johannes Ring
  • Date: 2014-09-22 14:35:34 UTC
  • mfrom: (1.1.17) (19.1.23 sid)
  • Revision ID: package-import@ubuntu.com-20140922143534-0yi89jyuqbgdxwm9
Tags: 1.4.0+dfsg-4
* debian/control: Disable libcgal-dev on i386, mipsel and sparc.
* debian/rules: Remove bad directives in pkg-config file dolfin.pc
  (closes: #760658).
* Remove debian/libdolfin-dev.lintian-overrides.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
}
52
52
//-----------------------------------------------------------------------------
53
53
MUMPSLUSolver::MUMPSLUSolver(const CoordinateMatrix& A)
54
 
  : _A(reference_to_no_delete_pointer(A))
 
54
  : _matA(reference_to_no_delete_pointer(A))
55
55
{
56
56
  // Set parameter values
57
57
  parameters = default_parameters();
58
58
}
59
59
//-----------------------------------------------------------------------------
60
 
MUMPSLUSolver::MUMPSLUSolver(boost::shared_ptr<const CoordinateMatrix> A)
61
 
  : _A(A)
 
60
MUMPSLUSolver::MUMPSLUSolver(std::shared_ptr<const CoordinateMatrix> A)
 
61
  : _matA(A)
62
62
{
63
63
  // Set parameter values
64
64
  parameters = default_parameters();
71
71
//-----------------------------------------------------------------------------
72
72
std::size_t MUMPSLUSolver::solve(GenericVector& x, const GenericVector& b)
73
73
{
74
 
  assert(_A);
 
74
  assert(_matA);
75
75
 
76
76
  DMUMPS_STRUC_C data;
77
77
 
120
120
  data.ICNTL(18) = 3;
121
121
 
122
122
  // Parallel/serial analysis (0=auto, 1=serial, 2=parallel)
123
 
  if (MPI::num_processes() > 1)
 
123
  if (MPI::size(_matA->mpi_comm()) > 1)
124
124
    data.ICNTL(28) = 2;
125
125
  else
126
126
    data.ICNTL(28) = 0;
129
129
  data.ICNTL(29) = 0;
130
130
 
131
131
  // Global size
132
 
  assert(_A->size(0) == _A->size(1));
133
 
  data.n = _A->size(0);
 
132
  assert(_matA->size(0) == _matA->size(1));
 
133
  data.n = _matA->size(0);
134
134
 
135
 
  if (!_A->base_one())
 
135
  if (!_matA->base_one())
136
136
    error("MUMPS requires a CoordinateMatrix with Fortran-style base 1 indexing.");
137
137
 
138
138
  // Get matrix coordindate and value data
139
 
  const std::vector<std::size_t>& rows = _A->rows();
140
 
  const std::vector<std::size_t>& cols = _A->columns();
141
 
  const std::vector<double>& vals = _A->values();
 
139
  const std::vector<std::size_t>& rows = _matA->rows();
 
140
  const std::vector<std::size_t>& cols = _matA->columns();
 
141
  const std::vector<double>& vals = _matA->values();
142
142
 
143
143
  // Number of non-zero entries on this process
144
144
  data.nz_loc = rows.size();
145
145
 
146
146
  // Pass matrix data to MUMPS. Trust MUMPS not to change it
147
 
  data.irn_loc = const_cast<int*>(reinterpret_cast<const int*>(&rows[0]));
148
 
  data.jcn_loc = const_cast<int*>(reinterpret_cast<const int*>(&cols[0]));
 
147
  data.irn_loc = const_cast<int*>(reinterpret_cast<const int*>(rows.data()));
 
148
  data.jcn_loc = const_cast<int*>(reinterpret_cast<const int*>(cols.data()));
149
149
  data.a_loc   = const_cast<double*>(&vals[0]);
150
150
 
151
151
  // Analyse and factorize
171
171
 
172
172
  // Attach solution data to MUMPS object
173
173
  data.lsol_loc = local_x_size;
174
 
  data.sol_loc  = &x_local_vals[0];
 
174
  data.sol_loc  = x_local_vals.data();
175
175
  data.isol_loc = x_local_indices.data();
176
176
 
177
177
  // Solve problem