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

Diff of /trunk/dataexporter/src/FinleyMesh.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/tools/libescriptreader/src/escriptreader/MeshWithElements.h revision 2806 by jfenwick, Mon Jul 20 06:20:06 2009 UTC trunk/dataexporter/src/FinleyMesh.h revision 2810 by caltinay, Mon Dec 7 04:13:49 2009 UTC
# Line 11  Line 11 
11  *  *
12  *******************************************************/  *******************************************************/
13    
14  //  #ifndef __FINLEYMESH_H__
15  // MeshWithElements.h  #define __FINLEYMESH_H__
 //  
 #ifndef __MESHWITHELEMENTS_H__  
 #define __MESHWITHELEMENTS_H__  
16    
17  #include <escriptreader/Mesh.h>  #include <escriptexport/escriptexport.h>
18    #include <escript/AbstractDomain.h>
19    
20  class DBfile;  class DBfile;
21    struct Finley_Mesh;
22    
23  namespace EscriptReader {  namespace escriptexport {
24    
25  class ElementData;  class ElementData;
26    class NodeData;
27    
28  /// \brief A full escript domain including elements.  /// \brief Represents a full Finley domain including nodes and elements.
29  ///  ///
30  /// This class represents a mesh including cells, faces, contact elements and  /// This class represents a Finley domain including nodes, cells, face elements
31  /// points if applicable.  /// and contact elements. It provides functionality to read a domain from a
32  class MeshWithElements : public Mesh  /// NetCDF file (generated by the domain's dump() method) or directly
33    /// through an instance of Finley_Mesh.
34    ///
35    /// Once initialised, the domain can be saved in the Silo file format or
36    /// its nodes and elements accessed through the respective methods.
37    ///
38    /// Note that this class is not MPI aware, that is if domain decomposition
39    /// was used only one 'chunk' of the domain can be read per instance of this
40    /// class. See MPDataSet for how to process full domains.
41    class FinleyMesh
42  {  {
43  public:  public:
44      /// \brief Default constructor.      /// \brief Default constructor.
45      MeshWithElements();      ESCRIPTEXPORT_DLL_API
46        FinleyMesh();
47    
48      /// \brief Copy constructor.      /// \brief Copy constructor.
49      MeshWithElements(const MeshWithElements& m);      ESCRIPTEXPORT_DLL_API
50            FinleyMesh(const FinleyMesh& m);
51    
52      /// \brief Virtual destructor.      /// \brief Virtual destructor.
53      virtual ~MeshWithElements();      ESCRIPTEXPORT_DLL_API
54        virtual ~FinleyMesh();
55    
56      virtual bool readFromNc(const std::string& filename);      /// \brief Initialises the mesh using an escript domain instance.
57      virtual void handleGhostZones(int ownIndex);      /// \note Finley_Mesh is the only supported domain.
58      virtual void removeGhostZones();      ESCRIPTEXPORT_DLL_API
59      virtual bool writeToSilo(DBfile* dbfile, const std::string& pathInSilo);      bool initFromEscript(escript::const_Domain_ptr escriptDomain);
60    
61        /// \brief Reads the mesh from a NetCDF file
62        ESCRIPTEXPORT_DLL_API
63        bool initFromNetCDF(const std::string& filename);
64    
65        /// \brief Writes the mesh to a Silo file
66        ESCRIPTEXPORT_DLL_API
67        bool writeToSilo(DBfile* dbfile, const std::string& pathInSilo);
68    
69        /// \brief Reorders elements so that 'ghost' elements appear last
70        ESCRIPTEXPORT_DLL_API
71        void reorderGhostZones(int ownIndex);
72    
73        /// \brief Removes 'ghost' elements and nodes
74        ESCRIPTEXPORT_DLL_API
75        void removeGhostZones(int ownIndex);
76    
77      /// \brief      /// \brief Returns the names of all meshes
78        ESCRIPTEXPORT_DLL_API
79      StringVec getMeshNames() const;      StringVec getMeshNames() const;
80    
81      /// \brief      /// \brief Returns the names of all 'special' Finley mesh variables
82        ESCRIPTEXPORT_DLL_API
83      StringVec getVarNames() const;      StringVec getVarNames() const;
84    
85      /// \brief      /// \brief Returns element data with given name
86      ElementData* getElementsByName(const std::string name) const;      ESCRIPTEXPORT_DLL_API
87        ElementData_ptr getElementsByName(const std::string& name) const;
88      /// \brief  
89      Mesh* getMeshByName(const std::string name) const;      /// \brief Returns node data with given name
90        ESCRIPTEXPORT_DLL_API
91      /// \brief      NodeData_ptr getMeshByName(const std::string& name) const;
92      const IntVec& getVarDataByName(const std::string name) const;  
93        /// \brief Returns mesh variable data
94        ESCRIPTEXPORT_DLL_API
95        const IntVec& getVarDataByName(const std::string& name) const;
96    
97        /// \brief Returns the node mesh for given function space
98        ESCRIPTEXPORT_DLL_API
99        NodeData_ptr getMeshForFinleyFS(int functionSpace) const;
100    
101        /// \brief Returns the element data for given function space
102        ESCRIPTEXPORT_DLL_API
103        ElementData_ptr getElementsForFinleyFS(int functionSpace) const;
104    
105        /// \brief Returns a pointer to the nodes.
106        ESCRIPTEXPORT_DLL_API
107        NodeData_ptr getNodes() const { return nodes; }
108    
109      /// \brief Returns a pointer to the elements.      /// \brief Returns a pointer to the elements.
110      ElementData* getElements() { return cells; }      ESCRIPTEXPORT_DLL_API
111        ElementData_ptr getElements() { return cells; }
112    
113      /// \brief Returns a pointer to the face elements.      /// \brief Returns a pointer to the face elements.
114      ElementData* getFaceElements() { return faces; }      ESCRIPTEXPORT_DLL_API
115        ElementData_ptr getFaceElements() { return faces; }
116    
117      /// \brief Returns a pointer to the contact elements.      /// \brief Returns a pointer to the contact elements.
118      ElementData* getContactElements() { return contacts; }      ESCRIPTEXPORT_DLL_API
119        ElementData_ptr getContactElements() { return contacts; }
120    
121      /// \brief Returns a pointer to the point "elements".      /// \brief Returns the absolute path within Silo file if writeToSilo()
122      ElementData* getPoints() { return points; }      ///        or setSiloPath() was called before, the empty string otherwise.
123        ESCRIPTEXPORT_DLL_API
124        std::string getSiloPath() const { return siloPath; }
125    
126        /// \brief Sets the silo path to be used when saving to a Silo file.
127        ESCRIPTEXPORT_DLL_API
128        void setSiloPath(const std::string& path)  { siloPath = path; }
129    
130  private:  private:
131      IntVec nodeTag, nodeGDOF, nodeGNI, nodeGRDFI, nodeGRNI;      void cleanup();
132      ElementData* cells;  
133      ElementData* faces;      bool initialized;
134      ElementData* contacts;      const Finley_Mesh* finleyMesh;
135      ElementData* points;      NodeData_ptr    nodes;
136        ElementData_ptr cells;
137        ElementData_ptr faces;
138        ElementData_ptr contacts;
139        std::string siloPath;
140  };  };
141    
142  } // namespace EscriptReader  } // namespace escriptexport
143    
144  #endif // __MESHWITHELEMENTS_H__  #endif // __FINLEYMESH_H__
145    

Legend:
Removed from v.2806  
changed lines
  Added in v.2810

  ViewVC Help
Powered by ViewVC 1.1.26