csubcam.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_COUPLEDSUBCAM_H
00023 #define MECHSYS_COUPLEDSUBCAM_H
00024 
00025 // MechSys
00026 #include "models/coupled/genericc.h"
00027 #include "models/subcam.h"
00028 #include "models/flow/linearflow.h"
00029 
00030 class CSubCam : public GenericC<SubCam, LinearFlow>
00031 {
00032 public:
00033     // Constructor
00034     CSubCam(Array<REAL> const & Prms, Array<REAL> const & IniData);
00035 
00036     // Derived methods
00037     String Name() const { return "CSubCam"; }
00038 
00039 }; // class CSubCam
00040 
00041 
00043 
00044 
00045 inline CSubCam::CSubCam(Array<REAL> const & Prms, Array<REAL> const & IniData) // {{{
00046 {
00047     // ##################################################################### Setup Parameters
00048 
00049     /* example.mat
00050      * #-----------------------------------------------------------
00051      *             0       1      2     3      4        5      6 
00052      *            lam     kap  phics    G      c        k    gammaW
00053      * CSubCam  0.0891  0.0196   31.6  105  14000   1.0e-4   0.001
00054      *
00055      */
00056 
00057     // Check number of parameters
00058     const size_t n_equi_prms = SubCam    ::NPRMS; // SubCam     { lam kap nu rcs c }
00059     const size_t n_flow_prms = LinearFlow::NPRMS; // LinearFlow { k gammaW}
00060     const size_t n_prms      = n_equi_prms+n_flow_prms;
00061     if (Prms.size()!=n_prms)
00062         throw new Fatal(_("CSubCam::Constructor: The number of parameters (%d) is incorrect. It must be equal to %d"), Prms.size(), n_prms);
00063 
00064     // Parameters
00065     Array<REAL> equi_prms; equi_prms.resize(n_equi_prms); for (size_t i=0; i<n_equi_prms; ++i) equi_prms[i]=Prms[i];
00066     Array<REAL> flow_prms; flow_prms.resize(n_flow_prms); for (size_t i=0; i<n_flow_prms; ++i) flow_prms[i]=Prms[i+n_equi_prms];
00067 
00068     // ##################################################################### Setup Initial State
00069 
00070     // Check number of initial data
00071     const size_t n_equi_idat = SubCam    ::NIDAT; // SubCam     { SigX SigY SigZ vini OCR }
00072     const size_t n_flow_idat = LinearFlow::NIDAT; // LinearFlow { Pp }
00073     const size_t n_idat      = n_equi_idat+n_flow_idat;
00074     if (IniData.size()!=n_idat) // Layered analysis
00075         throw new Fatal(_("CSubCam::Constructor: The number of initial data is not sufficiet (it must be equal to 5). { SigX SigY SigZ vini OCR Pp }"));
00076 
00077     // Initial data
00078     Array<REAL> equi_idat; equi_idat.resize(n_equi_idat); for (size_t i=0; i<n_equi_idat; ++i) equi_idat[i]=IniData[i];
00079     Array<REAL> flow_idat; flow_idat.resize(n_flow_idat); for (size_t i=0; i<n_flow_idat; ++i) flow_idat[i]=IniData[i+n_equi_idat];
00080 
00081     // ##################################################################### Allocate derived models
00082     
00083     // Allocate equilib and flow models
00084     AllocateSubModels(equi_prms, equi_idat, flow_prms, flow_idat);
00085     
00086 } // }}}
00087 
00088 
00090 
00091 // Allocate a new CSubCam model
00092 CoupledModel * CSubCamMaker(Array<REAL> const & Prms, Array<REAL> const & IniData)
00093 {
00094     return new CSubCam(Prms, IniData); 
00095 }
00096 
00097 // Register an CSubCam model into ModelFactory array map
00098 int CSubCamRegister()
00099 {
00100     CoupledModelFactory["CSubCam"] = CSubCamMaker;
00101     return 0;
00102 }
00103 
00104 // Execute the autoregistration
00105 int __CSubCam_dummy_int = CSubCamRegister();
00106 
00107 // }}}
00108 
00109 #endif // MECHSYS_COUPLEDSUBCAM_H
00110 
00111 // vim:fdm=marker

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