1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/**
 * MOAB, a Mesh-Oriented datABase, is a software component for creating,
 * storing and accessing finite element mesh data.
 *
 * Copyright 2008 Sandia Corporation.  Under the terms of Contract
 * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
 * retains certain rights in this software.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 */

#ifndef SWEPT_ELEMENT_SEQUENCE
#define SWEPT_ELEMENT_SEQUENCE

//
// Class: SweptElementSequence
//
// Purpose: represent a swept element of mesh
//

#include "ElementSequence.hpp"
#include "ScdElementData.hpp"

namespace moab
{

class SweptElementSeq : public ElementSequence
{
  public:
    //! constructor
    SweptElementSeq( EntityHandle start_handle,
                     const int imin,
                     const int jmin,
                     const int kmin,
                     const int imax,
                     const int jmax,
                     const int kmax,
                     const int* Cq );

    virtual ~SweptElementSeq();

    ScdElementData* sdata()
    {
        return reinterpret_cast< ScdElementData* >( data() );
    }
    ScdElementData const* sdata() const
    {
        return reinterpret_cast< const ScdElementData* >( data() );
    }

    //! get handle of vertex at i, j, k
    EntityHandle get_vertex( const int i, const int j, const int k ) const
    {
        return get_vertex( HomCoord( i, j, k ) );
    }

    //! get handle of vertex at homogeneous coords
    inline EntityHandle get_vertex( const HomCoord& coords ) const
    {
        return sdata()->get_vertex( coords );
    }

    //! get handle of element at i, j, k
    EntityHandle get_element( const int i, const int j, const int k ) const
    {
        return sdata()->get_element( i, j, k );
    }

    //! get handle of element at homogeneous coords
    EntityHandle get_element( const HomCoord& coords ) const
    {
        return sdata()->get_element( coords.i(), coords.j(), coords.k() );
    }

    //! get min params for this element
    const HomCoord& min_params() const
    {
        return sdata()->min_params();
    }
    void min_params( HomCoord& coords ) const
    {
        coords = min_params();
    }
    void min_params( int& i, int& j, int& k ) const
    {
        i = min_params().i();
        j = min_params().j();
        k = min_params().k();
    }

    //! get max params for this element
    const HomCoord& max_params() const
    {
        return sdata()->max_params();
    }
    void max_params( HomCoord& coords ) const
    {
        coords = max_params();
    }
    void max_params( int& i, int& j, int& k ) const
    {
        i = max_params().i();
        j = max_params().j();
        k = max_params().k();
    }

    //! get the number of vertices in each direction, inclusive
    void param_extents( int& di, int& dj, int& dk ) const
    {
        sdata()->param_extents( di, dj, dk );
    }

    //! given a handle, get the corresponding parameters
    ErrorCode get_params( const EntityHandle ehandle, int& i, int& j, int& k ) const
    {
        return sdata()->get_params( ehandle, i, j, k );
    }

    //! convenience functions for parameter extents
    int i_min() const
    {
        return min_params().i();
    }
    int j_min() const
    {
        return min_params().j();
    }
    int k_min() const
    {
        return min_params().k();
    }
    int i_max() const
    {
        return max_params().i();
    }
    int j_max() const
    {
        return max_params().j();
    }
    int k_max() const
    {
        return max_params().k();
    }

    //! test the bounding vertex sequences and determine whether they fully
    //! define the vertices covering this element block's parameter space
    inline bool boundary_complete() const
    {
        return sdata()->boundary_complete();
    }

    //! test whether this sequence contains these parameters
    bool contains( const int i, const int j, const int k ) const
    {
        return sdata()->contains( HomCoord( i, j, k ) );
    }
    inline bool contains( const HomCoord& coords ) const
    {
        return sdata()->contains( coords );
    }

    //! get connectivity of an entity given entity's parameters
    ErrorCode get_params_connectivity( const int i,
                                       const int j,
                                       const int k,
                                       std::vector< EntityHandle >& connectivity ) const
    {
        return sdata()->get_params_connectivity( i, j, k, connectivity );
    }

    /***************** Methods from ElementSeq *****************/

    virtual ErrorCode get_connectivity( EntityHandle handle,<--- Function in derived class<--- Function in derived class
                                        std::vector< EntityHandle >& connect,
                                        bool topological = false ) const;

    virtual ErrorCode get_connectivity( EntityHandle handle,<--- Function in derived class<--- Function in derived class
                                        EntityHandle const*& connect,
                                        int& connect_length,
                                        bool topological                     = false,
                                        std::vector< EntityHandle >* storage = 0 ) const;

    virtual ErrorCode set_connectivity( EntityHandle handle, EntityHandle const* connect, int connect_length );<--- Function in derived class<--- Function in derived class

    virtual EntityHandle* get_connectivity_array();<--- Function in derived class<--- Function in derived class

    /***************** Methods from EntitySequence *****************/

    /* Replace the ElementSequence implementation of this method with
     * one that always returns zero, because we cannot re-use handles
     * that are within a ScdElementData
     */
    virtual int values_per_entity() const;<--- Function in derived class<--- Function in derived class

    virtual EntitySequence* split( EntityHandle here );<--- Function in derived class<--- Function in derived class

    virtual SequenceData* create_data_subset( EntityHandle start_handle, EntityHandle end_handle ) const;<--- Function in derived class<--- Function in derived class

    virtual void get_const_memory_use( unsigned long& bytes_per_entity, unsigned long& size_of_sequence ) const;<--- Function in derived class<--- Function in derived class

  protected:
    SweptElementSeq( SweptElementSeq& split_from, EntityHandle here ) : ElementSequence( split_from, here ) {}
};

}  // namespace moab

#endif