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

Annotation of /trunk/tools/libescriptreader/src/escriptreader/Mesh.h

Parent Directory Parent Directory | Revision Log Revision Log


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

1 caltinay 2183
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     // Mesh.h
16     //
17     #ifndef __MESH_H__
18     #define __MESH_H__
19    
20     #include <escriptreader/common.h>
21    
22     class DBfile;
23 caltinay 2187
24     namespace EscriptReader {
25    
26 caltinay 2183 class ElementData;
27    
28 caltinay 2206 /// \brief
29 caltinay 2183 class Mesh
30     {
31     public:
32 caltinay 2206 /// \brief Constructor with mesh coordinates, dimensionality and size.
33 caltinay 2183 Mesh(CoordArray c, int nDims, int nNodes);
34    
35 caltinay 2206 /// \brief Copy constructor.
36 caltinay 2183 Mesh(const Mesh& m);
37    
38 caltinay 2206 /// \brief Virtual destructor
39 caltinay 2183 virtual ~Mesh();
40    
41     virtual bool readFromNc(const std::string& ncFile);
42     virtual bool writeToSilo(DBfile* dbfile, const std::string& pathInSilo);
43    
44     void setName(const std::string& n) { name = n; }
45     std::string getName() const { return name; }
46    
47     void setSiloPath(const std::string& p) { siloPath = p; }
48     std::string getSiloPath() const { return siloPath; }
49    
50 caltinay 2206 /// \brief Returns full Silo mesh name, e.g. "/block0000/Elements".
51 caltinay 2183 std::string getFullSiloName() const;
52    
53     const IntVec& getNodeIDs() const { return nodeID; }
54     void setNodeIDs(const IntVec& ids) { nodeID = ids; }
55    
56     const IndexMap& getIndexMap() const { return nodeID2idx; }
57     void setIndexMap(const IndexMap& map) { nodeID2idx = map; }
58    
59 caltinay 2206 /// \brief Returns an array with the coordinates of the mesh nodes.
60 caltinay 2183 const CoordArray& getCoords() const { return coords; }
61 caltinay 2206
62     /// \brief Returns the dimensionality of this mesh (2 or 3).
63 caltinay 2183 int getNumDims() const { return numDims; }
64 caltinay 2206
65     /// \brief Returns the number of mesh nodes.
66 caltinay 2183 int getNumNodes() const { return numNodes; }
67    
68     protected:
69 caltinay 2206 /// \brief Protected default constructor.
70 caltinay 2183 Mesh() {}
71    
72     void buildIndexMap();
73    
74 caltinay 2206 CoordArray coords; /// x, y[, z] coordinates of mesh nodes
75     int numDims; /// dimensionality of mesh (2 or 3)
76     int numNodes; /// number of mesh nodes
77     IntVec nodeID; /// node IDs
78     IndexMap nodeID2idx; /// mapping of node ID -> array index
79     std::string name; /// the name of this mesh
80     std::string siloPath; /// absolute path in Silo file
81 caltinay 2183 };
82    
83    
84     inline void Mesh::buildIndexMap()
85     {
86     nodeID2idx.clear();
87     int idx = 0;
88     IntVec::const_iterator idIt;
89     for (idIt = nodeID.begin(); idIt != nodeID.end(); idIt++, idx++)
90     nodeID2idx[*idIt] = idx;
91     }
92    
93     inline std::string Mesh::getFullSiloName() const
94     {
95     if (siloPath == "/")
96     return siloPath + name;
97     else
98     return siloPath + std::string("/") + name;
99     }
100 caltinay 2187
101     } // namespace EscriptReader
102    
103 caltinay 2183 #endif // __MESH_H__
104    

  ViewVC Help
Powered by ViewVC 1.1.26