source: trunk/optimizer/src/plugin_pgapack.c @ 897

Last change on this file since 897 was 897, checked in by mmc, 16 years ago

Improved the Rappture optimization API to include Tcl bindings.
Added standard build/test stuff for Tcl libraries. Created a
plugin hook for optimization libraries like pgapack. The plugin
support still needs some work.

File size: 1.8 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  OPTIMIZER PLUG-IN:  Pgapack
4 *
5 *  This code connects Pgapack into the Rappture Optimization
6 *  infrastructure.
7 *
8 * ======================================================================
9 *  AUTHOR:  Michael McLennan, Purdue University
10 *  Copyright (c) 2008  Purdue Research Foundation
11 *
12 *  See the file "license.terms" for information on usage and
13 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 * ======================================================================
15 */
16#include "rp_optimizer_plugin.h"
17
18typedef struct PgapackData {
19    int foo;                        /* data used by Pgapack... */
20} PgapackData;
21
22RpTclOption PgapackOptions[] = {
23  {"-foo", RP_OPTION_INT, NULL, Rp_Offset(PgapackData,foo)},
24  {NULL, NULL, NULL, 0}
25};
26
27/*
28 * ----------------------------------------------------------------------
29 * PgapackInit()
30 *
31 * This routine is called whenever a new optimization object is created
32 * to initialize Pgapack.  Returns a pointer to PgapackData that is
33 * used in later routines.
34 * ----------------------------------------------------------------------
35 */
36ClientData
37PgapackInit()
38{
39    PgapackData *dataPtr;
40    dataPtr = (PgapackData*)malloc(sizeof(PgapackData));
41    dataPtr->foo = 1;
42    return (ClientData)dataPtr;
43}
44
45/*
46 * ----------------------------------------------------------------------
47 * PgapackCleanup()
48 *
49 * This routine is called whenever an optimization object is deleted
50 * to clean up data associated with the object.  Frees the data
51 * allocated in PgapackInit.
52 * ----------------------------------------------------------------------
53 */
54void
55PgapackCleanup(cdata)
56    ClientData cdata;  /* data from to be cleaned up */
57{
58    PgapackData *dataPtr = (PgapackData*)cdata;
59    dataPtr->foo = 0;
60    free(dataPtr);
61}
Note: See TracBrowser for help on using the repository browser.