moab
StructuredElementSeq.cpp
Go to the documentation of this file.
00001 
00016 #include "StructuredElementSeq.hpp"
00017 #include "ScdVertexData.hpp"
00018 #include "ScdElementData.hpp"
00019 #include "moab/Interface.hpp"
00020 #include "moab/ReadUtilIface.hpp"
00021 #include "moab/CN.hpp"
00022 #include "Internals.hpp"
00023 
00024 namespace moab {
00025 
00026 StructuredElementSeq::StructuredElementSeq(EntityHandle shandle,
00027                              const int imin, const int jmin, const int kmin,
00028                                            const int imax, const int jmax, const int kmax,
00029                                            int *is_per) 
00030   : ElementSequence( shandle, 
00031                      ScdElementData::calc_num_entities( shandle,
00032                                                         imax-imin,
00033                                                         jmax-jmin,
00034                                                         kmax-kmin,
00035                                                         is_per),
00036                      CN::VerticesPerEntity(TYPE_FROM_HANDLE(shandle)),
00037                      new ScdElementData( shandle, 
00038                                         imin, jmin, kmin,
00039                                          imax, jmax, kmax, is_per) )
00040 {
00041 }
00042 
00043 StructuredElementSeq::~StructuredElementSeq() 
00044 {
00045 }
00046 
00047 ErrorCode StructuredElementSeq::get_connectivity( 
00048                                         EntityHandle handle,
00049                                         std::vector<EntityHandle>& connect,
00050                                         bool /*topological*/ ) const
00051 {
00052   int i, j, k;
00053   ErrorCode rval = get_params( handle, i, j, k );
00054   if (MB_SUCCESS == rval)
00055     rval = get_params_connectivity( i, j, k, connect );
00056   return rval;
00057 }
00058 
00059 ErrorCode StructuredElementSeq::get_connectivity( 
00060                                         EntityHandle handle,
00061                                         EntityHandle const*& connect,
00062                                         int &connect_length,
00063                                         bool topo,
00064                                         std::vector<EntityHandle>* storage
00065                                         ) const
00066 {
00067   if (!storage) {
00068     connect = 0;
00069     connect_length = 0;
00070     return MB_STRUCTURED_MESH;
00071   }
00072   
00073   storage->clear();
00074   ErrorCode rval = get_connectivity( handle, *storage, topo );
00075   connect = &(*storage)[0];
00076   connect_length = storage->size();
00077   return rval;
00078 }
00079 
00080 ErrorCode StructuredElementSeq::set_connectivity( 
00081                                         EntityHandle,
00082                                         EntityHandle const*,
00083                                         int )
00084 {
00085   return MB_STRUCTURED_MESH;
00086 }
00087 
00088 EntityHandle* StructuredElementSeq::get_connectivity_array()
00089   { return 0; }
00090 
00091 int StructuredElementSeq::values_per_entity() const
00092   { return -1; } // never reuse freed handles for structured elements 
00093 
00094 EntitySequence* StructuredElementSeq::split( EntityHandle here )
00095   { return new StructuredElementSeq( *this, here ); }
00096 
00097 SequenceData* StructuredElementSeq::create_data_subset( EntityHandle, EntityHandle ) const
00098   { return 0; }
00099 
00100 void StructuredElementSeq::get_const_memory_use( unsigned long& bytes_per_entity,
00101                                                  unsigned long& sequence_size ) const
00102 {
00103   sequence_size = sizeof(*this);
00104   bytes_per_entity = sdata()->get_memory_use() / sdata()->size();
00105 }
00106 
00107 } // namespace moab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines