[MOAB-dev] r2740 - MOAB/trunk
pppebay at sandia.gov
pppebay at sandia.gov
Fri Mar 20 17:09:32 CDT 2009
Author: pebay
Date: 2009-03-20 17:09:31 -0500 (Fri, 20 Mar 2009)
New Revision: 2740
Modified:
MOAB/trunk/SequenceManager.cpp
MOAB/trunk/SequenceManager.hpp
Log:
ENH: added placeholders in the sequence manager for the creation of swept sequences
Modified: MOAB/trunk/SequenceManager.cpp
===================================================================
--- MOAB/trunk/SequenceManager.cpp 2009-03-20 22:08:50 UTC (rev 2739)
+++ MOAB/trunk/SequenceManager.cpp 2009-03-20 22:09:31 UTC (rev 2740)
@@ -685,6 +685,82 @@
first_handle_out, sequence_out );
}
+MBErrorCode
+SequenceManager::create_sweep_sequence( int imin, int jmin, int kmin,
+ int imax, int jmax, int kmax,
+ int* Cq,
+ MBEntityType type,
+ MBEntityID start_id_hint,
+ MBEntityHandle& handle,
+ EntitySequence*& sequence )
+{
+ int this_dim = MBCN::Dimension(type);
+
+ // use > instead of != in the following assert to also catch cases where imin > imax, etc.
+ assert((this_dim < 3 || kmax > kmin) &&
+ (this_dim < 2 || jmax > jmin) &&
+ (this_dim < 1 || imax > imin));
+
+ // compute # entities; not as easy as it would appear...
+ MBEntityID num_ent;
+ if (MBVERTEX == type)
+ num_ent = (MBEntityID)(imax-imin+1)*(MBEntityID)(jmax-jmin+1)*(MBEntityID)(kmax-kmin+1);
+ else {
+ num_ent = (imax-imin) *
+ (this_dim >= 2 ? (jmax-jmin) : 1) *
+ (this_dim >= 3 ? (kmax-kmin) : 1);
+ }
+
+ // get a start handle
+ SequenceData* data = 0;
+ MBEntityID data_size = 0;
+ handle = sequence_start_handle( type, num_ent, -1, start_id_hint, data, data_size );
+
+ if (!handle)
+ return MB_MEMORY_ALLOCATION_FAILED;
+ assert(!data);
+
+ switch (type) {
+ case MBVERTEX:
+ data = new ScdVertexData( handle, imin, jmin, kmin, imax, jmax, kmax );
+ sequence = new VertexSequence( handle, data->size(), data );
+ break;
+ case MBEDGE:
+ case MBQUAD:
+ case MBHEX:
+ sequence = new StructuredElementSeq( handle, imin, jmin, kmin, imax, jmax, kmax );
+ break;
+ default:
+ return MB_TYPE_OUT_OF_RANGE;
+ }
+
+ MBErrorCode result = typeData[type].insert_sequence( sequence );
+ if (MB_SUCCESS != result) {
+ data = sequence->data();
+ delete sequence;
+ delete data;
+ return result;
+ }
+
+ return MB_SUCCESS;
+}
+
+MBErrorCode
+SequenceManager::create_sweep_sequence( const HomCoord& coord_min,
+ const HomCoord& coord_max,
+ int* Cq,
+ MBEntityType type,
+ MBEntityID start_id_hint,
+ MBEntityHandle& first_handle_out,
+ EntitySequence*& sequence_out )
+{
+ return create_sweep_sequence( coord_min.i(), coord_min.j(), coord_min.k(),
+ coord_max.i(), coord_max.j(), coord_max.k(),
+ Cq,
+ type, start_id_hint,
+ first_handle_out, sequence_out );
+}
+
MBErrorCode
SequenceManager::add_vsequence(EntitySequence *vert_seq,
EntitySequence *elem_seq,
Modified: MOAB/trunk/SequenceManager.hpp
===================================================================
--- MOAB/trunk/SequenceManager.hpp 2009-03-20 22:08:50 UTC (rev 2739)
+++ MOAB/trunk/SequenceManager.hpp 2009-03-20 22:09:31 UTC (rev 2740)
@@ -164,6 +164,24 @@
MBEntityHandle& first_handle_out,
EntitySequence*& sequence_out );
+ /** Create swept mesh */
+ MBErrorCode create_sweep_sequence( int imin, int jmin, int kmin,
+ int imax, int jmax, int kmax,
+ int* Cq,
+ MBEntityType type,
+ MBEntityID start_id_hint,
+ MBEntityHandle& first_handle_out,
+ EntitySequence*& sequence_out );
+
+ /** Create swept mesh */
+ MBErrorCode create_sweep_sequence( const HomCoord& coord_min,
+ const HomCoord& coord_max,
+ int* Cq,
+ MBEntityType type,
+ MBEntityID start_id_hint,
+ MBEntityHandle& first_handle_out,
+ EntitySequence*& sequence_out );
+
/** Add a structured vertex sequence to this structured element sequence;
* see comments in ScdElementData */
MBErrorCode add_vsequence(EntitySequence *vert_seq,
More information about the moab-dev
mailing list