/* If using BOINC try reading a few of the settings from the project
 * preferences. If command line arguments are used, those will
 * override the preferences. The command line arguments will also
 * still work without BOINC */
static void separationReadPreferences(SeparationPrefs* prefsOut)
{
    static SeparationPrefs prefs;
    static MWProjectPrefs sepPrefs[] =
        {
            { "gpu_target_frequency", MW_PREF_DOUBLE, FALSE, &prefs.gpuTargetFrequency   },
            { "gpu_wait_factor",      MW_PREF_DOUBLE, FALSE, &prefs.gpuWaitFactor        },
            { "gpu_non_responsive",   MW_PREF_BOOL,   FALSE, &prefs.gpuNonResponsive     },
            { "gpu_process_priority", MW_PREF_INT,    FALSE, &prefs.gpuProcessPriority   },
            { "no_gpu_checkpoint",    MW_PREF_BOOL,   FALSE, &prefs.gpuDisableCheckpoint },
            END_MW_PROJECT_PREFS
        };

    prefs.gpuTargetFrequency   = DEFAULT_TARGET_FREQUENCY;
    prefs.gpuWaitFactor        = DEFAULT_WAIT_FACTOR;
    prefs.gpuNonResponsive     = DEFAULT_NON_RESPONSIVE;
    prefs.gpuProcessPriority   = DEFAULT_GPU_PRIORITY;
    prefs.gpuDisableCheckpoint = DEFAULT_DISABLE_GPU_CHECKPOINTING;

    if (BOINC_APPLICATION)
    {
        if (mwGetAppInitData())
        {
            mw_printf("Error reading app init data. Project preferences will not be used\n");
        }
        else
        {
            mwReadProjectPrefs(sepPrefs, mwGetProjectPrefs());
        }
    }

    *prefsOut = prefs;
}
Ejemplo n.º 2
0
static void nbglReadPreferences(VisArgs* args)
{
    static struct
    {
        int blockSimulation;
        int noFloat;
        double floatSpeed;
        double texturedPointSize;
        double pointPointSize;
        int untexturedPoints;
        int monochromatic;
        int originCentered;
        int showAxes;
        int showOrbitTrace;
        int noShowInfo;
    } prefs;

    static MWProjectPrefs nbglPrefs[] =
        {
            { "block_simulation",    MW_PREF_BOOL,   FALSE, &prefs.blockSimulation   },
            { "no_float",            MW_PREF_BOOL,   FALSE, &prefs.noFloat           },
            { "float_speed",         MW_PREF_DOUBLE, FALSE, &prefs.floatSpeed        },
            { "textured_point_size", MW_PREF_DOUBLE, FALSE, &prefs.texturedPointSize },
            { "point_point_size",    MW_PREF_DOUBLE, FALSE, &prefs.pointPointSize    },
            { "untextured_points",   MW_PREF_BOOL,   FALSE, &prefs.untexturedPoints  },
            { "monochromatic",       MW_PREF_BOOL,   FALSE, &prefs.monochromatic     },
            { "origin_centered",     MW_PREF_BOOL,   FALSE, &prefs.originCentered    },
            { "no_show_info",        MW_PREF_BOOL,   FALSE, &prefs.noShowInfo        },
            { "show_axes",           MW_PREF_BOOL,   FALSE, &prefs.showAxes          },
            { "show_orbit_trace",    MW_PREF_BOOL,   FALSE, &prefs.showOrbitTrace    },
            END_MW_PROJECT_PREFS
        };

    if (mwGetAppInitData())
    {
        mw_printf("Error reading app init data. Project preferences will not be used\n");
    }
    else
    {
        mwReadProjectPrefs(nbglPrefs, mwGetProjectPrefs());
    }

    /* Any successfully found setting will be used; otherwise it will get the default */
    args->blockSimulation   = prefs.blockSimulation;
    args->noFloat           = prefs.noFloat;
    args->floatSpeed        = (float) prefs.floatSpeed;
    args->texturedPointSize = (float) prefs.texturedPointSize;
    args->pointPointSize    = (float) prefs.pointPointSize;
    args->untexturedPoints  = prefs.untexturedPoints;
    args->monochromatic     = prefs.monochromatic;
    args->originCentered    = prefs.originCentered;
    args->noDrawInfo        = prefs.noShowInfo;
    args->drawAxes          = prefs.showAxes;
    args->drawOrbitTrace    = prefs.showOrbitTrace;
}