MCPcopy Create free account
hub / github.com/coin-or/CppAD / atomic_function

Function atomic_function

cppad_lib/csrc_writer.cpp:132–161  ·  view source on GitHub ↗

atomic_function

Source from the content-addressed store, hash-verified

130 //
131 // atomic_function
132 void atomic_function(
133 std::ostream& os ,
134 size_t result_node ,
135 const std::string& atomic_name ,
136 size_t call_id ,
137 size_t n_result ,
138 const CppAD::vector<size_t>& arg_node )
139 { using CppAD::to_string;
140 std::string complete_name = "cppad_atomic_" + atomic_name;
141 size_t nu = arg_node.size();
142 size_t nw = n_result;
143 os << "\t{\t// call " + atomic_name + "\n";
144 os << "\t\tint flag;\n";
145 os << "\t\tfloat_point_t " + element("u", nu) + ";\n";
146 os << "\t\tfloat_point_t* w = v + " + to_string(result_node) + ";\n";
147 for(size_t j = 0; j < nu; ++j)
148 { size_t i = arg_node[j];
149 os << "\t\t" + element("u",j) + " = " + element("v",i) + ";\n";
150 }
151 //
152 os << "\t\tflag = " + complete_name + "(";
153 os << to_string(call_id) + ", ";
154 os << to_string(nu) + ", u, ";
155 os << to_string(nw) + ", w, ";
156 os << "compare_change);\n";
157 os << "\t\tif( flag == 1 || flag == 2 ) return 3;\n";
158 os << "\t\tif( flag != 0 ) return flag;\n";
159 //
160 os << "\t}\n";
161 }
162 //
163 // discrete_function
164 void discrete_function(

Callers 1

csrc_writerMethod · 0.85

Calls 3

elementFunction · 0.70
to_stringFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected