int ColorBalanceMain::synchronize_params(ColorBalanceSlider *slider, float difference) { if(thread && config.lock_params) { if(slider != ((ColorBalanceWindow*)thread->window)->cyan) { config.cyan += difference; test_boundary(config.cyan); ((ColorBalanceWindow*)thread->window)->cyan->update((int64_t)config.cyan); } if(slider != ((ColorBalanceWindow*)thread->window)->magenta) { config.magenta += difference; test_boundary(config.magenta); ((ColorBalanceWindow*)thread->window)->magenta->update((int64_t)config.magenta); } if(slider != ((ColorBalanceWindow*)thread->window)->yellow) { config.yellow += difference; test_boundary(config.yellow); ((ColorBalanceWindow*)thread->window)->yellow->update((int64_t)config.yellow); } } return 0; }
int main( int argc, char *argv[] ) { MPI_Init( &argc, &argv ); MPI_Comm comm = MPI_COMM_WORLD; int comm_rank; MPI_Comm_rank( comm, &comm_rank ); DTK_ExecutionSpace exec_space = DTK_SERIAL; int opt; while ( ( opt = getopt( argc, argv, "s:h" ) ) != -1 ) { switch ( opt ) { case 's': if ( !strcmp( optarg, "serial" ) ) exec_space = DTK_SERIAL; else if ( !strcmp( optarg, "openmp" ) ) exec_space = DTK_OPENMP; else if ( !strcmp( optarg, "cuda" ) ) exec_space = DTK_CUDA; else { printf( "Unknown execution space\n" ); return EXIT_FAILURE; } break; case 'h': printf( "Usage: %s [-s <serial|openmp|cuda>] [-h]\n", argv[0] ); return EXIT_FAILURE; } } if ( !comm_rank ) { printf( "DTK version: %s\n", DTK_version() ); printf( "DTK hash: %s\n", DTK_git_commit_hash() ); } UserTestClass u; u._space_dim = SPACE_DIM; u._size_1 = SIZE_1; u._size_2 = SIZE_2; u._offset = OFFSET; u._field_name = FIELD_NAME; u._data = (double *)calloc( u._size_1 * u._space_dim, sizeof( double ) ); int rv = 0; { DTK_create( exec_space ); rv |= ( errno == 0 ); const char *errormsg = DTK_error( errno ); rv |= ( strcmp( errormsg, "DTK error: DTK is not initialized" ) ); } DTK_initialize_cmd( &argc, &argv ); rv |= ( DTK_is_initialized() ? 0 : 1 ); { DTK_UserApplicationHandle dtk_handle = DTK_create( exec_space ); rv |= ( errno != 0 ); const char *errormsg = DTK_error( errno ); rv |= ( strcmp( errormsg, "" ) ); rv |= ( DTK_is_valid( dtk_handle ) ? 0 : 1 ); DTK_destroy( dtk_handle ); rv |= ( DTK_is_valid( dtk_handle ) ? 1 : 0 ); } { DTK_UserApplicationHandle dtk_handle; #ifdef __clang__ #pragma GCC diagnostic ignored "-Wuninitialized" #else #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif rv |= ( DTK_is_valid( dtk_handle ) ? 1 : 0 ); DTK_destroy( dtk_handle ); } { DTK_UserApplicationHandle dtk_handle; DTK_set_function( dtk_handle, DTK_NODE_LIST_SIZE_FUNCTION, node_list_size, &u ); rv |= ( errno == 0 ); const char *errormsg = DTK_error( errno ); rv |= ( strcmp( errormsg, "DTK error: invalid DTK handle" ) ); } { DTK_UserApplicationHandle dtk_handle = DTK_create( exec_space ); rv |= test_node_list( dtk_handle, u ); DTK_destroy( dtk_handle ); } { DTK_UserApplicationHandle dtk_handle = DTK_create( exec_space ); rv |= test_bounding_volume_list( dtk_handle, u ); DTK_destroy( dtk_handle ); } { DTK_UserApplicationHandle dtk_handle = DTK_create( exec_space ); rv |= test_polyhedron_list( dtk_handle, u ); DTK_destroy( dtk_handle ); } { DTK_UserApplicationHandle dtk_handle = DTK_create( exec_space ); rv |= test_multiple_topology_cell( dtk_handle, u ); DTK_destroy( dtk_handle ); } { DTK_UserApplicationHandle dtk_handle = DTK_create( exec_space ); rv |= test_boundary( dtk_handle, u ); DTK_destroy( dtk_handle ); } { DTK_UserApplicationHandle dtk_handle = DTK_create( exec_space ); rv |= test_adjacency_list( dtk_handle, u ); DTK_destroy( dtk_handle ); } { DTK_UserApplicationHandle dtk_handle = DTK_create( exec_space ); rv |= test_single_topology_dof( dtk_handle, u ); DTK_destroy( dtk_handle ); } { DTK_UserApplicationHandle dtk_handle = DTK_create( exec_space ); rv |= test_multiple_topology_dof( dtk_handle, u ); DTK_destroy( dtk_handle ); } { DTK_UserApplicationHandle dtk_handle = DTK_create( exec_space ); rv |= test_field_push_pull( dtk_handle, u ); DTK_destroy( dtk_handle ); } { DTK_UserApplicationHandle dtk_handle = DTK_create( exec_space ); rv |= test_field_eval( dtk_handle, u ); DTK_destroy( dtk_handle ); } { DTK_UserApplicationHandle dtk_handle = DTK_create( exec_space ); rv |= test_missing_function( dtk_handle, u ); DTK_destroy( dtk_handle ); } { DTK_UserApplicationHandle dtk_handle = DTK_create( exec_space ); rv |= test_too_many_functions( dtk_handle, u ); DTK_destroy( dtk_handle ); } DTK_finalize(); if ( !comm_rank ) { if ( rv == 0 ) printf( "End Result: TEST PASSED\n" ); else printf( "End Result: TEST FAILED\n" ); } free( u._data ); MPI_Finalize(); return EXIT_SUCCESS; }