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 2004 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 #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 00027 StructuredElementSeq::StructuredElementSeq( EntityHandle shandle, const int imin, const int jmin, const int kmin, 00028 const int imax, const int jmax, const int kmax, int* is_per ) 00029 : ElementSequence( shandle, 00030 ScdElementData::calc_num_entities( shandle, imax - imin, jmax - jmin, kmax - kmin, is_per ), 00031 CN::VerticesPerEntity( TYPE_FROM_HANDLE( shandle ) ), 00032 new ScdElementData( shandle, imin, jmin, kmin, imax, jmax, kmax, is_per ) ) 00033 { 00034 } 00035 00036 StructuredElementSeq::~StructuredElementSeq() {} 00037 00038 ErrorCode StructuredElementSeq::get_connectivity( EntityHandle handle, std::vector< EntityHandle >& connect, 00039 bool /*topological*/ ) const 00040 { 00041 int i, j, k; 00042 ErrorCode rval = get_params( handle, i, j, k ); 00043 if( MB_SUCCESS == rval ) rval = get_params_connectivity( i, j, k, connect ); 00044 return rval; 00045 } 00046 00047 ErrorCode StructuredElementSeq::get_connectivity( EntityHandle handle, EntityHandle const*& connect, 00048 int& connect_length, bool topo, 00049 std::vector< EntityHandle >* storage ) const 00050 { 00051 if( !storage ) 00052 { 00053 connect = 0; 00054 connect_length = 0; 00055 return MB_STRUCTURED_MESH; 00056 } 00057 00058 storage->clear(); 00059 ErrorCode rval = get_connectivity( handle, *storage, topo ); 00060 connect = &( *storage )[0]; 00061 connect_length = storage->size(); 00062 return rval; 00063 } 00064 00065 ErrorCode StructuredElementSeq::set_connectivity( EntityHandle, EntityHandle const*, int ) 00066 { 00067 return MB_STRUCTURED_MESH; 00068 } 00069 00070 EntityHandle* StructuredElementSeq::get_connectivity_array() 00071 { 00072 return 0; 00073 } 00074 00075 int StructuredElementSeq::values_per_entity() const 00076 { 00077 return -1; 00078 } // never reuse freed handles for structured elements 00079 00080 EntitySequence* StructuredElementSeq::split( EntityHandle here ) 00081 { 00082 return new StructuredElementSeq( *this, here ); 00083 } 00084 00085 SequenceData* StructuredElementSeq::create_data_subset( EntityHandle, EntityHandle ) const 00086 { 00087 return 0; 00088 } 00089 00090 void StructuredElementSeq::get_const_memory_use( unsigned long& bytes_per_entity, unsigned long& sequence_size ) const 00091 { 00092 sequence_size = sizeof( *this ); 00093 bytes_per_entity = sdata()->get_memory_use() / sdata()->size(); 00094 } 00095 00096 } // namespace moab