OSHUN  beta
Arbitrary Order Spherical-Harmonic 1D-3P Vlasov-Fokker-Planck-Maxwell code
Export_Files Namespace Reference

Namespaces

 ofconventions
 

Data Structures

class  DefaultTags
 
class  Header
 
class  oAxis
 
class  Restart_Facility
 
class  Xport
 

Functions

template<typename T >
std::string stringify (T const &x)
 
int Makefolder (string _name)
 
void Folders ()
 
template<class T >
ofstream & operator<< (ofstream &s, const vector< T > &v)
 
template<class T >
ofstream & operator<< (ofstream &s, const valarray< T > &v)
 
template<class T >
ofstream & operator<< (ofstream &s, const Array2D< T > &array2D)
 
template<class T >
ofstream & operator<< (ofstream &s, const Array3D< T > &array3D)
 

Function Documentation

◆ Folders()

void Export_Files::Folders ( )

Definition at line 74 of file export.cpp.

References Input::List(), and Makefolder().

Referenced by main(), and stringify().

74  {
75 //--------------------------------------------------------------
76 // create the directory tree
77 //--------------------------------------------------------------
78 
79  if (Makefolder("RESTART") != 0) cout << "Warning: Folder 'RESTART' exists" << endl;
80 
81  if (Makefolder("OUTPUT") != 0) cout << "Warning: Folder 'OUTPUT' exists" << endl;
82 
83  if ( Input::List().o_EHist ) {
84  if ( Makefolder("OUTPUT/NUM") != 0) cout << "Warning: Folder 'OUTPUT/NUM' exists" << endl;
85  }
86 
87  if ( Input::List().o_Ex || Input::List().o_Ey || Input::List().o_Ez ||
88  Input::List().o_Bx || Input::List().o_By || Input::List().o_Bz ) {
89  if (Makefolder("OUTPUT/FLD") != 0)
90  cout<<"Warning: Folder 'OUTPUT/FLD' exists" << endl;
91 
92  if (Input::List().o_Ex) {
93  if (Makefolder("OUTPUT/FLD/Ex") != 0)
94  cout<<"Warning: Folder 'OUTPUT/FLD/EX' exists" << endl;
95  }
96  if (Input::List().o_Ey) {
97  if (Makefolder("OUTPUT/FLD/Ey") != 0)
98  cout<<"Warning: Folder 'OUTPUT/FLD/EY' exists" << endl;
99  }
100  if (Input::List().o_Ez) {
101  if (Makefolder("OUTPUT/FLD/Ez") != 0)
102  cout<<"Warning: Folder 'OUTPUT/FLD/EZ' exists" << endl;
103  }
104  if (Input::List().o_Bx) {
105  if (Makefolder("OUTPUT/FLD/Bx") != 0)
106  cout<<"Warning: Folder 'OUTPUT/FLD/BX' exists" << endl;
107  }
108  if (Input::List().o_By) {
109  if (Makefolder("OUTPUT/FLD/By") != 0)
110  cout<<"Warning: Folder 'OUTPUT/FLD/BY' exists" << endl;
111  }
112  if (Input::List().o_Bz) {
113  if (Makefolder("OUTPUT/FLD/Bz") != 0)
114  cout<<"Warning: Folder 'OUTPUT/FLD/BZ' exists" << endl;
115  }
116  }
117 
118  if ( Input::List().o_x1x2 || Input::List().o_pth ||
119  Input::List().o_G ||
120  Input::List().o_Px || Input::List().o_PxPx ||
121  Input::List().o_Py || Input::List().o_PxPy || Input::List().o_PyPy ||
122  Input::List().o_Pz || Input::List().o_PxPz || Input::List().o_PyPz || Input::List().o_PzPz ||
123  Input::List().o_Vx || Input::List().o_VxVx ||
124  Input::List().o_Vy || Input::List().o_VxVy || Input::List().o_VyVy ||
125  Input::List().o_VxVz || Input::List().o_VyVz || Input::List().o_VzVz ||
126  Input::List().o_Vsq || Input::List().o_Temperature || Input::List().o_Pressure ||
127  Input::List().o_Qx || Input::List().o_Qy || Input::List().o_Qz ||
128  Input::List().o_p1x1 ) {
129 
130  if (Makefolder("OUTPUT/MOM") != 0)
131  cout<<"Warning: Folder 'OUTPUT/MOM' exists" << endl;
132 
133 // Relativistic Energy - Momentum Tensor
134 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
135  if (Input::List().o_x1x2) {
136  if (Makefolder("OUTPUT/MOM/n") != 0)
137  cout<<"Warning: Folder 'OUTPUT/MOM/N' exists" << endl;
138  }
139  if (Input::List().o_pth) {
140  if (Makefolder("OUTPUT/MOM/Pth") != 0)
141  cout<<"Warning: Folder 'OUTPUT/MOM/Pth' exists" << endl;
142  }
143  if (Input::List().o_G) {
144  if (Makefolder("OUTPUT/MOM/Gam") != 0)
145  cout<<"Warning: Folder 'OUTPUT/MOM/Gam' exists" << endl;
146  }
147  if (Input::List().o_Px) {
148  if (Makefolder("OUTPUT/MOM/Px") != 0)
149  cout<<"Warning: Folder 'OUTPUT/MOM/Px' exists" << endl;
150  }
151  if (Input::List().o_PxPx) {
152  if (Makefolder("OUTPUT/MOM/PxPx") != 0)
153  cout<<"Warning: Folder 'OUTPUT/MOM/PxPx' exists" << endl;
154  }
155  if (Input::List().o_Py) {
156  if (Makefolder("OUTPUT/MOM/Py") != 0)
157  cout<<"Warning: Folder 'OUTPUT/MOM/Py' exists" << endl;
158  }
159  if (Input::List().o_PxPy) {
160  if (Makefolder("OUTPUT/MOM/PxPy") != 0)
161  cout<<"Warning: Folder 'OUTPUT/MOM/PxPy' exists" << endl;
162  }
163  if (Input::List().o_PyPy) {
164  if (Makefolder("OUTPUT/MOM/PyPy") != 0)
165  cout<<"Warning: Folder 'OUTPUT/MOM/PyPy' exists" << endl;
166  }
167  if (Input::List().o_Pz) {
168  if (Makefolder("OUTPUT/MOM/Pz") != 0)
169  cout<<"Warning: Folder 'OUTPUT/MOM/Pz' exists" << endl;
170  }
171  if (Input::List().o_PxPz) {
172  if (Makefolder("OUTPUT/MOM/PxPz") != 0)
173  cout<<"Warning: Folder 'OUTPUT/MOM/PxPz' exists" << endl;
174  }
175  if (Input::List().o_PyPz) {
176  if (Makefolder("OUTPUT/MOM/PyPz") != 0)
177  cout<<"Warning: Folder 'OUTPUT/MOM/PyPz' exists" << endl;
178  }
179  if (Input::List().o_PzPz) {
180  if (Makefolder("OUTPUT/MOM/PzPz") != 0)
181  cout<<"Warning: Folder 'OUTPUT/MOM/PzPz' exists" << endl;
182  }
183 
184 // Current
185 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
186  if (Input::List().o_Jx) {
187  if (Makefolder("OUTPUT/MOM/Jx") != 0)
188  cout<<"Warning: Folder 'OUTPUT/MOM/Jx' exists" << endl;
189  }
190  if (Input::List().o_Jy) {
191  if (Makefolder("OUTPUT/MOM/Jy") != 0)
192  cout<<"Warning: Folder 'OUTPUT/MOM/Jy' exists" << endl;
193  }
194  if (Input::List().o_Jz) {
195  if (Makefolder("OUTPUT/MOM/Jz") != 0)
196  cout<<"Warning: Folder 'OUTPUT/MOM/Jz' exists" << endl;
197  }
198 
199 
200 // Nonrelativistic output
201 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
202  if (Input::List().o_Vx) {
203  if (Makefolder("OUTPUT/MOM/Vx") != 0)
204  cout<<"Warning: Folder 'OUTPUT/MOM/Vx' exists" << endl;
205  }
206  if (Input::List().o_VxVx) {
207  if (Makefolder("OUTPUT/MOM/VxVx") != 0)
208  cout<<"Warning: Folder 'OUTPUT/MOM/VxVx' exists" << endl;
209  }
210  if (Input::List().o_Vy) {
211  if (Makefolder("OUTPUT/MOM/Vy") != 0)
212  cout<<"Warning: Folder 'OUTPUT/MOM/Vy' exists" << endl;
213  }
214  if (Input::List().o_VxVy) {
215  if (Makefolder("OUTPUT/MOM/VxVy") != 0)
216  cout<<"Warning: Folder 'OUTPUT/MOM/VxVy' exists" << endl;
217  }
218  if (Input::List().o_VyVy) {
219  if (Makefolder("OUTPUT/MOM/VyVy") != 0)
220  cout<<"Warning: Folder 'OUTPUT/MOM/VyVy' exists" << endl;
221  }
222  if (Input::List().o_VxVz) {
223  if (Makefolder("OUTPUT/MOM/VxVz") != 0)
224  cout<<"Warning: Folder 'OUTPUT/MOM/VxVz' exists" << endl;
225  }
226  if (Input::List().o_VyVz) {
227  if (Makefolder("OUTPUT/MOM/VyVz") != 0)
228  cout<<"Warning: Folder 'OUTPUT/MOM/VyVz' exists" << endl;
229  }
230  if (Input::List().o_VzVz) {
231  if (Makefolder("OUTPUT/MOM/VzVz") != 0)
232  cout<<"Warning: Folder 'OUTPUT/MOM/VzVz' exists" << endl;
233  }
234  if (Input::List().o_Vsq) {
235  if (Makefolder("OUTPUT/MOM/Vsq") != 0)
236  cout<<"Warning: Folder 'OUTPUT/MOM/Vsq' exists" << endl;
237  }
238  if (Input::List().o_Temperature) {
239 // if (Makefolder("OUTPUT/MOM/T_eV") != 0)
240 // cout<<"Warning: Folder 'OUTPUT/MOM/T_eV' exists" << endl;
241  if (Makefolder("OUTPUT/MOM/T") != 0)
242  cout<<"Warning: Folder 'OUTPUT/MOM/T' exists" << endl;
243  }
244  if (Input::List().o_Pressure) {
245  if (Makefolder("OUTPUT/MOM/P_Mbar") != 0)
246  cout<<"Warning: Folder 'OUTPUT/MOM/P_Mbar' exists" << endl;
247  }
248  if (Input::List().o_ND) {
249  if (Makefolder("OUTPUT/MOM/ND") != 0)
250  cout<<"Warning: Folder 'OUTPUT/MOM/ND' exists" << endl;
251  }
252  if (Input::List().o_Nu) {
253  if (Makefolder("OUTPUT/MOM/Nu") != 0)
254  cout<<"Warning: Folder 'OUTPUT/MOM/Nu' exists" << endl;
255  }
256  if (Input::List().o_Qx) {
257  if (Makefolder("OUTPUT/MOM/Qx") != 0)
258  cout<<"Warning: Folder 'OUTPUT/MOM/Qx' exists" << endl;
259  }
260  if (Input::List().o_Qy) {
261  if (Makefolder("OUTPUT/MOM/Qy") != 0)
262  cout<<"Warning: Folder 'OUTPUT/MOM/Qy' exists" << endl;
263  }
264  if (Input::List().o_Qz) {
265  if (Makefolder("OUTPUT/MOM/Qz") != 0)
266  cout<<"Warning: Folder 'OUTPUT/MOM/Qz' exists" << endl;
267  }
268  if (Input::List().o_vNx) {
269  if (Makefolder("OUTPUT/MOM/vNx") != 0)
270  cout<<"Warning: Folder 'OUTPUT/MOM/vNx' exists" << endl;
271  }
272  if (Input::List().o_vNy) {
273  if (Makefolder("OUTPUT/MOM/vNy") != 0)
274  cout<<"Warning: Folder 'OUTPUT/MOM/vNy' exists" << endl;
275  }
276  if (Input::List().o_vNz) {
277  if (Makefolder("OUTPUT/MOM/vNz") != 0)
278  cout<<"Warning: Folder 'OUTPUT/MOM/vNz' exists" << endl;
279  }
280  if (Input::List().o_Ux) {
281  if (Makefolder("OUTPUT/MOM/Ux") != 0)
282  cout<<"Warning: Folder 'OUTPUT/MOM/Ux' exists" << endl;
283  }
284  if (Input::List().o_Uy) {
285  if (Makefolder("OUTPUT/MOM/Uy") != 0)
286  cout<<"Warning: Folder 'OUTPUT/MOM/Uy' exists" << endl;
287  }
288  if (Input::List().o_Uz) {
289  if (Makefolder("OUTPUT/MOM/Uz") != 0)
290  cout<<"Warning: Folder 'OUTPUT/MOM/Ux' exists" << endl;
291  }
292  if (Input::List().o_Z) {
293  if (Makefolder("OUTPUT/MOM/Z") != 0)
294  cout<<"Warning: Folder 'OUTPUT/MOM/Z' exists" << endl;
295  }
296  if (Input::List().o_ni) {
297  if (Makefolder("OUTPUT/MOM/ni") != 0)
298  cout<<"Warning: Folder 'OUTPUT/MOM/ni' exists" << endl;
299  }
300  if (Input::List().o_Ti) {
301  if (Makefolder("OUTPUT/MOM/Ti") != 0)
302  cout<<"Warning: Folder 'OUTPUT/MOM/Ti' exists" << endl;
303  }
304 //><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><
305 // TWO STREAM STUFF
306 //><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><
307 // if (Input::List().o_p1x1) {
308 // if (Makefolder("OUTPUT/MOM/p1x1") != 0)
309 // cout<<"Warning: Folder 'OUTPUT/MOM/p1x1' exists\n";
310 // }
311 //><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><
312 
313  }
314 
315  if ( Input::List().o_f0x1 || Input::List().o_p1x1
316  || Input::List().o_f10x1 || Input::List().o_f11x1 || Input::List().o_f20x1
317  || Input::List().o_fl0x1) {
318  if (Makefolder("OUTPUT/DISTR") != 0)
319  cout<<"Warning: Folder 'OUTPUT/DISTR' exists" << endl;
320 
321  }
322 
323 
324 }
int Makefolder(string _name)
Definition: export.cpp:51
Input_List & List()
Definition: input.cpp:1585
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Makefolder()

