MOAB: Mesh Oriented datABase  (version 5.2.1)
SweptElementSeq.cpp
Go to the documentation of this file.
00001 /**
00002  * MOAB, a Mesh-Oriented datABase, is a software component for creating,
00003  * storing and accessing finite element mesh data.
00004  *
00005  * Copyright 2008 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 "SweptElementSeq.hpp"
00017 #include "SweptVertexData.hpp"
00018 #include "SweptElementData.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 SweptElementSeq::SweptElementSeq( EntityHandle shandle, const int imin, const int jmin, const int kmin, const int imax,
00028                                   const int jmax, const int kmax, const int* Cq )
00029     : ElementSequence( shandle, ScdElementData::calc_num_entities( shandle, imax - imin, jmax - jmin, kmax - kmin ),
00030                        CN::VerticesPerEntity( TYPE_FROM_HANDLE( shandle ) ),
00031                        new SweptElementData( shandle, imin, jmin, kmin, imax, jmax, kmax, Cq ) )
00032 {
00033 }
00034 
00035 SweptElementSeq::~SweptElementSeq() {}
00036 
00037 ErrorCode SweptElementSeq::get_connectivity( EntityHandle handle, std::vector< EntityHandle >& connect,
00038                                              bool /*topological*/ ) const
00039 {
00040     int i, j, k;
00041     ErrorCode rval = get_params( handle, i, j, k );
00042     if( MB_SUCCESS == rval ) rval = get_params_connectivity( i, j, k, connect );
00043     return rval;
00044 }
00045 
00046 ErrorCode SweptElementSeq::get_connectivity( EntityHandle handle, EntityHandle const*& connect, int& connect_length,
00047                                              bool topo, std::vector< EntityHandle >* storage ) const
00048 {
00049     if( !storage )
00050     {
00051         connect        = 0;
00052         connect_length = 0;
00053         return MB_NOT_IMPLEMENTED;
00054     }
00055 
00056     storage->clear();
00057     ErrorCode rval = get_connectivity( handle, *storage, topo );
00058     connect        = &( *storage )[0];
00059     connect_length = storage->size();
00060     return rval;
00061 }
00062 
00063 ErrorCode SweptElementSeq::set_connectivity( EntityHandle, EntityHandle const*, int )
00064 {
00065     return MB_NOT_IMPLEMENTED;
00066 }
00067 
00068 EntityHandle* SweptElementSeq::get_connectivity_array()
00069 {
00070     return 0;
00071 }
00072 
00073 int SweptElementSeq::values_per_entity() const
00074 {
00075     return -1;
00076 }  // never reuse freed handles for swept elements
00077 
00078 EntitySequence* SweptElementSeq::split( EntityHandle here )
00079 {
00080     return new SweptElementSeq( *this, here );
00081 }
00082 
00083 SequenceData* SweptElementSeq::create_data_subset( EntityHandle, EntityHandle ) const
00084 {
00085     return 0;
00086 }
00087 
00088 void SweptElementSeq::get_const_memory_use( unsigned long& bytes_per_entity, unsigned long& sequence_size ) const
00089 {
00090     sequence_size    = sizeof( *this );
00091     bytes_per_entity = sdata()->get_memory_use() / sdata()->size();
00092 }
00093 
00094 }  // namespace moab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines