Ejemplo n.º 1
0
document_to_graph::document_to_graph(k3d::idocument& Document) :
	m_document(Document),
	m_include_materials(init_owner(*this) + init_name("include_materials") + init_label("") + init_description("") + init_value(false)),
	m_include_painters(init_owner(*this) + init_name("include_painters") + init_label("") + init_description("") + init_value(false))
{
	m_include_materials.changed_signal().connect(k3d::hint::converter<
		k3d::hint::convert<k3d::hint::any, k3d::hint::graph_topology_changed> >(make_update_graph_slot()));

	m_include_painters.changed_signal().connect(k3d::hint::converter<
		k3d::hint::convert<k3d::hint::any, k3d::hint::graph_topology_changed> >(make_update_graph_slot()));
}
Ejemplo n.º 2
0
static bool init_my_label(my_label_t *lbl, widget_t *parent,
    const char *caption, uint16_t points, pixel_t background, pixel_t foreground)
{
	bool initialized = init_label(
	    &lbl->label, parent, caption, points, background, foreground);
	lbl->label.widget.destroy = my_label_destroy;
	return initialized;
}
Ejemplo n.º 3
0
node::node(iplugin_factory& Factory, idocument& Document) :
	property_collection(),
	m_factory(Factory),
	m_document(Document),
	m_name(init_owner(*this) + init_name("name") + init_label(_("Name")) + init_description(_("Assign a human-readable name to identify this node.")) + init_value<std::string>(""))
{
	m_deleted_signal.connect(sigc::mem_fun(*this, &node::on_deleted));
	m_name.changed_signal().connect(sigc::hide(m_name_changed_signal.make_slot()));
}
/* ******************************* *
 *  Pop out the first permutation  *
 * ******************************* */
int first_sample(int *L)
{
    if(L == NULL)
        return local_perm_size;

    // If is random, we'll choose the original L as the first sample
    // Note: local_pa.B == 0 => complete permutations
    //       local_pa.B >  0 => random permutations
    if(local_pa.B > 0) {
        get_permu(&local_pa, 0, L);
    } else {
        init_label(local_pa.n, local_pa.k, local_pa.nk, L);
        memcpy(local_L, L, sizeof(int) * local_pa.n);
    }

    return 1;
}
Ejemplo n.º 5
0
int main(int argc,char **argv) {
	INFO(char *dbg="Main(init): ");

	native_startup(argc, argv);

	/*** init modules ***/

	INFO(printf("%sSharedMemory\n",dbg));
	init_sharedmem(&dope);

	INFO(printf("%sTimer\n",dbg));
	init_timer(&dope);

	INFO(printf("%sTick\n",dbg));
	init_tick(&dope);

	INFO(printf("%sRelax\n",dbg));
	init_relax(&dope);

	INFO(printf("%sKeymap\n",dbg));
	init_keymap(&dope);

	INFO(printf("%sThread\n",dbg));
	init_thread(&dope);

	INFO(printf("%sCache\n",dbg));
	init_cache(&dope);

	INFO(printf("%sHashTable\n",dbg));
	init_hashtable(&dope);

	INFO(printf("%sApplication Manager\n",dbg));
	init_appman(&dope);

	INFO(printf("%sTokenizer\n",dbg));
	init_tokenizer(&dope);

	INFO(printf("%sMessenger\n",dbg));
	init_messenger(&dope);

	INFO(printf("%sScript\n",dbg));
	init_script(&dope);

	INFO(printf("%sClipping\n",dbg));
	init_clipping(&dope);

	INFO(printf("%sScreen Driver\n",dbg));
	init_scrdrv(&dope);

	INFO(printf("%sInput\n",dbg));
	init_input(&dope);

	INFO(printf("%sViewManager\n",dbg));
	init_viewman(&dope);

	INFO(printf("%sConvertFNT\n",dbg));
	init_conv_fnt(&dope);

	INFO(printf("%sFontManager\n",dbg));
	init_fontman(&dope);

	INFO(printf("%sGfxScreen16\n",dbg));
	init_gfxscr16(&dope);

	INFO(printf("%sGfxImage16\n",dbg));
	init_gfximg16(&dope);

	INFO(printf("%sGfxImage32\n",dbg));
	init_gfximg32(&dope);

	INFO(printf("%sGfxImageYUV420\n",dbg));
	init_gfximgyuv420(&dope);

	INFO(printf("%sGfx\n",dbg));
	init_gfx(&dope);

	INFO(printf("%sRedrawManager\n",dbg));
	init_redraw(&dope);

	INFO(printf("%sUserState\n",dbg));
	init_userstate(&dope);

	INFO(printf("%sWidgetManager\n",dbg));
	init_widman(&dope);

	INFO(printf("%sScope\n",dbg));
	init_scope(&dope);

	INFO(printf("%sButton\n",dbg));
	init_button(&dope);

	INFO(printf("%sEntry\n",dbg));
	init_entry(&dope);

	INFO(printf("%sVariable\n",dbg));
	init_variable(&dope);

	INFO(printf("%sLabel\n",dbg));
	init_label(&dope);

	INFO(printf("%sLoadDisplay\n",dbg));
	init_loaddisplay(&dope);

	INFO(printf("%sBackground\n",dbg));
	init_background(&dope);

	INFO(printf("%sScrollbar\n",dbg));
	init_scrollbar(&dope);

	INFO(printf("%sScale\n",dbg));
	init_scale(&dope);

	INFO(printf("%sFrame\n",dbg));
	init_frame(&dope);

	INFO(printf("%sContainer\n",dbg));
	init_container(&dope);

	INFO(printf("%sGrid\n",dbg));
	init_grid(&dope);

	INFO(printf("%sWinLayout\n",dbg));
	init_winlayout(&dope);

	INFO(printf("%sWindow\n",dbg));
	init_window(&dope);

	INFO(printf("%sScreen\n",dbg));
	init_screen(&dope);

	INFO(printf("%sScheduler\n",dbg));
	if (config_don_scheduler)
        {
	//	init_don_scheduler(&dope);
          printf("NOOOOOOOOOOOOOOOOOOO\n");
        }
	else
		init_simple_scheduler(&dope);

	INFO(printf("%sVScreenServer\n",dbg));
	init_vscr_server(&dope);

	INFO(printf("%sVScreen\n",dbg));
	init_vscreen(&dope);
	
	INFO(printf("%sVTextScreen\n",dbg));
	init_vtextscreen(&dope);

	INFO(printf("%sServer\n",dbg));
	init_server(&dope);

	INFO(printf("%screate screen\n",dbg));
	{
		static GFX_CONTAINER *scr_ds;
		gfx       = pool_get("Gfx 1.0");
		screen    = pool_get("Screen 1.0");
		userstate = pool_get("UserState 1.0");

		scr_ds = gfx->alloc_scr("default");
		curr_scr = screen->create();
		curr_scr->scr->set_gfx(curr_scr, scr_ds);
		userstate->set_max_mx(gfx->get_width(scr_ds));
		userstate->set_max_my(gfx->get_height(scr_ds));
	}
	
	INFO(printf("%sstarting server\n",dbg));
	if ((server = pool_get("Server 1.0")))
		server->start();
	
	INFO(printf("%sstarting scheduler\n",dbg));
	if ((sched  = pool_get("Scheduler 1.0")))
		sched->process_mainloop();

	return 0;
}
/* ******************************************************** *
 *  Create the sampling structure and initialize all values *
 * ******************************************************** */
