MOAB: Mesh Oriented datABase
(version 5.2.1)
|
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, const int imin, const int jmin, const int kmin, const int imax, 00036 const int jmax, const int kmax, const int* Cq ); 00037 00038 virtual ~SweptElementSeq(); 00039 00040 ScdElementData* sdata() 00041 { 00042 return reinterpret_cast< ScdElementData* >( data() ); 00043 } 00044 ScdElementData const* sdata() const 00045 { 00046 return reinterpret_cast< const ScdElementData* >( data() ); 00047 } 00048 00049 //! get handle of vertex at i, j, k 00050 EntityHandle get_vertex( const int i, const int j, const int k ) const 00051 { 00052 return get_vertex( HomCoord( i, j, k ) ); 00053 } 00054 00055 //! get handle of vertex at homogeneous coords 00056 inline EntityHandle get_vertex( const HomCoord& coords ) const 00057 { 00058 return sdata()->get_vertex( coords ); 00059 } 00060 00061 //! get handle of element at i, j, k 00062 EntityHandle get_element( const int i, const int j, const int k ) const 00063 { 00064 return sdata()->get_element( i, j, k ); 00065 } 00066 00067 //! get handle of element at homogeneous coords 00068 EntityHandle get_element( const HomCoord& coords ) const 00069 { 00070 return sdata()->get_element( coords.i(), coords.j(), coords.k() ); 00071 } 00072 00073 //! get min params for this element 00074 const HomCoord& min_params() const 00075 { 00076 return sdata()->min_params(); 00077 } 00078 void min_params( HomCoord& coords ) const 00079 { 00080 coords = min_params(); 00081 } 00082 void min_params( int& i, int& j, int& k ) const 00083 { 00084 i = min_params().i(); 00085 j = min_params().j(); 00086 k = min_params().k(); 00087 } 00088 00089 //! get max params for this element 00090 const HomCoord& max_params() const 00091 { 00092 return sdata()->max_params(); 00093 } 00094 void max_params( HomCoord& coords ) const 00095 { 00096 coords = max_params(); 00097 } 00098 void max_params( int& i, int& j, int& k ) const 00099 { 00100 i = max_params().i(); 00101 j = max_params().j(); 00102 k = max_params().k(); 00103 } 00104 00105 //! get the number of vertices in each direction, inclusive 00106 void param_extents( int& di, int& dj, int& dk ) const 00107 { 00108 sdata()->param_extents( di, dj, dk ); 00109 } 00110 00111 //! given a handle, get the corresponding parameters 00112 ErrorCode get_params( const EntityHandle ehandle, int& i, int& j, int& k ) const 00113 { 00114 return sdata()->get_params( ehandle, i, j, k ); 00115 } 00116 00117 //! convenience functions for parameter extents 00118 int i_min() const 00119 { 00120 return min_params().i(); 00121 } 00122 int j_min() const 00123 { 00124 return min_params().j(); 00125 } 00126 int k_min() const 00127 { 00128 return min_params().k(); 00129 } 00130 int i_max() const 00131 { 00132 return max_params().i(); 00133 } 00134 int j_max() const 00135 { 00136 return max_params().j(); 00137 } 00138 int k_max() const 00139 { 00140 return max_params().k(); 00141 } 00142 00143 //! test the bounding vertex sequences and determine whether they fully 00144 //! define the vertices covering this element block's parameter space 00145 inline bool boundary_complete() const 00146 { 00147 return sdata()->boundary_complete(); 00148 } 00149 00150 //! test whether this sequence contains these parameters 00151 bool contains( const int i, const int j, const int k ) const 00152 { 00153 return sdata()->contains( HomCoord( i, j, k ) ); 00154 } 00155 inline bool contains( const HomCoord& coords ) const 00156 { 00157 return sdata()->contains( coords ); 00158 } 00159 00160 //! get connectivity of an entity given entity's parameters 00161 ErrorCode get_params_connectivity( const int i, const int j, const int k, 00162 std::vector< EntityHandle >& connectivity ) const 00163 { 00164 return sdata()->get_params_connectivity( i, j, k, connectivity ); 00165 } 00166 00167 /***************** Methods from ElementSeq *****************/ 00168 00169 virtual ErrorCode get_connectivity( EntityHandle handle, std::vector< EntityHandle >& connect, 00170 bool topological = false ) const; 00171 00172 virtual ErrorCode get_connectivity( EntityHandle handle, EntityHandle const*& connect, int& connect_length, 00173 bool topological = false, std::vector< EntityHandle >* storage = 0 ) const; 00174 00175 virtual ErrorCode set_connectivity( EntityHandle handle, EntityHandle const* connect, int connect_length ); 00176 00177 virtual EntityHandle* get_connectivity_array(); 00178 00179 /***************** Methods from EntitySequence *****************/ 00180 00181 /* Replace the ElementSequence implementation of this method with 00182 * one that always returns zero, because we cannot re-use handles 00183 * that are within a ScdElementData 00184 */ 00185 virtual int values_per_entity() const; 00186 00187 virtual EntitySequence* split( EntityHandle here ); 00188 00189 virtual SequenceData* create_data_subset( EntityHandle start_handle, EntityHandle end_handle ) const; 00190 00191 virtual void get_const_memory_use( unsigned long& bytes_per_entity, unsigned long& size_of_sequence ) const; 00192 00193 protected: 00194 SweptElementSeq( SweptElementSeq& split_from, EntityHandle here ) : ElementSequence( split_from, here ) {} 00195 }; 00196 00197 } // namespace moab 00198 00199 #endif