00001 // -*- C++ -*- 00002 /*************************************************************************** 00003 * 00004 * The IPPL Framework 00005 * 00006 * 00007 * Visit http://people.web.psi.ch/adelmann/ for more details 00008 * 00009 ***************************************************************************/ 00010 00011 #ifndef ACLVIS_PARTICLE_ATTRIB_DATA_SOURCE_H 00012 #define ACLVIS_PARTICLE_ATTRIB_DATA_SOURCE_H 00013 00014 /*********************************************************************** 00015 * 00016 * class ACLVISParticleAttribDataSource 00017 * 00018 * ACLVISParticleAttribDataSource is a specific version of 00019 * ParticleAttribDataSource which takes the data for a given ParticleAttrib 00020 * and formats it properly for connection to the ACL visualization code, 00021 * which uses the VTK toolkit. The initial version 00022 * collects all the data onto node 0, and then formats it for VTK use. 00023 * Future versions will properly redistribute the data based on 00024 * the needs of the recipient. 00025 * 00026 ***********************************************************************/ 00027 00028 // include files 00029 #include "DataSource/PtclAttribDataSource.h" 00030 00031 00032 // forward declarations 00033 template<class T> class ParticleAttrib; 00034 class ReadParticleTool; 00035 00036 00037 template<class T> 00038 class ACLVISParticleAttribDataSource : public ParticleAttribDataSource { 00039 00040 public: 00041 // constructor: the name, the connection, the transfer method, the attrib 00042 ACLVISParticleAttribDataSource(const char *, DataConnect *, int, 00043 ParticleAttrib<T>&); 00044 00045 // destructor 00046 virtual ~ACLVISParticleAttribDataSource(); 00047 00048 // 00049 // DataSourceObject virtual function interface. 00050 // 00051 00052 // Update the object, that is, make sure the receiver of the data has a 00053 // current and consistent snapshot of the current state. Return success. 00054 virtual bool update(); 00055 00056 // Indicate to the receiver that we're allowing them time to manipulate the 00057 // data (e.g., for a viz program, to rotate it, change representation, etc.) 00058 // This should only return when the manipulation is done. 00059 virtual void interact(const char * = 0); 00060 00061 // 00062 // ParticleAttribDataSource virtual function interface. 00063 // 00064 00065 // retrieve the agency-specific data structure 00066 virtual void *getConnectStorage() { return (void *)LocalData; } 00067 00068 // copy attrib data on the local processor into the given Message. 00069 virtual void putMessage(Message *); 00070 00071 // prepare the agency-specific data structures for update; this may 00072 // require reallocation of storage memory, etc. 00073 // Argument = are we at the start (true) or end (false) of the data update; 00074 // # of particles to prepare for. 00075 virtual void prepare_data(bool, unsigned); 00076 00077 // take data for N particles out of the given message, and put it 00078 // into the proper agency-specific structure. 00079 // If the Message pointer is 0, put in the locally-stored particles. 00080 // Arguments: num particles, 00081 // starting index for inserted particles, Message containing 00082 // particles 00083 virtual void insert_data(unsigned, unsigned, Message *); 00084 00085 private: 00086 // the particle attrib object 00087 ParticleAttrib<T>& MyParticles; 00088 00089 // our ACLVIS data structure 00090 ReadParticleTool *LocalData; 00091 }; 00092 00093 #include "DataSource/ACLVISPtclAttribDataSource.cpp" 00094 00095 #endif // ACLVIS_PARTICLE_ATTRIB_DATA_SOURCE_H 00096 00097 /*************************************************************************** 00098 * $RCSfile: ACLVISPtclAttribDataSource.h,v $ $Author: adelmann $ 00099 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:24 $ 00100 * IPPL_VERSION_ID: $Id: ACLVISPtclAttribDataSource.h,v 1.1.1.1 2003/01/23 07:40:24 adelmann Exp $ 00101 ***************************************************************************/