34 #include <oomph-lib-config.h> 63 const unsigned n_dof = problem_pt->
ndof();
82 oomph_info << std::endl <<
"CPU for setup of Dense Jacobian [sec]: " 87 solve(&jacobian,residuals,result);
94 double total_time=t_end-t_start;
97 oomph_info <<
"CPU for DenseLU LinearSolver [sec]: " 98 << total_time << std::endl << std::endl;
135 const unsigned long n = matrix_pt->
nrow();
138 const double small_number=1.0e-20;
148 for(
unsigned long i=0;
i<n;
i++)
150 double largest_entry=0.0;
151 for(
unsigned long j=0;j<n;j++)
153 double tmp = std::fabs((*matrix_pt)(
i,j));
154 if(tmp > largest_entry) largest_entry = tmp;
156 if(largest_entry==0.0)
159 OOMPH_CURRENT_FUNCTION,
160 OOMPH_EXCEPTION_LOCATION);
163 scaling[
i] = 1.0/largest_entry;
179 for(
unsigned long i=0;
i<n;
i++)
181 for(
unsigned long j=0;j<n;j++)
189 for(
unsigned long j=0;j<n;j++)
192 unsigned long imax=0;
194 for(
unsigned long i=0;
i<j;
i++)
197 for(
unsigned long k=0;k<
i;k++)
205 double largest_entry=0.0;
206 for(
unsigned long i=j;
i<n;
i++)
209 for(
unsigned long k=0;k<j;k++)
215 double tmp = scaling[
i]*std::fabs(sum);
216 if(tmp >= largest_entry)
226 for(
unsigned long k=0;k<n;k++)
233 signature = -signature;
236 scaling[imax] = scaling[j];
249 for(
unsigned long i=j+1;
i<n;
i++)
261 double determinant_mantissa=1.0;
262 int determinant_exponent = 0, iexp;
263 for(
unsigned i=0;
i<n;
i++)
267 determinant_mantissa *= frexp(
LU_factors[n*
i+
i], &iexp);
270 determinant_exponent += iexp;
273 determinant_mantissa = frexp(determinant_mantissa,&iexp);
274 determinant_exponent += iexp;
298 if(determinant_mantissa > 0.0) {sign = 1;}
299 if(determinant_mantissa < 0.0) {sign = -1;}
321 const unsigned long n = rhs.
nrow();
322 for(
unsigned long i=0;
i<n;++
i)
324 result_pt[
i] = rhs_pt[
i];
329 for(
unsigned long i=0;
i<n;
i++)
331 unsigned long ip =
Index[
i];
332 double sum = result_pt[ip];
333 result_pt[ip] = result_pt[
i];
336 for(
unsigned long j=k-1;j<
i;j++)
349 for (
long i=
long(n)-1;
i>=0;
i--)
351 double sum = result_pt[
i];
352 for(
long j=
i+1;j<long(n);j++)
370 const unsigned long n = rhs.size();
371 for(
unsigned long i=0;
i<n;++
i)
378 for(
unsigned long i=0;
i<n;
i++)
380 unsigned long ip =
Index[
i];
381 double sum = result[ip];
382 result[ip] = result[
i];
385 for(
unsigned long j=k-1;j<
i;j++)
398 for (
long i=
long(n)-1;
i>=0;
i--)
400 double sum = result[
i];
401 for(
long j=
i+1;j<long(n);j++)
422 std::ostringstream error_message_stream;
424 <<
"The vectors rhs and result must not be distributed";
426 OOMPH_CURRENT_FUNCTION,
427 OOMPH_EXCEPTION_LOCATION);
431 if (matrix_pt->
nrow() != matrix_pt->
ncol())
433 std::ostringstream error_message_stream;
435 <<
"The matrix at matrix_pt must be square.";
437 OOMPH_CURRENT_FUNCTION,
438 OOMPH_EXCEPTION_LOCATION);
441 if (matrix_pt->
nrow() != rhs.
nrow())
443 std::ostringstream error_message_stream;
445 <<
"The matrix and the rhs vector must have the same number of rows.";
447 OOMPH_CURRENT_FUNCTION,
448 OOMPH_EXCEPTION_LOCATION);
455 if (dist_matrix_pt != 0)
457 if (dist_matrix_pt->distribution_pt()->communicator_pt()->nproc() > 1 &&
458 dist_matrix_pt->distribution_pt()->distributed() ==
true)
461 "Matrix must not be distributed or only one processor",
462 OOMPH_CURRENT_FUNCTION,
463 OOMPH_EXCEPTION_LOCATION);
466 if (!(temp_comm == *dist_matrix_pt->distribution_pt()->communicator_pt()))
468 std::ostringstream error_message_stream;
470 <<
"The matrix matrix_pt must have the same communicator as the vectors" 471 <<
" rhs and result must have the same communicator";
473 OOMPH_CURRENT_FUNCTION,
474 OOMPH_EXCEPTION_LOCATION);
483 std::ostringstream error_message_stream;
485 <<
"The result vector distribution has been setup; it must have the " 486 <<
"same distribution as the rhs vector.";
488 OOMPH_CURRENT_FUNCTION,
489 OOMPH_EXCEPTION_LOCATION);
517 oomph_info << std::endl <<
"CPU for solve with DenseLU [sec]: " 534 clock_t t_start = clock();
540 clock_t t_end = clock();
545 oomph_info <<
"CPU for solve with DenseLU [sec]: " 561 clock_t t_start = clock();
570 std::ostringstream error_message_stream;
572 <<
"The result vector must not be distributed";
574 OOMPH_CURRENT_FUNCTION,
575 OOMPH_EXCEPTION_LOCATION);
581 unsigned long n_dof = problem_pt->
ndof();
589 clock_t t_start = clock();
595 clock_t t_end = clock();
601 oomph_info << std::endl <<
"CPU for setup of Dense Jacobian [sec]: " 607 solve(&jacobian,residuals,result);
613 clock_t t_end = clock();
614 double total_time=double(t_end-t_start)/CLOCKS_PER_SEC;
617 oomph_info <<
"CPU for FD DenseLU LinearSolver [sec]: " 618 << total_time << std::endl << std::endl;
628 int superlu(
int *,
int *,
int *,
int *,
629 double *,
int *,
int *,
630 double *,
int *,
int *,
int *,
646 int n,
int nnz,
double *values,
647 int *row_index,
int *col_start,
648 double *b,
int nprow,
int npcol,
649 int doc,
void **data,
int *info,
655 int n,
int nnz_local,
657 double *values,
int *col_index,
658 int *row_start,
double *b,
659 int nprow,
int npcol,
660 int doc,
void **data,
int *info,
666 int* cr_index,
int* cr_start,
double** cc_values,
667 int** cc_index,
int** cc_start);
686 if (Solver_type == Distributed ||
687 (Solver_type == Default && problem_pt->
communicator_pt()->nproc() > 1))
693 unsigned n_dof = problem_pt->
ndof();
697 !Dist_use_global_solver);
701 bool copy_of_Delete_matrix_data = Dist_delete_matrix_data;
704 Dist_delete_matrix_data =
true;
707 if (!Dist_use_global_solver)
724 oomph_info <<
"Time to set up CRDoubleMatrix Jacobian [sec] : " 735 if((result.
built()) &&
741 solve(&jacobian,residuals,result);
746 solve(&jacobian,residuals,result);
769 oomph_info <<
"Time to set up CR Jacobian [sec] : " 784 result.
build(&dist,0.0);
785 solve(&jacobian,residuals,result);
790 solve(&jacobian,residuals,result);
795 Dist_delete_matrix_data = copy_of_Delete_matrix_data;
806 problem_pt->
ndof(),
false);
813 if(Serial_compressed_row_flag)
840 <<
"Time to set up CRDoubleMatrix Jacobian [sec]: " 850 if((result.
built()) &&
856 solve(&CR_jacobian,residuals,result);
862 solve(&CR_jacobian,residuals,result);
892 oomph_info <<
"\nTime to set up CCDoubleMatrix Jacobian [sec]: " 902 if((result.
built()) &&
908 solve(&CC_jacobian,residuals,result);
914 solve(&CC_jacobian,residuals,result);
944 std::ostringstream error_message_stream;
946 <<
"The vectors rhs must be setup";
948 OOMPH_CURRENT_FUNCTION,
949 OOMPH_EXCEPTION_LOCATION);
953 if (matrix_pt->
nrow() != matrix_pt->
ncol())
955 std::ostringstream error_message_stream;
957 <<
"The matrix at matrix_pt must be square.";
959 OOMPH_CURRENT_FUNCTION,
960 OOMPH_EXCEPTION_LOCATION);
969 if (cr_pt->nnz() == 0)
971 std::ostringstream error_message_stream;
973 <<
"Attempted to call SuperLu on a CRDoubleMatrix with no entries, " 974 <<
"SuperLU would segfault (because the values array pt is " 975 <<
"uninitialised or null).";
977 OOMPH_CURRENT_FUNCTION,
978 OOMPH_EXCEPTION_LOCATION);
983 if (matrix_pt->
nrow() != rhs.
nrow())
985 std::ostringstream error_message_stream;
987 <<
"The matrix and the rhs vector must have the same number of rows.";
989 OOMPH_CURRENT_FUNCTION,
990 OOMPH_EXCEPTION_LOCATION);
997 if (dist_matrix_pt != 0)
1001 std::ostringstream error_message_stream;
1002 error_message_stream
1003 <<
"The matrix matrix_pt must have the same distribution as the " 1006 OOMPH_CURRENT_FUNCTION,
1007 OOMPH_EXCEPTION_LOCATION);
1016 std::ostringstream error_message_stream;
1017 error_message_stream
1018 <<
"The matrix (matrix_pt) is not distributable and therefore the rhs" 1019 <<
" vector must not be distributed";
1021 OOMPH_CURRENT_FUNCTION,
1022 OOMPH_EXCEPTION_LOCATION);
1031 std::ostringstream error_message_stream;
1032 error_message_stream
1033 <<
"The result vector distribution has been setup; it must have the " 1034 <<
"same distribution as the rhs vector.";
1036 OOMPH_CURRENT_FUNCTION,
1037 OOMPH_EXCEPTION_LOCATION);
1043 if (dynamic_cast<DistributableLinearAlgebraObject*>(matrix_pt))
1066 oomph_info <<
"Time for SuperLUSolver solve [sec] : " 1067 << t_end-t_start << std::endl;
1094 oomph_info <<
"Time for SuperLUSolver solve [sec]: " 1095 << t_end-t_start << std::endl;
1111 #ifdef OOMPH_HAS_MPI 1115 if (dist_matrix_pt != 0)
1119 if (Solver_type == Distributed ||
1120 (Solver_type == Default && nproc > 1 &&
1126 if (dist_matrix_pt != 0)
1128 factorise_distributed(matrix_pt);
1133 factorise_serial(matrix_pt);
1140 factorise_serial(matrix_pt);
1145 #ifdef OOMPH_HAS_MPI 1155 int m = matrix_pt->
ncol();
1156 int n = matrix_pt->
nrow();
1159 std::ostringstream error_message_stream;
1160 error_message_stream <<
"Can only solve for square matrices\n" 1161 <<
"N, M " << n <<
" " << m << std::endl;
1164 OOMPH_CURRENT_FUNCTION,
1165 OOMPH_EXCEPTION_LOCATION);
1171 if(dynamic_cast<DistributableLinearAlgebraObject*>(matrix_pt) != 0)
1179 int nprow=int(sqrt(
double(nproc)));
1184 if (nproc%nprow==0)
break;
1190 Dist_npcol=nproc/Dist_nprow;
1202 int allow_permutations = Dist_allow_row_and_col_permutations;
1205 if(dynamic_cast<CRDoubleMatrix*>(matrix_pt) != 0)
1215 if (!cr_matrix_pt->
built())
1218 (
"To apply SuperLUSolver to a CRDoubleMatrix - it must be built",
1219 OOMPH_CURRENT_FUNCTION,OOMPH_EXCEPTION_LOCATION);
1227 const int nnz_local = int(cr_matrix_pt->
nnz());
1235 Dist_value_pt =
new double[nnz_local];
1236 double* matrix_value_pt = cr_matrix_pt->
value();
1237 for(
int i=0;
i<nnz_local;
i++)
1239 Dist_value_pt[
i] = matrix_value_pt[
i];
1243 Dist_index_pt =
new int[nnz_local];
1245 for (
int i=0;
i<nnz_local;
i++)
1247 Dist_index_pt[
i] = matrix_index_pt[
i];
1252 Dist_start_pt =
new int[nrow_local+1];
1253 int* matrix_start_pt = cr_matrix_pt->
row_start();
1256 Dist_start_pt[
i] = matrix_start_pt[
i];
1264 if (Dist_delete_matrix_data==
true)
1266 cr_matrix_pt->
clear();
1271 ndof, nnz_local, nrow_local,
1272 first_row, Dist_value_pt, Dist_index_pt,
1273 Dist_start_pt, 0, Dist_nprow, Dist_npcol,
1274 doc,&Dist_solver_data_pt, &Dist_info,
1276 communicator_pt()->mpi_comm());
1279 Dist_distributed_solve_data_allocated=
true;
1285 const int nnz = int(cr_matrix_pt->
nnz());
1299 &Dist_value_pt,&Dist_index_pt,&Dist_start_pt);
1302 if (Dist_delete_matrix_data==
true)
1304 cr_matrix_pt->
clear();
1309 nrow, nnz, Dist_value_pt, Dist_index_pt,
1311 0, Dist_nprow, Dist_npcol, doc,
1312 &Dist_solver_data_pt, &Dist_info,
1314 ->communicator_pt()->mpi_comm());
1317 Dist_global_solve_data_allocated=
true;
1322 else if(dynamic_cast<CCDoubleMatrix*>(matrix_pt))
1328 const int nnz = int(serial_matrix_pt->
nnz());
1331 int ndof = int(serial_matrix_pt->
nrow());
1334 int ndof_local = ndof;
1342 Dist_value_pt =
new double[nnz];
1343 double* matrix_value_pt = serial_matrix_pt->
value();
1344 for(
int i=0;
i<nnz;
i++)
1346 Dist_value_pt[
i] = matrix_value_pt[
i];
1350 Dist_index_pt =
new int[nnz];
1351 int* matrix_index_pt = serial_matrix_pt->
row_index();
1352 for (
int i=0;
i<nnz;
i++)
1354 Dist_index_pt[
i] = matrix_index_pt[
i];
1358 Dist_start_pt =
new int[ndof_local+1];
1359 int* matrix_start_pt = serial_matrix_pt->
column_start();
1360 for (
int i=0;
i<=ndof_local;
i++)
1362 Dist_start_pt[
i] = matrix_start_pt[
i];
1366 if (Dist_delete_matrix_data==
true)
1373 ndof, nnz, Dist_value_pt, Dist_index_pt,
1374 Dist_start_pt, 0, Dist_nprow, Dist_npcol, doc,
1375 &Dist_solver_data_pt, &Dist_info,
1377 ->communicator_pt()->mpi_comm());
1380 Dist_global_solve_data_allocated=
true;
1385 std::ostringstream error_message_stream;
1386 error_message_stream <<
"SuperLUSolver implemented only for " 1387 <<
" CCDoubleMatrix, CRDoubleMatrix\n" 1388 <<
"and DistributedCRDoubleMatrix matrices\n";
1390 OOMPH_CURRENT_FUNCTION,
1391 OOMPH_EXCEPTION_LOCATION);
1397 std::ostringstream error_msg;
1398 error_msg <<
"SuperLU returned the error status code " 1400 <<
" . See the SuperLU documentation for what this means.";
1402 OOMPH_CURRENT_FUNCTION,
1403 OOMPH_EXCEPTION_LOCATION);
1418 if (dynamic_cast<DistributableLinearAlgebraObject*>(matrix_pt) != 0)
1420 if (dynamic_cast<DistributableLinearAlgebraObject*>
1423 std::ostringstream error_message_stream;
1424 error_message_stream
1425 <<
"The matrix must not be distributed.";
1427 OOMPH_CURRENT_FUNCTION,
1428 OOMPH_EXCEPTION_LOCATION);
1434 int n = matrix_pt->
nrow();
1438 int m = matrix_pt->
ncol();
1441 std::ostringstream error_message_stream;
1442 error_message_stream <<
"Can only solve for square matrices\n" 1443 <<
"N, M " << n <<
" " << m << std::endl;
1446 OOMPH_CURRENT_FUNCTION,
1447 OOMPH_EXCEPTION_LOCATION);
1454 int *index=0, *
start=0;
1467 if(dynamic_cast<CRDoubleMatrix*>(matrix_pt))
1470 Serial_compressed_row_flag=
true;
1477 nnz = CR_matrix_pt->
nnz();
1478 value = CR_matrix_pt->
value();
1483 else if(dynamic_cast<CCDoubleMatrix*>(matrix_pt))
1486 Serial_compressed_row_flag=
false;
1492 nnz = CC_matrix_pt->
nnz();
1493 value = CC_matrix_pt->
value();
1500 throw OomphLibError(
"SuperLU only works with CR or CC Double matrices",
1501 OOMPH_CURRENT_FUNCTION,
1502 OOMPH_EXCEPTION_LOCATION);
1511 Serial_sign_of_determinant_of_matrix =
superlu(&i, &n, &nnz, 0,
1512 value, index,
start,
1513 0, &n, &transpose, &doc,
1518 if(Serial_info != 0)
1520 std::ostringstream error_msg;
1521 error_msg <<
"SuperLU returned the error status code " 1523 <<
" . See the SuperLU documentation for what this means.";
1525 OOMPH_CURRENT_FUNCTION,
1526 OOMPH_EXCEPTION_LOCATION);
1542 #ifdef OOMPH_HAS_MPI 1545 backsub_distributed(rhs,result);
1550 backsub_serial(rhs,result);
1554 #ifdef OOMPH_HAS_MPI 1574 std::ostringstream error_message_stream;
1575 error_message_stream
1576 <<
"The vectors rhs must be setup";
1578 OOMPH_CURRENT_FUNCTION,
1579 OOMPH_EXCEPTION_LOCATION);
1587 if(!Suppress_incorrect_rhs_distribution_warning_in_resolve)
1589 std::ostringstream warning_stream;
1591 <<
"The distribution of rhs vector does not match that ofthe solver.\n";
1593 <<
"The rhs will be redistributed, which is likely to be inefficient\n";
1595 <<
"To remove this warning you can either:\n" 1596 <<
" i) Ensure that the rhs vector has the correct distribution\n" 1597 <<
" before calling the resolve() function\n" 1598 <<
"or ii) Set the flag \n" 1599 <<
" SuperLUSolver::Suppress_incorrect_rhs_distribution_warning_in_resolve\n" 1600 <<
" to be true\n\n";
1603 "SuperLUSolver::resolve()",
1604 OOMPH_EXCEPTION_LOCATION);
1619 std::ostringstream error_message_stream;
1620 error_message_stream
1621 <<
"The result vector distribution has been setup; it must have the " 1622 <<
"same distribution as the rhs vector.";
1624 OOMPH_CURRENT_FUNCTION,
1625 OOMPH_EXCEPTION_LOCATION);
1642 if (Dist_distributed_solve_data_allocated)
1648 &Dist_solver_data_pt, &Dist_info,
1650 communicator_pt()->mpi_comm());
1652 else if (Dist_global_solve_data_allocated)
1656 Dist_nprow, Dist_npcol,
doc,
1657 &Dist_solver_data_pt, &Dist_info,
1662 throw OomphLibError(
"The matrix factors have not been stored",
1663 OOMPH_CURRENT_FUNCTION,
1664 OOMPH_EXCEPTION_LOCATION);
1670 std::ostringstream error_msg;
1671 error_msg <<
"SuperLU returned the error status code " 1672 << Dist_info <<
" . See the SuperLU documentation for what this means.";
1674 OOMPH_CURRENT_FUNCTION,
1675 OOMPH_EXCEPTION_LOCATION);
1681 const_cast<DoubleVector&
>(rhs).redistribute(&rhs_distribution);
1698 std::ostringstream error_message_stream;
1699 error_message_stream
1700 <<
"The rhs vector distribution must be setup.";
1702 OOMPH_CURRENT_FUNCTION,
1703 OOMPH_EXCEPTION_LOCATION);
1706 if(static_cast<int>(Serial_n_dof) != n)
1709 "RHS does not have the same dimension as the linear system",
1710 OOMPH_CURRENT_FUNCTION,
1711 OOMPH_EXCEPTION_LOCATION);
1716 std::ostringstream error_message_stream;
1717 error_message_stream
1718 <<
"The rhs vector must not be distributed.";
1720 OOMPH_CURRENT_FUNCTION,
1721 OOMPH_EXCEPTION_LOCATION);
1729 std::ostringstream error_message_stream;
1730 error_message_stream
1731 <<
"If the result distribution is setup then it must be the same as the " 1732 <<
"rhs distribution";
1734 OOMPH_CURRENT_FUNCTION,
1735 OOMPH_EXCEPTION_LOCATION);
1747 int transpose = Serial_compressed_row_flag;
1754 result.values_pt(), &n, &transpose, &
doc,
1755 &Serial_f_factors, &Serial_info);
1758 if(Serial_info != 0)
1760 std::ostringstream error_msg;
1761 error_msg <<
"SuperLU returned the error status code " 1763 <<
" . See the SuperLU documentation for what this means.";
1765 OOMPH_CURRENT_FUNCTION,
1766 OOMPH_EXCEPTION_LOCATION);
1777 if(Serial_f_factors!=0)
1781 int transpose = Serial_compressed_row_flag;
1783 0, 0, &transpose, 0,
1784 &Serial_f_factors, &Serial_info);
1791 #ifdef OOMPH_HAS_MPI 1793 if(Dist_solver_data_pt!=0)
1806 if (Dist_distributed_solve_data_allocated)
1808 superlu_dist_distributed_matrix(3, -1, ndof, 0, 0, 0, 0, 0, 0, 0,
1809 Dist_nprow, Dist_npcol, doc,
1810 &Dist_solver_data_pt,
1814 Dist_distributed_solve_data_allocated =
false;
1816 if (Dist_global_solve_data_allocated)
1819 Dist_nprow, Dist_npcol, doc,
1820 &Dist_solver_data_pt, &Dist_info,
1823 Dist_global_solve_data_allocated =
false;
1826 Dist_solver_data_pt=0;
1829 delete[] Dist_value_pt;
1830 delete[] Dist_index_pt;
1831 delete[] Dist_start_pt;
int * column_index()
Access to C-style column index array.
unsigned long nnz() const
Return the number of nonzero entries (the local nnz)
Class of matrices containing doubles, and stored as a DenseMatrix<double>, but with solving functiona...
void clean_up_memory()
Clean up the memory allocated by the solver.
void solve(Problem *const &problem_pt, DoubleVector &result)
Solver: Takes pointer to problem and returns the results Vector which contains the solution of the li...
void solve(Problem *const &problem_pt, DoubleVector &result)
Solver: Takes pointer to problem and returns the results Vector which contains the solution of the li...
void factorise_distributed(DoubleMatrixBase *const &matrix_pt)
factorise method for SuperLU Dist
int Sign_of_determinant_of_matrix
Sign of the determinant of the matrix (obtained during the LU decomposition)
void redistribute(const LinearAlgebraDistribution *const &dist_pt)
The contents of the vector are redistributed to match the new distribution. In a non-MPI rebuild this...
bool built() const
access function to the Built flag - indicates whether the matrix has been build - i...
double * values_pt()
access function to the underlying values
void backsub_distributed(const DoubleVector &rhs, DoubleVector &result)
backsub method for SuperLU Dist
int * row_index()
Access to C-style row index array.
bool Enable_resolve
Boolean that indicates whether the matrix (or its factors, in the case of direct solver) should be st...
OomphCommunicator * communicator_pt() const
const access to the communicator pointer
bool Gradient_has_been_computed
flag that indicates whether the gradient was computed or not
static OomphCommunicator * communicator_pt()
access to the global oomph-lib communicator
void multiply_transpose(const DoubleVector &x, DoubleVector &soln) const
Multiply the transposed matrix by the vector x: soln=A^T x.
unsigned nrow() const
access function to the number of global rows.
bool distributed() const
access function to the distributed - indicates whether the distribution is serial or distributed ...
static bool mpi_has_been_initialised()
return true if MPI has been initialised
OomphCommunicator * communicator_pt()
access function to the oomph-lib communicator
double * LU_factors
Pointer to storage for the LU decomposition.
double * value()
Access to C-style value array.
unsigned long nnz() const
Return the number of nonzero entries.
bool distribution_built() const
void backsub_serial(const DoubleVector &rhs, DoubleVector &result)
backsub method for SuperLU (serial)
bool distributed() const
distribution is serial or distributed
void backsub(const DoubleVector &rhs, DoubleVector &result)
Do the backsubstitution step to solve the system LU result = rhs.
Describes the distribution of a distributable linear algebra type object. Typically this is a contain...
void build(const DoubleVector &old_vector)
Just copys the argument DoubleVector.
Base class for any linear algebra object that is distributable. Just contains storage for the LinearA...
bool Doc_time
Boolean flag that indicates whether the time taken.
void factorise(DoubleMatrixBase *const &matrix_pt)
Perform the LU decomposition of the matrix.
DoubleVector Gradient_for_glob_conv_newton_solve
DoubleVector storing the gradient for the globally convergent Newton method.
void start(const unsigned &i)
(Re-)start i-th timer
int & sign_of_jacobian()
Access function for the sign of the global jacobian matrix. This will be set by the linear solver...
void superlu_dist_global_matrix(int opt_flag, int allow_permutations, int n, int nnz, double *values, int *row_index, int *col_start, double *b, int nprow, int npcol, int doc, void **data, int *info, MPI_Comm comm)
int superlu(int *, int *, int *, int *, double *, int *, int *, double *, int *, int *, int *, void *, int *)
void multiply_transpose(const DoubleVector &x, DoubleVector &soln) const
Multiply the transposed matrix by the vector x: soln=A^T x.
double Jacobian_setup_time
Jacobian setup time.
unsigned first_row() const
access function for the first row on this processor
void get_fd_jacobian(DoubleVector &residuals, DenseMatrix< double > &jacobian)
Return the fully-assembled Jacobian and residuals, generated by finite differences.
void resolve(const DoubleVector &rhs, DoubleVector &result)
Resolve the system defined by the last assembled jacobian and the specified rhs vector if resolve has...
double timer()
returns the time in seconds after some point in past
void clear_distribution()
clear the distribution of this distributable linear algebra object
double Solution_time
Solution time.
void superlu_cr_to_cc(int nrow, int ncol, int nnz, double *cr_values, int *cr_index, int *cr_start, double **cc_values, int **cc_index, int **cc_start)
unsigned long ndof() const
Return the number of dofs.
void clean_up_memory()
Clean up the stored LU factors.
A class for compressed column matrices that store doubles.
virtual void get_jacobian(DoubleVector &residuals, DenseDoubleMatrix &jacobian)
Return the fully-assembled Jacobian and residuals for the problem Interface for the case when the Jac...
unsigned nrow() const
access function to the number of global rows.
virtual unsigned long nrow() const =0
Return the number of rows of the matrix.
void solve(Problem *const &problem_pt, DoubleVector &result)
Solver: Takes pointer to problem and returns the results Vector which contains the solution of the li...
void build_distribution(const LinearAlgebraDistribution *const dist_pt)
setup the distribution of this distributable linear algebra object
void backsub(const DoubleVector &rhs, DoubleVector &result)
Do the backsubstitution for SuperLU solver Note: returns the global result Vector.
void factorise(DoubleMatrixBase *const &matrix_pt)
Do the factorisation stage Note: if Delete_matrix_data is true the function matrix_pt->clean_up_memor...
bool Doc_stats
Boolean to indicate whether to output basic info during setup_multi_domain_interaction() routines...
unsigned nrow_local() const
access function for the num of local rows on this processor.
static bool Suppress_incorrect_rhs_distribution_warning_in_resolve
Static flag that determines whether the warning about incorrect distribution of RHSs will be printed ...
int * column_start()
Access to C-style column_start array.
A vector in the mathematical sense, initially developed for linear algebra type applications. If MPI then this vector can be distributed - its distribution is described by the LinearAlgebraDistribution object at Distribution_pt. Data is stored in a C-style pointer vector (double*)
unsigned long nrow() const
Return the number of rows of the matrix.
bool Compute_gradient
flag that indicates whether the gradient required for the globally convergent Newton method should be...
int * row_start()
Access to C-style row_start array.
Abstract base class for matrices of doubles – adds abstract interfaces for solving, LU decomposition and multiplication by vectors.
void superlu_dist_distributed_matrix(int opt_flag, int allow_permutations, int n, int nnz_local, int nrow_local, int first_row, double *values, int *col_index, int *row_start, double *b, int nprow, int npcol, int doc, void **data, int *info, MPI_Comm comm)
void clean_up_memory()
Wipe matrix data and set all values to 0.
A class for compressed row matrices. This is a distributable object.
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
virtual unsigned long ncol() const =0
Return the number of columns of the matrix.
long * Index
Pointer to storage for the index of permutations in the LU solve.
T * value()
Access to C-style value array.
unsigned long nrow() const
Return the number of rows of the matrix.
void factorise_serial(DoubleMatrixBase *const &matrix_pt)
factorise method for SuperLU (serial)
An oomph-lib wrapper to the MPI_Comm communicator object. Just contains an MPI_Comm object (which is ...