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