int Export_Files::Makefolder ( string  _name)

Definition at line 51 of file export.cpp.

Referenced by Folders(), Export_Files::Restart_Facility::Restart_Facility(), stringify(), and Export_Files::Xport::Xport().

51  {
52 
53  mode_t _permissions(S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
54  // char* foldername = new char [_name.length() + 1];
55 
56 
57  const char* foldername = _name.data();
58 
59 
60  // strcpy(foldername, _name.c_str());
61 
62  // vector<char> foldername(_name.c_str(), _name.c_str() + _name.size() + 1);
63 
64  int status(mkdir(foldername,_permissions));
65 
66  // if (status != 0) cout << "Warning: Folder "<< _name<< " exists\n";
67 
68  // delete[] foldername;
69 
70  return status;
71 }
Here is the caller graph for this function:

◆ operator<<() [1/4]

template<class T >
ofstream& Export_Files::operator<< ( ofstream &  s,
const vector< T > &  v 
)

Definition at line 62 of file export.h.

References Export_Files::ofconventions::ofile_precision.

62  {
63  s << setprecision(ofconventions::ofile_precision);
64  s << 1 <<"\n";
65  s << v.size()<<"\n";
66  for (size_t i(0); i < v.size(); ++i) {
67  s << v[i]<<"\n";
68  }
69  return s;
70  }
const int ofile_precision
Definition: export.h:19

◆ operator<<() [2/4]

template<class T >
ofstream& Export_Files::operator<< ( ofstream &  s,
const valarray< T > &  v 
)

Definition at line 73 of file export.h.

References Export_Files::ofconventions::ofile_precision.

73  {
74  s << setprecision(ofconventions::ofile_precision);
75  s << 1 <<"\n";
76  s << v.size()<<"\n";
77  for (size_t i(0); i < v.size(); ++i) {
78  s << v[i]<<"\n";
79  }
80  return s;
81  }
const int ofile_precision
Definition: export.h:19

◆ operator<<() [3/4]

template<class T >
ofstream& Export_Files::operator<< ( ofstream &  s,
const Array2D< T > &  array2D 
)

Definition at line 84 of file export.h.

References Export_Files::ofconventions::ofile_precision.

84  {
85  s << setprecision(ofconventions::ofile_precision);
86  s << 2 <<"\n";
87  s << array2D.dim1()<<"\n";
88  s << array2D.dim2()<<"\n";
89  for (size_t i(0); i < array2D.dim(); ++i) {
90  s << array2D(i)<<"\n";
91  }
92  return s;
93  }
size_t dim() const
Definition: lib-array.h:288
const int ofile_precision
Definition: export.h:19
size_t dim1() const
Definition: lib-array.h:289
size_t dim2() const
Definition: lib-array.h:290

◆ operator<<() [4/4]

template<class T >
ofstream& Export_Files::operator<< ( ofstream &  s,
const Array3D< T > &  array3D 
)

Definition at line 96 of file export.h.

References Export_Files::ofconventions::ofile_precision.

96  {
97  s << setprecision(ofconventions::ofile_precision);
98  s << 3 <<"\n";
99  s << array3D.dim1()<<"\n";
100  s << array3D.dim2()<<"\n";
101  s << array3D.dim3()<<"\n";
102  for (size_t i(0); i < array3D.dim(); ++i) {
103  s << array3D(i)<<"\n";
104  }
105  return s;
106  }
size_t dim() const
Definition: lib-array.h:1052
const int ofile_precision
Definition: export.h:19
size_t dim3() const
Definition: lib-array.h:1055
size_t dim2() const
Definition: lib-array.h:1054
size_t dim1() const
Definition: lib-array.h:1053

◆ stringify()

template<typename T >
std::string Export_Files::stringify ( T const &  x)
inline

Definition at line 30 of file export.h.

References Folders(), and Makefolder().

Referenced by Export_Files::Xport::oH5Fextension(), Export_Files::Restart_Facility::rFextension(), and Export_Files::Xport::Xport().

30  {
31  std::ostringstream out;
32  out << x;
33  return out.str();
34  }
Here is the call graph for this function:
Here is the caller graph for this function: