Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
StructuredElementSeq.cpp
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 2004 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 #include "StructuredElementSeq.hpp"
17 #include "ScdVertexData.hpp"
18 #include "ScdElementData.hpp"
19 #include "moab/Interface.hpp"
20 #include "moab/ReadUtilIface.hpp"
21 #include "moab/CN.hpp"
22 #include "Internals.hpp"
23 
24 namespace moab
25 {
26 
28  const int imin,
29  const int jmin,
30  const int kmin,
31  const int imax,
32  const int jmax,
33  const int kmax,
34  int* is_per )
35  : ElementSequence( shandle,
36  ScdElementData::calc_num_entities( shandle, imax - imin, jmax - jmin, kmax - kmin, is_per ),
37  CN::VerticesPerEntity( TYPE_FROM_HANDLE( shandle ) ),
38  new ScdElementData( shandle, imin, jmin, kmin, imax, jmax, kmax, is_per ) )
39 {
40 }
41 
43 
45  std::vector< EntityHandle >& connect,
46  bool /*topological*/ ) const
47 {
48  int i, j, k;
49  ErrorCode rval = get_params( handle, i, j, k );
50  if( MB_SUCCESS == rval ) rval = get_params_connectivity( i, j, k, connect );
51  return rval;
52 }
53 
55  EntityHandle const*& connect,
56  int& connect_length,
57  bool topo,
58  std::vector< EntityHandle >* storage ) const
59 {
60  if( !storage )
61  {
62  connect = 0;
63  connect_length = 0;
64  return MB_STRUCTURED_MESH;
65  }
66 
67  storage->clear();
68  ErrorCode rval = get_connectivity( handle, *storage, topo );
69  connect = &( *storage )[0];
70  connect_length = storage->size();
71  return rval;
72 }
73 
75 {
76  return MB_STRUCTURED_MESH;
77 }
78 
80 {
81  return 0;
82 }
83 
85 {
86  return -1;
87 } // never reuse freed handles for structured elements
88 
90 {
91  return new StructuredElementSeq( *this, here );
92 }
93 
95 {
96  return 0;
97 }
98 
99 void StructuredElementSeq::get_const_memory_use( unsigned long& bytes_per_entity, unsigned long& sequence_size ) const
100 {
101  sequence_size = sizeof( *this );
102  bytes_per_entity = sdata()->get_memory_use() / sdata()->size();
103 }
104 
105 } // namespace moab