make_test.C

Go to the documentation of this file.
00001 /* Gnome gxsm - Gnome X Scanning Microscopy
00002  * universal STM/AFM/SARLS/SPALEED/... controlling and
00003  * data analysis software
00004  *
00005  * plugin_helper reports your answers as
00006 author          =Percy Zahl
00007 email                   =zahl@users.sf.net
00008 pluginname              =make_test
00009 pluginmenuentry         =make test
00010 menupath                =Math/Convert/
00011 entryplace              =Convert
00012 shortentryplace =CV
00013 abouttext               =Generate text data
00014 smallhelp               =Generate text data
00015 longhelp                =Generate text data
00016  * 
00017  * Gxsm Plugin Name: make_test.C
00018  * ========================================
00019  * 
00020  * Copyright (C) 1999 The Free Software Foundation
00021  *
00022  * Authors: Percy Zahl <zahl@fkp.uni-hannover.de>
00023  * additional features: Andreas Klust <klust@fkp.uni-hannover.de>
00024  *
00025  * This program is free software; you can redistribute it and/or modify
00026  * it under the terms of the GNU General Public License as published by
00027  * the Free Software Foundation; either version 2 of the License, or
00028  * (at your option) any later version.
00029  *
00030  * This program is distributed in the hope that it will be useful,
00031  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00032  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00033  * GNU General Public License for more details.
00034  *
00035  * You should have received a copy of the GNU General Public License
00036  * along with this program; if not, write to the Free Software
00037  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00038  */
00039 
00040 
00041 /* Please do not change the Begin/End lines of this comment section!
00042  * this is a LaTeX style section used for auto generation of the PlugIn Manual 
00043  * Chapter. Add a complete PlugIn documentation inbetween the Begin/End marks!
00044  * All "% PlugInXXX" commentary tags are mandatory
00045  * All "% OptPlugInXXX" tags are optional and can be removed or commented in
00046  * --------------------------------------------------------------------------------
00047 % BeginPlugInDocuSection
00048 % PlugInDocuCaption: Generate text data
00049 % PlugInName: make_test
00050 % PlugInAuthor: Percy Zahl
00051 % PlugInAuthorEmail: zahl@users.sf.net
00052 % PlugInMenuPath: Math/Convert/make test
00053 
00054 % PlugInDescription
00055 Makes a test data set
00056 
00057 % PlugInUsage
00058 Call \GxsmMenu{Math/Convert/make test}.
00059 
00060 % OptPlugInSources
00061 
00062 % OptPlugInDest
00063 
00064 % EndPlugInDocuSection
00065  * -------------------------------------------------------------------------------- 
00066  */
00067 
00068 #include <gtk/gtk.h>
00069 #include "config.h"
00070 #include "gxsm/plugin.h"
00071 
00072 // Plugin Prototypes
00073 static void make_test_init( void );
00074 static void make_test_about( void );
00075 static void make_test_configure( void );
00076 static void make_test_cleanup( void );
00077 
00078 // Define Type of math plugin here, only one line should be commented in!!
00079 #define GXSM_ONE_SRC_PLUGIN__DEF
00080 // #define GXSM_TWO_SRC_PLUGIN__DEF
00081 
00082 // Math-Run-Function, use only one of (automatically done :=)
00083 #ifdef GXSM_ONE_SRC_PLUGIN__DEF
00084 // "OneSrc" Prototype
00085  static gboolean make_test_run( Scan *Src, Scan *Dest );
00086 #else
00087 // "TwoSrc" Prototype
00088  static gboolean make_test_run( Scan *Src1, Scan *Src2, Scan *Dest );
00089 #endif
00090 
00091 // Fill in the GxsmPlugin Description here
00092 GxsmPlugin make_test_pi = {
00093   NULL,                   // filled in and used by Gxsm, don't touch !
00094   NULL,                   // filled in and used by Gxsm, don't touch !
00095   0,                      // filled in and used by Gxsm, don't touch !
00096   NULL,                   // The Gxsm-App Class Ref.pointer (called "gapp" in Gxsm) is 
00097                           // filled in here by Gxsm on Plugin load, 
00098                           // just after init() is called !!!
00099   // ----------------------------------------------------------------------
00100   // Plugins Name, CodeStly is like: Name-M1S|M2S-BG|F1D|F2D|ST|TR|Misc
00101   "make_test-"
00102 #ifdef GXSM_ONE_SRC_PLUGIN__DEF
00103   "M1S"
00104 #else
00105   "M2S"
00106 #endif
00107   "-CV",
00108   // Plugin's Category - used to autodecide on Pluginloading or ignoring
00109   // NULL: load, else
00110   // example: "+noHARD +STM +AFM"
00111   // load only, if "+noHARD: no hardware" and Instrument is STM or AFM
00112   // +/-xxxHARD und (+/-INST or ...)
00113   NULL,
00114   // Description, is shown by PluginViewer (Plugin: listplugin, Tools->Plugin Details)
00115   "Make test scan data, type layered float",                   
00116   // Author(s)
00117   "Percy Zahl",
00118   // Menupath to position where it is appendet to
00119   N_("_Math/_Convert/"),
00120   // Menuentry
00121   N_("make test"),
00122   // help text shown on menu
00123   N_("Make test data"),
00124   // more info...
00125   "Make test scan data, type is layered float",
00126   NULL,          // error msg, plugin may put error status msg here later
00127   NULL,          // Plugin Status, managed by Gxsm, plugin may manipulate it too
00128   // init-function pointer, can be "NULL", 
00129   // called if present at plugin load
00130   make_test_init,  
00131   // query-function pointer, can be "NULL", 
00132   // called if present after plugin init to let plugin manage it install itself
00133   NULL, // query should be "NULL" for Gxsm-Math-Plugin !!!
00134   // about-function, can be "NULL"
00135   // can be called by "Plugin Details"
00136   make_test_about,
00137   // configure-function, can be "NULL"
00138   // can be called by "Plugin Details"
00139   make_test_configure,
00140   // run-function, can be "NULL", if non-Zero and no query defined, 
00141   // it is called on menupath->"plugin"
00142   NULL, // run should be "NULL" for Gxsm-Math-Plugin !!!
00143   // cleanup-function, can be "NULL"
00144   // called if present at plugin removeal
00145   make_test_cleanup
00146 };
00147 
00148 // special math Plugin-Strucure, use
00149 // GxsmMathOneSrcPlugin make_test_m1s_pi -> "OneSrcMath"
00150 // GxsmMathTwoSrcPlugin make_test_m2s_pi -> "TwoSrcMath"
00151 #ifdef GXSM_ONE_SRC_PLUGIN__DEF
00152  GxsmMathOneSrcPlugin make_test_m1s_pi
00153 #else
00154  GxsmMathTwoSrcPlugin make_test_m2s_pi
00155 #endif
00156  = {
00157    // math-function to run, see prototype(s) above!!
00158    make_test_run
00159  };
00160 
00161 // Text used in Aboutbox, please update!!
00162 static const char *about_text = N_("Gxsm make_test Plugin\n\n"
00163                                    "Makes a test scan data set. Type is layered float.");
00164 
00165 // Symbol "get_gxsm_plugin_info" is resolved by dlsym from Gxsm, used to get Plugin's info!! 
00166 // Essential Plugin Function!!
00167 GxsmPlugin *get_gxsm_plugin_info ( void ){ 
00168   make_test_pi.description = g_strdup_printf(N_("Gxsm MathOneArg make_test plugin %s"), VERSION);
00169   return &make_test_pi; 
00170 }
00171 
00172 // Symbol "get_gxsm_math_one|two_src_plugin_info" is resolved by dlsym from Gxsm, 
00173 // used to find out which Math Type the Plugin is!! 
00174 // Essential Plugin Function!!
00175 #ifdef GXSM_ONE_SRC_PLUGIN__DEF
00176 GxsmMathOneSrcPlugin *get_gxsm_math_one_src_plugin_info( void ) {
00177   return &make_test_m1s_pi; 
00178 }
00179 #else
00180 GxsmMathTwoSrcPlugin *get_gxsm_math_two_src_plugin_info( void ) { 
00181   return &make_test_m2s_pi; 
00182 }
00183 #endif
00184 
00185 /* Here we go... */
00186 // init-Function
00187 static void make_test_init(void)
00188 {
00189   PI_DEBUG (DBG_L2, "make_test Plugin Init");
00190 }
00191 
00192 // about-Function
00193 static void make_test_about(void)
00194 {
00195   const gchar *authors[] = { make_test_pi.authors, NULL};
00196   gtk_widget_show(gnome_about_new ( make_test_pi.name,
00197                                     VERSION,
00198                                     N_("(C) 2000 the Free Software Foundation"),
00199                                     about_text,
00200                                     authors,
00201                                     NULL, NULL, NULL
00202                                     ));
00203 }
00204 
00205 // configure-Function
00206 static void make_test_configure(void)
00207 {
00208         if(make_test_pi.app)
00209                 make_test_pi.app->message("make_test Plugin Configuration");
00210 }
00211 
00212 // cleanup-Function
00213 static void make_test_cleanup(void)
00214 {
00215         PI_DEBUG (DBG_L2, "make_test Plugin Cleanup");
00216 }
00217 
00218 // run-Function
00219 static gboolean make_test_run(Scan *Src, Scan *Dest)
00220 {
00221         Dest->mem2d->Resize (Src->data.s.nx, Src->data.s.ny, 20, ZD_FLOAT);
00222         Dest->data.s.ntimes=1;
00223         Dest->data.s.nvalues=Dest->mem2d->GetNv ();
00224         Dest->mem2d->data->MkVLookup(0., 1.);
00225         Dest->data.s.dz=1.;
00226         UnitObj *VoltUnit = new UnitObj("V","V",".3f","Volt");
00227         Dest->data.SetZUnit (VoltUnit);
00228         delete VoltUnit;
00229 //      Dest->mem2d->data->SetVLookup(n, v);
00230 
00231         for (int i=0; i<Dest->mem2d->GetNx (); ++i)
00232                 for (int j=0; j<Dest->mem2d->GetNy (); ++j)
00233                         for (int k=0; k<Dest->mem2d->GetNv (); ++k){
00234                                 double v = (double)k;
00235                                 v *= v*10.;
00236                                 Dest->mem2d->PutDataPkt (Src->mem2d->GetDataPkt (i,j) + v, (i+k)%Dest->mem2d->GetNx (),j,k);
00237                         }
00238 
00239         return MATH_OK;
00240 }
00241 
00242 

Generated on Sat Apr 1 09:04:21 2006 for GXSM by  doxygen 1.4.6