Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
SweptElementSeq.hpp
Go to the documentation of this file.
1 /**
2  * MOAB, a Mesh-Oriented datABase, is a software component for creating,
3  * storing and accessing finite element mesh data.
4  *
5  * Copyright 2008 Sandia Corporation. Under the terms of Contract
6  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
7  * retains certain rights in this software.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  */
15 
16 #ifndef SWEPT_ELEMENT_SEQUENCE
17 #define SWEPT_ELEMENT_SEQUENCE
18 
19 //
20 // Class: SweptElementSequence
21 //
22 // Purpose: represent a swept element of mesh
23 //
24 
25 #include "ElementSequence.hpp"
26 #include "ScdElementData.hpp"
27 
28 namespace moab
29 {
30 
32 {
33  public:
34  //! constructor
36  const int imin,
37  const int jmin,
38  const int kmin,
39  const int imax,
40  const int jmax,
41  const int kmax,
42  const int* Cq );
43 
44  virtual ~SweptElementSeq();
45 
47  {
48  return reinterpret_cast< ScdElementData* >( data() );
49  }
50  ScdElementData const* sdata() const
51  {
52  return reinterpret_cast< const ScdElementData* >( data() );
53  }
54 
55  //! get handle of vertex at i, j, k
56  EntityHandle get_vertex( const int i, const int j, const int k ) const
57  {
58  return get_vertex( HomCoord( i, j, k ) );
59  }
60 
61  //! get handle of vertex at homogeneous coords
62  inline EntityHandle get_vertex( const HomCoord& coords ) const
63  {
64  return sdata()->get_vertex( coords );
65  }
66 
67  //! get handle of element at i, j, k
68  EntityHandle get_element( const int i, const int j, const int k ) const
69  {
70  return sdata()->get_element( i, j, k );
71  }
72 
73  //! get handle of element at homogeneous coords
74  EntityHandle get_element( const HomCoord& coords ) const
75  {
76  return sdata()->get_element( coords.i(), coords.j(), coords.k() );
77  }
78 
79  //! get min params for this element
80  const HomCoord& min_params() const
81  {
82  return sdata()->min_params();
83  }
84  void min_params( HomCoord& coords ) const
85  {
86  coords = min_params();
87  }
88  void min_params( int& i, int& j, int& k ) const
89  {
90  i = min_params().i();
91  j = min_params().j();
92  k = min_params().k();
93  }
94 
95  //! get max params for this element
96  const HomCoord& max_params() const
97  {
98  return sdata()->max_params();
99  }
100  void max_params( HomCoord& coords ) const
101  {
102  coords = max_params();
103  }
104  void max_params( int& i, int& j, int& k ) const
105  {
106  i = max_params().i();
107  j = max_params().j();
108  k = max_params().k();
109  }
110 
111  //! get the number of vertices in each direction, inclusive
112  void param_extents( int& di, int& dj, int& dk ) const
113  {
114  sdata()->param_extents( di, dj, dk );
115  }
116 
117  //! given a handle, get the corresponding parameters
118  ErrorCode get_params( const EntityHandle ehandle, int& i, int& j, int& k ) const
119  {
120  return sdata()->get_params( ehandle, i, j, k );
121  }
122 
123  //! convenience functions for parameter extents
124  int i_min() const
125  {
126  return min_params().i();
127  }
128  int j_min() const
129  {
130  return min_params().j();
131  }
132  int k_min() const
133  {
134  return min_params().k();
135  }
136  int i_max() const
137  {
138  return max_params().i();
139  }
140  int j_max() const
141  {
142  return max_params().j();
143  }
144  int k_max() const
145  {
146  return max_params().k();
147  }
148 
149  //! test the bounding vertex sequences and determine whether they fully
150  //! define the vertices covering this element block's parameter space
151  inline bool boundary_complete() const
152  {
153  return sdata()->boundary_complete();
154  }
155 
156  //! test whether this sequence contains these parameters
157  bool contains( const int i, const int j, const int k ) const
158  {
159  return sdata()->contains( HomCoord( i, j, k ) );
160  }
161  inline bool contains( const HomCoord& coords ) const
162  {
163  return sdata()->contains( coords );
164  }
165 
166  //! get connectivity of an entity given entity's parameters
168  const int j,
169  const int k,
170  std::vector< EntityHandle >& connectivity ) const
171  {
172  return sdata()->get_params_connectivity( i, j, k, connectivity );
173  }
174 
175  /***************** Methods from ElementSeq *****************/
176 
177  virtual ErrorCode get_connectivity( EntityHandle handle,
178  std::vector< EntityHandle >& connect,
179  bool topological = false ) const;
180 
181  virtual ErrorCode get_connectivity( EntityHandle handle,
182  EntityHandle const*& connect,
183  int& connect_length,
184  bool topological = false,
185  std::vector< EntityHandle >* storage = 0 ) const;
186 
187  virtual ErrorCode set_connectivity( EntityHandle handle, EntityHandle const* connect, int connect_length );
188 
190 
191  /***************** Methods from EntitySequence *****************/
192 
193  /* Replace the ElementSequence implementation of this method with
194  * one that always returns zero, because we cannot re-use handles
195  * that are within a ScdElementData
196  */
197  virtual int values_per_entity() const;
198 
199  virtual EntitySequence* split( EntityHandle here );
200 
202 
203  virtual void get_const_memory_use( unsigned long& bytes_per_entity, unsigned long& size_of_sequence ) const;
204 
205  protected:
206  SweptElementSeq( SweptElementSeq& split_from, EntityHandle here ) : ElementSequence( split_from, here ) {}
207 };
208 
209 } // namespace moab
210 
211 #endif