colvar::dihedral::dihedral(cvm::atom const &a1, cvm::atom const &a2, cvm::atom const &a3, cvm::atom const &a4) { if (cvm::debug()) cvm::log("Initializing dihedral object from atom groups.\n"); function_type = "dihedral"; period = 360.0; b_periodic = true; provide(f_cvc_inv_gradient); provide(f_cvc_Jacobian); provide(f_cvc_com_based); b_1site_force = false; group1 = new cvm::atom_group(std::vector<cvm::atom>(1, a1)); group2 = new cvm::atom_group(std::vector<cvm::atom>(1, a2)); group3 = new cvm::atom_group(std::vector<cvm::atom>(1, a3)); group4 = new cvm::atom_group(std::vector<cvm::atom>(1, a4)); atom_groups.push_back(group1); atom_groups.push_back(group2); atom_groups.push_back(group3); atom_groups.push_back(group4); x.type(colvarvalue::type_scalar); if (cvm::debug()) cvm::log("Done initializing dihedral object from atom groups.\n"); }
colvar::gyration::gyration() { function_type = "gyration"; provide(f_cvc_inv_gradient); provide(f_cvc_Jacobian); x.type(colvarvalue::type_scalar); }
LoopReductor::LoopReductor(bool _reduce_loops) : Processor((_reduce_loops ? "otawa::LoopReductor" : "otawa::SpanningTreeBuilder"), Version(1, 0, 0)), reduce_loops(_reduce_loops) { require(COLLECTED_CFG_FEATURE); invalidate(COLLECTED_CFG_FEATURE); provide(LOOP_HEADERS_FEATURE); if (reduce_loops) { provide(REDUCED_LOOPS_FEATURE); } }
colvar::distance_z::distance_z() { function_type = "distance_z"; provide(f_cvc_inv_gradient); provide(f_cvc_Jacobian); enable(f_cvc_com_based); x.type(colvarvalue::type_scalar); }
colvar::dihedral::dihedral() { function_type = "dihedral"; period = 360.0; b_periodic = true; provide(f_cvc_inv_gradient); provide(f_cvc_Jacobian); x.type(colvarvalue::type_scalar); }
colvar::distance_xy::distance_xy(std::string const &conf) : distance_z(conf) { function_type = "distance_xy"; provide(f_cvc_inv_gradient); provide(f_cvc_Jacobian); enable(f_cvc_com_based); x.type(colvarvalue::type_scalar); }
colvar::distance::distance() : cvc() { function_type = "distance"; provide(f_cvc_inv_gradient); provide(f_cvc_Jacobian); enable(f_cvc_com_based); b_no_PBC = false; x.type(colvarvalue::type_scalar); }
colvar::distance_z::distance_z(std::string const &conf) : cvc(conf) { function_type = "distance_z"; provide(f_cvc_inv_gradient); provide(f_cvc_Jacobian); enable(f_cvc_com_based); x.type(colvarvalue::type_scalar); // TODO detect PBC from MD engine (in simple cases) // and then update period in real time if (period != 0.0) b_periodic = true; if ((wrap_center != 0.0) && (period == 0.0)) { cvm::error("Error: wrapAround was defined in a distanceZ component," " but its period has not been set.\n"); return; } main = parse_group(conf, "main"); ref1 = parse_group(conf, "ref"); // this group is optional ref2 = parse_group(conf, "ref2", true); if (ref2 && ref2->size()) { cvm::log("Using axis joining the centers of mass of groups \"ref\" and \"ref2\""); fixed_axis = false; if (key_lookup(conf, "axis")) cvm::log("Warning: explicit axis definition will be ignored!"); } else { if (get_keyval(conf, "axis", axis, cvm::rvector(0.0, 0.0, 1.0))) { if (axis.norm2() == 0.0) { cvm::error("Axis vector is zero!"); return; } if (axis.norm2() != 1.0) { axis = axis.unit(); cvm::log("The normalized axis is: "+cvm::to_str(axis)+".\n"); } } fixed_axis = true; } if (get_keyval(conf, "forceNoPBC", b_no_PBC, false)) { cvm::log("Computing distance using absolute positions (not minimal-image)"); } init_total_force_params(conf); }
colvar::distance::distance(std::string const &conf) : cvc(conf) { function_type = "distance"; provide(f_cvc_inv_gradient); provide(f_cvc_Jacobian); enable(f_cvc_com_based); group1 = parse_group(conf, "group1"); group2 = parse_group(conf, "group2"); init_total_force_params(conf); x.type(colvarvalue::type_scalar); }
colvar::angle::angle(std::string const &conf) : cvc(conf) { function_type = "angle"; provide(f_cvc_inv_gradient); provide(f_cvc_Jacobian); provide(f_cvc_com_based); group1 = parse_group(conf, "group1"); group2 = parse_group(conf, "group2"); group3 = parse_group(conf, "group3"); if (get_keyval(conf, "oneSiteSystemForce", b_1site_force, false)) { cvm::log("Computing system force on group 1 only"); } x.type(colvarvalue::type_scalar); }
int main(int argc, char **argv) { if (argc != 2 && argc != 3) { print_usage(); goto out; } /* compute machine */ if (argc == 2) { /* local bench configuration */ if (atoi(argv[1])) compute(atoi(argv[1]), NULL); /* dsm configuration */ else compute(0, argv[1]); /* provider machine */ } else { provide(argv[1], argv[2]); } out: return 0; }
void TraceAnalyzer::recordSideEffects(trace::Call *call) { const char *name = call->name(); /* FIXME: If we encode the list of commands that are executed * immediately (as opposed to those that are compiled into a * display list) then we could generate a "display-list-X" * resource just as we do for "texture-X" resources and only * emit it in the trace if a glCallList(X) is emitted. For * now, simply punt and include anything within glNewList and * glEndList in the trim output. This guarantees that display * lists will work, but does not trim out unused display * lists. */ if (insideNewEndList != 0) { provide("state", call->no); /* Also, any texture bound inside a display list is * conservatively considered required. */ if (strcmp(name, "glBindTexture") == 0) { GLuint texture = call->arg(1).toUInt(); linkf("state", "texture-", texture); } return; } if (trimFlags & TRIM_FLAG_NO_SIDE_EFFECTS) { if (callHasNoSideEffects(call, name)) { return; } } if (trimFlags & TRIM_FLAG_TEXTURES) { if (recordTextureSideEffects(call, name)) { return; } } if (trimFlags & TRIM_FLAG_SHADERS) { if (recordShaderSideEffects(call, name)) { return; } } if (trimFlags & TRIM_FLAG_DRAWING) { if (recordDrawingSideEffects(call, name)) { return; } } /* By default, assume this call affects the state somehow. */ resources["state"].insert(call->no); }
ContextTreeByCFGBuilder::ContextTreeByCFGBuilder(void) : CFGProcessor("otawa::ContextTreeByCFGBuilder", Version(1, 0, 0)) { require(DOMINANCE_FEATURE); require(LOOP_HEADERS_FEATURE); require(LOOP_INFO_FEATURE); provide(CONTEXT_TREE_BY_CFG_FEATURE); }
/* Module init function. */ int emacs_module_init (struct emacs_runtime *ert) { emacs_env *env = ert->get_environment (ert); #define DEFUN(lsym, csym, amin, amax, doc, data) \ bind_function (env, lsym, \ env->make_function (env, amin, amax, csym, doc, data)) DEFUN ("mod-test-return-t", Fmod_test_return_t, 1, 1, NULL, NULL); DEFUN ("mod-test-sum", Fmod_test_sum, 2, 2, "Return A + B\n\n(fn a b)", NULL); DEFUN ("mod-test-signal", Fmod_test_signal, 0, 0, NULL, NULL); DEFUN ("mod-test-throw", Fmod_test_throw, 0, 0, NULL, NULL); DEFUN ("mod-test-non-local-exit-funcall", Fmod_test_non_local_exit_funcall, 1, 1, NULL, NULL); DEFUN ("mod-test-globref-make", Fmod_test_globref_make, 0, 0, NULL, NULL); DEFUN ("mod-test-string-a-to-b", Fmod_test_string_a_to_b, 1, 1, NULL, NULL); DEFUN ("mod-test-userptr-make", Fmod_test_userptr_make, 1, 1, NULL, NULL); DEFUN ("mod-test-userptr-get", Fmod_test_userptr_get, 1, 1, NULL, NULL); DEFUN ("mod-test-vector-fill", Fmod_test_vector_fill, 2, 2, NULL, NULL); DEFUN ("mod-test-vector-eq", Fmod_test_vector_eq, 2, 2, NULL, NULL); #undef DEFUN provide (env, "mod-test"); return 0; }
colvar::distance_vec::distance_vec(std::string const &conf) : distance(conf) { function_type = "distance_vec"; provide(f_cvc_com_based); x.type(colvarvalue::type_3vector); }
colvar::distance_dir::distance_dir() : distance() { function_type = "distance_dir"; provide(f_cvc_com_based); x.type(colvarvalue::type_unit3vector); }
colvar::distance_vec::distance_vec() : distance() { function_type = "distance_vec"; provide(f_cvc_com_based); x.type(colvarvalue::type_3vector); }
colvar::gyration::gyration(std::string const &conf) : cvc(conf) { function_type = "gyration"; provide(f_cvc_inv_gradient); provide(f_cvc_Jacobian); atoms = parse_group(conf, "atoms"); if (atoms->b_user_defined_fit) { cvm::log("WARNING: explicit fitting parameters were provided for atom group \"atoms\"."); } else { atoms->b_center = true; atoms->ref_pos.assign(1, cvm::atom_pos(0.0, 0.0, 0.0)); } x.type(colvarvalue::type_scalar); }
/** * Build a new CFG normalizer. */ CFGNormalizer::CFGNormalizer(void): CFGProcessor("otawa::CFGNormalizer", Version(1, 0, 0)), force(false), verbose(false) { provide(NORMALIZED_CFGS_FEATURE); require(COLLECTED_CFG_FEATURE); }
/** * Constructor. */ TextDecoder::TextDecoder(void) : Processor("otawa::TextDecoder", Version(1, 0, 0)), follow_paths(false) { provide(DECODED_TEXT); //config(follow_paths_config); require(FLOW_FACTS_FEATURE); }
ISPCATBuilder::ISPCATBuilder(void) : CFGProcessor("otawa::ISPCATBuilder", Version(1, 0, 0)) { require(DOMINANCE_FEATURE); require(LOOP_HEADERS_FEATURE); require(LOOP_INFO_FEATURE); require(COLLECTED_FUNCTIONBLOCKS_FEATURE); provide(ISP_CAT_FEATURE); }
EdgeCAT2Builder::EdgeCAT2Builder(void) : CFGProcessor("otawa::EdgeCAT2Builder", Version(1, 0, 0)) { require(DOMINANCE_FEATURE); require(LOOP_HEADERS_FEATURE); require(LOOP_INFO_FEATURE); require(COLLECTED_LBLOCKS_FEATURE); require(ICACHE_EDGE_ACS_FEATURE); require(ICACHE_FIRSTLAST_FEATURE); provide(ICACHE_EDGE_CATEGORY2_FEATURE); }
/* Like provide, but with a simply-formatted string, (appending an * integer to the given string). */ void TraceAnalyzer::providef(std::string resource, int resource_no, trace::CallNo call_no) { std::stringstream ss; ss << resource << resource_no; provide(ss.str(), call_no); }
colvar::distance::distance(std::string const &conf) : cvc(conf) { function_type = "distance"; provide(f_cvc_inv_gradient); provide(f_cvc_Jacobian); enable(f_cvc_com_based); group1 = parse_group(conf, "group1"); group2 = parse_group(conf, "group2"); if (get_keyval(conf, "forceNoPBC", b_no_PBC, false)) { cvm::log("Computing distance using absolute positions (not minimal-image)"); } init_total_force_params(conf); x.type(colvarvalue::type_scalar); }
colvar::angle::angle(cvm::atom const &a1, cvm::atom const &a2, cvm::atom const &a3) { function_type = "angle"; provide(f_cvc_inv_gradient); provide(f_cvc_Jacobian); provide(f_cvc_com_based); b_1site_force = false; group1 = new cvm::atom_group(std::vector<cvm::atom>(1, a1)); group2 = new cvm::atom_group(std::vector<cvm::atom>(1, a2)); group3 = new cvm::atom_group(std::vector<cvm::atom>(1, a3)); atom_groups.push_back(group1); atom_groups.push_back(group2); atom_groups.push_back(group3); x.type(colvarvalue::type_scalar); }
bool TraceAnalyzer::recordDrawingSideEffects(trace::Call *call, const char *name) { /* Handle all rendering operations, (even though only glEnd is * flagged as a rendering operation we treat everything from * glBegin through glEnd as a rendering operation). */ if (call->flags & trace::CALL_FLAG_RENDER || insideBeginEnd) { std::set<unsigned> calls; std::set<unsigned>::iterator c; provide("framebuffer", call->no); calls = resolve("render-state"); for (c = calls.begin(); c != calls.end(); c++) { provide("framebuffer", *c); } /* In some cases, rendering has side effects beyond the * framebuffer update. */ if (renderingHasSideEffect()) { provide("state", call->no); for (c = calls.begin(); c != calls.end(); c++) { provide("state", *c); } } return true; } /* Though it's not flagged as a "RENDER" operation, we also want * to trim swapbuffers calls when trimming drawing operations. */ if (call->flags & trace::CALL_FLAG_SWAP_RENDERTARGET && call->flags & trace::CALL_FLAG_END_FRAME) { return true; } /* No known drawing-related side effects. Return false for more analysis. */ return false; }
colvar::dihedral::dihedral(std::string const &conf) : cvc(conf) { function_type = "dihedral"; period = 360.0; b_periodic = true; provide(f_cvc_inv_gradient); provide(f_cvc_Jacobian); provide(f_cvc_com_based); if (get_keyval(conf, "oneSiteSystemForce", b_1site_force, false)) { cvm::log("Computing system force on group 1 only"); } group1 = parse_group(conf, "group1"); group2 = parse_group(conf, "group2"); group3 = parse_group(conf, "group3"); group4 = parse_group(conf, "group4"); x.type(colvarvalue::type_scalar); }
void BinaryFile::do_put(const uint8 *ptr,ulen len) { auto src=Range(ptr,len); while( +src ) { if( !out ) provide(); ulen delta=Min(src.len,out.len); (out+=delta).copy( (src+=delta).ptr ); } }
int emacs_module_init(struct emacs_runtime *ert) { emacs_env *env = ert->get_environment(ert); #define DEFUN(lsym, csym, amin, amax, doc, data) \ bind_function(env, lsym, env->make_function(env, amin, amax, csym, doc, data)) DEFUN("qrencode-encode", Fqrencode_encode, 2, 2, "Encode string to QRCode", NULL); #undef DEFUN provide(env, "qrencode-core"); return 0; }
int emacs_module_init(struct emacs_runtime *ert) { emacs_env *env = ert->get_environment(ert); #define DEFUN(lsym, csym, amin, amax, doc, data) \ bind_function (env, lsym, env->make_function(env, amin, amax, csym, doc, data)) DEFUN("mecab-core-new", Fmecab_new, 1, 1, NULL, NULL); DEFUN("mecab-core-sparse-to-string", Fmecab_sparse_to_string, 3, 3, NULL, NULL); DEFUN("mecab-core-sparse-to-list", Fmecab_sparse_to_list, 3, 3, NULL, NULL); #undef DEFUN provide(env, "mecab-core"); return 0; }