MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbstractLinAlgPack_MA28Solver.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 //
42 // This is a class for encapsulsting the MA28 package as
43 // and object so that multiple sparse matrix systems can
44 // be solved at the same time.
45 
46 #ifndef SSP_MA28_SOLVER_H
47 #define SSP_MA28_SOLVER_H
48 
50 
51 namespace MA28_Cpp {
52 
53 // Adobt some of the declarations from MA29_CppDecl
58 
69 class MA28Solver {
70 public:
71 
73  MA28Solver();
74 
76  MA28Solver(const MA28Solver& s);
77 
78  // MA28 interface functions
79 
81  void ma28ad(const f_int& n, const f_int& nz, f_dbl_prec a[], const f_int& licn
82  , f_int irn[], const f_int& lirn, f_int icn[], const f_dbl_prec& u
83  , f_int ikeep[], f_int iw[], f_dbl_prec w[], f_int* iflag)
84  {
86  MA28_CppDecl::ma28ad(n,nz,a,licn,irn,lirn,icn,u,ikeep,iw,w,iflag);
88  }
89 
91  void ma28bd(const f_int& n, const f_int& nz, f_dbl_prec a[], const f_int& licn
92  , const f_int ivect[], const f_int jvect[], const f_int icn[]
93  , const f_int ikeep[], f_int iw[], f_dbl_prec w[], f_int* iflag)
94  {
96  MA28_CppDecl::ma28bd(n,nz,a,licn,ivect,jvect,icn,ikeep,iw,w,iflag);
98  }
99 
101  void ma28cd(const f_int& n, const f_dbl_prec a[], const f_int& licn, const f_int icn[]
102  , const f_int ikeep[], f_dbl_prec rhs[], f_dbl_prec w[], const f_int& mtype)
103  {
105  MA28_CppDecl::ma28cd(n,a,licn,icn,ikeep,rhs,w,mtype);
107  }
108 
109  // Common block data setting and retrieval functions
110 
112  void lp(f_int lp)
113  { changed_=true; common_blocks_.ma28ed_.lp=lp; }
116  { return common_blocks_.ma28ed_.lp; }
118  void mp(f_int mp)
119  { changed_=true; common_blocks_.ma28ed_.mp=mp; }
122  { return common_blocks_.ma28ed_.mp; }
125  { changed_=true; common_blocks_.ma28ed_.lblock=lblock; }
128  { return common_blocks_.ma28ed_.lblock; }
131  { changed_=true; common_blocks_.ma28ed_.grow=grow; }
134  { return common_blocks_.ma28ed_.grow; }
137  { changed_=true; common_blocks_.ma28fd_.eps=eps; }
140  { return common_blocks_.ma28fd_.eps; }
143  { changed_=true; common_blocks_.ma28fd_.rmin=rmin; }
146  { return common_blocks_.ma28fd_.rmin; }
149  { changed_=true; common_blocks_.ma28fd_.resid=resid; }
152  { return common_blocks_.ma28fd_.resid; }
155  { changed_=true; common_blocks_.ma28fd_.irncp=irncp; }
158  { return common_blocks_.ma28fd_.irncp; }
161  { changed_=true; common_blocks_.ma28fd_.icncp=icncp; }
164  { return common_blocks_.ma28fd_.icncp; }
167  { changed_=true; common_blocks_.ma28fd_.minirn=minirn; }
170  { return common_blocks_.ma28fd_.minirn; }
173  { changed_=true; common_blocks_.ma28fd_.minicn=minicn; }
176  { return common_blocks_.ma28fd_.minicn; }
179  { changed_=true; common_blocks_.ma28fd_.irank=irank; }
182  { return common_blocks_.ma28fd_.irank; }
185  { changed_=true; common_blocks_.ma28fd_.abort1=abort1; }
188  { return common_blocks_.ma28fd_.abort1; }
191  { changed_=true; common_blocks_.ma28fd_.abort2=abort2; }
194  { return common_blocks_.ma28fd_.abort2; }
196  void idisp(f_int val, f_int i)
197  { changed_=true; common_blocks_.ma28gd_.idisp[i]=val; }
200  { return common_blocks_.ma28gd_.idisp[i]; }
203  { changed_=true; common_blocks_.ma28hd_.tol=tol; }
206  { return common_blocks_.ma28hd_.tol; }
209  { changed_=true; common_blocks_.ma28hd_.themax=themax; }
212  { return common_blocks_.ma28hd_.themax; }
215  { changed_=true; common_blocks_.ma28hd_.big=big; }
218  { return common_blocks_.ma28hd_.big; }
221  { changed_=true; common_blocks_.ma28hd_.dxmax=dxmax; }
224  { return common_blocks_.ma28hd_.dxmax; }
227  { changed_=true; common_blocks_.ma28hd_.errmax=errmax; }
230  { return common_blocks_.ma28hd_.errmax; }
233  { changed_=true; common_blocks_.ma28hd_.dres=dres; }
236  { return common_blocks_.ma28hd_.dres; }
239  { changed_=true; common_blocks_.ma28hd_.cgce=cgce; }
242  { return common_blocks_.ma28hd_.cgce; }
245  { changed_=true; common_blocks_.ma28hd_.ndrop=ndrop; }
248  { return common_blocks_.ma28hd_.ndrop; }
251  { changed_=true; common_blocks_.ma28hd_.maxit=maxit; }
254  { return common_blocks_.ma28hd_.maxit; }
257  { changed_=true; common_blocks_.ma28hd_.noiter=noiter; }
260  { return common_blocks_.ma28hd_.noiter; }
263  { changed_=true; common_blocks_.ma28hd_.nsrch=nsrch; }
266  { return common_blocks_.ma28hd_.nsrch; }
269  { changed_=true; common_blocks_.ma28hd_.istart=istart; }
272  { return common_blocks_.ma28hd_.istart; }
275  { changed_=true; common_blocks_.ma28hd_.lbig=lbig; }
278  { return common_blocks_.ma28hd_.lbig; }
279 
281  void dump_common_blocks(std::ostream& o)
283 
286  { changed_ = true; common_blocks_ = solver.common_blocks_; return *this; }
287 
288  // ///////////////////////////////////
289  // Static member functions
290 
292  static void dump_ma28_common_blocks(std::ostream& o)
294 
295 private:
296 
297  // ////////////////////////////////////
298  // Private member functions
299 
300  // Copy the local copy the common block data to MA28 before a MA28 call.
301  void set_common_block_data();
302 
303  // Retrieve the common block data after a ma28 call.
304  void get_common_block_data();
305 
306  // ///////////////////////////////////
307  // Private member data
308 
309  // Common block data for this solver object
311 
312  // Flag for if the common bock data has changed
313  bool changed_;
314 
315  // ///////////////////////////////////
316  // Static member data
317 
318  // Copies of the default values for the
319  // common block data.
321 
322  // References to the MA28 common blocks
324 
325  // Pointer variable who's purpose it to identify
326  // what solver object is the current one.
328 
329 };
330 
331 } // end namespace MA28_Cpp
332 
333 #endif // SSP_MA28_SOLVER_H
const f_int f_dbl_prec const f_int & licn
const f_int f_dbl_prec const f_int f_int const f_int f_int const f_dbl_prec f_int f_int iw[]
void ma28ad(const f_int &n, const f_int &nz, f_dbl_prec a[], const f_int &licn, f_int irn[], const f_int &lirn, f_int icn[], const f_dbl_prec &u, f_int ikeep[], f_int iw[], f_dbl_prec w[], f_int *iflag)
void ma28bd(const f_int &n, const f_int &nz, f_dbl_prec a[], const f_int &licn, const f_int ivect[], const f_int jvect[], const f_int icn[], const f_int ikeep[], f_int iw[], f_dbl_prec w[], f_int *iflag)
void dump_values(std::ostream &o)
static MA28CommonBlockReferences ma28_common_blocks_
FortranTypes::f_int f_int
MA28Solver & operator=(const MA28Solver &solver)
Copy the state of one solver to another.
const f_int f_dbl_prec const f_int f_int const f_int f_int const f_dbl_prec f_int ikeep[]
FortranTypes::f_logical f_logical
void dump_values(std::ostream &o)
void ma28bd(const f_int &n, const f_int &nz, f_dbl_prec a[], const f_int &licn, const f_int ivect[], const f_int jvect[], const f_int icn[], const f_int ikeep[], f_int iw[], f_dbl_prec w[], f_int *iflag)
MA28CommonBlockStorage common_blocks_
const f_int f_dbl_prec const f_int const f_int const f_int jvect[]
const f_int f_dbl_prec const f_int f_int const f_int f_int const f_dbl_prec f_int f_int f_dbl_prec w[]
void dump_common_blocks(std::ostream &o)
Dump the common block infomation for this solver object.
const f_dbl_prec const f_int const f_int const f_int f_dbl_prec f_dbl_prec const f_int & mtype
const f_int f_dbl_prec const f_int f_int const f_int f_int const f_dbl_prec f_int f_int f_dbl_prec f_int * iflag
void ma28ad(const f_int &n, const f_int &nz, f_dbl_prec a[], const f_int &licn, f_int irn[], const f_int &lirn, f_int icn[], const f_dbl_prec &u, f_int ikeep[], f_int iw[], f_dbl_prec w[], f_int *iflag)
const f_int f_dbl_prec const f_int const f_int ivect[]
const f_int f_dbl_prec const f_int f_int const f_int f_int icn[]
static void dump_ma28_common_blocks(std::ostream &o)
Dump the common block infomation for ma28 common blocks.
const f_dbl_prec const f_int const f_int const f_int f_dbl_prec rhs[]
void ma28cd(const f_int &n, const f_dbl_prec a[], const f_int &licn, const f_int icn[], const f_int ikeep[], f_dbl_prec rhs[], f_dbl_prec w[], const f_int &mtype)
const f_int f_dbl_prec const f_int f_int irn[]
static MA28CommonBlockStorage default_common_blocks_
FortranTypes::f_dbl_prec f_dbl_prec
void ma28cd(const f_int &n, const f_dbl_prec a[], const f_int &licn, const f_int icn[], const f_int ikeep[], f_dbl_prec rhs[], f_dbl_prec w[], const f_int &mtype)
const f_int f_dbl_prec const f_int f_int const f_int f_int const f_dbl_prec & u
FortranTypes::f_real f_real
const f_int f_dbl_prec const f_int f_int const f_int & lirn
MA28Solver()
Construct a solver object that is initialized with the default common block data variables.
MA28 Basic Encapsulation Class.