DinverCore/Generator.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of DinverCore.
00004 **
00005 **  This file may be distributed and/or modified under the terms of the
00006 **  GNU General Public License version 2 or 3 as published by the Free
00007 **  Software Foundation and appearing in the file LICENSE.GPL included
00008 **  in the packaging of this file.
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 General Public License for
00013 **  more details.
00014 **
00015 **  You should have received a copy of the GNU General Public License
00016 **  along with this program. If not, see <http://www.gnu.org/licenses/>.
00017 **
00018 **  See http://www.geopsy.org for more information.
00019 **
00020 **  Created: 2010-12-21
00021 **  Authors:
00022 **    Marc Wathelet (LGIT, Grenoble, France)
00023 **
00024 ***************************************************************************/
00025 
00026 #ifndef GENERATOR_H
00027 #define GENERATOR_H
00028 
00029 #include <QGpCoreTools.h>
00030 
00031 #include "DinverCoreDLLExport.h"
00032 
00033 namespace DinverCore {
00034 
00035   class ModelRepository;
00036   class AbstractForward;
00037   class VoronoiNavigator;
00038   class NewModel;
00039 
00040   class DINVERCORE_EXPORT Generator : public Thread
00041   {
00042   public:
00043     Generator(ModelRepository * repository, AbstractForward * forward);
00044     ~Generator();
00045 
00046     enum Type {MonteCarlo, Neighborhood};
00047 
00048     void setWalkCount(int n) {_walkCount=n;}
00049     void setType(Type t) {_type=t;}
00050 
00051     void stop() {_terminated.setValue(true);}
00052   protected:
00053     virtual void run();
00054   private:
00055     virtual void monteCarloLoop();
00056     virtual void neighborhoodLoop();
00057     void monteCarlo(NewModel * newModel);
00058     void neighborhood(NewModel * newModel);
00059 
00060     AtomicBoolean _terminated;
00061 
00062     Type _type;
00063     int _walkCount;
00064 
00065     ModelRepository * _repository;
00066     AbstractForward * _forward;
00067     Random * _randomNumbers;
00068 
00069     int _generatorModelsSerialNumber;
00070     VoronoiNavigator * _nav;
00071   };
00072 
00073 } // namespace DinverCore
00074 
00075 #endif // GENERATOR_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines