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

src/DataSource/MakeDataSource.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/MakeDataSource.h"
00028 #include "DataSource/DataSourceObject.h"
00029 #include "DataSource/DataConnect.h"
00030 #include "Utility/Pstring.h"
00031 #include "Profile/Profiler.h"
00032 
00033 //
00034 // include the connection-method-specific class headers
00035 //
00036 
00037 // file connection method
00038 #include "DataSource/FileFieldDataSource.h"
00039 #include "DataSource/FilePtclBaseDataSource.h"
00040 #include "DataSource/FilePtclAttribDataSource.h"
00041 
00042 // aclvis connection method
00043 #ifdef IPPL_ACLVIS
00044 #include "DataSource/ACLVISFieldDataSource.h"
00045 #include "DataSource/ACLVISPtclBaseDataSource.h"
00046 #include "DataSource/ACLVISPtclAttribDataSource.h"
00047 #endif
00048 
00049 // paws connection method
00050 #ifdef IPPL_PAWS
00051 #include "IpplPaws/PawsFieldDataSource.h"
00052 #include "IpplPaws/PawsPtclAttribDataSource.h"
00053 #include "IpplPaws/PawsScalarDataSource.h"
00054 #include "IpplPaws/PawsStringDataSource.h"
00055 #endif
00056 
00057 
00059 // a version of make_DataSourceObject for Field's.
00060 // arguments: name, connection type, transfer metohd, Field
00061 template<class T, unsigned Dim, class M, class C>
00062 DataSourceObject *
00063 make_DataSourceObject(const char *nm, DataConnect *dc, int t,
00064                       Field<T,Dim,M,C>& F) {
00065   TAU_TYPE_STRING(taustr, "DataSourceObject * (char *, DataConnect *, " +
00066                   CT(F) + " )");
00067   TAU_PROFILE("make_DataSourceObject()", taustr, TAU_VIZ);
00068 
00069   // get the connection method name, and make a string out of it
00070   string method(dc->ID());
00071 
00072   // find what method it is, and make the appropriate DataSourceObject
00073   DataSourceObject *dso = 0;
00074   if (method == "aclvis") {
00075     // create a DataSourceObject for this Field which will connect to
00076     // the ACL visualization code
00077 #ifdef IPPL_ACLVIS
00078     dso = new ACLVISFieldDataSource<T,Dim,M,C>(nm, dc, t, F);
00079 #endif
00080 
00081   } else if (method == "paws") {
00082     // create a DataSourceObject for this Field which will connect to
00083     // another PAWS application
00084 #ifdef IPPL_PAWS
00085     dso = new PawsFieldDataSource<T,Dim,M,C>(nm, dc, t, F);
00086 #endif
00087 
00088   } else if (method == "file") {
00089     // create a DataSourceObject for this Field which will connect to a file
00090     dso = new FileFieldDataSource<T,Dim,M,C>(nm, dc, t, F);
00091   }
00092 
00093   // make a default connection is nothing has been found
00094   if (dso == 0)
00095     dso = new DataSourceObject;
00096 
00097   return dso;
00098 }
00099 
00100 
00102 // a version of make_DataSourceObject for ParticleAttrib's
00103 template<class T>
00104 DataSourceObject *
00105 make_DataSourceObject(const char *nm, DataConnect *dc, int t,
00106                       ParticleAttrib<T>& P) {
00107   TAU_TYPE_STRING(taustr, "DataSourceObject * (char *, DataConnect *, int, "
00108                   + CT(P) + " )");
00109   TAU_PROFILE("make_DataSourceObject()", taustr, TAU_VIZ);
00110 
00111   // get the connection method name, and make a string out of it
00112   string method(dc->ID());
00113 
00114   DataSourceObject *dso = 0;
00115   if (method == "aclvis") {
00116     // create a DataSourceObject for this ParticleAttrib which will connect to
00117     // the ACL visualization code
00118 #ifdef IPPL_ACLVIS
00119     dso = new ACLVISParticleAttribDataSource<T>(nm, dc, t, P);
00120 #endif
00121 
00122   } else if (method == "paws") {
00123     // create a DataSourceObject for this ParticleAttrib which will connect to
00124     // another PAWS application
00125 #ifdef IPPL_PAWS
00126     dso = new PawsParticleAttribDataSource<T>(nm, dc, t, P);
00127 #endif
00128 
00129   } else if (method == "file") {
00130     // create a DataSourceObject for this ParticleAttrib which will connect to
00131     // a file
00132     dso = new FileParticleAttribDataSource<T>(nm, dc, t, P);
00133   }
00134 
00135   // make a default connection is nothing has been found
00136   if (dso == 0)
00137     dso = new DataSourceObject;
00138 
00139   return dso;
00140 }
00141 
00142 
00144 // a version of make_DataSourceObject for ParticleBase's
00145 template<class PLayout>
00146 DataSourceObject *
00147 make_DataSourceObject(const char *nm, DataConnect *dc, int t,
00148                       ParticleBase<PLayout>& P) {
00149   TAU_TYPE_STRING(taustr, "DataSourceObject * (char *, DataConnect *, int, "
00150                   + CT(P) + " )");
00151   TAU_PROFILE("make_DataSourceObject()", taustr, TAU_VIZ);
00152 
00153   // get the connection method name, and make a string out of it
00154   string method(dc->ID());
00155 
00156   DataSourceObject *dso = 0;
00157   if (method == "aclvis") {
00158     // create a DataSourceObject for this ParticleBase which will connect to
00159     // the ACL visualization code
00160 #ifdef IPPL_ACLVIS
00161     dso = new ACLVISParticleBaseDataSource<PLayout>(nm, dc, t, P);
00162 #endif
00163 
00164   } else if (method == "paws") {
00165     // create a DataSourceObject for this ParticleAttrib which will connect to
00166     // another PAWS application
00167 
00168   } else if (method == "file") {
00169     // create a DataSourceObject for this FILE which will connect to
00170     // a file
00171     dso = new FileParticleBaseDataSource<PLayout>(nm, dc, t, P);
00172   }
00173 
00174   // make a default connection is nothing has been found
00175   if (dso == 0)
00176     dso = new DataSourceObject;
00177 
00178   return dso;
00179 }
00180 
00182 // a version of make_DataSourceObject for ScalarDataSource's
00183 template<class T>
00184 DataSourceObject *
00185 make_DataSourceObject(const char *nm, DataConnect *dc, int t,
00186                       ScalarDataSource<T>& S) {
00187   TAU_TYPE_STRING(taustr, "DataSourceObject * (char *, DataConnect *, int, "
00188                   + CT(S) + " )");
00189   TAU_PROFILE("make_DataSourceObject()", taustr, TAU_VIZ);
00190 
00191   // get the connection method name, and make a string out of it
00192   string method(dc->ID());
00193 
00194   DataSourceObject *dso = 0;
00195   if (method == "aclvis") {
00196     // create a DataSourceObject for this ParticleBase which will connect to
00197     // the ACL visualization code
00198 
00199   } else if (method == "paws") {
00200     // create a DataSourceObject for this ParticleAttrib which will connect to
00201     // another PAWS application
00202 #ifdef IPPL_PAWS
00203     dso = new PawsScalarDataSource<T>(nm, dc, t, S);
00204 #endif
00205   } else if (method == "file") {
00206     // create a DataSourceObject for this FILE which will connect to
00207     // a file
00208   }
00209 
00210   // make a default connection is nothing has been found
00211   if (dso == 0)
00212     dso = new DataSourceObject;
00213 
00214   return dso;
00215 }
00216 
00217 
00219 // a version of make_DataSourceObject for StringDataSource's
00220 template<class T>
00221 DataSourceObject *
00222 make_DataSourceObject(const char *nm, DataConnect *dc, int t,
00223                       StringDataSource<T>& S) {
00224   TAU_TYPE_STRING(taustr, "DataSourceObject * (char *, DataConnect *, int, "
00225                   + CT(S) + " )");
00226   TAU_PROFILE("make_DataSourceObject()", taustr, TAU_VIZ);
00227 
00228   // get the connection method name, and make a string out of it
00229   string method(dc->ID());
00230 
00231   DataSourceObject *dso = 0;
00232   if (method == "aclvis") {
00233     // create a DataSourceObject for this ParticleBase which will connect to
00234     // the ACL visualization code
00235 
00236   } else if (method == "paws") {
00237     // create a DataSourceObject for this ParticleAttrib which will connect to
00238     // another PAWS application
00239 #ifdef IPPL_PAWS
00240     dso = new PawsStringDataSource<T>(nm, dc, t, S);
00241 #endif
00242   } else if (method == "file") {
00243     // create a DataSourceObject for this FILE which will connect to
00244     // a file
00245   }
00246 
00247   // make a default connection is nothing has been found
00248   if (dso == 0)
00249     dso = new DataSourceObject;
00250 
00251   return dso;
00252 }
00253 
00254 /***************************************************************************
00255  * $RCSfile: MakeDataSource.cpp,v $   $Author: adelmann $
00256  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:25 $
00257  * IPPL_VERSION_ID: $Id: MakeDataSource.cpp,v 1.1.1.1 2003/01/23 07:40:25 adelmann Exp $ 
00258  ***************************************************************************/

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