00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef QC_TOOLS_H_
00021 #define QC_TOOLS_H_
00022
00023 #include <algorithm>
00024 #include <vector>
00025 #include <iostream>
00026
00027 #include "QCCommon.hpp"
00028 #include "QCSymMatrix.hpp"
00032 inline std::string intToString(int i) {
00033 std::stringstream ss;
00034 std::string s;
00035 ss<<i ; ss >> s ;
00036 return s;
00037 }
00038 template<typename T>
00039 inline void print(int &size, T* v, char* msg = "") {
00040 if(*msg != 0)
00041 { std::cout << msg << ":" <<std::endl;}
00042 for ( int i = 0 ; i < size ; ++i){
00043 std::cout << " "<< v[i] ;
00044 }
00045 std::cout << std::endl;
00046 }
00047 template<typename T>
00048 inline void print(int &size1, int &size2, T* v, char* msg = "") {
00049 if(*msg != 0)
00050 { std::cout << msg << ":" <<std::endl;}
00051 for ( int i = 0 ; i < size1 ; ++i){
00052 for ( int j= 0 ; j < size2 ; ++j){
00053 std::cout << " "<< v[j+i*size2] ;
00054 }
00055 std::cout <<std::endl;
00056 }
00057 std::cout << std::endl;
00058 }
00059
00060 template<typename T>
00061 inline void print(std::vector<T>& v, char* msg = "") {
00062 if(*msg != 0)
00063 { std::cout << msg << ":" <<std::endl;}
00064 for (unsigned int i = 0 ; i < v.size() ; ++i){
00065 std::cout << " "<< v[i] ;
00066 }
00067 std::cout << std::endl;
00068 }
00069
00070 inline int computeFlag(QCSubDomainZone & zone1, QCSubDomainZone & zone2, QCPartitionType& type){
00071
00072 int flag = 0 ;
00073
00074 if( zone1 == QC_SHELL2 || zone2 == QC_SHELL2 ){
00075 return flag ;
00076 }
00077 else if( (zone1 == QC_SHELL1 && zone2 == QC_SHELL1 ) && type == QC_DIXON_PART ){
00078 return flag ;
00079 }
00080 else{
00081 flag = 1 ;
00082 return flag ;
00083 }
00084 } ;
00086 void readGlobalDensityFromAsciiFile(const string &fileName, QCSymMatrix &D ) ;
00088 void readGlobalDensityFromAsciiFileSEQ(std::ifstream &data , QCSymMatrix &D );
00090 void readGlobalDensityFromAsciiFileSHARED(std::ifstream &data , QCSymMatrix &D );
00092 void readGlobalDensityFromAsciiFilePARA(std::ifstream &data , QCSymMatrix &D );
00093
00094
00095 #endif