OPAL (Object Oriented Parallel Accelerator Library)
2021.1.99
OPAL
src
ippl
src
DataSource
MakeDataSource.hpp
Go to the documentation of this file.
1
// -*- C++ -*-
2
/***************************************************************************
3
*
4
* The IPPL Framework
5
*
6
* This program was prepared by PSI.
7
* All rights in the program are reserved by PSI.
8
* Neither PSI nor the author(s)
9
* makes any warranty, express or implied, or assumes any liability or
10
* responsibility for the use of this software
11
*
12
* Visit www.amas.web.psi for more details
13
*
14
***************************************************************************/
15
16
// -*- C++ -*-
17
/***************************************************************************
18
*
19
* The IPPL Framework
20
*
21
*
22
* Visit http://people.web.psi.ch/adelmann/ for more details
23
*
24
***************************************************************************/
25
26
// include files
27
#include "
DataSource/MakeDataSource.h
"
28
#include "
DataSource/DataSourceObject.h
"
29
#include "
DataSource/DataConnect.h
"
30
31
//
32
// include the connection-method-specific class headers
33
//
34
35
// file connection method
36
#include "
DataSource/FileFieldDataSource.h
"
37
#include "
DataSource/FilePtclBaseDataSource.h
"
38
#include "
DataSource/FilePtclAttribDataSource.h
"
39
40
// forward declaration to avoid possible recursive inclusion
41
template
<
class
T,
unsigned
Dim,
class
M,
class
C>
42
class
FileFieldDataSource
;
43
template
<
class
T>
44
class
FileParticleAttribDataSource
;
45
template
<
class
T>
46
class
FileIpplParticleBaseDataSource
;
47
49
// a version of make_DataSourceObject for Field's.
50
// arguments: name, connection type, transfer method, Field
51
template
<
class
T,
unsigned
Dim,
class
M,
class
C>
52
DataSourceObject
*
53
make_DataSourceObject
(
const
char
*nm,
DataConnect
*dc,
int
t,
54
Field<T,Dim,M,C>
& F) {
55
56
// get the connection method name, and make a string out of it
57
std::string method(dc->
DSID
());
58
59
// find what method it is, and make the appropriate DataSourceObject
60
DataSourceObject
*dso = 0;
61
if
(method ==
"file"
) {
62
// create a DataSourceObject for this Field which will connect to a file
63
dso =
new
FileFieldDataSource<T,Dim,M,C>
(nm, dc, t, F);
64
}
65
66
// make a default connection is nothing has been found
67
if
(dso == 0)
68
dso =
new
DataSourceObject
;
69
70
return
dso;
71
}
72
73
75
// a version of make_DataSourceObject for ParticleAttrib's
76
template
<
class
T>
77
DataSourceObject
*
78
make_DataSourceObject
(
const
char
*nm,
DataConnect
*dc,
int
t,
79
ParticleAttrib<T>
& P) {
80
81
// get the connection method name, and make a string out of it
82
std::string method(dc->
DSID
());
83
84
DataSourceObject
*dso = 0;
85
if
(method ==
"file"
) {
86
// create a DataSourceObject for this ParticleAttrib which will connect to
87
// a file
88
dso =
new
FileParticleAttribDataSource<T>
(nm, dc, t, P);
89
}
90
91
// make a default connection is nothing has been found
92
if
(dso == 0)
93
dso =
new
DataSourceObject
;
94
95
return
dso;
96
}
97
98
100
// a version of make_DataSourceObject for IpplParticleBase's
101
template
<
class
PLayout>
102
DataSourceObject
*
103
make_DataSourceObject
(
const
char
*nm,
DataConnect
*dc,
int
t,
104
IpplParticleBase<PLayout>
& P) {
105
106
// get the connection method name, and make a string out of it
107
std::string method(dc->
DSID
());
108
109
DataSourceObject
*dso = 0;
110
if
(method ==
"file"
) {
111
// create a DataSourceObject for this FILE which will connect to
112
// a file
113
dso =
new
FileIpplParticleBaseDataSource<PLayout>
(nm, dc, t, P);
114
}
115
116
// make a default connection is nothing has been found
117
if
(dso == 0)
118
dso =
new
DataSourceObject
;
119
120
return
dso;
121
}
DataConnect.h
DataSourceObject.h
FileFieldDataSource.h
FilePtclAttribDataSource.h
FilePtclBaseDataSource.h
MakeDataSource.h
make_DataSourceObject
DataSourceObject * make_DataSourceObject(const char *nm, DataConnect *dc, int t, Field< T, Dim, M, C > &F)
Definition:
MakeDataSource.hpp:53
DataConnect
Definition:
DataConnect.h:32
DataConnect::DSID
const char * DSID() const
Definition:
DataConnect.h:55
DataSourceObject
Definition:
DataSourceObject.h:53
DataSourceObject::DataSourceObject
DataSourceObject()
Definition:
DataSourceObject.h:61
Field< T, Dim, M, C >
FileFieldDataSource
Definition:
FileFieldDataSource.h:31
FileParticleAttribDataSource
Definition:
FilePtclAttribDataSource.h:31
FileIpplParticleBaseDataSource
Definition:
FilePtclBaseDataSource.h:31
ParticleAttrib
Definition:
ParticleAttrib.h:100
IpplParticleBase
Definition:
IpplParticleBase.h:126
Generated on Wed Aug 25 2021 16:40:58 for OPAL (Object Oriented Parallel Accelerator Library) by
1.9.1