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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2881 - (show annotations)
Thu Jan 28 02:03:15 2010 UTC (9 years, 4 months ago) by jfenwick
File MIME type: text/plain
File size: 3469 byte(s)
Don't panic.
Updating copyright stamps

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 __NODEDATA_H__
15 #define __NODEDATA_H__
16
17 #include <escriptexport/escriptexport.h>
18
19 class DBfile;
20 class NcFile;
21 struct Finley_NodeFile;
22
23 namespace escriptexport {
24
25 /// \brief
26 class NodeData
27 {
28 public:
29 /// \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
37 /// \brief Copy constructor.
38 ESCRIPTEXPORT_DLL_API
39 NodeData(const NodeData& m);
40
41 /// \brief Virtual destructor
42 ESCRIPTEXPORT_DLL_API
43 virtual ~NodeData();
44
45 /// \brief Initialises with finley node file.
46 ESCRIPTEXPORT_DLL_API
47 bool initFromFinley(const Finley_NodeFile* finleyFile);
48
49 /// \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 std::string getName() const { return name; }
74
75 /// \brief Returns full Silo mesh name, e.g. "/block0000/Nodes".
76 ESCRIPTEXPORT_DLL_API
77 std::string getFullSiloName() const;
78
79 /// \brief Returns the node ID array.
80 ESCRIPTEXPORT_DLL_API
81 const IntVec& getNodeIDs() const { return nodeID; }
82
83 /// \brief Returns the coordinates of the mesh nodes.
84 ESCRIPTEXPORT_DLL_API
85 const CoordArray& getCoords() const { return coords; }
86
87 /// \brief Returns the dimensionality of this mesh (2 or 3).
88 ESCRIPTEXPORT_DLL_API
89 int getNumDims() const { return numDims; }
90
91 /// \brief Returns the number of mesh nodes.
92 ESCRIPTEXPORT_DLL_API
93 int getNumNodes() const { return numNodes; }
94
95 protected:
96 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 };
105
106
107 inline std::string NodeData::getFullSiloName() const
108 {
109 std::string result(siloPath);
110 if (result.length() == 0 || *result.rbegin() != '/')
111 result += '/';
112 result += name;
113 return result;
114 }
115
116 } // namespace escriptexport
117
118 #endif // __NODEDATA_H__
119

  ViewVC Help
Powered by ViewVC 1.1.26