Changes in src/molecule_graph.cpp [112b09:35b698]
- File:
-
- 1 edited
-
src/molecule_graph.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/molecule_graph.cpp
r112b09 r35b698 12 12 #include "bondgraph.hpp" 13 13 #include "config.hpp" 14 #include "defs.hpp" 14 15 #include "element.hpp" 15 16 #include "helpers.hpp" … … 1024 1025 /** Storing the bond structure of a molecule to file. 1025 1026 * Simply stores Atom::nr and then the Atom::nr of all bond partners per line. 1026 * \param *path path tofile1027 * \param *filename name of file1027 * \param &filename name of file 1028 * \param path path to file, defaults to empty 1028 1029 * \return true - file written successfully, false - writing failed 1029 1030 */ 1030 bool molecule::StoreAdjacencyToFile( char *path, char *filename)1031 bool molecule::StoreAdjacencyToFile(std::string &filename, std::string path) 1031 1032 { 1032 1033 ofstream AdjacencyFile; 1033 string streamline;1034 string line; 1034 1035 bool status = true; 1035 1036 1036 if (path != NULL)1037 line << path << "/" <<filename;1037 if (path != "") 1038 line = path + "/" + filename; 1038 1039 else 1039 line <<filename;1040 AdjacencyFile.open(line. str().c_str(), ios::out);1040 line = filename; 1041 AdjacencyFile.open(line.c_str(), ios::out); 1041 1042 DoLog(1) && (Log() << Verbose(1) << "Saving adjacency list ... " << endl); 1042 if (AdjacencyFile != NULL) {1043 if (AdjacencyFile.good()) { 1043 1044 AdjacencyFile << "m\tn" << endl; 1044 1045 ActOnAllAtoms(&atom::OutputAdjacency, &AdjacencyFile); … … 1046 1047 DoLog(1) && (Log() << Verbose(1) << "\t... done." << endl); 1047 1048 } else { 1048 DoLog(1) && (Log() << Verbose(1) << "\t... failed to open file " << line .str()<< "." << endl);1049 DoLog(1) && (Log() << Verbose(1) << "\t... failed to open file " << line << "." << endl); 1049 1050 status = false; 1050 1051 } … … 1056 1057 /** Storing the bond structure of a molecule to file. 1057 1058 * Simply stores Atom::nr and then the Atom::nr of all bond partners, one per line. 1058 * \param *path path tofile1059 * \param *filename name of file1059 * \param &filename name of file 1060 * \param path path to file, defaults to empty 1060 1061 * \return true - file written successfully, false - writing failed 1061 1062 */ 1062 bool molecule::StoreBondsToFile( char *path, char *filename)1063 bool molecule::StoreBondsToFile(std::string &filename, std::string path) 1063 1064 { 1064 1065 ofstream BondFile; 1065 string streamline;1066 string line; 1066 1067 bool status = true; 1067 1068 1068 if (path != NULL)1069 line << path << "/" <<filename;1069 if (path != "") 1070 line = path + "/" + filename; 1070 1071 else 1071 line <<filename;1072 BondFile.open(line. str().c_str(), ios::out);1072 line = filename; 1073 BondFile.open(line.c_str(), ios::out); 1073 1074 DoLog(1) && (Log() << Verbose(1) << "Saving adjacency list ... " << endl); 1074 if (BondFile != NULL) {1075 if (BondFile.good()) { 1075 1076 BondFile << "m\tn" << endl; 1076 1077 ActOnAllAtoms(&atom::OutputBonds, &BondFile); … … 1078 1079 DoLog(1) && (Log() << Verbose(1) << "\t... done." << endl); 1079 1080 } else { 1080 DoLog(1) && (Log() << Verbose(1) << "\t... failed to open file " << line .str()<< "." << endl);1081 DoLog(1) && (Log() << Verbose(1) << "\t... failed to open file " << line << "." << endl); 1081 1082 status = false; 1082 1083 } … … 1086 1087 ; 1087 1088 1088 bool CheckAdjacencyFileAgainstMolecule_Init( char *path, ifstream &File, int *&CurrentBonds)1089 { 1090 string streamfilename;1091 filename << path << "/" << FRAGMENTPREFIX <<ADJACENCYFILE;1092 File.open(filename. str().c_str(), ios::out);1089 bool CheckAdjacencyFileAgainstMolecule_Init(std::string &path, ifstream &File, int *&CurrentBonds) 1090 { 1091 string filename; 1092 filename = path + ADJACENCYFILE; 1093 File.open(filename.c_str(), ios::out); 1093 1094 DoLog(1) && (Log() << Verbose(1) << "Looking at bond structure stored in adjacency file and comparing to present one ... " << endl); 1094 if (File == NULL)1095 if (File.fail()) 1095 1096 return false; 1096 1097 … … 1146 1147 * \return true - structure is equal, false - not equivalence 1147 1148 */ 1148 bool molecule::CheckAdjacencyFileAgainstMolecule( char *path, atom **ListOfAtoms)1149 bool molecule::CheckAdjacencyFileAgainstMolecule(std::string &path, atom **ListOfAtoms) 1149 1150 { 1150 1151 ifstream File;
Note:
See TracChangeset
for help on using the changeset viewer.
