本文整理汇总了C++中graph::adj方法的典型用法代码示例。如果您正苦于以下问题:C++ graph::adj方法的具体用法?C++ graph::adj怎么用?C++ graph::adj使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graph
的用法示例。
在下文中一共展示了graph::adj方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: topo_sort_r
void topo_sort_r(vertex u, graph& g, deque<vertex>& order, vector<bool>& visited)
{
visited[u] = true;
for (unsigned int i = 0; i != g.adj(u).size(); ++i) {
vertex v = g.adj(u)[i];
if (!visited[v])
topo_sort_r(v, g, order, visited);
}
order.push_front(u);
}
示例2: order_subgraphs_wrapper
void order_subgraphs_wrapper(vector<subgraph*> &sgorder, subgraph *sg,
graph &g) {
// simplify the call to the above order subgraphs
deque<vertex> order;
map<vertex,subgraph*> new_sub;
map<vertex,vertex> new_old;
if (sg == 0) {
vector<vertex> verts;
for (unsigned int i = 0; i != g.num_vertices(); ++i)
if (g.find_parent(i) == 0 && (g.adj(i).size() > 0 || g.inv_adj(i).size() > 0))
verts.push_back(i);
order_subgraphs(order, new_sub, new_old, 0, verts, g.subgraphs, g);
}
else {
order_subgraphs(order, new_sub, new_old, sg, sg->vertices, sg->subs, g);
}
map<vertex,subgraph*>::iterator itr = new_sub.begin();
for (unsigned int i = 0; i < order.size(); i++) {
map<vertex,subgraph*>::iterator iter = new_sub.find(order[i]);
if (iter != new_sub.end()) {
sgorder.push_back(iter->second);
}
}
}
示例3: print_graph
void print_graph(std::ostream& out, graph const& g) {
out << "digraph G {" << std::endl;
for (unsigned int i = 0; i != g.num_vertices(); ++i) {
if (g.adj(i).size() > 0 || g.inv_adj(i).size() > 0) {
const vertex_info &lsd = g.info(i);
string l = lsd.to_string(i);
out << i << g.info(i).to_string(i) << std::endl;
}
for (unsigned int j = 0; j != g.adj(i).size(); ++j) {
out << i << " -> " << g.adj(i)[j] << ";" << std::endl;
}
}
for (unsigned int i = 0; i != g.subgraphs.size(); ++i)
print_subgraph(out, g.subgraphs[i], g);
out << "}" << std::endl;
}
示例4: print_subgraph
void print_subgraph(std::ostream& out, subgraph* sg, graph const& g) {
out << "subgraph cluster" << subgraph_num++ << " {\n" << std::endl;
out << "label = \"conditions:" << sg->sg_iterator.printConditions()
<< "\\nupdates: "
<< sg->sg_iterator.printUpdates()
<< "\\n" << format_to_name(sg->sg_iterator.format)
<< attribute_to_string(&sg->sg_iterator)
<< "\\n id:" << sg->str_id << "\";" << std::endl;
out << "style = solid;\n";
for (unsigned int j = 0; j != sg->vertices.size(); ++j) {
vertex u = sg->vertices[j];
if (g.adj(u).size() > 0 || g.inv_adj(u).size() > 0)
out << u << ";\n";
}
for (unsigned int j = 0; j != sg->subs.size(); ++j)
print_subgraph(out, sg->subs[j], g);
out << "}" << std::endl;
}
示例5: order_subgraphs
void order_subgraphs(deque<vertex>& order,
map<vertex,subgraph*>& new_sub,
map<vertex,vertex>& new_old,
subgraph* current,
vector<vertex> const& vertices,
vector<subgraph*> const& subgraphs,
graph& g)
{
// create the graph to sort
graph sg;
map<vertex,vertex> old_new;
//std::cerr << "starting graph creation " << vertices.size() << " " << subgraphs.size() << std::endl;
{
map<subgraph*,vertex> sub_new;
// create the vertices
for (unsigned int i = 0; i != vertices.size(); ++i) {
vertex old = vertices[i];
vertex n = sg.add_vertex(g.info(old));
old_new[old] = n;
new_old[n] = old;
}
for (unsigned int i = 0; i != subgraphs.size(); ++i) {
vertex_info vi;
vertex n = sg.add_vertex(vi);
new_sub[n] = subgraphs[i];
sub_new[subgraphs[i]] = n;
}
// get all current level and verts of all children subgraphs
// this is only needed when not at the top level.
vector<vertex> childVerts;
if (current)
get_child_verts(current,childVerts);
//std::cerr << sg.num_vertices() << " vertices added" << std::endl;
// create the edges
for (vertex u = 0; u != g.num_vertices(); ++u) {
for (unsigned int i = 0; i != g.adj(u).size(); ++i) {
vertex v = g.adj(u)[i];
// normal edges in this subgraph
if (g.find_parent(u) == current
&& g.find_parent(v) == current) {
if (old_new[u] != old_new[v])
sg.add_edge_no_dup(old_new[u],old_new[v]);
}
// edges from nested subgraph to this subgraph
if (ancestor(current, g.find_parent(u))
&& g.find_parent(v) == current) {
if (sub_new[get_child_ancestor(current,
g.find_parent(u))] != old_new[v])
sg.add_edge_no_dup(sub_new[get_child_ancestor(current, g.find_parent(u))], old_new[v]);
}
// edges from this subgraph to nested subgraph
if (g.find_parent(u) == current
&& ancestor(current, g.find_parent(v))) {
if (old_new[u] != sub_new[get_child_ancestor(current,
g.find_parent(v))])
sg.add_edge_no_dup(old_new[u],
sub_new[get_child_ancestor(current,
g.find_parent(v))]);
}
// edges from one nested subgrpah to another
if (g.find_parent(u) != g.find_parent(v)
&& ancestor(current, g.find_parent(u))
&& ancestor(current, g.find_parent(v))) {
if (sub_new[get_child_ancestor(current, g.find_parent(u))] !=
sub_new[get_child_ancestor(current, g.find_parent(v))])
sg.add_edge_no_dup(sub_new[get_child_ancestor(current, g.find_parent(u))],
sub_new[get_child_ancestor(current, g.find_parent(v))]);
}
// there can be dependencies above this level of subgraph
// that come back into this subgraph
// so any vertex in a subgraph that is a parent level
// is important
// 1) from vertex inside this level -> outside
if (g.find_parent(u) == current && !(g.find_parent(v) == current || ancestor(current, g.find_parent(v)))) {
set<subgraph*> sgs;
vector<vertex> verts;
vector<vertex> lchild(childVerts);
set<subgraph*> empty;
while (1) {
verts.clear();
int reachable =
check_reachable_new_r(v,g,lchild,sgs,empty,true,
verts);
if (reachable < 0)
break;
lchild.erase(find(lchild.begin(),lchild.end(),
reachable));
//cout << u << "->" << reachable << "\n";
if (find(vertices.begin(),vertices.end(),reachable)
!= vertices.end()) {
// vertex to vertex
//.........这里部分代码省略.........
示例6: expr_of_noPtr
string expr_of_noPtr(vertex u, graph& g, subgraph* cur, std::map<unsigned int,
std::pair<string, string> > &indexMap)
{
switch (g.info(u).op) {
case trans:
assert(g.inv_adj(u).size() == 1);
return expr_of_noPtr(g.inv_adj(u)[0], g, cur, indexMap);
case negate_op:
assert(g.inv_adj(u).size() == 1);
return "(-" + expr_of_noPtr(g.inv_adj(u)[0], g, cur, indexMap) + ")";
case squareroot:
assert(g.inv_adj(u).size() == 1);
return "sqrt(" + expr_of_noPtr(g.inv_adj(u)[0], g, cur, indexMap) + ")";
case add:
assert(g.inv_adj(u).size() == 2);
return "(" + expr_of_noPtr(g.inv_adj(u)[0], g, cur, indexMap) + "+" + expr_of_noPtr(g.inv_adj(u)[1], g, cur, indexMap) + ")";
case subtract:
assert(g.inv_adj(u).size() == 2);
return "(" + expr_of_noPtr(g.inv_adj(u)[0], g, cur, indexMap) + "-" + expr_of_noPtr(g.inv_adj(u)[1], g, cur, indexMap) + ")";
case multiply:
assert(g.inv_adj(u).size() == 2);
return "(" + expr_of_noPtr(g.inv_adj(u)[0], g, cur, indexMap) + "*" + expr_of_noPtr(g.inv_adj(u)[1], g, cur, indexMap) + ")";
case divide:
assert(g.inv_adj(u).size() == 2);
return "(" + expr_of_noPtr(g.inv_adj(u)[0], g, cur, indexMap) + "/" + expr_of_noPtr(g.inv_adj(u)[1], g, cur, indexMap) + ")";
case get_element: {
char itr = var_name[depth(g.find_parent(u))];
map<vertex,pair<string,string> >::iterator index_found = indexMap.find(g.inv_adj(u)[0]);
if (index_found != indexMap.end()) {
return indexMap[g.inv_adj(u)[0]].second + indexMap[g.inv_adj(u)[0]].first + "[" + itr +"]";
} else if (g.info(g.inv_adj(u)[0]).label.compare("") == 0) {
std::cerr << "bad index in expr_of" << endl;
} else {
return g.info(g.inv_adj(u)[0]).label + "[" + itr + "]";
}
}
case store_element:
case store_add_element: {
char itr = var_name[depth(g.find_parent(u))];
vertex succ = g.adj(u)[0];
for (unsigned int i = 0; i != g.adj(u).size(); ++i) {
if (g.info(g.adj(u)[i]).op == output) {
succ = g.adj(u)[i];
break;
}
}
return indexMap[succ].second + indexMap[succ].first + "[" + itr +"]";
}
case get_row:
case get_column:
case get_row_from_column:
case get_column_from_row:
case store_row:
case store_column:
case store_add_row:
case store_add_column:
case temporary:
return "t" + boost::lexical_cast<string>(u);
case input:
case output:
return g.info(u).label;
case sumto:
return "t" + boost::lexical_cast<string>(u);
default:
return "?";
}
}
示例7: expr_of
string expr_of(vertex u, graph& g, subgraph* cur)
{
switch (g.info(u).op) {
case trans:
assert(g.inv_adj(u).size() == 1);
return expr_of(g.inv_adj(u)[0], g, cur);
case negate_op:
assert(g.inv_adj(u).size() == 1);
return "(-" + expr_of(g.inv_adj(u)[0], g, cur) + ")";
case squareroot:
assert(g.inv_adj(u).size() == 1);
return "(" + expr_of(g.inv_adj(u)[0], g, cur) + ")";
case add:
assert(g.inv_adj(u).size() == 2);
return "(" + expr_of(g.inv_adj(u)[0], g, cur) + "+" + expr_of(g.inv_adj(u)[1], g, cur) + ")";
case subtract:
assert(g.inv_adj(u).size() == 2);
return "(" + expr_of(g.inv_adj(u)[0], g, cur) + "-" + expr_of(g.inv_adj(u)[1], g, cur) + ")";
case multiply:
assert(g.inv_adj(u).size() == 2);
return "(" + expr_of(g.inv_adj(u)[0], g, cur) + "*" + expr_of(g.inv_adj(u)[1], g, cur) + ")";
case divide:
assert(g.inv_adj(u).size() == 2);
return "(" + expr_of(g.inv_adj(u)[0], g, cur) + "/" + expr_of(g.inv_adj(u)[1], g, cur) + ")";
case get_element: {
string indx;
indx.assign(var_name,depth(g.find_parent(u)),1);
if (g.info(g.inv_adj(u)[0]).op == get_row_from_column
|| g.info(g.inv_adj(u)[0]).op == get_column_from_row)
indx += "*"+g.info(g.inv_adj(u)[0]).t.dim.step;
if (g.info(g.inv_adj(u)[0]).op == output || g.info(g.inv_adj(u)[0]).op == input)
return g.info(g.inv_adj(u)[0]).label + "[" + indx +"]";
vertex pred = g.inv_adj(u)[0];
while (g.info(pred).op == partition_cast) {
pred = g.inv_adj(pred)[0];
}
if (g.info(pred).t.k == scalar && g.adj(pred).size() > 1) {
for (unsigned int i = 0; i < g.adj(pred).size(); ++i) {
vertex s = g.adj(pred)[i];
if (s == u) continue;
if (g.info(s).op == input || g.info(s).op == output)
return g.info(s).label + "[" + indx + "]";
}
}
return "t" + boost::lexical_cast<string>(pred)
+ "[" + indx + "]";
}
case store_element:
case store_add_element: {
char itr = var_name[depth(g.find_parent(u))];
for (unsigned int i = 0; i != g.adj(u).size(); ++i) {
if (g.info(g.adj(u)[i]).op == output) {
return g.info(g.adj(u)[i]).label + "[" + itr + "]";
}
}
return "t" + boost::lexical_cast<string>(g.adj(u)[0])
+ "[" + itr + "]";
//return "t" + boost::lexical_cast<string>(u);
}
case get_row:
case get_column:
case get_row_from_column:
case get_column_from_row:
case store_row:
case store_column:
case store_add_row:
case store_add_column:
case temporary:
return "t" + boost::lexical_cast<string>(u);
case input:
case output:
return g.info(u).label;
case sumto:
return "t" + boost::lexical_cast<string>(u);
default:
return "?";
}
}
示例8: translate_declareVariables_noPtr
void translate_declareVariables_noPtr(ostream& out, graph &g, vertex u, bool parallel, map<vertex, pair<string, string> > &indexMap) {
string iter = string(1,var_name[depth(g.find_parent(u))]);
string topName = "";
bool need_iter = true;
switch (g.info(u).op) {
case get_row_from_column:
case get_column_from_row: {
vertex pred = g.inv_adj(u)[0];
if (g.info(pred).op == input)
topName = g.info(pred).label;
else
topName = indexMap[pred].second;
break;
}
case get_row:
case get_element:
case get_column: {
vertex pred = g.inv_adj(u)[0];
if (g.info(pred).op == input) {
topName = g.info(pred).label;
} else {
topName = indexMap[pred].second;
}
break;
}
case store_row:
case store_element:
case store_add_element:
case store_add_column:
case store_column: {
vertex succ = g.adj(u)[0];
if (g.info(succ).op == output)
topName = g.info(succ).label;
else
topName = indexMap[succ].second;
break;
}
case temporary:
topName = "t"+boost::lexical_cast<string>(u);
need_iter = false;
if (parallel)
break;
switch (g.info(u).t.k) {
case row:
case column:
out << type_to_noPtr(g.info(u).t, "t"+boost::lexical_cast<string>(u), false) << ";\n";
break;
case scalar:
out << precision_type << " t" << u << ";\n";
break;
default:
break;
}//switch inside temporary case
break;
case sumto:
{
vertex succ = g.adj(u)[0];
string scl = "t" + boost::lexical_cast<string>(succ);
//new stuff
//code coverage:
/* I think the point here is that the output of the sumto node
* may or may not be an output in the total graph.
* If it isn't, we need to create a temporary for it.
* My question: why don't we have the same situation for the other nodes?
*/
if (g.info(succ).op == output) {
topName = g.info(succ).label;
scl = g.info(succ).label;
} else {
topName = scl;
}
// What does this mean? Why do we care about the height difference of the two nodes?
if (g.info(u).t.height < g.info(succ).t.height) {
if (g.info(u).t.k == scalar) {
out << precision_type << " t" << u << " = " << scl;
if (g.info(succ).t.k != scalar) {
out << "[" << iter << "]";
}
out << ";\n";
}
/*else {
out << precision_type << "* t" << u << " = " << scl
<< " + " << iter << get_next_elem(g.info(succ).t) << ";\n";
}*/
}
else {
if (g.info(u).t.k == scalar) {
if (depth(g.find_parent(u)) > depth(g.find_parent(succ))) {
out << precision_type << " *t" << u << " = " << scl;
} else {
out << precision_type << " t" << u;
}
out << ";\n";
}
else {
if (depth(g.find_parent(u)) > depth(g.find_parent(succ))) {
if (parallel) {
out << precision_type << " *t" << u << " = " << scl
<< "+disp*" << container_size(u,g) << ";\n";
//.........这里部分代码省略.........
示例9: translate_to_noPtr
void translate_to_noPtr(ostream& out,
string name,
map<string,type*>const& inputs,
map<string,type*>const& outputs,
graph& g)
{
std::map<vertex, std::pair<string,string> > indexMap;
// get all of the top level data into the map
for (int i = 0; i < g.num_vertices(); ++i) {
if (g.find_parent(i) == 0) {
if (g.info(i).op == input || g.info(i).op == output) {
indexMap[i] = make_pair("",g.info(i).label);
} else if (g.info(i).op == temporary) {
indexMap[i] = make_pair("","t"+boost::lexical_cast<string>(i));
}
}
}
// change all vertex sizes from $$* to s*
// have to touch all levels of a type because functions like get_next_element use
// lower levels of a given type
for (int i = 0; i != g.num_vertices(); i++) {
type *t = &g.info(i).t;
while (t) {
string &s = t->dim.dim;
if (s.find("$$") == 0) {
s.erase(0,2);
s = "__s" + s;
}
t = t->t;
}
}
step_mp_noPtr.clear();
// for malloc
out << "#include <stdlib.h>\n";
//dummy map for function
map<string,pair<vertex,type> > data;
out << make_function_signature(name,inputs,outputs,data,"",typeWithName,true);
//out << "void " << name << function_args(inputs,outputs,data,"",typeWithName,true);
//out << "{\n";
// string of pointers for scalar output
string ptrOutputLcl;
string ptrOutputEnd;
for (map<string,type*>::const_iterator i = outputs.begin(); i != outputs.end(); ++i) {
if (i->second->k == scalar) {
// create local working scalar value
ptrOutputLcl += type_to_noPtr(*i->second, i->first) + " = ";
ptrOutputLcl += "*" + i->first + "_ptr;\n";
// create store back to argument
ptrOutputEnd +="*" + i->first + "_ptr = " + i->first + ";\n";
}
}
// local copies of scalar outputs
out << ptrOutputLcl;
// declare iteration vars
int maxd = 0;
check_depth(1,maxd, g.subgraphs);
if (maxd > 0) {
out << "int ii";
for (int i = 1; i <= maxd; ++i)
out << "," << var_name[i];
out << ";\n";
}
else {
out << "int ii;\n";
}
init_partitions(g, g.subgraphs, out);
for (unsigned int u = 0; u != g.num_vertices(); ++u) {
if (g.find_parent(u) == 0 && (g.adj(u).size() > 0 || g.inv_adj(u).size() > 0)) {
translate_tmp_noPtr(out, g, u, indexMap);
}
}
for (int i = 0; i != g.subgraphs.size(); i++) {
subgraph *sg = g.subgraphs[i];
translate_graph_noPtr(out, sg, sg->vertices, sg->subs, g, indexMap);
}
/*
std::map<vertex, std::pair<string,string> >::iterator i;
for (i=indexMap.begin(); i!=indexMap.end(); ++i) {
std::cout << "map[" << i->first << "] = " << i->second.first << ", " << i->second.second << "\n";
}
*/
for (unsigned int i = 0; i != g.num_vertices(); ++i) {
if (g.find_parent(i) != 0)
continue;
//.........这里部分代码省略.........
示例10: translate_graph_noPtr
void translate_graph_noPtr(ostream& out,
subgraph* current,
vector<vertex> const& vertices,
vector<subgraph*> const& subgraphs,
graph& g,
std::map<vertex,std::pair<string,string> > &indexMap)
{
// get correct loop based on subgraph iterator details
out << current->sg_iterator.getSerialCLoop(current);
//std::cerr << "starting graph translation" << std::endl;
// topologically sort the subgraphs
deque<vertex> order;
map<vertex,subgraph*> new_sub;
map<vertex,vertex> new_old;
order_subgraphs(order, new_sub, new_old, current, vertices, subgraphs, g);
//std::cerr << "declaring variables" << std::endl;
// Declare variables
for (unsigned int i = 0; i != order.size(); ++i) {
map<vertex,vertex>::iterator iter = new_old.find(order[i]);
if (iter != new_old.end()) {
vertex u = iter->second;
translate_declareVariables_noPtr(out, g, u, false, indexMap);
}//if
}//for
//std::cerr << "finished declaring variables" << std::endl;
// Do computations and store the results
for (unsigned int i = 0; i != order.size(); ++i) {
map<vertex,subgraph*>::iterator iter = new_sub.find(order[i]);
if (iter != new_sub.end()) {
subgraph* sg = iter->second;
translate_graph_noPtr(out, sg, sg->vertices, sg->subs, g, indexMap);
}
else {
map<vertex,vertex>::iterator iter = new_old.find(order[i]);
if (iter != new_old.end()) {
vertex u = iter->second;
switch (g.info(u).op) {
case store_element:
if (g.inv_adj(u).size() == 1)
{
string target;
char itr = var_name[depth(g.find_parent(u))];
vertex succ = g.adj(u)[0];
if (g.info(succ).op != output)
target = "t" + boost::lexical_cast<string>(succ);
else
target = g.info(succ).label;
map<vertex,pair<string,string> >::iterator index_found = indexMap.find(succ);
if (index_found != indexMap.end()) {
out << indexMap[succ].second << indexMap[succ].first + "[" + itr << "] = "
<< expr_of_noPtr(g.inv_adj(u)[0], g, current, indexMap)
<< "; //accessing indexMap[" << succ << "]\n";
} else {
if (g.info(succ).label.compare("") == 0) {
std::cerr << "Failing to find in indexMap, unexpected case" << endl;
} else {
out << g.info(succ).label << "[" << itr << "] = "
<< expr_of_noPtr(g.inv_adj(u)[0], g, current, indexMap)
<< "; //accessing indexMap[" << succ << "]\n";
}
}
//out << "*t" << u << " = " << expr_of_noPtr(g.inv_adj(u)[0], g, current) << ";\n";
}
break;
case store_add_element:
if (g.inv_adj(u).size() == 1)
{
string target;
char itr = var_name[depth(g.find_parent(u))];
vertex succ = g.adj(u)[0];
if (g.info(succ).op != output)
target = "t" + boost::lexical_cast<string>(succ);
else
target = g.info(succ).label;
map<vertex,pair<string,string> >::iterator index_found = indexMap.find(succ);
if (index_found != indexMap.end()) {
out << indexMap[succ].second << indexMap[succ].first + "[" + itr << "] += "
<< expr_of_noPtr(g.inv_adj(u)[0], g, current, indexMap)
<< "; //accessing indexMap[" << succ << "]\n";
} else {
if (g.info(succ).label.compare("") == 0) {
std::cerr << "Failing to find in indexMap, unexpected case" << endl;
} else if (g.info(succ).label.compare(0, 3,"tmp") == 0) {
out << "t" + boost::lexical_cast<string>(succ) << "[" << itr << "] += "
<< expr_of_noPtr(g.inv_adj(u)[0], g, current, indexMap)
<< "; //accessing indexMap[" << succ << "]\n";
} else {
out << g.info(succ).label << "[" << itr << "] += "
<< expr_of_noPtr(g.inv_adj(u)[0], g, current, indexMap)
<< "; //accessing indexMap[" << succ << "]\n";
//.........这里部分代码省略.........
示例11: translate_tmp_noPtr
void translate_tmp_noPtr(ostream& out, graph &g, vertex u, map<vertex, pair<string,string> > &indexMap) {
string iter = string(1,var_name[depth(g.find_parent(u))]);
string topname = "";
// create temporary space
switch (g.info(u).op) {
case temporary:
topname = "t"+boost::lexical_cast<string>(u);
switch (g.info(u).t.k) {
case row:
case column:
out << type_to_noPtr(g.info(u).t, "t"+boost::lexical_cast<string>(u), false) << ";\n";
break;
case scalar:
//out << precision_type << " t" << u << "[1];\n";
out << precision_type << " t" << u << ";\n";
break;
default:
break;
}//switch inside temporary case
break;
case sumto: {
topname = "t"+boost::lexical_cast<string>(u);
vertex succ = g.adj(u)[0];
string scl = "t" + boost::lexical_cast<string>(succ);
if (g.info(succ).op == output)
scl = g.info(succ).label;
int d = (depth(g.find_parent(u)) - depth(g.find_parent(succ)));
if (d == 0) {
// just point to
if (g.info(u).t.k == scalar)
out << precision_type << " t" << u << " = " << scl << ";\n";
else
out << precision_type << " *t" << u << " = " << scl << ";\n";
}
else if (d < 0) {
// treat as temporary
if (g.info(u).t.k == scalar) {
//out << precision_type << " t" << u << "[1];\n";
out << precision_type << " t" << u << ";\n";
}
else {
out << type_to_noPtr(g.info(u).t, "t"+boost::lexical_cast<string>(u), false) << ";\n";
}
}
else {
// if the adjacent node is an output, we can use the output space that exists
// aready so do nothing.Pointing to another sumto should have the space
// already allocated, but this check may need to be improved.
// For other ops
// parallel has shown other cases in the dispatch loops that are working
// correctly for now.In these cases, it may be correct to allocate
// this space here.Need to find a case for this.
//}
}
if (g.info(u).t.k == scalar) {
out << "t" + boost::lexical_cast<string>(u) << " = 0.0;\n";
}
else {
out << "for (ii = 0; ii < " << container_size(u, g) << "; ++ii)\n";
out << "t" + boost::lexical_cast<string>(u) << "[ii] = 0.0; //in translate_tmp\n";
}
//indexMap[u] = make_pair("t"+ boost::lexical_cast<string>(u), itr);
break;
}
case input:
case output:
break;
default: {
break;
}
}
if (topname != "") {
indexMap[u] = make_pair(indexMap[u].first, topname);
}
}