/[escript]/trunk/weipa/src/FileWriter.h
ViewVC logotype

Contents of /trunk/weipa/src/FileWriter.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3107 - (show annotations)
Thu Aug 26 03:41:28 2010 UTC (9 years, 1 month ago) by caltinay
File MIME type: text/plain
File size: 992 byte(s)
Removed ugly #defines in favour of a class.

1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2010 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
8 * Primary Business: Queensland, Australia
9 * Licensed under the Open Software License version 3.0
10 * http://www.opensource.org/licenses/osl-3.0.php
11 *
12 *******************************************************/
13
14 #ifndef __WEIPAFILEWRITER_H__
15 #define __WEIPAFILEWRITER_H__
16
17 #include <weipa/weipa.h>
18
19 #include <fstream>
20
21 namespace weipa {
22
23 class FileWriter
24 {
25 public:
26 FileWriter();
27
28 #if HAVE_MPI
29 FileWriter(MPI_Comm comm);
30 #endif
31
32 bool openFile(std::string filename);
33 bool writeOrdered(std::ostringstream& oss);
34 bool writeShared(std::ostringstream& oss);
35 void close();
36
37 private:
38 int mpiRank, mpiSize;
39 #if HAVE_MPI
40 MPI_Comm mpiComm;
41 MPI_File fileHandle;
42 #else
43 void* mpiComm;
44 #endif
45 std::ofstream ofs;
46 };
47
48 } // namespace weipa
49
50 #endif // __WEIPAFILEWRITER_H__
51

  ViewVC Help
Powered by ViewVC 1.1.26