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