Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

src/DataSource/ACLVISDataConnect.cpp

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /***************************************************************************
00003  *
00004  * The IPPL Framework
00005  * 
00006  * This program was prepared by PSI. 
00007  * All rights in the program are reserved by PSI.
00008  * Neither PSI nor the author(s)
00009  * makes any warranty, express or implied, or assumes any liability or
00010  * responsibility for the use of this software
00011  *
00012  * Visit http://www.acl.lanl.gov/POOMS for more details
00013  *
00014  ***************************************************************************/
00015 
00016 // -*- C++ -*-
00017 /***************************************************************************
00018  *
00019  * The IPPL Framework
00020  * 
00021  *
00022  * Visit http://people.web.psi.ch/adelmann/ for more details
00023  *
00024  ***************************************************************************/
00025 
00026 // include files
00027 #include "DataSource/ACLVISDataConnect.h"
00028 #include "Profile/Profiler.h"
00029 #include "Utility/IpplInfo.h"
00030 
00031 // ACLVIS library headers
00032 #ifdef IPPL_LUX
00033 # include "interface/script.h"
00034 #else
00035 # include "aclvis/aclvis.h"
00036 #endif
00037 
00038 
00039 // static data members of this class
00040 bool ACLVISDataConnect::ACLVISInitialized = false;
00041 
00042 
00044 // constructor: initialize ACLVIS window for display
00045 ACLVISDataConnect::ACLVISDataConnect(const char *nm, int n)
00046   : DataConnect(nm, "aclvis", DataSource::OUTPUT, n)
00047 {
00048   TAU_PROFILE("ACLVISDataConnect::ACLVISDataConnect()",
00049               "void (char *)", TAU_VIZ);
00050 
00051   // Inform dbgmsg("ACLVISDataConnect", INFORM_ALL_NODES);
00052   // dbgmsg << "Setting up new ACLVISDataConnect '" << nm << "'..." << endl;
00053 
00054   if (onConnectNode()) {
00055     // do one-time ACLVIS initialization
00056     if ( ! ACLVISInitialized ) {
00057       // dbgmsg << "Doing aclvis initialization ..." << endl;
00058 #ifdef IPPL_LUX
00059       Connection = lux_init("IPPL-R1");
00060 #else
00061       aclvis_init(Ippl::getArgc(), Ippl::getArgv());
00062 #endif
00063       ACLVISInitialized = true;
00064     }
00065 
00066     // create ACLVIS object, to initialize a new window
00067     // if successful, set proper flags
00068     // dbgmsg << "Creating new VizTool ..." << endl;
00069 #ifndef IPPL_LUX
00070     Connection = new VizTool();
00071 #endif
00072 
00073   } else {
00074     // not much to do; we just hope it worked on node 0
00075     // dbgmsg << "Simple initialization on node " << Ippl::myNode() << endl;
00076     Connection = 0;
00077   }
00078 }
00079 
00080 
00082 // destructor: disconnect all data objects, and close window
00083 ACLVISDataConnect::~ACLVISDataConnect() {
00084   TAU_PROFILE("ACLVISDataConnect::~ACLVISDataConnect()", "void ()", TAU_VIZ);
00085 
00086   // disconnect any remaining data objects
00087   disconnectConnections();
00088 
00089   // delete the ACLVIS object
00090   if (Connection != 0)
00091     delete Connection;
00092 }
00093 
00094 
00096 // are we currently connected to a receiver?  The base-class default
00097 // behavior for this is to indicate that we're not connected.  Here, we
00098 // just say that we are connected.
00099 bool ACLVISDataConnect::connected() const {
00100   return true;
00101 }
00102 
00103 
00105 // allow all connections to perform an interactive action
00106 // For ACLVIS, since interact passes control on to the graphics window,
00107 // we only want to call interact for the first connected item, instead
00108 // of for all of them, since that one interact will affect all the connected
00109 // (well, displayed) elements.
00110 void ACLVISDataConnect::interact(const char *str, DataConnect *dc) {
00111   TAU_PROFILE("ACLVISDataConnect::interact()", "void (const char *)", TAU_VIZ);
00112 
00113   // just do interact for first connection
00114   if (size() > 0)
00115     (*(begin()))->interact(str, dc);
00116 }
00117 
00118 
00119 /***************************************************************************
00120  * $RCSfile: ACLVISDataConnect.cpp,v $   $Author: adelmann $
00121  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:24 $
00122  * IPPL_VERSION_ID: $Id: ACLVISDataConnect.cpp,v 1.1.1.1 2003/01/23 07:40:24 adelmann Exp $ 
00123  ***************************************************************************/

Generated on Fri Nov 2 01:25:55 2007 for IPPL by doxygen 1.3.5