moab
StructuredElementSeq.hpp
Go to the documentation of this file.
00001 
00016 #ifndef STRUCTURED_ELEMENT_SEQUENCE
00017 #define STRUCTURED_ELEMENT_SEQUENCE
00018 
00019 //
00020 // Class: StructuredElementSeq
00021 //
00022 // Purpose: represent a rectangular element of mesh
00023 //
00024 // A ScdElement represents a rectangular element of mesh, including both vertices and
00025 // elements, and the parametric space used to address that element.  Vertex data,
00026 // i.e. coordinates, may not be stored directly in the element, but the element returns
00027 // information about the vertex handles of vertices in the element.  Vertex and element
00028 // handles associated with the element are each contiguous.
00029 
00030 #include "ElementSequence.hpp"
00031 #include "ScdElementData.hpp"
00032 
00033 namespace moab {
00034 
00035 class StructuredElementSeq : public ElementSequence
00036 {
00037 public:
00038 
00040   StructuredElementSeq(
00041                 EntityHandle start_handle,
00042                 const int imin, const int jmin, const int kmin,
00043                 const int imax, const int jmax, const int kmax,
00044                 int *is_periodic = NULL);
00045   
00046   virtual ~StructuredElementSeq();
00047 
00048   ScdElementData* sdata() 
00049     { return reinterpret_cast<ScdElementData*>(data()); }
00050   ScdElementData const* sdata() const 
00051     { return reinterpret_cast<const ScdElementData*>(data()); }
00052 
00054   EntityHandle get_vertex(const int i, const int j, const int k) const
00055     { return get_vertex( HomCoord(i,j,k) ); }
00056   
00058   inline EntityHandle get_vertex(const HomCoord &coords) const
00059     { return sdata()->get_vertex(coords); }
00060   
00062   EntityHandle get_element(const int i, const int j, const int k) const
00063     { return sdata()->get_element( i, j, k ); }
00064   
00066   EntityHandle get_element(const HomCoord &coords) const
00067     { return sdata()->get_element( coords.i(), coords.j(), coords.k() ); }
00068   
00070   const HomCoord &min_params() const
00071     { return sdata()->min_params(); }
00072   void min_params(HomCoord &coords) const
00073     { coords = min_params(); }
00074   void min_params(int &i, int &j, int &k) const
00075     { i = min_params().i(); j = min_params().j(); k = min_params().k(); }
00076 
00078   const HomCoord &max_params() const
00079     { return sdata()->max_params(); }
00080   void max_params(HomCoord &coords) const
00081     { coords = max_params(); }
00082   void max_params(int &i, int &j, int &k) const
00083     { i = max_params().i(); j = max_params().j(); k = max_params().k(); }
00084   
00086   void param_extents(int &di, int &dj, int &dk) const
00087     { sdata()->param_extents( di, dj, dk ); }
00088 
00090   ErrorCode get_params(const EntityHandle ehandle,
00091                           int &i, int &j, int &k) const
00092     { return sdata()->get_params( ehandle, i, j, k ); }
00093   
00095   int i_min() const {return min_params().i();}
00096   int j_min() const {return min_params().j();}
00097   int k_min() const {return min_params().k();}
00098   int i_max() const {return max_params().i();}
00099   int j_max() const {return max_params().j();}
00100   int k_max() const {return max_params().k();}
00101 
00104   inline bool boundary_complete() const
00105     { return sdata()->boundary_complete(); }
00106 
00108   bool contains(const int i, const int j, const int k) const
00109     { return sdata()->contains(HomCoord(i,j,k)); }
00110   inline bool contains(const HomCoord &coords) const
00111     { return sdata()->contains(coords); }
00112 
00114   ErrorCode get_params_connectivity(const int i, const int j, const int k,
00115                                 std::vector<EntityHandle>& connectivity) const
00116     { return sdata()->get_params_connectivity( i, j, k, connectivity ); }
00117   
00119 
00122   int is_periodic_i() const {return sdata()->is_periodic_i();};
00123   
00125 
00128   int is_periodic_j() const {return sdata()->is_periodic_j();};
00129   
00131 
00134   void is_periodic(int is_periodic_ij[2]) const {sdata()->is_periodic(is_periodic_ij);};
00135   
00136   
00137     /***************** Methods from ElementSequence *****************/
00138 
00139   virtual ErrorCode get_connectivity( EntityHandle handle,
00140                                         std::vector<EntityHandle>& connect,
00141                                         bool topological = false ) const;
00142   
00143   virtual ErrorCode get_connectivity( EntityHandle handle,
00144                                         EntityHandle const*& connect,
00145                                         int &connect_length,
00146                                         bool topological = false,
00147                                         std::vector<EntityHandle>* storage = 0
00148                                        ) const;
00149 
00150   virtual ErrorCode set_connectivity( EntityHandle handle,
00151                                         EntityHandle const* connect,
00152                                         int connect_length );
00153   
00154   virtual EntityHandle* get_connectivity_array();
00155   
00156   
00157     /***************** Methods from EntitySequence *****************/
00158 
00159     /* Replace the ElementSequence implementation of this method with
00160      * one that always returns zero, because we cannot re-use handles
00161      * that are within a ScdElementData
00162      */
00163   virtual int values_per_entity() const;
00164 
00165   virtual EntitySequence* split( EntityHandle here );
00166 
00167   virtual SequenceData* create_data_subset( EntityHandle start_handle,
00168                                             EntityHandle end_handle ) const;
00169 
00170   virtual void get_const_memory_use( unsigned long& bytes_per_entity,
00171                                      unsigned long& size_of_sequence ) const;
00172 
00173 protected:
00174   StructuredElementSeq( StructuredElementSeq& split_from, EntityHandle here )
00175     : ElementSequence( split_from, here )
00176     {}
00177 };
00178 
00179 } // namespace moab
00180 
00181 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines