36 #ifndef __SBNW_NETWORK_H_ 
   37 #define __SBNW_NETWORK_H_ 
   42 #include "graphfab/layout/point.h" 
   43 #include "graphfab/layout/curve.h" 
   50 #include "graphfab/sbml/autolayoutSBML.h" 
   52 #include "sbml/SBMLTypes.h" 
   53 #include "sbml/packages/layout/common/LayoutExtensionTypes.h" 
   68     std::string eltTypeToStr(
const NetworkEltType t);
 
   70     void dumpEltType(std::ostream& os, 
const NetworkEltType t, uint32 ind);
 
   73     inline bool typeMatchEither(
const NetworkEltType a, 
const NetworkEltType b, 
const NetworkEltType z) {
 
   84     bool haveDefaultCompartmentId();
 
   86     void setDefaultCompartmentId(
const std::string& 
id);
 
   88     std::string getDefaultCompartmentId();
 
   92     class SubCurve : 
public RxnBezier {
 
   95             RxnCurveType getRole()
 const {
 
   96                 return RXN_CURVE_SUBSTRATE;
 
   99             Point getCentroidCP()
 const { 
return c2; }
 
  101             bool isStartNodeSide()
 const { 
return true; }
 
  103             virtual bool hasArrowhead()
 const { 
return true; }
 
  105             ArrowheadStyle getArrowheadStyle() 
const;
 
  108             virtual Arrowhead* getArrowhead() {
 
  109               Arrowhead* result = 
new SubstrateArrowhead();
 
  110               transformArrowhead(*result);
 
  117     class PrdCurve : 
public RxnBezier {
 
  120             RxnCurveType getRole()
 const {
 
  121                 return RXN_CURVE_PRODUCT;
 
  124             Point getCentroidCP()
 const { 
return c1; }
 
  126             bool isStartNodeSide()
 const { 
return false; }
 
  128             virtual bool hasArrowhead()
 const { 
return true; }
 
  130             ArrowheadStyle getArrowheadStyle() 
const;
 
  133             virtual Arrowhead* getArrowhead() {
 
  134               Arrowhead* result = 
new ProductArrowhead();
 
  135               transformArrowhead(*result);
 
  142     class ActCurve : 
public RxnBezier {
 
  145             RxnCurveType getRole()
 const {
 
  146                 return RXN_CURVE_ACTIVATOR;
 
  149             Point getCentroidCP()
 const { 
return c2; }
 
  151             bool isStartNodeSide()
 const { 
return true; }
 
  153             virtual bool hasArrowhead()
 const { 
return true; }
 
  155             ArrowheadStyle getArrowheadStyle() 
const;
 
  158             virtual Arrowhead* getArrowhead() {
 
  159               Arrowhead* result = 
new ActivatorArrowhead();
 
  160               transformArrowhead(*result);
 
  167     class InhCurve : 
public RxnBezier {
 
  170             RxnCurveType getRole()
 const {
 
  171                 return RXN_CURVE_INHIBITOR;
 
  174             Point getCentroidCP()
 const { 
return c2; }
 
  176             bool isStartNodeSide()
 const { 
return true; }
 
  178             virtual bool hasArrowhead()
 const { 
return true; }
 
  180             ArrowheadStyle getArrowheadStyle() 
const;
 
  183             virtual Arrowhead* getArrowhead() {
 
  184               Arrowhead* result = 
new InhibitorArrowhead();
 
  185               transformArrowhead(*result);
 
  192     class ModCurve : 
public RxnBezier {
 
  195             RxnCurveType getRole()
 const {
 
  196                 return RXN_CURVE_MODIFIER;
 
  199             Point getCentroidCP()
 const { 
return c2; }
 
  201             bool isStartNodeSide()
 const { 
return true; }
 
  203             virtual bool hasArrowhead()
 const { 
return true; }
 
  205             ArrowheadStyle getArrowheadStyle() 
const;
 
  208             virtual Arrowhead* getArrowhead() {
 
  209               Arrowhead* result = 
new ModifierArrowhead();
 
  210               transformArrowhead(*result);
 
  215     extern ArrowheadStyle sub_arrow_style_;
 
  216     inline ArrowheadStyle ArrowheadStyleLookup(
const SubCurve* ) {
 
  217       return sub_arrow_style_;
 
  220     extern ArrowheadStyle prod_arrow_style_;
 
  221     inline ArrowheadStyle ArrowheadStyleLookup(
const PrdCurve* ) {
 
  222       return prod_arrow_style_;
 
  225     extern ArrowheadStyle act_arrow_style_;
 
  226     inline ArrowheadStyle ArrowheadStyleLookup(
const ActCurve* ) {
 
  227       return act_arrow_style_;
 
  230     extern ArrowheadStyle inh_arrow_style_;
 
  231     inline ArrowheadStyle ArrowheadStyleLookup(
const InhCurve* ) {
 
  232       return inh_arrow_style_;
 
  235     extern ArrowheadStyle mod_arrow_style_;
 
  236     inline ArrowheadStyle ArrowheadStyleLookup(
const ModCurve* ) {
 
  237       return mod_arrow_style_;
 
  248     class NetworkElement {
 
  257                 : _pset(0), _v(0,0), _deg(0), _ldeg(0), _lock(0), networkEltBytePattern_(0x1199) {}
 
  260             NetworkEltType getType()
 const { 
return _type; }
 
  262             bool hasNetworkElementBase() {
 
  263                 if(networkEltBytePattern_ == 0x1199)
 
  270             void set_degree(uint64 deg) { _deg = deg; }
 
  271             virtual uint64 degree()
 const { 
return _deg; }
 
  272             virtual uint64& degree() { 
return _deg; }
 
  275             virtual void resetActivity();
 
  278             void addDelta(
const Point& d);
 
  281             void capDelta(
const Real cap);
 
  284             virtual void capDelta2(
const Real cap2);
 
  287             virtual void doMotion(
const Real scale);
 
  290             virtual void setCentroid(
const Point& p);
 
  291             virtual void setGlobalCentroid(
const Point& p);
 
  292             void setCentroid(
Real x, 
Real y) { setCentroid(Point(x,y)); }
 
  294             virtual bool isCentroidSet()
 const { 
return _pset; }
 
  297             virtual Point getCentroid(COORD_SYSTEM coord = COORD_SYSTEM_LOCAL) 
const;
 
  302             Point getMin(COORD_SYSTEM coord = COORD_SYSTEM_LOCAL)
 const { 
return getExtents(coord).getMin(); }
 
  303             Point getMax(COORD_SYSTEM coord = COORD_SYSTEM_LOCAL)
 const { 
return getExtents(coord).getMax(); }
 
  305             Real getMinX()
 const { 
return getExtents().getMin().x; }
 
  306             Real getMaxX()
 const { 
return getExtents().getMax().x; }
 
  307             Real getMinY()
 const { 
return getExtents().getMin().y; }
 
  308             Real getMaxY()
 const { 
return getExtents().getMax().y; }
 
  311             Real getWidth()
 const { AT(getMaxX() >= getMinX()); 
return getMaxX() - getMinX(); }
 
  312             Real getHeight()
 const { AT(getMaxY() >= getMinY()); 
return getMaxY() - getMinY(); }
 
  315             Real getGlobalWidth()
 const { AT(getMaxX() >= getMinX()); 
return (getMaxX() - getMinX())*tf_.scaleFactor(); }
 
  316             Real getGlobalHeight()
 const { AT(getMaxY() >= getMinY()); 
return (getMaxY() - getMinY())*tf_.scaleFactor(); }
 
  320             virtual Box getExtents(COORD_SYSTEM coord = COORD_SYSTEM_LOCAL)
 const {
 
  322                 case COORD_SYSTEM_LOCAL:
 
  323                   return getLocalExtents();
 
  324                 case COORD_SYSTEM_GLOBAL:
 
  325                   return tf_*getLocalExtents();
 
  327                   AN(0, 
"Unknown coord system");
 
  328                   return getLocalExtents();
 
  334             virtual Box getLocalExtents()
 const {
 
  340             void setExtents(
const Box& b) { _ext = b; recalcCentroid(); }
 
  342             Box getBoundingBox()
 const { 
return getExtents(); }
 
  345             virtual void applyTransform(
const Affine2d& t) {
 
  346                 _ext = xformBox(_ext, t);
 
  347                 _p = xformPoint(_p, t);
 
  350             virtual void applyDisplacement(
const Point& d) {
 
  356             void recalcCentroid() { _p = (_ext.getMin() + _ext.getMax())*0.5; }
 
  359             virtual void recalcExtents() = 0;
 
  362             void lock() { _lock = 1; }
 
  365             void unlock() { _lock = 0; }
 
  368             bool isLocked()
 const { 
return _lock; }
 
  370             NetworkEltShape getShape()
 const { 
return _shape; }
 
  373             virtual bool isContainer() 
const = 0;
 
  376             Real radius()
 const { 
return _r; }
 
  379             Real distance(
const NetworkElement& e) 
const;
 
  382             bool overlap(
const NetworkElement& e) 
const;
 
  386             Point forceVec(
const NetworkElement& e) 
const;
 
  389             Point centroidDisplacementFrom(
const NetworkElement& e) 
const;
 
  392             void forceVec_(
const NetworkElement& e, Point& p) 
const;
 
  394             virtual void dump(std::ostream& os, uint32 ind) = 0;
 
  397             virtual void dumpForces(std::ostream& os, uint32 ind) 
const = 0;
 
  399             virtual Affine2d getTransform()
 const { 
return tf_; }
 
  401             virtual void setTransform(
const Affine2d& tf, 
bool recurse = 
true) { tf_ = tf; }
 
  403             virtual Affine2d getInverseTransform()
 const { 
return itf_; }
 
  405             virtual void setInverseTransform(
const Affine2d& itf, 
bool recurse = 
true) { itf_ = itf; }
 
  423             NetworkEltShape _shape;
 
  425             NetworkEltType _type;
 
  433             long networkEltBytePattern_;
 
  440     class Node : 
public NetworkElement {
 
  445                     _shape = ELT_SHAPE_RECT;
 
  447                     _type = NET_ELT_TYPE_SPEC;
 
  448                     _ext = Box(0,0,40,20);
 
  449                     bytepattern = 0xc455;
 
  456             void setName(
const std::string& name);
 
  459             const std::string& getName() 
const;
 
  462             const std::string& getId() 
const;
 
  465             void setId(
const std::string& 
id);
 
  468             const std::string& getGlyph() 
const;
 
  471             void setGlyph(
const std::string& 
id);
 
  476             uint32& numUses() { 
return _numUses; }
 
  477             uint32 numUses()
 const { 
return _numUses; }
 
  481             bool isAlias()
 const { 
return _isAlias; }
 
  484             bool isCommonInstance(
const Node* other) 
const;
 
  487             void setAlias(
bool b) { _isAlias = b; }
 
  489             int alias(Network* net);
 
  491             int getSubgraphIndex()
 const {
 
  493                     SBNW_THROW(InvalidParameterException, 
"No subgraph index set", 
"Network::getSubgraphIndex");
 
  497             void setSubgraphIndex(
int v) { isub_ = v; }
 
  499             bool isSetSubgraphIndex() { 
return isub_ < 0; }
 
  501             void clearSubgraphIndex() { isub_ = -1; }
 
  503             bool excludeFromSubgraphEnum()
 const { 
return exsub_; }
 
  505             bool setExcludeFromSubgraphEnum() { 
return exsub_ = 
true; }
 
  507             void clearExcludeFromSubgraphEnum() { exsub_ = 
false; }
 
  512             Point getUpperLeftCorner() 
const;
 
  514             Point getLowerRightCorner() 
const;
 
  516             void recalcExtents() {
 
  517                 Real width = _ext.width();
 
  518                 Real height = _ext.height();
 
  519                 Point del(0.5*width, 0.5*height);
 
  521                 _ext = Box(_p - del, _p + del);
 
  522                 _r = _ext.maxDim()*0.5;
 
  526             void setWidth(
Real w);
 
  529             void setHeight(
Real h);
 
  532             void affectGlobalWidth(
Real w);
 
  535             void affectGlobalHeight(
Real h);
 
  537             void set_i(
size_t i) { i_ = i; } 
 
  538             size_t get_i()
 const { 
return i_; }
 
  542             bool isContainer()
 const { 
return false; }
 
  547             void dump(std::ostream& os, uint32 ind);
 
  550             void dumpForces(std::ostream& os, uint32 ind) 
const;
 
  554             bool doByteCheck() { 
if(bytepattern == 0xc455) 
return true; 
else return false; }
 
  559             std::string _name, _id;
 
  576     inline Node* CastToNode(
void* p) {
 
  577         NetworkElement* e = (NetworkElement*)p;
 
  578         AN(e->hasNetworkElementBase(), 
"Runtime type check failed");
 
  580         AN(dynamic_cast<Node*>(e), 
"Runtime type check failed");
 
  581         return dynamic_cast<Node*
>(e);
 
  590         RXN_ROLE_SIDESUBSTRATE,
 
  591         RXN_ROLE_SIDEPRODUCT,
 
  597     class RxnCurveFactory {
 
  599             static RxnBezier* CreateCurve(RxnRoleType role);
 
  604     class Reaction : 
public NetworkElement {
 
  607             typedef std::pair<Node*, RxnRoleType> SpeciesElt;
 
  609             typedef std::vector< SpeciesElt > NodeVec;
 
  613             typedef std::vector<RxnBezier*> CurveVec;
 
  616             typedef NodeVec::iterator NodeIt;
 
  617             typedef NodeVec::const_iterator ConstNodeIt;
 
  622             typedef CurveVec::iterator CurveIt;
 
  623             typedef CurveVec::const_iterator ConstCurveIt;
 
  625             NodeIt NodesBegin() { 
return _spec.begin(); }
 
  626             NodeIt NodesEnd() { 
return _spec.end(); }
 
  628             ConstNodeIt NodesBegin()
 const { 
return _spec.begin(); }
 
  629             ConstNodeIt NodesEnd()
 const { 
return _spec.end(); }
 
  631             CurveIt CurvesBegin() { 
return _curv.begin(); }
 
  632             CurveIt CurvesEnd() { 
return _curv.end(); }
 
  634             ConstCurveIt CurvesBegin()
 const { 
return _curv.begin(); }
 
  635             ConstCurveIt CurvesEnd()
 const { 
return _curv.end(); }
 
  641                     _shape = ELT_SHAPE_ROUND;
 
  642                     _type = NET_ELT_TYPE_RXN;
 
  643                     bytepattern = 0xff83;
 
  646             void hierarchRelease();
 
  651             const std::string& getId()
 const { 
return _id; }
 
  654             void setId(
const std::string& 
id) { _id = id; }
 
  656             void setName(
const std::string& name) { name_ = name; }
 
  661             uint64 numSpecies()
 const { 
return _spec.size(); }
 
  664             void addSpeciesRef(Node* n, RxnRoleType role);
 
  667             void removeNode(Node* n);
 
  670             Node* findSpeciesById(
const std::string& 
id);
 
  673             bool hasSpecies(
const Node* n) 
const;
 
  676             uint64 degree(
const Node* n);
 
  678             RxnRoleType getSpeciesRole(
size_t i) { 
return _spec.at(i).second; }
 
  680             RxnRoleType getSpeciesRole(Node* n);
 
  682             Node* getSpecies(
size_t i) { 
return _spec.at(i).first; }
 
  688             void substituteSpeciesById(
const std::string& 
id, Node* spec);
 
  692             void substituteSpeciesByIdwRole(
const std::string& 
id, Node* spec, RxnRoleType role);
 
  696             void substituteSpecies(Node* before, Node* after);
 
  699             CurveVec& getCurves();
 
  703             size_t getNumCurves() { curveGuard(); 
return _curv.size(); }
 
  707             RxnBezier* getCurve(
size_t i) { curveGuard(); 
return _curv.at(i); }
 
  710             NodeVec& getSpec() { 
return _spec; }
 
  711             const NodeVec& getSpec()
 const { 
return _spec; }
 
  714             void forceRecalcCentroid();
 
  719             void rebuildCurves();
 
  725             void recalcCurveCPs();
 
  733             bool isContainer()
 const { 
return false; }
 
  736             void recalcExtents() {
 
  738                 _ext = Box(_p - Point(_r,_r), _p + Point(_r,_r));
 
  741             virtual Box getLocalExtents()
 const {
 
  742               return Box(getCentroid() - Point(5, 5), getCentroid() + Point(5, 5));
 
  745             virtual void applyTransform(
const Affine2d& t) {
 
  746                 NetworkElement::applyTransform(t);
 
  747                 for(CurveIt i = CurvesBegin(); i != CurvesEnd(); ++i) {
 
  748                     (*i)->applyTransform(t);
 
  752             virtual void setTransform(
const Affine2d& tf, 
bool recurse = 
true) {
 
  754                 for(CurveIt i = CurvesBegin(); i != CurvesEnd(); ++i) {
 
  755                     (*i)->setTransform(tf);
 
  759             virtual void setInverseTransform(
const Affine2d& itf, 
bool recurse = 
true) {
 
  761                 for(CurveIt i = CurvesBegin(); i != CurvesEnd(); ++i) {
 
  762                     (*i)->setInverseTransform(itf);
 
  767             void dump(std::ostream& os, uint32 ind);
 
  770             void dumpForces(std::ostream& os, uint32 ind) 
const;
 
  772             bool doByteCheck() { 
if(bytepattern == 0xff83) 
return true; 
else return false; }
 
  774             void clearDirtyFlag() { _cdirty = 
false; }
 
  777             RxnBezier* addCurve(RxnRoleType role) {
 
  778                 _curv.push_back(RxnCurveFactory::CreateCurve(role));
 
  779                 _curv.back()->setTransform(itf_);
 
  780                 _curv.back()->setInverseTransform(itf_);
 
  794             void recompCentroid();
 
  797             void doCentroidCalc();
 
  800                 if(_cdirty && _spec.size()) {
 
  830     inline Reaction* CastToReaction(
void* p) {
 
  831         NetworkElement* e = (NetworkElement*)p;
 
  832         AN(e->hasNetworkElementBase(), 
"Runtime type check failed");
 
  833         AN(dynamic_cast<Reaction*>(e), 
"Runtime type check failed");
 
  834         return dynamic_cast<Reaction*
>(e);
 
  840         COMP_EDGE_TYPE_BOTTOM,
 
  842     } CompartmentEdgeType;
 
  846     class Compartment : 
public NetworkElement {
 
  852             typedef std::vector<Graphfab::NetworkElement*> EltVec;
 
  854             typedef EltVec::iterator EltIt;
 
  855             typedef EltVec::const_iterator ConstEltIt;
 
  857             EltIt EltsBegin() { 
return _elt.begin(); }
 
  858             EltIt EltsEnd() { 
return _elt.end(); }
 
  860             ConstEltIt EltsBegin()
 const { 
return _elt.begin(); }
 
  861             ConstEltIt EltsEnd()
 const { 
return _elt.end(); }
 
  863             Graphfab::NetworkElement* getElt(
const uint64 i) { 
return _elt.at(i); }
 
  865             const Graphfab::NetworkElement* getElt(
const uint64 i)
 const { 
return _elt.at(i); }
 
  867             uint64 getNElts()
 const { 
return _elt.size(); }
 
  870                 :  _ra(50.*50.), _E(10.), _res(0.25), bytepattern(0xffae11), NetworkElement() {
 
  871                     _shape = ELT_SHAPE_RECT;
 
  872                     _type = NET_ELT_TYPE_COMP;
 
  876             const std::string& getId()
 const { 
return _id; }
 
  879             void setId(
const std::string& 
id) { _id = id; }
 
  882             void setName(
const std::string& name) { name_ = name; }
 
  885             const std::string& getGlyph()
 const { 
return _gly; }
 
  888             void setGlyph(
const std::string& glyph) { _gly = glyph; }
 
  890             void setCentroid(
const Point& p) {
 
  891                 AN(0, 
"setCentroid should not be called on a compt");
 
  895             void recalcExtents() {
 
  896                 _r = _ext.maxDim()*0.5;
 
  897                 _p = (_ext.getMin() + _ext.getMax())*0.5;
 
  903             void addElt(NetworkElement* e);
 
  905             bool containsElt(
const NetworkElement* e) 
const;
 
  908             void removeElt(NetworkElement* e);
 
  911             void setRestExtents(
const Box& ext);
 
  914             void resizeEnclose(
double padding = 0);
 
  920             Real restArea()
 const { 
return _ra; }
 
  922             void setMin(
const Point& p) { _ext.setMin(p); }
 
  923             void setMax(
const Point& p) { _ext.setMax(p); }
 
  925             virtual Point getCentroid(COORD_SYSTEM coord = COORD_SYSTEM_LOCAL)
 const { 
return getExtents(coord).getCenter(); }
 
  930             virtual void resetActivity();
 
  938             void applyBoundaryForce(
const Real fx1, 
const Real fy1, 
const Real fx2, 
const Real fy2);
 
  945             void doInternalForce(NetworkElement* e, 
const Real f, 
const Real t);
 
  948             void doInternalForceAll(
const Real f, 
const Real t);
 
  951             void doMotion(
const Real scale);
 
  953             void capDelta2(
const Real cap2);
 
  955             bool isContainer()
 const { 
return true; }
 
  958             bool contains(
const NetworkElement* e) 
const;
 
  961             bool empty()
 const { 
return _elt.size() ? 
false : 
true; }
 
  964             void dump(std::ostream& os, uint32 ind);
 
  967             void dumpForces(std::ostream& os, uint32 ind) 
const;
 
  969             bool doByteCheck() { 
if(bytepattern == 0xffae11) 
return true; 
else return false; }
 
  987             Real _fx1, _fy1, _fx2, _fy2;
 
  991             uint64_t bytepattern;
 
  996     class Network : 
public Compartment {
 
 1001             typedef std::vector<Node*> NodeVec;
 
 1003             typedef std::vector<Graphfab::Reaction*> RxnVec;
 
 1005             typedef std::vector<Graphfab::Compartment*> CompVec;
 
 1008             typedef NodeVec::iterator NodeIt;
 
 1009             typedef NodeVec::const_iterator ConstNodeIt;
 
 1011             typedef RxnVec::iterator RxnIt;
 
 1012             typedef RxnVec::const_iterator ConstRxnIt;
 
 1014             typedef CompVec::iterator CompIt;
 
 1015             typedef CompVec::const_iterator ConstCompIt;
 
 1020                 bytepattern = 0x3355;
 
 1021                 layoutspecified_ = 
false;
 
 1027             void hierarchRelease();
 
 1032             void addNode(Node* n);
 
 1036             void removeNode(Node* n);
 
 1039             void connectNode(Node* n, Reaction* r, RxnRoleType role);
 
 1042             bool isNodeConnected(Node* n, Reaction* r) 
const;
 
 1045             Node* findNodeById(
const std::string& 
id);
 
 1046             const Node* findNodeById(
const std::string& 
id) 
const;
 
 1049             std::string getUniqueId() 
const;
 
 1051             std::string getUniqueGlyphId(
const Node& src) 
const;
 
 1054             std::size_t getUniqueIndex() 
const;
 
 1057             Node* findNodeByGlyph(
const std::string& gly);
 
 1059             Node* getNodeAt(
const size_t i) { 
return _nodes.at(i); }
 
 1061             Node* getUniqueNodeAt(
const size_t n);
 
 1063             size_t getNumInstances(
const Node* u);
 
 1066             Node* getInstance(
const Node* u, 
const size_t n);
 
 1068             bool containsNode(
const Node* n) 
const;
 
 1070             bool containsReaction(
const Reaction* r) 
const;
 
 1072             typedef std::vector<Reaction*> AttachedRxnList;
 
 1074             AttachedRxnList getConnectedReactions(
const Node* n);
 
 1076             typedef std::vector<RxnBezier*> AttachedCurveList;
 
 1078             AttachedCurveList getAttachedCurves(
const Node* n);
 
 1080             int getNumSubgraphs();
 
 1083             void enumerateSubgraphs();
 
 1086             void propagateSubgraphIndex(Node* x, 
int isub);
 
 1088             void clearSubgraphInfo();
 
 1090             void clearExcludeFromSubgraphEnum();
 
 1093             Reaction* findReactionById(
const std::string& 
id);
 
 1095             Reaction* getRxnAt(
const size_t i) { 
return _rxn.at(i); }
 
 1098             void resetUsageInfo();
 
 1101             const std::string& getId()
 const { 
return _id; }
 
 1103             void setId(
const std::string& 
id) { _id = id; }
 
 1105             bool isSetId()
 const { 
return _id.size(); }
 
 1107             bool isLayoutSpecified()
 const { 
return layoutspecified_; }
 
 1109             void setLayoutSpecified(
bool value) {
 
 1110                 layoutspecified_ = value;
 
 1116             void addReaction(Reaction* rxn);
 
 1119             void removeReaction(Reaction* r);
 
 1124             void addCompartment(Compartment* c) { _comp.push_back(c); addElt(c); }
 
 1129             Compartment* findCompById(
const std::string& 
id);
 
 1134             Compartment* findCompByGlyph(
const std::string& gly);
 
 1136             Compartment* getCompAt(
const size_t i) { 
return _comp.at(i); }
 
 1138             Compartment* findContainingCompartment(
const NetworkElement* e);
 
 1142             uint64 getTotalNumComps()
 const { 
return _comp.size(); }
 
 1145             uint64 getTotalNumPts()
 const { 
return _nodes.size() + _rxn.size(); }
 
 1148             uint64 getTotalNumRxns()
 const { 
return _rxn.size(); }
 
 1151             uint64 getTotalNumNodes()
 const { 
return _nodes.size(); }
 
 1153             uint64 getNumUniqueNodes() 
const;
 
 1155             Box getBoundingBox() 
const;
 
 1157             void fitToWindow(
const Box& w);
 
 1159             void applyTransform(
const Affine2d& t);
 
 1161             void setTransform(
const Affine2d& t, 
bool recurse = 
true);
 
 1163             void setInverseTransform(
const Affine2d& it, 
bool recurse = 
true);
 
 1165             void applyDisplacement(
const Point& d);
 
 1168             void elideEmptyComps();
 
 1171             void randomizePositions(
const Box& bounds);
 
 1174             void rebuildCurves();
 
 1178             void recalcCurveCPs();
 
 1181             void recenterJunctions();
 
 1184             void resetActivity();
 
 1196             void capDeltas(
const Real cap);
 
 1201             void updatePositions(
const Real scale);
 
 1204             void updateExtents();
 
 1207             void resizeCompsEnclose(
double padding = 0);
 
 1210             void autosizeComps();
 
 1214             Point pmean() 
const;
 
 1218             Point center() 
const;
 
 1222             Box getExtents() 
const;
 
 1227             void recenter(
const Point& p);
 
 1235             Point pvariance() 
const;
 
 1240             void dump(std::ostream& os, uint32 ind);
 
 1243             void dumpEltForces(std::ostream& os, uint32 ind) 
const;
 
 1245                         Node* getNodeAtIndex(
int index) { 
return _nodes[index]; }
 
 1249             NodeIt NodesBegin() { 
return _nodes.begin(); }
 
 1250             NodeIt NodesEnd() { 
return _nodes.end(); }
 
 1252             ConstNodeIt NodesBegin()
 const { 
return _nodes.begin(); }
 
 1253             ConstNodeIt NodesEnd()
 const { 
return _nodes.end(); }
 
 1255             RxnIt RxnsBegin() { 
return _rxn.begin(); }
 
 1256             RxnIt RxnsEnd() { 
return _rxn.end(); }
 
 1258             ConstRxnIt RxnsBegin()
 const { 
return _rxn.begin(); }
 
 1259             ConstRxnIt RxnsEnd()
 const { 
return _rxn.end(); }
 
 1261             CompIt CompsBegin() { 
return _comp.begin(); }
 
 1262             CompIt CompsEnd() { 
return _comp.end(); }
 
 1264             ConstCompIt CompsBegin()
 const { 
return _comp.begin(); }
 
 1265             ConstCompIt CompsEnd()
 const { 
return _comp.end(); }
 
 1267             bool doByteCheck()
 const { 
if(bytepattern == 0x3355) 
return true; 
else return false; }
 
 1270             void removeReactionsForNode(Node* n);
 
 1280             bool layoutspecified_;
 
 1287     inline Network* CastToNetwork(
void* p) {
 
 1288         NetworkElement* e = (NetworkElement*)p;
 
 1289         AN(e->hasNetworkElementBase(), 
"Runtime type check failed");
 
 1290         return dynamic_cast<Network*
>(e);
 
 1301     Network* networkFromLayout(
const Layout& lay, 
const Model& mod);
 
 1308     Network* networkFromModel(
const Model& mod);
 
 1312     int layout_getNumFloatingSpecies(
const Layout& lay, 
const Model& mod);
 
SAGITTARIUS_REAL Real
Make Real visible to C. Consider letting Real lie in top namespace. 
Definition: SagittariusCommon.h:136
 
Definition: SagittariusCommon.cpp:38