00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef QC_PARTITIONER_H_
00021 #define QC_PARTITIONER_H_
00022
00023
00024 #include <fstream>
00025
00026 #include "QCCommon.hpp"
00027 #include "QCPartSubDomain.hpp"
00028 #include "QCSubDomain.hpp"
00029
00030 class QCGeneralData;
00031 class QCFiles;
00032 class QCSystem;
00037 template <class TPSystem>
00038 class QCPartitioner
00039 {
00040
00042 public:
00043
00044 typedef TPSystem TSystem;
00048 QCPartitioner (void);
00052 virtual ~QCPartitioner (void);
00056 int getNbParts (void) const
00057 { return nbPartitions; }
00061 int getNbPartitions (void) const
00062 { return nbPartitions; }
00066 void setNumberOfPartitions(const int N)
00067 { nbPartitions = N; }
00071 QCPartitionType getPartitionType() const
00072 { return partType;}
00076 void setRadiusOfBuffer1(const QCFloat R)
00077 { radius1 = R; }
00081 void setRadiusOfBuffer2(const QCFloat R)
00082 { radius2 = R; }
00087 bool isToReadFromFile (void) const { return readPartFile; }
00091 virtual void init (const QCGeneralData& data, const QCFiles& files,
00092 const int * load = NULL, const int sizeLoad = 0);
00096 void initData ( const QCGeneralData& data, const QCFiles& files);
00097
00098 void setLoad(const int * charge, const int nb) ;
00102 virtual void partitioning (TPSystem& mdSystem);
00111 void readFromFile (TPSystem& system, QCGeneralData& data, const QCFiles& files, const string& path);
00119 inline void writeInFile (const TPSystem& system,const QCFiles & files, const string& path);
00126 void writeInFile (const TPSystem& system, const std::string& fileNameIn, const string& path) ;
00127 virtual void writeInFileVTK( std::ofstream & out, const TPSystem& system ) ;
00128 virtual void writeSubDomainVTK( std::ofstream & out, const QCSubDomain & domain ) ;
00129
00130 virtual void writeInFileV2 ( std::ofstream & out, const TPSystem& system )
00131 {this->writeInFileNew(out,system);};
00132 virtual void writeInFileV1 ( std::ofstream & out, const TPSystem& system )
00133 {this->writeInFileOLD(out,system);};
00134
00135 void writeHeader( std::ofstream & out);
00136
00137
00138 protected:
00142 void updateInternalStructure(TPSystem& system);
00143
00144
00145 private:
00146 void writeInFileNew ( std::ofstream & out,const TPSystem& system);
00147 void writeInFileOLD ( std::ofstream & out,const TPSystem& system) ;
00149
00150
00151
00152 public:
00153 protected:
00157 bool isReady;
00161 bool readPartFile;
00166 bool useFrag;
00170 int nbPartitions;
00174 QCPartitionType partType;
00175 std::string partTypeStr;
00179 QCFloat radius1;
00183 QCFloat radius2;
00187 int * charge;
00192 int * _ordering;
00196 const QCFiles * files;
00197
00198 private:
00199
00200 };
00201
00202 template <class TPSystem>
00203 void QCPartitioner<TPSystem>::writeInFile(const TPSystem& system, const QCFiles & files, const string& path)
00204 {
00205 QC_TRACE_OUT("BEGIN QCPartitioner<TPSystem>::writeInFile");
00206
00207 this->writeInFile(system,files.getResultFile(),path) ;
00208
00209 QC_TRACE_OUT("END QCPartitioner<TPSystem>::writeInFile");
00210
00211 }
00212
00213 #endif // QC_PARTITIONER_H_