MOAB: Mesh Oriented datABase  (version 5.4.1)
SweptElementSeq.hpp
Go to the documentation of this file.
00001 /**
00002  * MOAB, a Mesh-Oriented datABase, is a software component for creating,
00003  * storing and accessing finite element mesh data.
00004  *
00005  * Copyright 2008 Sandia Corporation.  Under the terms of Contract
00006  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
00007  * retains certain rights in this software.
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2.1 of the License, or (at your option) any later version.
00013  *
00014  */
00015 
00016 #ifndef SWEPT_ELEMENT_SEQUENCE
00017 #define SWEPT_ELEMENT_SEQUENCE
00018 
00019 //
00020 // Class: SweptElementSequence
00021 //
00022 // Purpose: represent a swept element of mesh
00023 //
00024 
00025 #include "ElementSequence.hpp"
00026 #include "ScdElementData.hpp"
00027 
00028 namespace moab
00029 {
00030 
00031 class SweptElementSeq : public ElementSequence
00032 {
00033   public:
00034     //! constructor
00035     SweptElementSeq( EntityHandle start_handle,
00036                      const int imin,
00037                      const int jmin,
00038                      const int kmin,
00039                      const int imax,
00040                      const int jmax,
00041                      const int kmax,
00042                      const int* Cq );
00043 
00044     virtual ~SweptElementSeq();
00045 
00046     ScdElementData* sdata()
00047     {
00048         return reinterpret_cast< ScdElementData* >( data() );
00049     }
00050     ScdElementData const* sdata() const
00051     {
00052         return reinterpret_cast< const ScdElementData* >( data() );
00053     }
00054 
00055     //! get handle of vertex at i, j, k
00056     EntityHandle get_vertex( const int i, const int j, const int k ) const
00057     {
00058         return get_vertex( HomCoord( i, j, k ) );
00059     }
00060 
00061     //! get handle of vertex at homogeneous coords
00062     inline EntityHandle get_vertex( const HomCoord& coords ) const
00063     {
00064         return sdata()->get_vertex( coords );
00065     }
00066 
00067     //! get handle of element at i, j, k
00068     EntityHandle get_element( const int i, const int j, const int k ) const
00069     {
00070         return sdata()->get_element( i, j, k );
00071     }
00072 
00073     //! get handle of element at homogeneous coords
00074     EntityHandle get_element( const HomCoord& coords ) const
00075     {
00076         return sdata()->get_element( coords.i(), coords.j(), coords.k() );
00077     }
00078 
00079     //! get min params for this element
00080     const HomCoord& min_params() const
00081     {
00082         return sdata()->min_params();
00083     }
00084     void min_params( HomCoord& coords ) const
00085     {
00086         coords = min_params();
00087     }
00088     void min_params( int& i, int& j, int& k ) const
00089     {
00090         i = min_params().i();
00091         j = min_params().j();
00092         k = min_params().k();
00093     }
00094 
00095     //! get max params for this element
00096     const HomCoord& max_params() const
00097     {
00098         return sdata()->max_params();
00099     }
00100     void max_params( HomCoord& coords ) const
00101     {
00102         coords = max_params();
00103     }
00104     void max_params( int& i, int& j, int& k ) const
00105     {
00106         i = max_params().i();
00107         j = max_params().j();
00108         k = max_params().k();
00109     }
00110 
00111     //! get the number of vertices in each direction, inclusive
00112     void param_extents( int& di, int& dj, int& dk ) const
00113     {
00114         sdata()->param_extents( di, dj, dk );
00115     }
00116 
00117     //! given a handle, get the corresponding parameters
00118     ErrorCode get_params( const EntityHandle ehandle, int& i, int& j, int& k ) const
00119     {
00120         return sdata()->get_params( ehandle, i, j, k );
00121     }
00122 
00123     //! convenience functions for parameter extents
00124     int i_min() const
00125     {
00126         return min_params().i();
00127     }
00128     int j_min() const
00129     {
00130         return min_params().j();
00131     }
00132     int k_min() const
00133     {
00134         return min_params().k();
00135     }
00136     int i_max() const
00137     {
00138         return max_params().i();
00139     }
00140     int j_max() const
00141     {
00142         return max_params().j();
00143     }
00144     int k_max() const
00145     {
00146         return max_params().k();
00147     }
00148 
00149     //! test the bounding vertex sequences and determine whether they fully
00150     //! define the vertices covering this element block's parameter space
00151     inline bool boundary_complete() const
00152     {
00153         return sdata()->boundary_complete();
00154     }
00155 
00156     //! test whether this sequence contains these parameters
00157     bool contains( const int i, const int j, const int k ) const
00158     {
00159         return sdata()->contains( HomCoord( i, j, k ) );
00160     }
00161     inline bool contains( const HomCoord& coords ) const
00162     {
00163         return sdata()->contains( coords );
00164     }
00165 
00166     //! get connectivity of an entity given entity's parameters
00167     ErrorCode get_params_connectivity( const int i,
00168                                        const int j,
00169                                        const int k,
00170                                        std::vector< EntityHandle >& connectivity ) const
00171     {
00172         return sdata()->get_params_connectivity( i, j, k, connectivity );
00173     }
00174 
00175     /***************** Methods from ElementSeq *****************/
00176 
00177     virtual ErrorCode get_connectivity( EntityHandle handle,
00178                                         std::vector< EntityHandle >& connect,
00179                                         bool topological = false ) const;
00180 
00181     virtual ErrorCode get_connectivity( EntityHandle handle,
00182                                         EntityHandle const*& connect,
00183                                         int& connect_length,
00184                                         bool topological                     = false,
00185                                         std::vector< EntityHandle >* storage = 0 ) const;
00186 
00187     virtual ErrorCode set_connectivity( EntityHandle handle, EntityHandle const* connect, int connect_length );
00188 
00189     virtual EntityHandle* get_connectivity_array();
00190 
00191     /***************** Methods from EntitySequence *****************/
00192 
00193     /* Replace the ElementSequence implementation of this method with
00194      * one that always returns zero, because we cannot re-use handles
00195      * that are within a ScdElementData
00196      */
00197     virtual int values_per_entity() const;
00198 
00199     virtual EntitySequence* split( EntityHandle here );
00200 
00201     virtual SequenceData* create_data_subset( EntityHandle start_handle, EntityHandle end_handle ) const;
00202 
00203     virtual void get_const_memory_use( unsigned long& bytes_per_entity, unsigned long& size_of_sequence ) const;
00204 
00205   protected:
00206     SweptElementSeq( SweptElementSeq& split_from, EntityHandle here ) : ElementSequence( split_from, here ) {}
00207 };
00208 
00209 }  // namespace moab
00210 
00211 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines