/[escript]/trunk/tools/libescriptreader/src/escriptreader/MPDataSet.h
ViewVC logotype

Contents of /trunk/tools/libescriptreader/src/escriptreader/MPDataSet.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2206 - (show annotations)
Fri Jan 9 03:50:29 2009 UTC (12 years, 5 months ago) by caltinay
File MIME type: text/plain
File size: 2781 byte(s)
Added some more doxygen docu to escriptreader classes.

1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2008 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 //
15 // MPDataSet.h
16 //
17 #ifndef __MPDATASET_H__
18 #define __MPDATASET_H__
19
20 #include <escriptreader/common.h>
21
22 class DBfile;
23
24 namespace EscriptReader {
25
26 class DataVar;
27 class MeshWithElements;
28
29 typedef std::vector<MeshWithElements*> MeshBlocks;
30
31 struct VarInfo {
32 std::string fileName;
33 std::string varName;
34 DataVar* dataVar;
35 bool valid;
36 };
37 typedef std::vector<VarInfo> VarVector;
38
39
40 /// \brief Represents an escript/finley dataset including mesh and variables for
41 /// one timestep. The domain may consist of multiple blocks.
42 class MPDataSet
43 {
44 public:
45 /// \brief Constructor.
46 MPDataSet();
47
48 /// \brief Destructor.
49 ~MPDataSet();
50
51 /// \brief Loads mesh and variables.
52 bool load(const std::string meshFile, const StringVec& varFiles,
53 const StringVec& varNames, int nBlocks);
54
55 /// \brief Loads only variables using given external mesh.
56 bool load(const MeshBlocks& m, const std::string siloFile,
57 const StringVec& varFiles, const StringVec& varNames);
58
59 /// \brief Saves the dataset to a Silo file.
60 bool saveAsSilo(const std::string siloFile, bool useMultiMesh=true);
61
62 /// \brief Returns the dataset's mesh.
63 ///
64 /// \note The caller is responsible for freeing the memory of the returned
65 /// mesh.
66 MeshBlocks extractMesh() { keepMesh = true; return meshBlocks; }
67
68 /// \brief Returns the dataset's mesh.
69 const MeshBlocks& getMesh() const { return meshBlocks; }
70
71 /// \brief Returns a vector with the dataset's variables.
72 const VarVector& getVariables() const { return variables; }
73
74 /// \brief Returns a vector with the mesh variables.
75 const VarVector& getMeshVariables() const { return meshVariables; }
76
77 private:
78 typedef std::vector<DataVar*> DataParts;
79
80 bool readMeshes();
81 bool readVariables();
82 void convertMeshVariables();
83 void assembleVariable(VarInfo& vi, const DataParts& parts);
84 void putSiloMultiMesh(DBfile* dbfile, std::string meshName);
85 void putSiloMultiTensor(DBfile* dbfile, const DataVar* var);
86 void putSiloMultiVar(DBfile* dbfile, std::string varName,
87 bool useMeshFile = false);
88
89 int numParts;
90 bool keepMesh;
91 std::string meshFmt;
92 std::string siloMeshFile;
93 MeshBlocks meshBlocks;
94 VarVector variables, meshVariables;
95 };
96
97 } // namespace EscriptReader
98
99 #endif // __MPDATASET_H__
100

  ViewVC Help
Powered by ViewVC 1.1.26