OpticalGraph.h revision 10448
1/* Copyright (c) 2012 Massachusetts Institute of Technology 2 * 3 * Permission is hereby granted, free of charge, to any person obtaining a copy 4 * of this software and associated documentation files (the "Software"), to deal 5 * in the Software without restriction, including without limitation the rights 6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 * copies of the Software, and to permit persons to whom the Software is 8 * furnished to do so, subject to the following conditions: 9 * 10 * The above copyright notice and this permission notice shall be included in 11 * all copies or substantial portions of the Software. 12 * 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 * THE SOFTWARE. 20 */ 21 22#ifndef __DSENT_MODEL_OPTICALGRAPH_OPTICALGRAPH_H__ 23#define __DSENT_MODEL_OPTICALGRAPH_OPTICALGRAPH_H__ 24 25#include <vector> 26 27#include "util/CommonType.h" 28#include "model/optical_graph/OpticalNode.h" 29 30namespace DSENT 31{ 32 class OpticalNode; 33 class OpticalWavelength; 34 35 class OpticalGraph 36 { 37 public: 38 // The visited number for the next timing run. This needs to be 39 // global because several timing trees may be created to evaluate 40 // a single timing path, causing problems 41 static int msTreeNum; 42 43 public: 44 // Construct timing tree that watches over model_ 45 OpticalGraph(const String& instance_name_, OpticalModel* model_); 46 ~OpticalGraph(); 47 48 public: 49 // Get graph name 50 const String& getInstanceName() const; 51 // Perform datapath power optimization by balancing insertion loss and extinction 52 // ratio with modulator/receiver and laser power, returns false if there are no 53 // designs that are possible 54 bool performPowerOpt(OpticalNode* node_, const WavelengthGroup& wavelengths_, unsigned int number_detectors_, double util_); 55 // Recursively trace a wavelength starting from an OpticalLaser 56 // source finding all lasers, modulators and detectors that a 57 // wavelength group hits. 58 OpticalWavelength* traceWavelength(const WavelengthGroup& wavelengths_, OpticalNode* node_); 59 OpticalWavelength* traceWavelength(OpticalWavelength* wavelength_, OpticalNode* node_, OpticalLaser* laser_, OpticalModulator* modulator_, double loss_); 60 // Return the model 61 OpticalModel* getModel(); 62 63 private: 64 65 // Disable the use of copy constructor 66 OpticalGraph(const OpticalGraph& graph_); 67 68 public: 69 // Set the sequence number of the optical graph 70 static void setTreeNum(int tree_num_); 71 static int getTreeNum(); 72 73 private: 74 // Name of the optical graph 75 const String m_instance_name_; 76 // A pointer to the model that contains this node 77 OpticalModel* m_model_; 78 79 }; // class OpticalGraph 80} // namespace DSENT 81 82#endif // __DSENT_MODEL_OPTICALGRAPH_OPTICALGRAPH_H__ 83 84