integschemesctes.h

00001 /*************************************************************************************
00002  * MechSys - A C++ library to simulate (Continuum) Mechanical Systems                *
00003  * Copyright (C) 2005 Dorival de Moraes Pedroso <dorival.pedroso at gmail.com>       *
00004  * Copyright (C) 2005 Raul Dario Durand Farfan  <raul.durand at gmail.com>           *
00005  *                                                                                   *
00006  * This file is part of MechSys.                                                     *
00007  *                                                                                   *
00008  * MechSys is free software; you can redistribute it and/or modify it under the      *
00009  * terms of the GNU General Public License as published by the Free Software         *
00010  * Foundation; either version 2 of the License, or (at your option) any later        *
00011  * version.                                                                          *
00012  *                                                                                   *
00013  * MechSys is distributed in the hope that it will be useful, but WITHOUT ANY        *
00014  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A   *
00015  * PARTICULAR PURPOSE. See the GNU General Public License for more details.          *
00016  *                                                                                   *
00017  * You should have received a copy of the GNU General Public License along with      *
00018  * MechSys; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, *
00019  * Fifth Floor, Boston, MA 02110-1301, USA                                           *
00020  *************************************************************************************/
00021 
00022 #ifndef MECHSYS_INTEGSCHEMESCTES_H
00023 #define MECHSYS_INTEGSCHEMESCTES_H
00024 
00025 #ifdef HAVE_CONFIG_H
00026   #include "config.h"
00027 #else
00028   #ifndef REAL
00029     #define REAL double
00030   #endif
00031 #endif
00032 
00033 #include "util/string.h"
00034 #include "util/exception.h"
00035 
00037 class IntegSchemesCtes
00038 {
00039 public:
00041     enum ISCType {FE,  // FE : Forward-Euler
00042                   ME}; // ME : (Automatic) Modified Euler
00043     
00044     // Constructor
00045     IntegSchemesCtes()
00046         : _type     (ME    ),
00047           _FE_ndiv  (1000  ),
00048           _ME_maxSS (200   ),
00049           _ME_STOL  (1.0e-3),
00050           _ME_dTini (0.001 ),
00051           _ME_mMin  (0.01  ),
00052           _ME_mMax  (10.0  ),
00053           _Ed_max   (0.5   )
00054     {}
00055 
00056     // Setup methods
00057     IntegSchemesCtes & Type    (String const & Type );
00058     IntegSchemesCtes & Type    (ISCType        Type ) { _type     = Type;  return (*this); }
00059     IntegSchemesCtes & FE_ndiv (int            ndiv ) { _FE_ndiv  = ndiv;  return (*this); }
00060     IntegSchemesCtes & ME_maxSS(int            maxSS) { _ME_maxSS = maxSS; return (*this); }
00061     IntegSchemesCtes & ME_STOL (REAL           STOL ) { _ME_STOL  = STOL;  return (*this); }
00062     IntegSchemesCtes & ME_dTini(REAL           dTini) { _ME_dTini = dTini; return (*this); }
00063     IntegSchemesCtes & ME_mMin (REAL           mMin ) { _ME_mMin  = mMin;  return (*this); }
00064     IntegSchemesCtes & ME_mMax (REAL           mMax ) { _ME_mMax  = mMax;  return (*this); }
00065     IntegSchemesCtes & EdMax   (REAL           EdMax) { _Ed_max   = EdMax; return (*this); }
00066 
00067     // Access methods
00068     ISCType        const & Type    () const { return _type;     }
00069     int            const & FE_ndiv () const { return _FE_ndiv;  }
00070     int            const & ME_maxSS() const { return _ME_maxSS; }
00071     REAL           const & ME_STOL () const { return _ME_STOL;  }
00072     REAL           const & ME_dTini() const { return _ME_dTini; }
00073     REAL           const & ME_mMin () const { return _ME_mMin;  }
00074     REAL           const & ME_mMax () const { return _ME_mMax;  }
00075     REAL           const & EdMax   () const { return _Ed_max;   }
00076 
00077 private:
00078     // Data
00079     ISCType        _type;     
00080     int            _FE_ndiv;  
00081     int            _ME_maxSS; 
00082     REAL           _ME_STOL;  
00083     REAL           _ME_dTini; 
00084     REAL           _ME_mMin;  
00085     REAL           _ME_mMax;  
00086     REAL           _Ed_max;   
00087 
00088 }; // class IntegSchemesCtes
00089 
00090 
00092 
00093 
00094 inline IntegSchemesCtes & IntegSchemesCtes::Type(String const & Type) // {{{
00095 {
00096          if (Type=="FE") _type=FE;
00097     else if (Type=="ME") _type=ME;
00098     else throw new Fatal(_("IntegSchemesCtes::Type: <%s> is an invalid type"), Type.c_str());
00099     return (*this); 
00100 } // }}}
00101 
00102 #endif // MECHSYS_INTEGSCHEMESCTES_H
00103 
00104 // vim:fdm=marker

Generated on Wed Jan 24 15:56:27 2007 for MechSys by  doxygen 1.4.7