Changeset f66195 for src/graph.cpp
- Timestamp:
- Oct 9, 2009, 10:54:52 AM (16 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 49f802c
- Parents:
- e41951
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/graph.cpp
re41951 rf66195 7 7 using namespace std; 8 8 9 #include "atom.hpp" 10 #include "bond.hpp" 11 #include "config.hpp" 9 12 #include "graph.hpp" 13 #include "molecule.hpp" 10 14 11 15 /***************************************** Implementations for graph classes ********************************/ 12 16 13 /** Constructor of class Graph. 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 //}; 66 67 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 debugging 75 * \param &set KeySet to insert 76 * \param &graph Graph to insert into 77 * \param *counter pointer to unique fragment count 78 * \param factor energy factor for the fragment 14 79 */ 15 Graph::Graph()80 void InsertFragmentIntoGraph(ofstream *out, struct UniqueFragments *Fragment) 16 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 factor 85 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" counter 91 *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 again 97 // 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 debugging 105 * \param graph1 first (dest) graph 106 * \param graph2 second (source) graph 107 * \param *counter keyset counter that gets increased 108 */ 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 factor 115 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 } 17 123 }; 18 124 19 /** Destructor of class Graph.20 * Destructor does release memory for nodes and edges contained in its lists as well.21 */22 Graph::~Graph()23 {24 };25 26 /** Constructor of class SubGraph.27 */28 SubGraph::SubGraph()29 {30 };31 32 /** Destructor of class SubGraph.33 * Note that destructor does not deallocate either nodes or edges! (this is done by its subgraph!)34 */35 SubGraph::~SubGraph()36 {37 };38 39 /** Constructor of class Node.40 */41 Node::Node()42 {43 };44 45 /** Destructor of class Node.46 */47 Node::~Node()48 {49 };50 51 /** Constructor of class Edge.52 */53 Edge::Edge()54 {55 };56 57 /** Destructor of class Edge.58 */59 Edge::~Edge()60 {61 };62
Note:
See TracChangeset
for help on using the changeset viewer.