00001 // SuperMix version 1.0 C++ source file 00002 // 00003 // Copyright (c) 1999 California Institute of Technology. 00004 // All rights reserved. 00005 // 00006 // Redistribution and use in source and binary forms for noncommercial 00007 // purposes are permitted provided that the above copyright notice and 00008 // this paragraph are duplicated in all such forms and that any 00009 // documentation and other materials related to such distribution and 00010 // use acknowledge that the software was developed by California 00011 // Institute of Technology. Redistribution and/or use in source or 00012 // binary forms is not permitted for any commercial purpose. Use of 00013 // this software does not include a permitted use of the Institute's 00014 // name or trademark for any purpose. 00015 // 00016 // DISCLAIMER: 00017 // THIS SOFTWARE AND/OR RELATED MATERIALS ARE PROVIDED "AS-IS" WITHOUT 00018 // WARRANTY OF ANY KIND INCLUDING ANY WARRANTIES OF PERFORMANCE OR 00019 // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE OR PURPOSE (AS SET 00020 // FORTH IN UCC 23212-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE 00021 // LICENSED PRODUCT, HOWEVER USED. IN NO EVENT SHALL CALTECH/JPL BE 00022 // LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING BUT NOT LIMITED TO 00023 // INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, INCLUDING ECONOMIC 00024 // DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF 00025 // WHETHER CALTECH/JPL SHALL BE ADVISED, HAVE REASON TO KNOW, OR IN 00026 // FACT SHALL KNOW OF THE POSSIBILITY. THE USER BEARS ALL RISK 00027 // RELATING TO QUALITY AND PERFORMANCE OF THE SOFTWARE AND/OR RELATED 00028 // MATERIALS. 00029 // 00030 // ************************************************************************** 00031 00042 // ************************************************************************** 00043 // 00044 // 5/13/01: Converted comments to javadoc format. 00045 // 11/16/99: changes to support new noise calculations 00046 // 9/18/98: class cascade is now a subclass of data_ptr_nport. 00047 // 9/17/98: converted algorithm to use tree structure for 00048 // storing intermediate stages of connections. 00049 // circuit::recalc() no longer recreates temporary 00050 // connection class devices. 00051 // 8/21/98: added circuit::pop_port(); added class cascade 00052 // 8/19/98: added a local temperature Temp 00053 // 00054 // ************************************************************************** 00055 00056 #ifndef CIRCUIT_H 00057 #define CIRCUIT_H 00058 00059 #include "nport.h" 00060 #include "circuitADT.h" 00061 #include "connection.h" 00062 #include "parameter.h" 00063 #include <stack> 00064 00065 // ************************************************************************** 00066 00075 class circuit : public nport 00076 { 00077 private: 00079 nportSet devset; 00080 00082 portStack constack; 00083 00089 portVector labels; 00090 00099 void build_tree(); 00100 00108 nport *tree_base; 00109 00114 bool tree_is_built; 00115 00117 std::stack <connection *> del_stack; 00118 00124 void calc(bool noise); 00125 00126 void recalc() { calc(true); } 00127 void recalc_S() { calc(false); } 00128 00129 public: 00130 00136 parameter Temp; 00137 00141 circuit(); 00142 00144 ~circuit(); 00145 00152 circuit(const circuit & c); 00153 00159 int size() { return labels.len(); } 00160 00166 const nport::data_info & get_data_info(); 00167 00174 void connect(nport &, int, nport &, int); 00175 00183 int add_port(nport &, int); 00184 00195 port pop_port() { tree_is_built = false; return labels.pop(); } 00196 00203 circuit & operator =(const circuit & c); 00204 }; 00205 00206 // ************************************************************************** 00207 00224 class cascade : public data_ptr_nport 00225 { 00226 public: 00227 00233 parameter Temp; 00234 00236 cascade(); 00237 00243 int size() { return (last) ? last->size() : 2; } 00244 00250 const nport::data_info & get_data_info(); 00251 00258 cascade & add(nport & n); 00259 00265 inline cascade & a(nport & n) { return add(n); } 00266 00267 private: 00268 00270 nport *last; 00271 00273 circuit c; 00274 00275 void recalc(); 00276 void recalc_S(); 00277 }; 00278 00279 #endif /* CIRCUIT_H */
Please direct comments and corrections to
supermix@submm.caltech.edu
Go to the supermix home page
Generated by
1.2.7