Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Examples  

ExodusMeshReader.h

Go to the documentation of this file.
00001 #ifndef EXODUSMESHREADER_H
00002 #define EXODUSMESHREADER_H
00003 
00004 #include "SundanceDefs.h"
00005 
00006 #include "MeshReader.h"
00007 
00008 #include "Expr.h"
00009 
00010 
00011 namespace Sundance
00012 {
00013 
00014   using namespace TSF;
00015   using std::string;
00016 
00017   using std::ostream;
00018 
00019   /** \ingroup UserLevelGeometry
00020    * Reads a 2D or 3D mesh stored in the Exodus file format.
00021    */
00022 
00023   class ExodusMeshReader : public MeshReaderBase
00024     {
00025     public:
00026       /** Construct an ExodusMeshReader for reading from a given file */
00027       ExodusMeshReader(const string& filename)
00028         : filename_(filename),
00029         hasMesh_(false),
00030         hasNodalNames_(false),
00031         hasElementalNames_(false),
00032         nodalVarNames_(1),
00033         elementalVarNames_(1)
00034         {;}
00035 
00036       /** read a mesh from the reader's file */
00037       virtual Mesh getMesh() const ;
00038 
00039       /** read in a list of Nodal Field by index */
00040       Expr getNodalField(const TSFArray<int>& attributeIndices, int timeStep = 1);
00041       /** read in a single Nodal Field by index */
00042       Expr getNodalField(const int attributeIndex, int timeStep = 1)
00043         {
00044           TSFArray<int> attributeIndices(1);
00045           attributeIndices[0] = attributeIndex;
00046           return getNodalField(attributeIndices, timeStep);
00047         }
00048 
00049       /** read in a list of elemental Fields by index */
00050       Expr getElementalField(const TSFArray<int>& attributeIndices, int timeStep = 1);
00051       /** read in a single elemental Field by index */
00052       Expr getElementalField(const int attributeIndex, int timeStep = 1)
00053         {
00054           TSFArray<int> attributeIndices(1);
00055           attributeIndices[0] = attributeIndex;
00056           return getElementalField(attributeIndices, timeStep);
00057         }
00058 
00059       /** read in a list of nodal Fields by name */
00060       Expr getNodalField(const TSFArray<string>& attributeNames, int timeStep = 1);
00061       /** read in a single nodal Field by name */
00062       Expr getNodalField(const string attributeName, int timeStep = 1)
00063         {
00064           TSFArray<string> attributeNames(1);
00065           attributeNames[0] = attributeName;
00066           return getNodalField(attributeNames, timeStep);
00067         }
00068 
00069       /** read in a list of elemental Fields by name */
00070       Expr getElementalField(const TSFArray<string>& attributeNames, int timeStep = 1);
00071       /** read in a single elemental Field by name */
00072       Expr getElementalField(const string attributeName, int timeStep = 1)
00073         {
00074           TSFArray<string> attributeNames(1);
00075           attributeNames[0] = attributeName;
00076           return getElementalField(attributeNames, timeStep);
00077         }
00078 
00079       TSFArray<string>& getNodalVarNames();
00080       TSFArray<string>& getElementalVarNames();
00081     private:
00082 
00083       TSFArray<TSFArray<double> > readNodalField(const TSFArray<int>& attributeIndices, int timeStep = 1);
00084 
00085       TSFArray<TSFArray<double> > readElementalField(const TSFArray<int>& attributeIndices, int timeStep = 1);
00086 
00087 
00088       static const int CPUWORDSIZE;
00089       static const int IOWORDSIZE;
00090 
00091       string filename_;
00092       mutable Mesh mesh_;
00093 
00094       mutable bool hasMesh_;
00095       bool hasNodalNames_;
00096       bool hasElementalNames_;
00097       TSFArray<string> nodalVarNames_;
00098       TSFArray<string> elementalVarNames_;
00099 
00100     };
00101 
00102 
00103 }
00104 #endif

Contact:
Kevin Long (krlong@ca.sandia.gov)


Documentation generated by