00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _OC_SUBDOMAIN_H_
00019 #define _OC_SUBDOMAIN_H_
00020
00021 #include <fstream>
00022 #include <iostream>
00023 #include <vector>
00024
00025 #include "commonDef.h"
00026 #include "Atoms.h"
00027
00028 class subDomain{
00029
00030 public:
00031 subDomain() ;
00032 ~subDomain() ;
00033
00034 int myNumber() const
00035 {return _myNum ;}
00036
00037 int& myNumber()
00038 {return _myNum ;}
00039
00040 void setMyNumber(int num, const int nx, const int ny, const int nz)
00041 {_myNum = num;_localNum[0] = nx ; _localNum[1] = ny ; _localNum[2] = nz ; }
00042
00043 void setMyNumber(int num)
00044 {_myNum = num;_localNum[0] = num ; _localNum[1] = 1 ; _localNum[2] = 1 ; }
00045
00046 int * getLocalNum()
00047 { return _localNum ;}
00048
00049 int getNumberOfAtoms() const
00050 {return _numberOfAtoms ;}
00051
00052 int getNumberOfNeighbors() const
00053 {return _indexOfNeighbors.size() ;}
00054
00055 int getNumberOfNeighbor(const int i) const
00056 {return _indexOfNeighbors[i] ;}
00057
00058 int getLocalNumberOfSundomain(const int num) const
00059 { for(int i = 0 ; i< static_cast<int>(_indexOfNeighbors.size());++i){
00060 if(_indexOfNeighbors[i] == num){return i ;}}return -1; }
00061 bool initNumberOfOverlapDomain() ;
00062
00063 bool initNumberOfOverlapDomain(const int &) ;
00064
00065 void setNumberOfNeighbor(const int i, const int n)
00066 { _indexOfNeighbors[i] = n;}
00067
00068 void addNeigboors(const int num)
00069 {_indexOfNeighbors.push_back(num) ;}
00070
00071 std::vector<int> & getNeighboorsIndex()
00072 {return _indexOfNeighbors ;}
00073
00074 int getNumberOfAtomsInKernel( ) const
00075 {return _numberOfAtomsKernel ;}
00076
00077 int getNumberOfAtomsInOverlap() const
00078 {return _numberOfAtomsOverlap ;}
00079
00080 int getNumberOfAtomsInOverlap(const int num ) const
00081 {return _indexInOverlap[num].size() ;}
00082
00083 int getNumberOfAtomsInCut() const
00084 {return _numberOfAtomsCut ;}
00085
00086 int getNumberOfAtomsInCut(const int num ) const
00087 {return _indexInCut[num].size() ;}
00088
00089 void setXmin(const double &x)
00090 { _xmin[0] = x ;}
00091 void setXmin(const double *x)
00092 { _xmin[0] = x[0] ; _xmin[1] = x[1] ; _xmin[2] = x[2] ;}
00093
00094 double getXmax(const int i) const
00095 { return _xmax[i] ;}
00096
00097 double getXmin(const int i) const
00098 { return _xmin[i] ;}
00099
00100 double& getXmax(const int i)
00101 { return _xmax[i] ;}
00102
00103 void setXmax(const double *x)
00104 { _xmax[0] = x[0] ; _xmax[1] = x[1] ; _xmax[2] = x[2] ;}
00105
00106 void getXmin(double *x)
00107 { x[0] = _xmin[0] ; x[1] = _xmin[1] ; x[2] = _xmin[2] ; }
00108
00109 void getXmax(double *x)
00110 { x[0] = _xmax[0] ; x[1] = _xmax[1] ; x[2] = _xmax[2] ; }
00111
00112 void getLength(double *x)
00113 { x[0] = _xmax[0] - _xmin[0] ; x[1] = _xmax[1] - _xmin[1] ; x[2] = _xmax[2] - _xmin[2] ; }
00114
00115 double getXLength() const
00116 { return _xmax[0] - _xmin[0] ;}
00117
00118 double getYLength() const
00119 { return _xmax[1] - _xmin[1] ;}
00120
00121 double getZLength() const
00122 { return _xmax[2] - _xmin[2] ;}
00123
00124 double getVolume() const
00125 { return (_xmax[0] - _xmin[0])*(_xmax[1] - _xmin[1])*(_xmax[2] - _xmin[2]) ;}
00126
00127 void getCentre(double * C) const
00128 {
00129 for(int i = 0 ; i<3 ; ++i){C[i] = 0.5*(_xmax[i] + _xmin[i]);}
00130 }
00131
00132 void addIndexInKernel(const int i)
00133 { _indexInKernel.push_back(i) ;++_numberOfAtomsKernel ;++_numberOfAtoms ;}
00134 void addIndexInKernel(const int localNum, const int globalNum)
00135 { _indexInKernel[localNum] = globalNum ;++_numberOfAtomsKernel ;++_numberOfAtoms ;}
00136
00137 int numberOfAtomsInKernel()
00138 { return _indexInKernel.size() ;}
00139
00140 std::vector<int> & getAtomsIndexInKernel()
00141 {return _indexInKernel ;}
00142
00143 std::vector<int> & getAtomsIsInKernel()
00144 {return _atomIsInKernel ;}
00145
00146 int load() const
00147 { return _weight[Core_Zone] + _weight[Overlap_Zone] + _weight[Cut_Zone]; }
00148
00149 int loadInKernel() const
00150 { return _weight[Core_Zone]; }
00151
00152 int& loadInKernel()
00153 { return _weight[Core_Zone]; }
00154
00155 void removeNeigboors(std::vector<int> & list) ;
00156
00157 void addIndexInOverlap(const int &a ,const int i)
00158 {_indexInOverlap[a].push_back(i) ;++_numberOfAtoms ;++_numberOfAtomsOverlap;}
00159
00160 std::vector<int>& getAtomsIndexInOverlap(const int i)
00161 {return _indexInOverlap[i] ;}
00162
00163 int loadInOverlap() const
00164 { return _weight[Overlap_Zone]; }
00165
00166 int& loadInOverlap()
00167 { return _weight[Overlap_Zone]; }
00168
00169 void addIndexInCut(const int &a , const int i)
00170 { _indexInCut[a].push_back(i) ;_numberOfAtoms++ ;_numberOfAtomsCut++ ;}
00171
00172 std::vector<int>& getAtomsIndexInCut(const int i)
00173 {return _indexInCut[i] ;}
00174
00175 int loadInCut() const
00176 { return _weight[Cut_Zone]; }
00177
00178 int& loadInCut()
00179 { return _weight[Cut_Zone]; }
00180
00181 void addAtomsInKernel( const setOfAtoms &atoms, bool use_frag) ;
00182
00183 template <class TYPEOFSYSTEM >
00184 bool addAtomsFromSubdomainInOverlapAndCut(const int & localOverlapSubDomain,
00185 subDomain & domain,
00186 const TYPEOFSYSTEM &atoms,
00187
00188 const double & R_overlap, const double & R_cut, bool use_frag) ;
00189
00190 void computeNumberOfAtoms();
00191
00192 template <class TYPEOFSYSTEM >
00193 void buildLocalNumerotation(const TYPEOFSYSTEM &atoms, std::vector<AtomIn> *atomsInZone) ;
00194
00195
00196 void resetData() ;
00197
00198 protected:
00199 int _myNum ;
00200 int _localNum[3] ;
00201 int _numberOfAtoms ;
00202 int _numberOfAtomsKernel ;
00203 int _numberOfAtomsOverlap ;
00204 int _numberOfAtomsCut ;
00205 int _weight[numberOfZone] ;
00206 double _xmin[3] ;
00207 double _xmax[3] ;
00208 double _length[3] ;
00209 std::vector<int> _indexOfNeighbors ;
00210 std::vector<int> _indexInKernel ;
00211 std::vector<int> _atomIsInKernel ;
00212
00213
00214
00215 std::vector<int> *_indexInOverlap ;
00216 std::vector<int> *_indexInCut ;
00217 };
00218
00219
00220 #endif
00221