RTREE_TEMPLATE void RTREE_QUAL::SplitNode(Node* a_node, const Branch* a_branch, Node** a_newNode) { ASSERT(a_node); ASSERT(a_branch); // Could just use local here, but member or external is faster since it is reused PartitionVars localVars; PartitionVars* parVars = &localVars; // Load all the branches into a buffer, initialize old node GetBranches(a_node, a_branch, parVars); // Find partition ChoosePartition(parVars, MINNODES); // Create a new node to hold (about) half of the branches *a_newNode = AllocNode(); (*a_newNode)->m_level = a_node->m_level; // Put branches from buffer into 2 nodes according to the chosen partition a_node->m_count = 0; LoadNodes(a_node, *a_newNode, parVars); ASSERT((a_node->m_count + (*a_newNode)->m_count) == parVars->m_total); }
int OutTreeManager::LoadTree(string aname, string trname) { thefilei = new TFile(aname.c_str(), "UPDATE" ); if(thefilei->IsZombie()) return 0; thetreei= new TChain(trname.c_str()); thetreei->AddFile(aname.c_str()); // thetreei=(TTree*)thefilei->Get(trname.c_str()); if(thetreei==0) return 0; GetBranches(thetreei); return 1; }
int OutTreeManager::LoadTreeList(string alist, string trname) { string sfile; ifstream infile (alist.c_str()); if(!infile) { cout<<" *********cannot open file "<<alist<<endl;; } thetreei= new TChain(trname.c_str()); while(infile>>sfile) { thetreei->AddFile(sfile.c_str()); if(Debug>2) cout<<" added= "<<sfile<<endl; } GetBranches(thetreei); return 1; }
/* To vshort (ideal) opamp nodes, the following conditions must be met - Input node = Output node (physically shorted) OR - Branch count between the two nodes exceeds one If neither these conditions are met: - If branch count between the two nodes is zero , vshorting is not possible - If branch count between the two nodes is one, branch must not consist of one element being the opamp segment in question. */ void circuit_t::VshortIdealOpampInputs () { list <element_t*> ooi_list = GetElements ( (ElementType) CmpElement ("OOI")); // Get a list of OON sections /* Check that there is a branch between the output and the inverting node of all opamps */ for (list<element_t*>::iterator i = ooi_list.begin(); i != ooi_list.end(); i++) { //TODO: case where the path between inv. and out. is indirect. i.e. check if there is ANY path between both points // maybe list <element_t*> GetOpampPath () list<branch_t*> inv_to_out_branches = GetBranches ((*i)->OpampInputNode(), (*i)->OpampOutputNode()); // Input and output nodes are shorted (as in voltage follower), skip testing. if (SameOrVshortedNodes ((*i)->OpampInputNode(), (*i)->OpampOutputNode())) { goto do_vshort; } /* if */ // more than one branch between inv and out if ( inv_to_out_branches.size() > 1) { goto do_vshort; } /* if */ // one branch with more than one member if (inv_to_out_branches.size() == 1 && (inv_to_out_branches.front()->items.size() > 1)) { goto do_vshort; } /* if */ // one branch with more than one member if (inv_to_out_branches.size() == 1 && (inv_to_out_branches.front()->items.size() == 1) && inv_to_out_branches.front()->items.front().e != *i) { goto do_vshort; } /* if */ no_vshort: error ("Saturating ideal opamp"); continue; // dont vshort /* Set operation amplifier virtual shorts */ do_vshort: if (!OpampHasPossibleDrivingSources(*i)) { goto no_vshort; } /* if */ // cout << "Will vshort opamp..." << endl; element_t* oon = (*i)->OpampConjugate (); // retrieve associated opamp element if (oon != NONE) { /* Set feedback flags */ (*i)->opamp_fedback = true; oon->opamp_fedback = true; SetVirtualShort ((*i)->OpampInputNode(), oon->OpampInputNode()); // Virtual-short the non-output nodes of the opamp elements } /* if */ else { // error ("Opamps must have a proper negative feedback to function."); } /* else */ } /* for */ } /* circuit_t::VshortIdealOpampInputs */