frontal_solver.h
Go to the documentation of this file.
1 // LIC// ====================================================================
2 // LIC// This file forms part of oomph-lib, the object-oriented,
3 // LIC// multi-physics finite-element library, available
4 // LIC// at http://www.oomph-lib.org.
5 // LIC//
6 // LIC// Copyright (C) 2006-2022 Matthias Heil and Andrew Hazel
7 // LIC//
8 // LIC// This library is free software; you can redistribute it and/or
9 // LIC// modify it under the terms of the GNU Lesser General Public
10 // LIC// License as published by the Free Software Foundation; either
11 // LIC// version 2.1 of the License, or (at your option) any later version.
12 // LIC//
13 // LIC// This library is distributed in the hope that it will be useful,
14 // LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // LIC// Lesser General Public License for more details.
17 // LIC//
18 // LIC// You should have received a copy of the GNU Lesser General Public
19 // LIC// License along with this library; if not, write to the Free Software
20 // LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 // LIC// 02110-1301 USA.
22 // LIC//
23 // LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24 // LIC//
25 // LIC//====================================================================
26 // This is the header file for the C-wrapper functions for the HSL MA42
27 // frontal solver
28 
29 // Include guards to prevent multiple inclusions of the header
30 #ifndef HSL_MA42OOMPH__FRONTAL_SOLVER_HEADER
31 #define HSL_MA42OOMPH__FRONTAL_SOLVER_HEADER
32 
33 
34 // Config header generated by autoconfig
35 #ifdef HAVE_CONFIG_H
36 #include <oomph-lib-config.h>
37 #endif
38 
39 #ifdef OOMPH_HAS_MPI
40 #include "mpi.h"
41 #endif
42 
43 // oomph-lib headers
44 #include "Vector.h"
45 #include "linear_solver.h"
46 
47 namespace oomph
48 {
49  //====================================================================
54  //====================================================================
55  class HSL_MA42 : public LinearSolver
56  {
57  private:
60  void solve_for_one_dof(Problem* const& problem_pt, DoubleVector& result);
61 
62 
64  bool Doc_stats;
65 
68 
71 
75 
79 
83 
86  double Front_factor;
87 
90  double Lenfle_factor;
91 
93  int Icntl[8];
94 
96  int Isave[45];
97 
99  int Info[23];
100 
102  double* W;
103 
105  int Lw;
106 
108  int* IW;
109 
111  int Liw;
112 
114  unsigned long N_dof;
115 
116  public:
119  HSL_MA42() : W(0), Lw(0), IW(0), Liw(0), N_dof(0)
120  {
121  Doc_stats = false;
122  Reorder_flag = false;
123  Use_direct_access_files = false;
124 
125  // Default values for memory allocation
126  Lenbuf_factor0 = 1.2;
127  Lenbuf_factor1 = 1.2;
128  Lenbuf_factor2 = 1.5;
129  Front_factor = 1.1;
130  Lenfle_factor = 1.5;
131  }
132 
135  {
136  clean_up_memory();
137  }
138 
140  HSL_MA42(const HSL_MA42&) = delete;
141 
143  void operator=(const HSL_MA42&) = delete;
144 
147  {
148  if (IW)
149  {
150  delete[] IW;
151  IW = 0;
152  Liw = 0;
153  }
154  if (W)
155  {
156  delete[] W;
157  W = 0;
158  Lw = 0;
159  }
160  }
161 
164  {
166  clean_up_memory();
167  }
168 
172  void solve(Problem* const& problem_pt, DoubleVector& result);
173 
178  void solve(DoubleMatrixBase* const& matrix_pt,
179  const DoubleVector& rhs,
180  DoubleVector& result)
181  {
182  LinearSolver::solve(matrix_pt, rhs, result);
183  }
184 
185 
190  void solve(DoubleMatrixBase* const& matrix_pt,
191  const Vector<double>& rhs,
192  Vector<double>& result)
193  {
194  LinearSolver::solve(matrix_pt, rhs, result);
195  }
196 
197 
201  void resolve(const DoubleVector& rhs, DoubleVector& result);
202 
204  void reorder_elements(Problem* const& problem_pt);
205 
208  {
209  Doc_stats = true;
210  }
211 
214  {
215  Doc_stats = false;
216  }
217 
220  {
221  Reorder_flag = true;
222  }
223 
226  {
227  Reorder_flag = false;
228  }
229 
232  {
234  }
235 
238  {
239  Use_direct_access_files = false;
240  }
241 
244  double& lenbuf_factor0()
245  {
246  return Lenbuf_factor0;
247  }
248 
251  double& lenbuf_factor1()
252  {
253  return Lenbuf_factor1;
254  }
255 
258  double& lenbuf_factor2()
259  {
260  return Lenbuf_factor2;
261  }
262 
265  double& front_factor()
266  {
267  return Front_factor;
268  }
269 
272  double& lenfle_factor()
273  {
274  return Lenfle_factor;
275  }
276  };
277 
278 } // namespace oomph
279 
280 #endif
Definition: matrices.h:261
Definition: double_vector.h:58
Definition: frontal_solver.h:56
int Lw
Size of the workspace array, W.
Definition: frontal_solver.h:105
~HSL_MA42()
Destructor, clean up the allocated memory.
Definition: frontal_solver.h:134
double & front_factor()
Definition: frontal_solver.h:265
bool Doc_stats
Doc the solver stats or stay quiet?
Definition: frontal_solver.h:64
double Lenfle_factor
Definition: frontal_solver.h:90
double & lenfle_factor()
Definition: frontal_solver.h:272
bool Use_direct_access_files
Use direct access files?
Definition: frontal_solver.h:70
void disable_direct_access_files()
Disable use of direct access files.
Definition: frontal_solver.h:237
bool Reorder_flag
Reorder elements with Sloan's algorithm?
Definition: frontal_solver.h:67
void operator=(const HSL_MA42 &)=delete
Broken assignment operator.
double Lenbuf_factor2
Definition: frontal_solver.h:82
void enable_doc_stats()
Enable documentation of statistics.
Definition: frontal_solver.h:207
double Lenbuf_factor1
Definition: frontal_solver.h:78
int Icntl[8]
Control flag for MA42; see MA42 documentation for details.
Definition: frontal_solver.h:93
int Isave[45]
Control flag for MA42; see MA42 documentation for details.
Definition: frontal_solver.h:96
double & lenbuf_factor1()
Definition: frontal_solver.h:251
int Liw
Size of the integer workspace array.
Definition: frontal_solver.h:111
void solve(DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &result)
Definition: frontal_solver.h:178
void reorder_elements(Problem *const &problem_pt)
Function to reorder the elements based on Sloan's algorithm.
Definition: frontal_solver.cc:969
void solve_for_one_dof(Problem *const &problem_pt, DoubleVector &result)
Definition: frontal_solver.cc:48
void clean_up_memory()
Clean up memory.
Definition: frontal_solver.h:146
void disable_resolve()
Overload disable resolve so that it cleans up memory too.
Definition: frontal_solver.h:163
void enable_reordering()
Enable reordering using Sloan's algorithm.
Definition: frontal_solver.h:219
void enable_direct_access_files()
Enable use of direct access files.
Definition: frontal_solver.h:231
HSL_MA42(const HSL_MA42 &)=delete
Broken copy constructor.
void disable_reordering()
Disable reordering.
Definition: frontal_solver.h:225
double Front_factor
Definition: frontal_solver.h:86
int Info[23]
Control flag for MA42; see MA42 documentation for details.
Definition: frontal_solver.h:99
double * W
Workspace storage for MA42.
Definition: frontal_solver.h:102
void resolve(const DoubleVector &rhs, DoubleVector &result)
Wrapper for HSL MA42 frontal solver.
Definition: frontal_solver.cc:888
double Lenbuf_factor0
Definition: frontal_solver.h:74
void solve(DoubleMatrixBase *const &matrix_pt, const Vector< double > &rhs, Vector< double > &result)
Definition: frontal_solver.h:190
HSL_MA42()
Definition: frontal_solver.h:119
double & lenbuf_factor0()
Definition: frontal_solver.h:244
void solve(Problem *const &problem_pt, DoubleVector &result)
Wrapper for HSL MA42 frontal solver.
Definition: frontal_solver.cc:127
void disable_doc_stats()
Disable documentation of statistics.
Definition: frontal_solver.h:213
int * IW
Integer workspace storage for MA42.
Definition: frontal_solver.h:108
double & lenbuf_factor2()
Definition: frontal_solver.h:258
unsigned long N_dof
Size of the linear system.
Definition: frontal_solver.h:114
Definition: linear_solver.h:68
virtual void solve(Problem *const &problem_pt, DoubleVector &result)=0
virtual void disable_resolve()
Definition: linear_solver.h:144
Definition: problem.h:151
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10