ADMB Documentation  11.1.2192
 All Classes Files Functions Variables Typedefs Friends Defines
fmm_cont.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: fmm_cont.cpp 1919 2014-04-22 22:02:01Z 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 
00028 void fmm_control::set_defaults()
00029 {
00030   noprintx=0;
00031   fringe = 0.0;
00032   maxfn  = 500;
00033   iprint = 1;
00034   crit   = 0.0001;
00035   imax   = 30;
00036   dfn    = 0;
00037   ifn    = 0;
00038   iexit  = 0;
00039   ialph  = 0;
00040   ihflag = 0;
00041   ihang  = 0;
00042   scroll_flag = 1;
00043   maxfn_flag=0;
00044   quit_flag=0;
00045   min_improve=.0000001;
00046   ireturn = 0;
00047   dcheck_flag = -1;
00048   use_control_c=1;
00049 }
00050 
00055 fmm_control::fmm_control(const fmm_control & t)
00056 {
00057   fringe = t.fringe;
00058   maxfn  = t.maxfn;
00059   iprint = t.iprint;
00060   crit   = t.crit;
00061   imax   = t.imax;
00062   dfn    = t.dfn;
00063   ifn    = t.ifn;
00064   iexit  = t.iexit;
00065   min_improve =t.min_improve;
00066   ialph  = t.ialph;
00067   ihflag = t.ihflag;
00068   ihang  = t.ihang;
00069   scroll_flag = t.scroll_flag;
00070   dcheck_flag = t.dcheck_flag;
00071 
00072   ireturn = t.ireturn;
00073 }
00074 
00079 fmm_control::fmm_control()
00080 {
00081   set_defaults();
00082 }
00083 
00088 fmm_control::fmm_control(const lvector& ipar)
00089 {
00090   set_defaults();
00091   maxfn  = ipar[1];
00092   iprint = ipar[2];
00093   #ifdef __HP__
00094     crit   = .0001;
00095   #else
00096     crit   = pow(double(10), int(-ipar[3]));
00097   #endif
00098   imax   = ipar[4];
00099   scroll_flag = ipar[5];
00100 }
00101 
00108 ostream& operator<<(const ostream& s, const fmm_control& fmc)
00109 {
00110   fmc.writeon(s);
00111   return (ostream&)s;
00112 }
00113 
00118 void fmm_control::writeon(const ostream& _s) const
00119 {
00120   ostream& s = (ostream&) _s;
00121   s << "values of fmm_control structure:\n";
00122   s << "  maxfn  =  " << maxfn  << endl;
00123   s << "  iprint =  " << iprint << endl;
00124   s << "  crit   =  " << crit   << endl;
00125   s << "  imax   =  " << imax   << endl;
00126   s << "  dfn    =  " << dfn    << endl;
00127   s << "  ifn    =  " << ifn    << endl;
00128   s << "  iexit  =  " << iexit  << endl;
00129   s << "  ialph  =  " << ialph   << endl;
00130   s << "  ihflag =  " << ihflag << endl;
00131   s << "  ihang  =  " << ihang  << endl;
00132   s << "  scroll_flag  =  " << scroll_flag  << endl;
00133   s << "  ireturn  = " << ireturn  << endl;
00134 }