void create_sampling(int n, int *L, int B, int generator_flag, int initial_count)
{  
    int *ordern, *permun, *myL;
    int i;

    // Set the local size of permutations
    local_perm_size = B;
    local_perm_count = 1;

    // Allocate and initialize local L to original L
    local_L = (int *)R_alloc(n, sizeof(int));

    // To check random or complete
    if( generator_flag == 1 ) {

        // Initialize the permutation array (struct)
        // Sets the B in the struct equal to 0 to be
        // able to identify the generator later on
        init_permu_array(&local_pa, L, n, 0);

        // * ================================================================= *
        // *                     Forwarding logic                              *
        // *                     ----------------                              *
        // *  For parallel executions all processes, appart from the one with  *
        // *  rank == 0, should forward their random generators in order to    *
        // *  be able to reproduce the exact same random permutations as the   *
        // *  serial version of the code (or a version with only one thread)   *
        // *                                                                   *
        // *  The code below uses the initial_count variable to "burn" the     *
        // *  cycles from the random generator                                 *
        // * ================================================================= *

        // All processes apart from process with rank == 0 (translates to
        // initial_count == 0) will perform this forward
        if ( initial_count != 0 ) {

            // Initialize label
            init_label(local_pa.n, local_pa.k, local_pa.nk, local_L);

            // Burn the cycles
            // We *must* use L in order to initialize it in the proper permutation
            // L is given as the starting position for the next permutation
            for(i=0; i < initial_count; i++) {
                next_label(local_pa.n, local_pa.k, local_pa.nk, local_L);
            }
        }

        // * ================================================================= *
        // * ================================================================= *

    } else {

        // Intiailize the permu_array (struct)
        init_permu_array(&local_pa, L, n, B);

        permun = (int *)R_alloc(local_pa.n, sizeof(int));
        ordern = (int*)R_alloc(local_pa.n, sizeof(int));
        myL = (int *)R_alloc(local_pa.n, sizeof(int));

        // * ================================================================= *
        // *                     Forwarding logic                              *
        // *                     ----------------                              *
        // *  For parallel executions all processes, appart from the one with  *
        // *  rank == 0, should forward their random generators in order to    *
        // *  be able to reproduce the exact same random permutations as the   *
        // *  serial version of the code (or a version with only one thread)   *
        // *                                                                   *
        // *  The code below uses the initial_count variable to "burn" the     *
        // *  cycles from the random generator                                 *
        // * ================================================================= *

        // Set initial seed
        set_seed(g_random_seed);

        // Burn the cycles
        // ("permun" is a safe scratch space for this)
        for(i=0; i < initial_count; i++) {
            sample(permun, n);
        }

        // * ================================================================= *
        // * ================================================================= *

        for(i=0; i<n; i++){
            ordern[i]=i;
        }

        // Allocate and assign the values for l_first_sample
        set_permu(&local_pa, 0, L);

        for(i=1; i<B; i++) {
            memcpy(permun, ordern, sizeof(int)*n);
            sample(permun, n);

            // Change to labbeling
            sample2label(n, local_pa.k, local_pa.nk, permun, myL);
            set_permu(&local_pa, i, myL);
        }


    }
}