QGpCoreWave/ModalRefine.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of QGpCoreWave.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2004-10-22
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (ULg, Liège, Belgium)
00025 **    Marc Wathelet (LGIT, Grenoble, France)
00026 **
00027 ***************************************************************************/
00028 
00029 #ifndef MODALREFINE_H
00030 #define MODALREFINE_H
00031 
00032 #include <QGpCoreTools.h>
00033 #include "QGpCoreWaveDLLExport.h"
00034 
00035 namespace QGpCoreWave {
00036 
00037 class QGPCOREWAVE_EXPORT ModalRefine
00038 {
00039 public:
00040   ModalRefine() {_nModes=0; _values=0;}
00041   inline ModalRefine(int nModes, double x);
00042   inline ModalRefine(const ModalRefine& o);
00043   ~ModalRefine() {delete [] _values;}
00044 
00045   inline void operator=(const ModalRefine& o);
00046   bool operator<(const ModalRefine& o) const {return _x < o._x;}
00047 
00048   double x() const {return _x;}
00049 
00050   const RealValue& value(int iMode) const {ASSERT(iMode<_nModes); return _values[ iMode ];}
00051   void setValue(int iMode, double val) {ASSERT(iMode<_nModes); _values[ iMode ].setValue(val);}
00052   void setValid(int iMode, bool v) {ASSERT(iMode<_nModes); _values[ iMode ].setValid(v);}
00053   inline void setValid(bool v);
00054 private:
00055   double _x;
00056   int _nModes;
00057   RealValue * _values;
00058 };
00059 
00060 typedef QList<ModalRefine> RefineList;
00061 typedef QList<ModalRefine>::ConstIterator RefineIterator;
00062 
00063 inline ModalRefine::ModalRefine(int nModes, double x)
00064 {
00065   TRACE;
00066   _nModes=nModes;
00067   _values=new RealValue [ _nModes ];
00068   _x=x;
00069 }
00070 
00071 inline ModalRefine::ModalRefine(const ModalRefine& o)
00072 {
00073   TRACE;
00074   _x=o._x;
00075   _nModes=o._nModes;
00076   _values=new RealValue [ _nModes ];
00077   for(int i=0;i<_nModes;i++) {
00078     _values[i]=o._values[i];
00079   }
00080 }
00081 
00082 inline void ModalRefine::operator=(const ModalRefine& o)
00083 {
00084   TRACE;
00085   _x=o._x;
00086   _nModes=o._nModes;
00087   delete [] _values;
00088   _values=new RealValue [ _nModes ];
00089   for(int i=0;i<_nModes;i++) {
00090     _values[i]=o._values[i];
00091   }
00092 }
00093 
00094 inline void ModalRefine::setValid(bool v)
00095 {
00096   TRACE;
00097   for(int i=0;i<_nModes;i++) {
00098     _values[i].setValid(v);
00099   }
00100 }
00101 
00102 } // namespace QGpCoreWave
00103 
00104 #endif // MODALREFINE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines