Changes in src/graph.cpp [f66195:6ac7ee]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/graph.cpp
rf66195 r6ac7ee 7 7 using namespace std; 8 8 9 #include "atom.hpp"10 #include "bond.hpp"11 #include "config.hpp"12 #include "graph.hpp"13 #include "molecule.hpp"14 9 15 /***************************************** Implementations for graph classes ********************************/ 10 #include <iostream> 11 #include <list> 12 #include <vector> 16 13 17 ///** Constructor of class Graph. 18 // */ 19 //Graph::Graph() 20 //{ 21 //}; 22 // 23 ///** Destructor of class Graph. 24 // * Destructor does release memory for nodes and edges contained in its lists as well. 25 // */ 26 //Graph::~Graph() 27 //{ 28 //}; 29 // 30 ///** Constructor of class SubGraph. 31 // */ 32 //SubGraph::SubGraph() 33 //{ 34 //}; 35 // 36 ///** Destructor of class SubGraph. 37 // * Note that destructor does not deallocate either nodes or edges! (this is done by its subgraph!) 38 // */ 39 //SubGraph::~SubGraph() 40 //{ 41 //}; 42 // 43 ///** Constructor of class Node. 44 // */ 45 //Node::Node() 46 //{ 47 //}; 48 // 49 ///** Destructor of class Node. 50 // */ 51 //Node::~Node() 52 //{ 53 //}; 54 // 55 ///** Constructor of class Edge. 56 // */ 57 //Edge::Edge() 58 //{ 59 //}; 60 // 61 ///** Destructor of class Edge. 62 // */ 63 //Edge::~Edge() 64 //{ 65 //}; 14 /***************************************** Functions for class graph ********************************/ 66 15 67 16 68 //bool operator < (KeySet SubgraphA, KeySet SubgraphB)69 //{70 // return KeyCompare(SubgraphA, SubgraphB);71 //};72 73 /** Checking whether KeySet is not already present in Graph, if so just adds factor.74 * \param *out output stream for debugging75 * \param &set KeySet to insert76 * \param &graph Graph to insert into77 * \param *counter pointer to unique fragment count78 * \param factor energy factor for the fragment79 */80 void InsertFragmentIntoGraph(ofstream *out, struct UniqueFragments *Fragment)81 {82 GraphTestPair testGraphInsert;83 84 testGraphInsert = Fragment->Leaflet->insert(GraphPair (*Fragment->FragmentSet,pair<int,double>(Fragment->FragmentCounter,Fragment->TEFactor))); // store fragment number and current factor85 if (testGraphInsert.second) {86 *out << Verbose(2) << "KeySet " << Fragment->FragmentCounter << " successfully inserted." << endl;87 Fragment->FragmentCounter++;88 } else {89 *out << Verbose(2) << "KeySet " << Fragment->FragmentCounter << " failed to insert, present fragment is " << ((*(testGraphInsert.first)).second).first << endl;90 ((*(testGraphInsert.first)).second).second += Fragment->TEFactor; // increase the "created" counter91 *out << Verbose(2) << "New factor is " << ((*(testGraphInsert.first)).second).second << "." << endl;92 }93 };94 //void inline InsertIntoGraph(ofstream *out, KeyStack &stack, Graph &graph, int *counter, double factor)95 //{96 // // copy stack contents to set and call overloaded function again97 // KeySet set;98 // for(KeyStack::iterator runner = stack.begin(); runner != stack.begin(); runner++)99 // set.insert((*runner));100 // InsertIntoGraph(out, set, graph, counter, factor);101 //};102 103 /** Inserts each KeySet in \a graph2 into \a graph1.104 * \param *out output stream for debugging105 * \param graph1 first (dest) graph106 * \param graph2 second (source) graph107 * \param *counter keyset counter that gets increased108 */109 void InsertGraphIntoGraph(ofstream *out, Graph &graph1, Graph &graph2, int *counter)110 {111 GraphTestPair testGraphInsert;112 113 for(Graph::iterator runner = graph2.begin(); runner != graph2.end(); runner++) {114 testGraphInsert = graph1.insert(GraphPair ((*runner).first,pair<int,double>((*counter)++,((*runner).second).second))); // store fragment number and current factor115 if (testGraphInsert.second) {116 *out << Verbose(2) << "KeySet " << (*counter)-1 << " successfully inserted." << endl;117 } else {118 *out << Verbose(2) << "KeySet " << (*counter)-1 << " failed to insert, present fragment is " << ((*(testGraphInsert.first)).second).first << endl;119 ((*(testGraphInsert.first)).second).second += (*runner).second.second;120 *out << Verbose(2) << "New factor is " << (*(testGraphInsert.first)).second.second << "." << endl;121 }122 }123 };124
Note:
See TracChangeset
for help on using the changeset viewer.