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 FIELD_DATA_SOURCE_H 00012 #define FIELD_DATA_SOURCE_H 00013 00014 /*********************************************************************** 00015 * 00016 * class FieldDataSource 00017 * 00018 * FieldDataSource is a specific version of DataSourceObject which takes 00019 * the data for a given Field and formats it properly for use by other 00020 * agencies. This initial version collects all the data onto a parent node 00021 * and then formats it for the desired agency. This is done by calling a 00022 * virtual method 'insert_data' for each LField worth of data collected onto 00023 * the master node. Future versions will properly redistribute the data 00024 * based on the needs of the recipient. 00025 * 00026 * Subclasses must provide versions of the DataSourceObject virtual functions, 00027 * as well as the insert_data virtual function. 00028 * 00029 * This is a rewrite of some sections of FieldView. 00030 * 00031 ***********************************************************************/ 00032 00033 // include files 00034 #include "DataSource/DataSourceObject.h" 00035 00036 00037 // forward declarations 00038 template<class T, unsigned Dim, class Mesh, class Centering> class Field; 00039 template<class T, unsigned Dim> class CompressedBrickIterator; 00040 template<unsigned Dim> class NDIndex; 00041 00042 00043 template<class T, unsigned Dim, class M, class C> 00044 class FieldDataSource : public DataSourceObject { 00045 00046 public: 00047 // constructor: the name, the connection, the transfer method, 00048 // the field to connect, and the parent node 00049 FieldDataSource(const char *, DataConnect *, int, Field<T,Dim,M,C>&); 00050 00051 // destructor 00052 virtual ~FieldDataSource(); 00053 00054 protected: 00055 // the field to connect 00056 Field<T,Dim,M,C>& MyField; 00057 00058 // the function which performs the work to gather data onto one node 00059 void gather_data(); 00060 00061 // copy the data out of the given LField iterator (which is occupying the 00062 // given domain) and into the library-specific structure 00063 virtual void insert_data(const NDIndex<Dim>&, 00064 CompressedBrickIterator<T,Dim>) = 0; 00065 }; 00066 00067 #include "DataSource/FieldDataSource.cpp" 00068 00069 #endif // FIELD_DATA_SOURCE_H 00070 00071 /*************************************************************************** 00072 * $RCSfile: FieldDataSource.h,v $ $Author: adelmann $ 00073 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:25 $ 00074 * IPPL_VERSION_ID: $Id: FieldDataSource.h,v 1.1.1.1 2003/01/23 07:40:25 adelmann Exp $ 00075 ***************************************************************************/