/[escript]/trunk/dataexporter/src/NodeData.h
ViewVC logotype

Annotation of /trunk/dataexporter/src/NodeData.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2880 - (hide annotations)
Thu Jan 28 01:21:30 2010 UTC (9 years, 3 months ago) by caltinay
File MIME type: text/plain
File size: 3469 byte(s)
Better resolution for Hex27 & Rec9 data in dataexporter (mantis #486).
Saved Silo data resolution is now equal to finley.SaveVTK generated data in
all cases.

1 caltinay 2183
2     /*******************************************************
3     *
4 jfenwick 2548 * Copyright (c) 2003-2009 by University of Queensland
5 caltinay 2183 * 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 caltinay 2810 #ifndef __NODEDATA_H__
15     #define __NODEDATA_H__
16 caltinay 2183
17 caltinay 2810 #include <escriptexport/escriptexport.h>
18 caltinay 2183
19     class DBfile;
20 caltinay 2810 class NcFile;
21     struct Finley_NodeFile;
22 caltinay 2187
23 caltinay 2810 namespace escriptexport {
24 caltinay 2187
25 caltinay 2206 /// \brief
26 caltinay 2810 class NodeData
27 caltinay 2183 {
28     public:
29 caltinay 2810 /// \brief Constructor with mesh name.
30     ESCRIPTEXPORT_DLL_API
31     NodeData(const std::string& meshName);
32    
33     ESCRIPTEXPORT_DLL_API
34     NodeData(NodeData_ptr fullNodes, IntVec& requiredNodes,
35     const std::string& meshName);
36 caltinay 2183
37 caltinay 2206 /// \brief Copy constructor.
38 caltinay 2810 ESCRIPTEXPORT_DLL_API
39     NodeData(const NodeData& m);
40 caltinay 2183
41 caltinay 2206 /// \brief Virtual destructor
42 caltinay 2810 ESCRIPTEXPORT_DLL_API
43     virtual ~NodeData();
44 caltinay 2183
45 caltinay 2810 /// \brief Initialises with finley node file.
46     ESCRIPTEXPORT_DLL_API
47     bool initFromFinley(const Finley_NodeFile* finleyFile);
48 caltinay 2183
49 caltinay 2810 /// \brief Reads node data from a NetCDF file.
50     ESCRIPTEXPORT_DLL_API
51     bool readFromNc(NcFile* ncFile);
52    
53     /// \brief Writes node data to a Silo file.
54     ESCRIPTEXPORT_DLL_API
55     bool writeToSilo(DBfile* dbfile);
56    
57     /// \brief Sets the silo path to be used when saving.
58     ESCRIPTEXPORT_DLL_API
59     void setSiloPath(const std::string& path) { siloPath = path; }
60    
61     /// \brief Returns an array of nodal data by the given name.
62     ///
63     /// The name must be one of the names returned by getVarNames().
64     ESCRIPTEXPORT_DLL_API
65     const IntVec& getVarDataByName(const std::string& name) const;
66    
67     /// \brief Returns a vector with the mesh variable names.
68     ESCRIPTEXPORT_DLL_API
69     StringVec getVarNames() const;
70    
71     /// \brief Returns the name of this node mesh.
72     ESCRIPTEXPORT_DLL_API
73 caltinay 2183 std::string getName() const { return name; }
74    
75 caltinay 2810 /// \brief Returns full Silo mesh name, e.g. "/block0000/Nodes".
76     ESCRIPTEXPORT_DLL_API
77 caltinay 2183 std::string getFullSiloName() const;
78 caltinay 2810
79     /// \brief Returns the node ID array.
80     ESCRIPTEXPORT_DLL_API
81 caltinay 2183 const IntVec& getNodeIDs() const { return nodeID; }
82    
83 caltinay 2810 /// \brief Returns the coordinates of the mesh nodes.
84     ESCRIPTEXPORT_DLL_API
85 caltinay 2183 const CoordArray& getCoords() const { return coords; }
86 caltinay 2206
87     /// \brief Returns the dimensionality of this mesh (2 or 3).
88 caltinay 2810 ESCRIPTEXPORT_DLL_API
89 caltinay 2183 int getNumDims() const { return numDims; }
90 caltinay 2206
91     /// \brief Returns the number of mesh nodes.
92 caltinay 2810 ESCRIPTEXPORT_DLL_API
93 caltinay 2183 int getNumNodes() const { return numNodes; }
94    
95     protected:
96 caltinay 2810 CoordArray coords; /// x, y[, z] coordinates of nodes
97     int numDims; /// dimensionality (2 or 3)
98     int numNodes; /// number of nodes
99     IntVec nodeID; /// node IDs
100     IntVec nodeTag, nodeGDOF, nodeGNI, nodeGRDFI, nodeGRNI;
101     IntVec nodeDist; /// node distribution
102     std::string name; /// the name of this node mesh
103     std::string siloPath; /// the path to this mesh within the SILO file
104 caltinay 2183 };
105    
106    
107 caltinay 2810 inline std::string NodeData::getFullSiloName() const
108 caltinay 2183 {
109 caltinay 2810 std::string result(siloPath);
110     if (result.length() == 0 || *result.rbegin() != '/')
111     result += '/';
112     result += name;
113     return result;
114 caltinay 2183 }
115 caltinay 2187
116 caltinay 2810 } // namespace escriptexport
117 caltinay 2187
118 caltinay 2810 #endif // __NODEDATA_H__
119 caltinay 2183

  ViewVC Help
Powered by ViewVC 1.1.26