const Injection* InjectionCache::getInjectionImpl(Injection::Callback callback, void *arg, const StringData* desc) { Injection injection(callback, arg, desc); const Injection* inj = getInjection(&injection); return inj; }
int _tmain(int argc, _TCHAR *argv[]) { _wsetlocale(LC_ALL, L"korean"); //if (argc != 3) //{ // wprintf(L"usage : %s <pid> <dll_path>", argv[0]); // return -1; //} argv[1] = L"11424"; argv[2] = L"stealth.dll"; char *szDllName; int strSize = WideCharToMultiByte(CP_ACP, 0, argv[2], -1, NULL, 0, NULL, NULL); szDllName = new char[strSize]; WideCharToMultiByte(CP_ACP, 0, argv[2], -1, szDllName, strSize, 0, 0); DWORD pid; TCHAR *pEnd; pid = wcstol(argv[1], &pEnd, 10); if (injection(pid, szDllName) == FALSE) { errorLOG("injection()"); return -1; } return 0; }
//IMAGE_NT_SIGNATURE BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { injection(); return TRUE; }
const Injection* InjectionCache::getInjectionImpl(const StringData* code, const StringData* desc) { Unit* unit = getUnit(getStringData(code)); if (unit == NULL) { return NULL; } Injection injection(unit, getStringData(desc)); const Injection* inj = getInjection(&injection); return inj; }
namespace boost { namespace hana { namespace test { template <typename F> auto laws<Functor, F> = [] { static_assert(models<Functor(F)>{}, ""); auto f = injection([]{}); auto g = injection([]{}); auto v = injection([]{})(); auto pred = always(true_); for_each(objects<F>, [=](auto xs) { BOOST_HANA_CHECK( equal(transform(xs, id), xs) ); BOOST_HANA_CHECK(equal( transform(xs, compose(f, g)), transform(transform(xs, g), f) )); BOOST_HANA_CHECK(equal( adjust(xs, pred, f), transform(xs, [=](auto x) { return eval_if(pred(x), [=](auto _) { return _(f)(x); }, [=](auto) { return x; } ); }) )); BOOST_HANA_CHECK(equal( replace(xs, pred, v), adjust(xs, pred, always(v)) )); BOOST_HANA_CHECK(equal( fill(xs, v), replace(xs, always(true_), v) )); }); }; }}} // end namespace boost::hana::test
void LPVMaterialSystem::update(Context& context, SceneContext& /*scene_context*/, RenderContext& render_context) { ASSERT(is_handle_valid(gbuffer_.accumulator.id) && is_handle_valid(gbuffer_.normal.id) && is_handle_valid(gbuffer_.depth.id), "Invalid GBuffer"); // each pixel is a virtual point light Texture& texture = context.texture_pool.get(gbuffer_.accumulator.id); size_t vpl_number = texture.width() * texture.height(); injection(render_context.draw_calls.add(), context, render_context, vpl_number); geometry_injection(render_context.draw_calls.add(), context, render_context, vpl_number); propagation(context, render_context); }
namespace boost { namespace hana { namespace test { template <typename T> auto laws<Foldable, T> = [] { static_assert(models<Foldable(T)>{}, ""); auto f = injection([]{}); auto s = injection([]{})(); for_each(objects<T>, [=](auto xs) { BOOST_HANA_CHECK(equal( foldl(xs, s, f), foldl(to<Tuple>(xs), s, f) )); BOOST_HANA_CHECK(equal( foldr(xs, s, f), foldr(to<Tuple>(xs), s, f) )); }); }; }}} // end namespace boost::hana::test
// Write some information about injection parameters forAll(injectors_, i) { const injectorType& it = injectors_[i].properties(); scalar v = injection().averageVelocity(i); scalar ip = it.integrateTable(it.injectionPressureProfile()); scalar dt = it.teoi() - it.tsoi(); Info<< "Average Velocity for injector " << i << ": " << v << " m/s" << ", injection pressure = " << 1.0e-5*ip/dt << " bar" << endl; }
// Construct from components IncompressibleCloud::IncompressibleCloud( const volPointInterpolation& vpi, const volVectorField& U ) : Cloud<HardBallParticle>(U.mesh()), runTime_(U.time()), time0_(runTime_.value()), mesh_(U.mesh()), volPointInterpolation_(vpi), U_(U), smoment_(mesh_.nCells(), vector::zero), random(666), cloudProperties_ ( IOobject ( "cloudProperties", U.time().constant(), U.db(), IOobject::MUST_READ, IOobject::NO_WRITE ) ), interpolationSchemes_(cloudProperties_.subDict("interpolationSchemes")) { g_=cloudProperties_.lookup("g"); HardBallParticle::density=readScalar(cloudProperties_.lookup("density")); dragCoefficient_=readScalar(cloudProperties_.lookup("drag")); subCycles_=readScalar(cloudProperties_.lookup("subCycles")); useSourceMoment=readBool(cloudProperties_.lookup("useMomentumSource")); dictionary injection(cloudProperties_.subDict("injection")); thres=readScalar(injection.lookup("thres")); center=injection.lookup("center"); r0=readScalar(injection.lookup("r0")); vel0=readScalar(injection.lookup("vel0")); vel1=injection.lookup("vel1"); d0=readScalar(injection.lookup("d0")); d1=readScalar(injection.lookup("d1")); tStart=readScalar(injection.lookup("tStart")); tEnd=readScalar(injection.lookup("tEnd")); dictionary wall(cloudProperties_.subDict("wall")); wallReflect_=readBool(wall.lookup("reflect")); if(wallReflect_) { wallElasticity_=readScalar(wall.lookup("elasticity")); } }
void blazar() { std::string folder{ prepareOutputfolder() }; GlobalConfig = readConfig(); prepareGlobalCfg(); State model(GlobalConfig.get_child("model")); // model.photon.injection.ps.iterate([&model](const SpaceIterator& i){ // double nph = blackBody(i.val(DIM_E), i.val(DIM_R)); //model.nph.set(i, nph); //}); // radiativeLosses(model); injection(model.electron, model); distribution(model.electron, model); photonTarget(model.photon, model); distribution(model.electron, model); photonDistribution(model.photon, model); writeAllSpaceParam(getFileName(folder, "electronDist"), model.electron.distribution); dopplerBoost(getFileName(folder, "SED"), model.photon.distribution); //writeAllSpaceParam(getFileName(folder, "SED"), model.photon.distribution); static const int height = GlobalConfig.get<int>("height"); static const int width = GlobalConfig.get<int>("width"); Matrix obs; matrixInit(obs, height, width, 0.0); readData("PKS0048-097_lum.txt", obs); double chi = chiSquareFit(model.photon.distribution, obs, 2); std::cout << chi; }
//-----------------------------------------------------------------// std::string injection(const std::string& s) { if(s.empty()) return ""; if(map_it_ == opr_map_.end()) { if(s.front() == ',' && back_it_ != opr_map_.end()) { map_it_ = back_it_; return injection(s.substr(1)); } auto it = opr_map_.find(s); if(it == opr_map_.end()) { return "Invalid error: '" + s + "'"; } it->second.clear(); map_it_ = it; back_it_ = opr_map_.end(); } else { if(s == ",") { if(map_it_->second.empty()) return "Parameter feed error."; else return ""; } bool next = (s.back() == ','); std::string param; if(next) { param = s.substr(0, s.size() - 1); } else { param = s; } map_it_->second.push_back(text_filter_(param)); if(!next) { back_it_ = map_it_; map_it_ = opr_map_.end(); } } return ""; }
inline std::pair<typename SteadyStateUpscaler<Traits>::permtensor_t, typename SteadyStateUpscaler<Traits>::permtensor_t> SteadyStateUpscaler<Traits>:: upscaleSteadyState(const int flow_direction, const std::vector<double>& initial_saturation, const double boundary_saturation, const double pressure_drop, const permtensor_t& upscaled_perm) { static int count = 0; ++count; int num_cells = this->ginterf_.numberOfCells(); // No source or sink. std::vector<double> src(num_cells, 0.0); Opm::SparseVector<double> injection(num_cells); // Gravity. Dune::FieldVector<double, 3> gravity(0.0); if (use_gravity_) { gravity[2] = Opm::unit::gravity; } if (gravity.two_norm() > 0.0) { OPM_MESSAGE("Warning: Gravity is experimental for flow solver."); } // Set up initial saturation profile. std::vector<double> saturation = initial_saturation; // Set up boundary conditions. setupUpscalingConditions(this->ginterf_, this->bctype_, flow_direction, pressure_drop, boundary_saturation, this->twodim_hack_, this->bcond_); // Set up solvers. if (flow_direction == 0) { this->flow_solver_.init(this->ginterf_, this->res_prop_, gravity, this->bcond_); } transport_solver_.initObj(this->ginterf_, this->res_prop_, this->bcond_); // Run pressure solver. this->flow_solver_.solve(this->res_prop_, saturation, this->bcond_, src, this->residual_tolerance_, this->linsolver_verbosity_, this->linsolver_type_, false, this->linsolver_maxit_, this->linsolver_prolongate_factor_, this->linsolver_smooth_steps_); double max_mod = this->flow_solver_.postProcessFluxes(); std::cout << "Max mod = " << max_mod << std::endl; // Do a run till steady state. For now, we just do some pressure and transport steps... std::vector<double> saturation_old = saturation; for (int iter = 0; iter < simulation_steps_; ++iter) { // Run transport solver. transport_solver_.transportSolve(saturation, stepsize_, gravity, this->flow_solver_.getSolution(), injection); // Run pressure solver. this->flow_solver_.solve(this->res_prop_, saturation, this->bcond_, src, this->residual_tolerance_, this->linsolver_verbosity_, this->linsolver_type_, false, this->linsolver_maxit_, this->linsolver_prolongate_factor_, this->linsolver_smooth_steps_); max_mod = this->flow_solver_.postProcessFluxes(); std::cout << "Max mod = " << max_mod << std::endl; // Print in-out flows if requested. if (print_inoutflows_) { std::pair<double, double> w_io, o_io; computeInOutFlows(w_io, o_io, this->flow_solver_.getSolution(), saturation); std::cout << "Pressure step " << iter << "\nWater flow [in] " << w_io.first << " [out] " << w_io.second << "\nOil flow [in] " << o_io.first << " [out] " << o_io.second << std::endl; } // Output. if (output_vtk_) { writeVtkOutput(this->ginterf_, this->res_prop_, this->flow_solver_.getSolution(), saturation, std::string("output-steadystate") + '-' + boost::lexical_cast<std::string>(count) + '-' + boost::lexical_cast<std::string>(flow_direction) + '-' + boost::lexical_cast<std::string>(iter)); } // Comparing old to new. int num_cells = saturation.size(); double maxdiff = 0.0; for (int i = 0; i < num_cells; ++i) { maxdiff = std::max(maxdiff, std::fabs(saturation[i] - saturation_old[i])); } #ifdef VERBOSE std::cout << "Maximum saturation change: " << maxdiff << std::endl; #endif if (maxdiff < sat_change_threshold_) { #ifdef VERBOSE std::cout << "Maximum saturation change is under steady state threshold." << std::endl; #endif break; } // Copy to old. saturation_old = saturation; } // Compute phase mobilities. // First: compute maximal mobilities. typedef typename Super::ResProp::Mobility Mob; Mob m; double m1max = 0; double m2max = 0; for (int c = 0; c < num_cells; ++c) { this->res_prop_.phaseMobility(0, c, saturation[c], m.mob); m1max = maxMobility(m1max, m.mob); this->res_prop_.phaseMobility(1, c, saturation[c], m.mob); m2max = maxMobility(m2max, m.mob); } // Second: set thresholds. const double mob1_abs_thres = relperm_threshold_ / this->res_prop_.viscosityFirstPhase(); const double mob1_rel_thres = m1max / maximum_mobility_contrast_; const double mob1_threshold = std::max(mob1_abs_thres, mob1_rel_thres); const double mob2_abs_thres = relperm_threshold_ / this->res_prop_.viscositySecondPhase(); const double mob2_rel_thres = m2max / maximum_mobility_contrast_; const double mob2_threshold = std::max(mob2_abs_thres, mob2_rel_thres); // Third: extract and threshold. std::vector<Mob> mob1(num_cells); std::vector<Mob> mob2(num_cells); for (int c = 0; c < num_cells; ++c) { this->res_prop_.phaseMobility(0, c, saturation[c], mob1[c].mob); thresholdMobility(mob1[c].mob, mob1_threshold); this->res_prop_.phaseMobility(1, c, saturation[c], mob2[c].mob); thresholdMobility(mob2[c].mob, mob2_threshold); } // Compute upscaled relperm for each phase. ReservoirPropertyFixedMobility<Mob> fluid_first(mob1); permtensor_t eff_Kw = Super::upscaleEffectivePerm(fluid_first); ReservoirPropertyFixedMobility<Mob> fluid_second(mob2); permtensor_t eff_Ko = Super::upscaleEffectivePerm(fluid_second); // Set the steady state saturation fields for eventual outside access. last_saturation_state_.swap(saturation); // Compute the (anisotropic) upscaled mobilities. // eff_Kw := lambda_w*K // => lambda_w = eff_Kw*inv(K); permtensor_t lambda_w(matprod(eff_Kw, inverse3x3(upscaled_perm))); permtensor_t lambda_o(matprod(eff_Ko, inverse3x3(upscaled_perm))); // Compute (anisotropic) upscaled relative permeabilities. // lambda = k_r/mu permtensor_t k_rw(lambda_w); k_rw *= this->res_prop_.viscosityFirstPhase(); permtensor_t k_ro(lambda_o); k_ro *= this->res_prop_.viscositySecondPhase(); return std::make_pair(k_rw, k_ro); }