ADMB Documentation  11.2.2853
 All Classes Files Functions Variables Typedefs Friends Defines
fmm_cont.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: fmm_cont.cpp 2353 2014-09-16 00:09:04Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include "fvar.hpp"
00012 
00013 #ifdef __TURBOC__
00014   #pragma hdrstop
00015   #include <iostream.h>
00016 #endif
00017 
00018 #ifdef __ZTC__
00019   #include <iostream.hpp>
00020   #define endl "\n"
00021 #endif
00022 #include <math.h>
00023 
00024 #ifndef OPT_LIB
00025   #include <cassert>
00026   #include <climits>
00027 #endif
00028 
00033 void fmm_control::set_defaults()
00034 {
00035   noprintx=0;
00036   fringe = 0.0;
00037   maxfn  = 500;
00038   iprint = 1;
00039   crit   = 0.0001;
00040   imax   = 30;
00041   dfn    = 0;
00042   ifn    = 0;
00043   iexit  = 0;
00044   ialph  = 0;
00045   ihflag = 0;
00046   ihang  = 0;
00047   scroll_flag = 1;
00048   maxfn_flag=0;
00049   quit_flag=0;
00050   min_improve=.0000001;
00051   ireturn = 0;
00052   dcheck_flag = -1;
00053   use_control_c=1;
00054 }
00055 
00060 fmm_control::fmm_control(const fmm_control & t)
00061 {
00062   fringe = t.fringe;
00063   maxfn  = t.maxfn;
00064   iprint = t.iprint;
00065   crit   = t.crit;
00066   imax   = t.imax;
00067   dfn    = t.dfn;
00068   ifn    = t.ifn;
00069   iexit  = t.iexit;
00070   min_improve =t.min_improve;
00071   ialph  = t.ialph;
00072   ihflag = t.ihflag;
00073   ihang  = t.ihang;
00074   scroll_flag = t.scroll_flag;
00075   dcheck_flag = t.dcheck_flag;
00076 
00077   ireturn = t.ireturn;
00078 }
00079 
00084 fmm_control::fmm_control()
00085 {
00086   set_defaults();
00087 }
00088 
00093 fmm_control::fmm_control(const lvector& ipar)
00094 {
00095   set_defaults();
00096   maxfn  = ipar[1];
00097   iprint = ipar[2];
00098   #ifdef __HP__
00099     crit   = .0001;
00100   #else
00101     crit   = pow(double(10), int(-ipar[3]));
00102   #endif
00103   imax   = ipar[4];
00104   long ipar5 = ipar[5];
00105 #ifndef OPT_LIB
00106   assert(ipar5 <= INT_MAX);
00107 #endif
00108   scroll_flag = (int)ipar5;
00109 }
00110 
00117 ostream& operator<<(const ostream& s, const fmm_control& fmc)
00118 {
00119   fmc.writeon(s);
00120   return (ostream&)s;
00121 }
00122 
00127 void fmm_control::writeon(const ostream& _s) const
00128 {
00129   ostream& s = (ostream&) _s;
00130   s << "values of fmm_control structure:\n";
00131   s << "  maxfn  =  " << maxfn  << endl;
00132   s << "  iprint =  " << iprint << endl;
00133   s << "  crit   =  " << crit   << endl;
00134   s << "  imax   =  " << imax   << endl;
00135   s << "  dfn    =  " << dfn    << endl;
00136   s << "  ifn    =  " << ifn    << endl;
00137   s << "  iexit  =  " << iexit  << endl;
00138   s << "  ialph  =  " << ialph   << endl;
00139   s << "  ihflag =  " << ihflag << endl;
00140   s << "  ihang  =  " << ihang  << endl;
00141   s << "  scroll_flag  =  " << scroll_flag  << endl;
00142   s << "  ireturn  = " << ireturn  << endl;
00143 }