void JavaNear::iterate(OopVisitor* visitor) { Oop::iterate(visitor); { NamedField id("class_info", true); visitor->do_oop(&id, class_info_offset(), true); } if (Verbose && (raw_value() != 0)) { NamedField id("raw value", true); visitor->do_int(&id, raw_value_offset(), true); } }
bool url_scan2(std::tuple<VALUE,PARAMS_IN...>, ITERATOR pattern, ITERATOR path, ITERATOR pattern_end, ITERATOR path_end, std::function<void(PARAMS...)>& f, PARAMS_OUT... params) { // At this point we know there's at least one more % to find as the std::tuple has at least one type in it (PARAMS_IN... could be empty). // effectively each recursion takes the head of the tuple's types and moves it to the back of the arguments list (PARAMS_OUT). // this should never happen.... static_assert(sizeof...(PARAMS_IN) + sizeof...(PARAMS_OUT) + 1 == sizeof...(PARAMS), "template error:expected 1+PARAMS_IN+PARAMS_OUT=PARAMS"); // probably pointless templating... typename ITERATOR::value_type current_pattern; typename ITERATOR::value_type current_path; // I feel bad about a while(true) but this genuinely feels like the cleanest // fastest way. Loop until we see a % or something goes wrong. while (true) { current_pattern = *pattern; current_path = *path; path++; pattern++; if (current_pattern == '%') { break; } else if (current_pattern != current_path) { return false; } else if (pattern == pattern_end || path == path_end) { return false; } } std::string raw_value(1,current_path); field_handler<VALUE> int_f; if (!int_f.try_append(current_path)) return false; while (int_f.try_append(*path) && path != path_end) { path++; }; return url_scan2(std::tuple<PARAMS_IN...>(), pattern, path, pattern_end, path_end, f, params..., int_f.get_value()); }
// w component of velocity source term double eval_q_w(double x, double y, double z) { typedef DualNumber<Scalar, NumberArray<NDIM, Scalar> > FirstDerivType; typedef DualNumber<FirstDerivType, NumberArray<NDIM, FirstDerivType> > SecondDerivType; typedef DualNumber<SecondDerivType, NumberArray<NDIM, SecondDerivType> > ThirdDerivType; typedef ThirdDerivType ADScalar; // Treat velocity as a vector NumberArray<NDIM, ADScalar> U; ADScalar x = ADScalar(x1,NumberArrayUnitVector<NDIM, 0, Scalar>::value()); ADScalar y = ADScalar(y1,NumberArrayUnitVector<NDIM, 1, Scalar>::value()); ADScalar z = ADScalar(z1,NumberArrayUnitVector<NDIM, 2, Scalar>::value()); // Arbitrary manufactured solutions U[0] = a * helper_f(x) + helper_g(y).derivatives()[1] + helper_h(z).derivatives()[2]; U[1] = b * helper_f(x).derivatives()[0] + helper_g(y) + helper_h(z).derivatives()[2]; U[2] = c * helper_f(x).derivatives()[0] + helper_g(y).derivatives()[1] + helper_h(z); ADScalar P = d * helper_f(x) + helper_gt(y) + helper_h(z); // NS equation residuals NumberArray<NDIM, Scalar> Q_u = raw_value( // convective term divergence(U.outerproduct(U)) // pressure - P.derivatives() // dissipation + nu * divergence(gradient(U))); return Q_u[2]; }
void JavaNear::set_lock(jint lock_value) { jint rest = raw_value() & (~lock_mask_in_place); set_raw_value(rest | (lock_value << lock_shift)); }
void JavaNear::set_hash(jint hash_value) { GUARANTEE(!has_hash(), "can only set hash once"); jint rest = raw_value() & (~hash_mask_in_place); set_raw_value(rest | (hash_value << hash_shift)); GUARANTEE(has_hash(), "hash must be valid"); }