Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
moab::HigherOrderFactory Class Reference

Functions for converting to/from higher-order elements. More...

#include <HigherOrderFactory.hpp>

+ Collaboration diagram for moab::HigherOrderFactory:

Public Member Functions

 HigherOrderFactory (Core *, Interface::HONodeAddedRemoved *function_object)
 
 ~HigherOrderFactory ()
 
ErrorCode convert (const EntityHandle meshset, const bool mid_edge_nodes, const bool mid_face_nodes, const bool mid_volume_nodes)
 
ErrorCode convert (const Range &entities, const bool mid_edge_nodes, const bool mid_face_nodes, const bool mid_volume_nodes)
 

Public Attributes

unsigned char mNodeMap [MBMAXTYPE][8][8]
 

Private Member Functions

void initialize_map ()
 
ErrorCode convert_sequence (ElementSequence *sequence, EntityHandle sequence_subset_start, EntityHandle sequence_subset_end, bool mid_edge_nodes, bool mid_face_nodes, bool mid_volume_nodes)
 
ErrorCode add_mid_edge_nodes (ElementSequence *)
 
ErrorCode add_mid_face_nodes (ElementSequence *)
 
ErrorCode add_mid_volume_nodes (ElementSequence *)
 
EntityHandle center_node_exist (EntityHandle corner1, EntityHandle corner2, std::vector< EntityHandle > &adj_entities)
 returns the handle of the first center node found between the two corner nodes. returns zero if none found entities that share those two corner nodes and have space allocated for mid-edge nodes are returned in a vector More...
 
EntityHandle center_node_exist (EntityHandle corners[4], std::vector< EntityHandle > &adj_entities)
 returns the handle of the first center node found between the 3-4 corner nodes. set the last node to zero if you want only 3 nodes returns zero if none found entities that share those corner nodes and have space allocated for mid face nodes are returned in a vector More...
 
bool add_center_node (EntityType type, EntityHandle *element_conn, int conn_size, EntityHandle corner_node1, EntityHandle corner_node2, EntityHandle center_node)
 adds a center node to element between corner nodes, returns success More...
 
ErrorCode copy_corner_nodes (ElementSequence *src, ElementSequence *dst)
 
ErrorCode copy_mid_edge_nodes (ElementSequence *src, ElementSequence *dst)
 
ErrorCode copy_mid_face_nodes (ElementSequence *src, ElementSequence *dst)
 
ErrorCode copy_mid_volume_nodes (ElementSequence *src, ElementSequence *dst)
 
ErrorCode copy_nodes (ElementSequence *src, ElementSequence *dst, unsigned nodes_per_elem_to_copy, unsigned src_conn_offset, unsigned dst_conn_offset)
 
ErrorCode zero_mid_edge_nodes (ElementSequence *dst)
 
ErrorCode zero_mid_face_nodes (ElementSequence *dst)
 
ErrorCode zero_mid_volume_nodes (ElementSequence *dst)
 
ErrorCode zero_nodes (ElementSequence *dst, unsigned nodes_per_elem_to_zero, unsigned dst_conn_offset)
 
ErrorCode remove_mid_edge_nodes (ElementSequence *seq, EntityHandle start, EntityHandle stop, Tag deletable_ndoes)
 
ErrorCode remove_mid_face_nodes (ElementSequence *seq, EntityHandle start, EntityHandle stop, Tag deletable_ndoes)
 
ErrorCode remove_mid_volume_nodes (ElementSequence *seq, EntityHandle start, EntityHandle stop, Tag deletable_ndoes)
 
ErrorCode remove_ho_nodes (ElementSequence *sequence, EntityHandle subset_start_handle, EntityHandle subset_end_handle, int nodes_per_elem_to_remove, int elem_conn_offset_to_remove, Tag deletable_nodes)
 
bool tag_for_deletion (EntityHandle element_with_node, int node_index_in_elem_connectivity, ElementSequence *sequence)
 

Private Attributes

CoremMB
 
Interface::HONodeAddedRemovedmHONodeAddedRemoved
 

Detailed Description

Functions for converting to/from higher-order elements.

Authors
Clinton Stimpson
Date
11/25/02

Definition at line 38 of file HigherOrderFactory.hpp.

Constructor & Destructor Documentation

◆ HigherOrderFactory()

moab::HigherOrderFactory::HigherOrderFactory ( Core MB,
Interface::HONodeAddedRemoved function_object 
)

Definition at line 39 of file HigherOrderFactory.cpp.

40  : mMB( MB ), mHONodeAddedRemoved( function_object )
41 {
43 }

References initialize_map().

◆ ~HigherOrderFactory()

moab::HigherOrderFactory::~HigherOrderFactory ( )

Definition at line 44 of file HigherOrderFactory.cpp.

44 {}

Member Function Documentation

◆ add_center_node()

bool moab::HigherOrderFactory::add_center_node ( EntityType  type,
EntityHandle element_conn,
int  conn_size,
EntityHandle  corner_node1,
EntityHandle  corner_node2,
EntityHandle  center_node 
)
private

adds a center node to element between corner nodes, returns success

Definition at line 597 of file HigherOrderFactory.cpp.

603 {
604  int first_node = std::find( element_conn, element_conn + conn_size, corner_node1 ) - element_conn;
605  int second_node = std::find( element_conn, element_conn + conn_size, corner_node2 ) - element_conn;
606  if( first_node == conn_size || second_node == conn_size )
607  assert( "We should always find our nodes no matter what" == NULL );
608  int high_node_index = mNodeMap[this_type][first_node][second_node];
609  element_conn[high_node_index] = center_node;
610  return true;
611 }

References mNodeMap.

◆ add_mid_edge_nodes()

ErrorCode moab::HigherOrderFactory::add_mid_edge_nodes ( ElementSequence seq)
private

Definition at line 387 of file HigherOrderFactory.cpp.

388 {
389  // for each node, need to see if it was already created.
390  EntityType this_type = seq->type();
391  SequenceManager* seq_manager = mMB->sequence_manager();
392 
393  // offset by number of corner nodes
394  int num_vertices = CN::VerticesPerEntity( this_type );
395  int num_edges = CN::mConnectivityMap[this_type][0].num_sub_elements;
396 
397  const CN::ConnMap& entity_edges = CN::mConnectivityMap[this_type][0];
398 
399  EntityHandle* element = seq->get_connectivity_array();
400  EntityHandle curr_handle = seq->start_handle();
401  int nodes_per_element = seq->nodes_per_element();
402  EntityHandle* end_element = element + nodes_per_element * ( seq->size() );
403 
404  EntityHandle tmp_edge_conn[2];
405  std::vector< EntityHandle > adjacent_entities( 32 );
406 
407  double tmp_coords[3];
408 
409  // iterate over the elements
410  for( ; element < end_element; element += nodes_per_element )
411  {
412  // for each edge in this entity
413  for( int i = 0; i < num_edges; i++ )
414  {
415  // a node was already assigned
416  if( element[i + num_vertices] != 0 ) continue;
417 
418  tmp_edge_conn[0] = element[entity_edges.conn[i][0]];
419  tmp_edge_conn[1] = element[entity_edges.conn[i][1]];
420 
421  EntityHandle already_made_node = center_node_exist( tmp_edge_conn[0], tmp_edge_conn[1], adjacent_entities );
422 
423  if( already_made_node )
424  {
425  element[i + num_vertices] = already_made_node;
426  }
427  // create a node
428  else
429  {
430  EntitySequence* tmp_sequence = NULL;
431  double sum_coords[3] = { 0, 0, 0 };
432  seq_manager->find( tmp_edge_conn[0], tmp_sequence );
433  static_cast< VertexSequence* >( tmp_sequence )
434  ->get_coordinates( tmp_edge_conn[0], tmp_coords[0], tmp_coords[1], tmp_coords[2] );
435  sum_coords[0] += tmp_coords[0];
436  sum_coords[1] += tmp_coords[1];
437  sum_coords[2] += tmp_coords[2];
438  seq_manager->find( tmp_edge_conn[1], tmp_sequence );
439  static_cast< VertexSequence* >( tmp_sequence )
440  ->get_coordinates( tmp_edge_conn[1], tmp_coords[0], tmp_coords[1], tmp_coords[2] );
441  sum_coords[0] = ( sum_coords[0] + tmp_coords[0] ) / 2;
442  sum_coords[1] = ( sum_coords[1] + tmp_coords[1] ) / 2;
443  sum_coords[2] = ( sum_coords[2] + tmp_coords[2] ) / 2;
444 
445  mMB->create_vertex( sum_coords, element[i + num_vertices] );
446  }
447 
448  if( mHONodeAddedRemoved ) mHONodeAddedRemoved->node_added( element[i + num_vertices], curr_handle );
449  }
450 
451  curr_handle++;
452  }
453 
454  return MB_SUCCESS;
455 }

References center_node_exist(), moab::CN::ConnMap::conn, moab::Core::create_vertex(), moab::SequenceManager::find(), moab::ElementSequence::get_connectivity_array(), MB_SUCCESS, moab::CN::mConnectivityMap, mHONodeAddedRemoved, mMB, moab::Interface::HONodeAddedRemoved::node_added(), moab::ElementSequence::nodes_per_element(), moab::CN::ConnMap::num_sub_elements, moab::Core::sequence_manager(), moab::EntitySequence::size(), moab::EntitySequence::start_handle(), moab::EntitySequence::type(), and moab::CN::VerticesPerEntity().

Referenced by convert_sequence().

◆ add_mid_face_nodes()

ErrorCode moab::HigherOrderFactory::add_mid_face_nodes ( ElementSequence seq)
private

Definition at line 310 of file HigherOrderFactory.cpp.

311 {
312  EntityType this_type = seq->type();
313  SequenceManager* seq_manager = mMB->sequence_manager();
314  int num_vertices = CN::VerticesPerEntity( this_type );
315  int num_edges = CN::mConnectivityMap[this_type][0].num_sub_elements;
316  num_edges = seq->has_mid_edge_nodes() ? num_edges : 0;
317  int num_faces = CN::mConnectivityMap[this_type][1].num_sub_elements;
318 
319  const CN::ConnMap& entity_faces = CN::mConnectivityMap[this_type][1];
320 
321  EntityHandle* element = seq->get_connectivity_array();
322  EntityHandle curr_handle = seq->start_handle();
323  int nodes_per_element = seq->nodes_per_element();
324  EntityHandle* end_element = element + nodes_per_element * ( seq->size() );
325 
326  EntityHandle tmp_face_conn[4]; // max face nodes = 4
327  std::vector< EntityHandle > adjacent_entities( 4 );
328 
329  double tmp_coords[3];
330 
331  // iterate over the elements
332  for( ; element < end_element; element += nodes_per_element )
333  {
334  // for each edge in this entity
335  for( int i = 0; i < num_faces; i++ )
336  {
337  // a node was already assigned
338  if( element[i + num_edges + num_vertices] != 0 ) continue;
339 
340  tmp_face_conn[0] = element[entity_faces.conn[i][0]];
341  tmp_face_conn[1] = element[entity_faces.conn[i][1]];
342  tmp_face_conn[2] = element[entity_faces.conn[i][2]];
343  if( entity_faces.num_corners_per_sub_element[i] == 4 )
344  tmp_face_conn[3] = element[entity_faces.conn[i][3]];
345  else
346  tmp_face_conn[3] = 0;
347 
348  EntityHandle already_made_node = center_node_exist( tmp_face_conn, adjacent_entities );
349 
350  if( already_made_node )
351  {
352  element[i + num_edges + num_vertices] = already_made_node;
353  }
354  // create a node
355  else
356  {
357  EntitySequence* tmp_sequence = NULL;
358  double sum_coords[3] = { 0, 0, 0 };
359  int max_nodes = entity_faces.num_corners_per_sub_element[i];
360  for( int k = 0; k < max_nodes; k++ )
361  {
362  seq_manager->find( tmp_face_conn[k], tmp_sequence );
363  static_cast< VertexSequence* >( tmp_sequence )
364  ->get_coordinates( tmp_face_conn[k], tmp_coords[0], tmp_coords[1], tmp_coords[2] );
365  sum_coords[0] += tmp_coords[0];
366  sum_coords[1] += tmp_coords[1];
367  sum_coords[2] += tmp_coords[2];
368  }
369 
370  sum_coords[0] /= max_nodes;
371  sum_coords[1] /= max_nodes;
372  sum_coords[2] /= max_nodes;
373 
374  mMB->create_vertex( sum_coords, element[i + num_edges + num_vertices] );
375  }
376 
377  if( mHONodeAddedRemoved )
378  mHONodeAddedRemoved->node_added( element[i + num_edges + num_vertices], curr_handle );
379  }
380 
381  curr_handle++;
382  }
383 
384  return MB_SUCCESS;
385 }

References center_node_exist(), moab::CN::ConnMap::conn, moab::Core::create_vertex(), moab::SequenceManager::find(), moab::ElementSequence::get_connectivity_array(), moab::ElementSequence::has_mid_edge_nodes(), MB_SUCCESS, moab::CN::mConnectivityMap, mHONodeAddedRemoved, mMB, moab::Interface::HONodeAddedRemoved::node_added(), moab::ElementSequence::nodes_per_element(), moab::CN::ConnMap::num_corners_per_sub_element, moab::CN::ConnMap::num_sub_elements, moab::Core::sequence_manager(), moab::EntitySequence::size(), moab::EntitySequence::start_handle(), moab::EntitySequence::type(), and moab::CN::VerticesPerEntity().

Referenced by convert_sequence().

◆ add_mid_volume_nodes()

ErrorCode moab::HigherOrderFactory::add_mid_volume_nodes ( ElementSequence seq)
private

Definition at line 261 of file HigherOrderFactory.cpp.

262 {
263  EntityType this_type = seq->type();
264  SequenceManager* seq_manager = mMB->sequence_manager();
265 
266  // find out where in the connectivity list to add these new mid volume nodes
267  int edge_factor = seq->has_mid_edge_nodes() ? 1 : 0;
268  int face_factor = seq->has_mid_face_nodes() ? 1 : 0;
269  // offset by number of higher order nodes on edges if they exist
270  int num_corner_nodes = CN::VerticesPerEntity( this_type );
271  int new_node_index = num_corner_nodes;
272  new_node_index += edge_factor * CN::mConnectivityMap[this_type][0].num_sub_elements;
273  new_node_index += face_factor * CN::mConnectivityMap[this_type][1].num_sub_elements;
274 
275  EntityHandle* element = seq->get_connectivity_array();
276  EntityHandle curr_handle = seq->start_handle();
277  int nodes_per_element = seq->nodes_per_element();
278  EntityHandle* end_element = element + nodes_per_element * ( seq->size() );
279 
280  // iterate over the elements
281  for( ; element < end_element; element += nodes_per_element )
282  {
283  // find the centroid of this element
284  double tmp_coords[3], sum_coords[3] = { 0, 0, 0 };
285  EntitySequence* eseq = NULL;
286  for( int i = 0; i < num_corner_nodes; i++ )
287  {
288  seq_manager->find( element[i], eseq );
289  static_cast< VertexSequence* >( eseq )->get_coordinates( element[i], tmp_coords[0], tmp_coords[1],
290  tmp_coords[2] );
291  sum_coords[0] += tmp_coords[0];
292  sum_coords[1] += tmp_coords[1];
293  sum_coords[2] += tmp_coords[2];
294  }
295  sum_coords[0] /= num_corner_nodes;
296  sum_coords[1] /= num_corner_nodes;
297  sum_coords[2] /= num_corner_nodes;
298 
299  // create a new vertex at the centroid
300  mMB->create_vertex( sum_coords, element[new_node_index] );
301 
302  if( mHONodeAddedRemoved ) mHONodeAddedRemoved->node_added( element[new_node_index], curr_handle );
303 
304  curr_handle++;
305  }
306 
307  return MB_SUCCESS;
308 }

References moab::Core::create_vertex(), moab::SequenceManager::find(), moab::ElementSequence::get_connectivity_array(), moab::ElementSequence::has_mid_edge_nodes(), moab::ElementSequence::has_mid_face_nodes(), MB_SUCCESS, moab::CN::mConnectivityMap, mHONodeAddedRemoved, mMB, moab::Interface::HONodeAddedRemoved::node_added(), moab::ElementSequence::nodes_per_element(), moab::CN::ConnMap::num_sub_elements, moab::Core::sequence_manager(), moab::EntitySequence::size(), moab::EntitySequence::start_handle(), moab::EntitySequence::type(), and moab::CN::VerticesPerEntity().

Referenced by convert_sequence().

◆ center_node_exist() [1/2]

EntityHandle moab::HigherOrderFactory::center_node_exist ( EntityHandle  corner1,
EntityHandle  corner2,
std::vector< EntityHandle > &  adj_entities 
)
private

returns the handle of the first center node found between the two corner nodes. returns zero if none found entities that share those two corner nodes and have space allocated for mid-edge nodes are returned in a vector

Definition at line 457 of file HigherOrderFactory.cpp.

460 {
461  AEntityFactory* a_fact = mMB->a_entity_factory();
462  std::vector< EntityHandle > adj_corner1( 32 );
463  std::vector< EntityHandle > adj_corner2( 32 );
464 
465  // create needed vertex adjacencies
466  if( !a_fact->vert_elem_adjacencies() ) a_fact->create_vert_elem_adjacencies();
467 
468  // vectors are returned sorted
469 
470  a_fact->get_adjacencies( corner1, adj_corner1 );
471  a_fact->get_adjacencies( corner2, adj_corner2 );
472 
473  // these are the entities adjacent to both nodes
474  adj_entities.clear();
475  std::set_intersection( adj_corner1.begin(), adj_corner1.end(), adj_corner2.begin(), adj_corner2.end(),
476  std::back_inserter< std::vector< EntityHandle > >( adj_entities ) );
477 
478  // iterate of the entities to find a mid node
479  const EntityHandle* conn;
480  int conn_size = 0;
481  for( std::vector< EntityHandle >::iterator iter = adj_entities.begin(); iter != adj_entities.end(); )
482  {
483  EntityType this_type = TYPE_FROM_HANDLE( *iter );
484  if( this_type == MBENTITYSET )
485  {
486  ++iter;
487  continue;
488  }
489  mMB->get_connectivity( *iter, conn, conn_size );
490  // if this entity has mid edge nodes
491  if( CN::HasMidEdgeNodes( this_type, conn_size ) )
492  {
493  // find out at which index the mid node should be at
494  int first_node = std::find( conn, conn + conn_size, corner1 ) - conn;
495  int second_node = std::find( conn, conn + conn_size, corner2 ) - conn;
496  if( first_node == conn_size || second_node == conn_size )
497  assert( "We should always find our nodes no matter what" == NULL );
498  int high_node_index = mNodeMap[this_type][first_node][second_node];
499  if( conn[high_node_index] != 0 ) return conn[high_node_index];
500  ++iter;
501  }
502  else
503  {
504  iter = adj_entities.erase( iter );
505  }
506  }
507 
508  return 0;
509 }

References moab::Core::a_entity_factory(), moab::AEntityFactory::create_vert_elem_adjacencies(), moab::AEntityFactory::get_adjacencies(), moab::Core::get_connectivity(), moab::CN::HasMidEdgeNodes(), MBENTITYSET, mMB, mNodeMap, moab::TYPE_FROM_HANDLE(), and moab::AEntityFactory::vert_elem_adjacencies().

Referenced by add_mid_edge_nodes(), and add_mid_face_nodes().

◆ center_node_exist() [2/2]

EntityHandle moab::HigherOrderFactory::center_node_exist ( EntityHandle  corners[4],
std::vector< EntityHandle > &  adj_entities 
)
private

returns the handle of the first center node found between the 3-4 corner nodes. set the last node to zero if you want only 3 nodes returns zero if none found entities that share those corner nodes and have space allocated for mid face nodes are returned in a vector

Definition at line 511 of file HigherOrderFactory.cpp.

512 {
513  AEntityFactory* a_fact = mMB->a_entity_factory();
514  std::vector< EntityHandle > adj_corner[4];
515  int num_nodes = corners[3] == 0 ? 3 : 4;
516  int i = 0;
517 
518  // create needed vertex adjacencies
519  if( !a_fact->vert_elem_adjacencies() ) a_fact->create_vert_elem_adjacencies();
520 
521  // vectors are returned sorted
522  for( i = 0; i < num_nodes; i++ )
523  a_fact->get_adjacencies( corners[i], adj_corner[i] );
524 
525  // these are the entities adjacent to both nodes
526  for( i = 1; i < num_nodes; i++ )
527  {
528  adj_entities.clear();
529  std::set_intersection( adj_corner[i - 1].begin(), adj_corner[i - 1].end(), adj_corner[i].begin(),
530  adj_corner[i].end(), std::back_inserter< std::vector< EntityHandle > >( adj_entities ) );
531  adj_corner[i].swap( adj_entities );
532  }
533  adj_entities.swap( adj_corner[i - 1] );
534 
535  // iterate of the entities to find a mid node
536  const EntityHandle* conn;
537  int conn_size = 0;
538  for( std::vector< EntityHandle >::iterator iter = adj_entities.begin(); iter != adj_entities.end(); )
539  {
540  EntityType this_type = TYPE_FROM_HANDLE( *iter );
541  if( this_type == MBENTITYSET )
542  {
543  ++iter;
544  continue;
545  }
546  const CN::ConnMap& entity_faces = CN::mConnectivityMap[this_type][1];
547  mMB->get_connectivity( *iter, conn, conn_size );
548  int offset = CN::VerticesPerEntity( this_type );
549  if( CN::HasMidEdgeNodes( this_type, conn_size ) ) offset += CN::mConnectivityMap[this_type][0].num_sub_elements;
550 
551  // if this entity has mid face nodes
552  if( CN::HasMidFaceNodes( this_type, conn_size ) )
553  {
554  int k;
555  int indexes[4];
556  for( k = 0; k < num_nodes; k++ )
557  indexes[k] = std::find( conn, conn + conn_size, corners[k] ) - conn;
558 
559  // find out at which index the mid node should be at
560  for( k = 0; k < entity_faces.num_sub_elements; k++ )
561  {
562  if( CN::VerticesPerEntity( entity_faces.target_type[k] ) != num_nodes ) continue;
563 
564  int* pivot = std::find( indexes, indexes + num_nodes, entity_faces.conn[k][0] );
565  if( pivot == indexes + num_nodes ) continue;
566 
567  if( pivot != indexes ) std::rotate( indexes, pivot, indexes + num_nodes );
568 
569  if( std::equal( indexes, indexes + num_nodes, entity_faces.conn[k] ) )
570  {
571  if( conn[k + offset] != 0 ) return conn[k + offset];
572  k = entity_faces.num_sub_elements;
573  }
574  else
575  {
576  int temp = indexes[1];
577  indexes[1] = indexes[num_nodes - 1];
578  indexes[num_nodes - 1] = temp;
579  if( std::equal( indexes, indexes + num_nodes, entity_faces.conn[k] ) )
580  {
581  if( conn[k + offset] != 0 ) return conn[k + offset];
582  k = entity_faces.num_sub_elements;
583  }
584  }
585  }
586  ++iter;
587  }
588  else
589  {
590  iter = adj_entities.erase( iter );
591  }
592  }
593 
594  return 0;
595 }

References moab::Core::a_entity_factory(), moab::CN::ConnMap::conn, moab::AEntityFactory::create_vert_elem_adjacencies(), moab::AEntityFactory::get_adjacencies(), moab::Core::get_connectivity(), moab::CN::HasMidEdgeNodes(), moab::CN::HasMidFaceNodes(), MBENTITYSET, moab::CN::mConnectivityMap, mMB, moab::CN::ConnMap::num_sub_elements, moab::CN::ConnMap::target_type, moab::TYPE_FROM_HANDLE(), moab::AEntityFactory::vert_elem_adjacencies(), and moab::CN::VerticesPerEntity().

◆ convert() [1/2]

ErrorCode moab::HigherOrderFactory::convert ( const EntityHandle  meshset,
const bool  mid_edge_nodes,
const bool  mid_face_nodes,
const bool  mid_volume_nodes 
)

Definition at line 71 of file HigherOrderFactory.cpp.

75 {
76  Range entities;
77  mMB->get_entities_by_handle( meshset, entities, true );
78  return convert( entities, mid_edge_nodes, mid_face_nodes, mid_volume_nodes );
79 }

References entities, moab::Core::get_entities_by_handle(), and mMB.

Referenced by moab::Core::convert_entities(), and moab::Tqdcfr::read_block().

◆ convert() [2/2]

ErrorCode moab::HigherOrderFactory::convert ( const Range entities,
const bool  mid_edge_nodes,
const bool  mid_face_nodes,
const bool  mid_volume_nodes 
)

Definition at line 81 of file HigherOrderFactory.cpp.

86 {
87 
88  // TODO -- add some more code to prevent from splitting of entity sequences when we don't need
89  // to. Say we have all hex8's in our mesh and 3 falses are passed in. In the end, no conversion
90  // will happen, but the sequences could still be split up.
91 
92  // find out what entity sequences we need to convert
93  // and where, if necessary, to split them
94 
95  SequenceManager* seq_manager = mMB->sequence_manager();
96  Range::const_pair_iterator p_iter;
97  for( p_iter = entities.const_pair_begin(); p_iter != entities.const_pair_end(); ++p_iter )
98  {
99 
100  EntityHandle h = p_iter->first;
101  while( h <= p_iter->second )
102  {
103 
104  EntitySequence* seq;
105  ErrorCode rval = seq_manager->find( h, seq );
106  if( MB_SUCCESS != rval ) return rval;
107 
108  if( seq->type() == MBVERTEX || seq->type() >= MBENTITYSET ) return MB_TYPE_OUT_OF_RANGE;
109 
110  // make sequence is not structured mesh
111  ElementSequence* elemseq = static_cast< ElementSequence* >( seq );
112  if( NULL == elemseq->get_connectivity_array() ) return MB_NOT_IMPLEMENTED;
113 
114  EntityHandle last = p_iter->second;
115  if( last > seq->end_handle() ) last = seq->end_handle();
116 
117  rval = convert_sequence( elemseq, h, last, mid_edge_nodes, mid_face_nodes, mid_volume_nodes );
118  if( MB_SUCCESS != rval ) return rval;
119 
120  h = last + 1;
121  }
122  }
123 
124  return MB_SUCCESS;
125 }

References convert_sequence(), moab::EntitySequence::end_handle(), entities, ErrorCode, moab::SequenceManager::find(), moab::ElementSequence::get_connectivity_array(), MB_NOT_IMPLEMENTED, MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, MBENTITYSET, MBVERTEX, mMB, moab::Core::sequence_manager(), and moab::EntitySequence::type().

◆ convert_sequence()

ErrorCode moab::HigherOrderFactory::convert_sequence ( ElementSequence sequence,
EntityHandle  sequence_subset_start,
EntityHandle  sequence_subset_end,
bool  mid_edge_nodes,
bool  mid_face_nodes,
bool  mid_volume_nodes 
)
private

Definition at line 127 of file HigherOrderFactory.cpp.

133 {
134 
135  ErrorCode status = MB_SUCCESS;
136 
137  // lets make sure parameters are ok before we continue
138  switch( seq->type() )
139  {
140  default:
141  return MB_TYPE_OUT_OF_RANGE;
142  case MBEDGE:
143  mid_face_nodes = false;
144  mid_volume_nodes = false;
145  break;
146  case MBTRI:
147  case MBQUAD:
148  mid_volume_nodes = false;
149  break;
150  case MBTET:
151  case MBHEX:
152  case MBPRISM:
153  case MBPYRAMID:
154  case MBKNIFE:
155  break;
156  }
157 
158  // calculate number of nodes in target configuration
159  unsigned nodes_per_elem = CN::VerticesPerEntity( seq->type() );
160  if( mid_edge_nodes ) nodes_per_elem += ( seq->type() == MBEDGE ) ? 1 : CN::NumSubEntities( seq->type(), 1 );
161  if( mid_face_nodes )
162  nodes_per_elem += ( CN::Dimension( seq->type() ) == 2 ) ? 1 : CN::NumSubEntities( seq->type(), 2 );
163  if( mid_volume_nodes ) nodes_per_elem += 1;
164 
165  if( nodes_per_elem == seq->nodes_per_element() ) return MB_SUCCESS;
166 
167  Tag deletable_nodes;
168  status = mMB->tag_get_handle( 0, 1, MB_TYPE_BIT, deletable_nodes, MB_TAG_CREAT | MB_TAG_BIT );
169  if( MB_SUCCESS != status ) return status;
170 
171  UnstructuredElemSeq* new_seq = new UnstructuredElemSeq( start, end - start + 1, nodes_per_elem, end - start + 1 );
172 
173  copy_corner_nodes( seq, new_seq );
174 
175  if( seq->has_mid_edge_nodes() && mid_edge_nodes )
176  status = copy_mid_edge_nodes( seq, new_seq );
177  else if( seq->has_mid_edge_nodes() && !mid_edge_nodes )
178  status = remove_mid_edge_nodes( seq, start, end, deletable_nodes );
179  else if( !seq->has_mid_edge_nodes() && mid_edge_nodes )
180  status = zero_mid_edge_nodes( new_seq );
181  if( MB_SUCCESS != status ) return status;
182 
183  if( seq->has_mid_face_nodes() && mid_face_nodes )
184  status = copy_mid_face_nodes( seq, new_seq );
185  else if( seq->has_mid_face_nodes() && !mid_face_nodes )
186  status = remove_mid_face_nodes( seq, start, end, deletable_nodes );
187  else if( !seq->has_mid_face_nodes() && mid_face_nodes )
188  status = zero_mid_face_nodes( new_seq );
189  if( MB_SUCCESS != status )
190  {
191  mMB->tag_delete( deletable_nodes );
192  return status;
193  }
194 
195  if( seq->has_mid_volume_nodes() && mid_volume_nodes )
196  status = copy_mid_volume_nodes( seq, new_seq );
197  else if( seq->has_mid_volume_nodes() && !mid_volume_nodes )
198  status = remove_mid_volume_nodes( seq, start, end, deletable_nodes );
199  else if( !seq->has_mid_volume_nodes() && mid_volume_nodes )
200  status = zero_mid_volume_nodes( new_seq );
201  if( MB_SUCCESS != status )
202  {
203  mMB->tag_delete( deletable_nodes );
204  return status;
205  }
206 
207  // gather nodes that were marked
208  Range nodes;
209  mMB->get_entities_by_type_and_tag( 0, MBVERTEX, &deletable_nodes, NULL, 1, nodes );
210 
211  // EntityHandle low_meshset;
212  // int dum;
213  // low_meshset = CREATE_HANDLE(MBENTITYSET, 0, dum);
214 
215  for( Range::iterator iter = nodes.begin(); iter != nodes.end(); ++iter )
216  {
217  unsigned char marked = 0;
218  mMB->tag_get_data( deletable_nodes, &( *iter ), 1, &marked );
219  if( marked )
220  {
221  // we can delete it
223  mMB->delete_entities( &( *iter ), 1 );
224  }
225  }
226 
227  const bool create_midedge = !seq->has_mid_edge_nodes() && mid_edge_nodes;
228  const bool create_midface = !seq->has_mid_face_nodes() && mid_face_nodes;
229  const bool create_midvolm = !seq->has_mid_volume_nodes() && mid_volume_nodes;
230 
231  mMB->tag_delete( deletable_nodes );
232 
233  status = mMB->sequence_manager()->replace_subsequence( new_seq );
234  if( MB_SUCCESS != status )
235  {
236  SequenceData* data = new_seq->data();
237  delete new_seq;
238  delete data;
239  return status;
240  }
241 
242  if( create_midedge )
243  {
244  status = add_mid_edge_nodes( new_seq );
245  if( MB_SUCCESS != status ) return status;
246  }
247  if( create_midface )
248  {
249  status = add_mid_face_nodes( new_seq );
250  if( MB_SUCCESS != status ) return status;
251  }
252  if( create_midvolm )
253  {
254  status = add_mid_volume_nodes( new_seq );
255  if( MB_SUCCESS != status ) return status;
256  }
257 
258  return status;
259 }

References add_mid_edge_nodes(), add_mid_face_nodes(), add_mid_volume_nodes(), moab::Range::begin(), copy_corner_nodes(), copy_mid_edge_nodes(), copy_mid_face_nodes(), copy_mid_volume_nodes(), moab::EntitySequence::data(), moab::Core::delete_entities(), moab::CN::Dimension(), moab::Range::end(), ErrorCode, moab::Core::get_entities_by_type_and_tag(), moab::ElementSequence::has_mid_edge_nodes(), moab::ElementSequence::has_mid_face_nodes(), moab::ElementSequence::has_mid_volume_nodes(), MB_SUCCESS, MB_TAG_BIT, MB_TAG_CREAT, MB_TYPE_BIT, MB_TYPE_OUT_OF_RANGE, MBEDGE, MBHEX, MBKNIFE, MBPRISM, MBPYRAMID, MBQUAD, MBTET, MBTRI, MBVERTEX, mHONodeAddedRemoved, mMB, moab::Interface::HONodeAddedRemoved::node_removed(), moab::ElementSequence::nodes_per_element(), moab::CN::NumSubEntities(), remove_mid_edge_nodes(), remove_mid_face_nodes(), remove_mid_volume_nodes(), moab::SequenceManager::replace_subsequence(), moab::Core::sequence_manager(), moab::Core::tag_delete(), moab::Core::tag_get_data(), moab::Core::tag_get_handle(), moab::EntitySequence::type(), moab::CN::VerticesPerEntity(), zero_mid_edge_nodes(), zero_mid_face_nodes(), and zero_mid_volume_nodes().

Referenced by convert().

◆ copy_corner_nodes()

ErrorCode moab::HigherOrderFactory::copy_corner_nodes ( ElementSequence src,
ElementSequence dst 
)
private

Definition at line 613 of file HigherOrderFactory.cpp.

614 {
615  unsigned num_corners = CN::VerticesPerEntity( src->type() );
616  return copy_nodes( src, dst, num_corners, 0, 0 );
617 }

References copy_nodes(), moab::EntitySequence::type(), and moab::CN::VerticesPerEntity().

Referenced by convert_sequence().

◆ copy_mid_edge_nodes()

ErrorCode moab::HigherOrderFactory::copy_mid_edge_nodes ( ElementSequence src,
ElementSequence dst 
)
private

Definition at line 619 of file HigherOrderFactory.cpp.

620 {
621  if( !src->has_mid_edge_nodes() || !dst->has_mid_edge_nodes() ) return MB_FAILURE;
622 
623  unsigned num_corners = CN::VerticesPerEntity( src->type() );
624  unsigned num_edges = ( src->type() == MBEDGE ) ? 1 : CN::NumSubEntities( src->type(), 1 );
625  return copy_nodes( src, dst, num_edges, num_corners, num_corners );
626 }

References copy_nodes(), moab::ElementSequence::has_mid_edge_nodes(), MBEDGE, moab::CN::NumSubEntities(), moab::EntitySequence::type(), and moab::CN::VerticesPerEntity().

Referenced by convert_sequence().

◆ copy_mid_face_nodes()

ErrorCode moab::HigherOrderFactory::copy_mid_face_nodes ( ElementSequence src,
ElementSequence dst 
)
private

Definition at line 637 of file HigherOrderFactory.cpp.

638 {
639  if( !src->has_mid_face_nodes() || !dst->has_mid_face_nodes() ) return MB_FAILURE;
640 
641  unsigned src_offset = CN::VerticesPerEntity( src->type() );
642  unsigned dst_offset = src_offset;
643  if( src->has_mid_edge_nodes() ) src_offset += CN::NumSubEntities( src->type(), 1 );
644  if( dst->has_mid_edge_nodes() ) dst_offset += CN::NumSubEntities( dst->type(), 1 );
645  unsigned num_faces = ( CN::Dimension( src->type() ) == 2 ) ? 1 : CN::NumSubEntities( src->type(), 2 );
646  return copy_nodes( src, dst, num_faces, src_offset, dst_offset );
647 }

References copy_nodes(), moab::CN::Dimension(), moab::ElementSequence::has_mid_edge_nodes(), moab::ElementSequence::has_mid_face_nodes(), moab::CN::NumSubEntities(), moab::EntitySequence::type(), and moab::CN::VerticesPerEntity().

Referenced by convert_sequence().

◆ copy_mid_volume_nodes()

ErrorCode moab::HigherOrderFactory::copy_mid_volume_nodes ( ElementSequence src,
ElementSequence dst 
)
private

Definition at line 659 of file HigherOrderFactory.cpp.

660 {
661  if( !src->has_mid_volume_nodes() || !dst->has_mid_volume_nodes() ) return MB_FAILURE;
662 
663  unsigned src_offset = CN::VerticesPerEntity( src->type() );
664  unsigned dst_offset = src_offset;
665  if( src->has_mid_edge_nodes() ) src_offset += CN::NumSubEntities( src->type(), 1 );
666  if( dst->has_mid_edge_nodes() ) dst_offset += CN::NumSubEntities( dst->type(), 1 );
667  if( src->has_mid_face_nodes() ) src_offset += CN::NumSubEntities( src->type(), 2 );
668  if( dst->has_mid_face_nodes() ) dst_offset += CN::NumSubEntities( dst->type(), 2 );
669  return copy_nodes( src, dst, 1, src_offset, dst_offset );
670 }

References copy_nodes(), moab::ElementSequence::has_mid_edge_nodes(), moab::ElementSequence::has_mid_face_nodes(), moab::ElementSequence::has_mid_volume_nodes(), moab::CN::NumSubEntities(), moab::EntitySequence::type(), and moab::CN::VerticesPerEntity().

Referenced by convert_sequence().

◆ copy_nodes()

ErrorCode moab::HigherOrderFactory::copy_nodes ( ElementSequence src,
ElementSequence dst,
unsigned  nodes_per_elem_to_copy,
unsigned  src_conn_offset,
unsigned  dst_conn_offset 
)
private

Definition at line 682 of file HigherOrderFactory.cpp.

687 {
688  if( src->type() != dst->type() ) return MB_FAILURE;
689 
690  unsigned src_stride = src->nodes_per_element();
691  unsigned dst_stride = dst->nodes_per_element();
692  EntityHandle* src_conn = src->get_connectivity_array();
693  EntityHandle* dst_conn = dst->get_connectivity_array();
694  if( !src_conn || !dst_conn ) return MB_FAILURE;
695 
696  if( dst->start_handle() < src->start_handle() || dst->end_handle() > src->end_handle() ) return MB_FAILURE;
697 
698  src_conn += ( dst->start_handle() - src->start_handle() ) * src_stride;
699  EntityID count = dst->size();
700  for( EntityID i = 0; i < count; ++i )
701  {
702  for( unsigned j = 0; j < nodes_per_elem; ++j )
703  dst_conn[j + dst_offset] = src_conn[j + src_offset];
704  src_conn += src_stride;
705  dst_conn += dst_stride;
706  }
707 
708  return MB_SUCCESS;
709 }

References moab::EntitySequence::end_handle(), moab::ElementSequence::get_connectivity_array(), MB_SUCCESS, moab::ElementSequence::nodes_per_element(), moab::EntitySequence::size(), moab::EntitySequence::start_handle(), and moab::EntitySequence::type().

Referenced by copy_corner_nodes(), copy_mid_edge_nodes(), copy_mid_face_nodes(), and copy_mid_volume_nodes().

◆ initialize_map()

void moab::HigherOrderFactory::initialize_map ( )
private

Definition at line 48 of file HigherOrderFactory.cpp.

49 {
50  // if(mMapInitialized)
51  // return;
52 
53  for( EntityType i = MBVERTEX; i < MBMAXTYPE; i++ )
54  {
55  const CN::ConnMap& canon_map = CN::mConnectivityMap[i][0];
56  unsigned char( &this_map )[8][8] = mNodeMap[i];
57  int num_node = CN::VerticesPerEntity( i );
58  for( int j = 0; j < canon_map.num_sub_elements; j++ )
59  {
60  unsigned char x = canon_map.conn[j][0];
61  unsigned char y = canon_map.conn[j][1];
62  this_map[x][y] = num_node;
63  this_map[y][x] = num_node;
64  num_node++;
65  }
66  }
67 
68  // mMapInitialized = true;
69 }

References moab::CN::ConnMap::conn, MBMAXTYPE, MBVERTEX, moab::CN::mConnectivityMap, mNodeMap, moab::CN::ConnMap::num_sub_elements, and moab::CN::VerticesPerEntity().

Referenced by HigherOrderFactory().

◆ remove_ho_nodes()

ErrorCode moab::HigherOrderFactory::remove_ho_nodes ( ElementSequence seq,
EntityHandle  start,
EntityHandle  end,
int  nodes_per_elem,
int  elem_conn_offset,
Tag  deletable_nodes 
)
private

MOAB, a Mesh-Oriented datABase, is a software component for creating, storing and accessing finite element mesh data.

Copyright 2004 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

Definition at line 794 of file HigherOrderFactory.cpp.

800 {
801  if( start < seq->start_handle() || end > seq->end_handle() ) return MB_ENTITY_NOT_FOUND;
802  EntityHandle* array = seq->get_connectivity_array();
803  if( !array ) return MB_NOT_IMPLEMENTED;
804 
805  std::set< EntityHandle > nodes_processed;
806  for( EntityHandle i = start; i <= end; ++i )
807  { // for each element
808  for( int j = 0; j < nodes_per_elem; ++j )
809  { // for each HO node to remove
810  const EntityID elem = ( i - seq->start_handle() ); // element index
811  const int conn_idx = j + elem_conn_offset;
812  const EntityID index = elem * seq->nodes_per_element() + conn_idx;
813  if( array[index] && nodes_processed.insert( array[index] ).second )
814  {
815  if( tag_for_deletion( i, conn_idx, seq ) )
816  {
817  unsigned char bit = 0x1;
818  mMB->tag_set_data( deletable_nodes, &( array[index] ), 1, &bit );
819  }
820  }
821  }
822  }
823 
824  return MB_SUCCESS;
825 }

References moab::EntitySequence::end_handle(), moab::ElementSequence::get_connectivity_array(), MB_ENTITY_NOT_FOUND, MB_NOT_IMPLEMENTED, MB_SUCCESS, mMB, moab::ElementSequence::nodes_per_element(), moab::EntitySequence::start_handle(), tag_for_deletion(), and moab::Core::tag_set_data().

Referenced by remove_mid_edge_nodes(), remove_mid_face_nodes(), and remove_mid_volume_nodes().

◆ remove_mid_edge_nodes()

ErrorCode moab::HigherOrderFactory::remove_mid_edge_nodes ( ElementSequence seq,
EntityHandle  start,
EntityHandle  stop,
Tag  deletable_ndoes 
)
private

Definition at line 727 of file HigherOrderFactory.cpp.

731 {
732  int count;
733  int offset;
734  if( seq->type() == MBEDGE )
735  {
736  count = 1;
737  offset = 2;
738  }
739  else
740  {
741  count = CN::NumSubEntities( seq->type(), 1 );
742  offset = CN::VerticesPerEntity( seq->type() );
743  }
744 
745  return remove_ho_nodes( seq, start, end, count, offset, deletable_nodes );
746 }

References MBEDGE, moab::CN::NumSubEntities(), remove_ho_nodes(), moab::EntitySequence::type(), and moab::CN::VerticesPerEntity().

Referenced by convert_sequence().

◆ remove_mid_face_nodes()

ErrorCode moab::HigherOrderFactory::remove_mid_face_nodes ( ElementSequence seq,
EntityHandle  start,
EntityHandle  stop,
Tag  deletable_ndoes 
)
private

Definition at line 748 of file HigherOrderFactory.cpp.

752 {
753  int count;
754  if( CN::Dimension( seq->type() ) == 2 )
755  count = 1;
756  else
757  count = CN::NumSubEntities( seq->type(), 2 );
758  int offset = CN::VerticesPerEntity( seq->type() );
759  if( seq->has_mid_edge_nodes() ) offset += CN::NumSubEntities( seq->type(), 1 );
760 
761  return remove_ho_nodes( seq, start, end, count, offset, deletable_nodes );
762 }

References moab::CN::Dimension(), moab::ElementSequence::has_mid_edge_nodes(), moab::CN::NumSubEntities(), remove_ho_nodes(), moab::EntitySequence::type(), and moab::CN::VerticesPerEntity().

Referenced by convert_sequence().

◆ remove_mid_volume_nodes()

ErrorCode moab::HigherOrderFactory::remove_mid_volume_nodes ( ElementSequence seq,
EntityHandle  start,
EntityHandle  stop,
Tag  deletable_ndoes 
)
private

Definition at line 764 of file HigherOrderFactory.cpp.

768 {
769  int offset = CN::VerticesPerEntity( seq->type() );
770  if( seq->has_mid_edge_nodes() ) offset += CN::NumSubEntities( seq->type(), 1 );
771  if( seq->has_mid_face_nodes() ) offset += CN::NumSubEntities( seq->type(), 2 );
772 
773  return remove_ho_nodes( seq, start, end, 1, offset, deletable_nodes );
774 }

References moab::ElementSequence::has_mid_edge_nodes(), moab::ElementSequence::has_mid_face_nodes(), moab::CN::NumSubEntities(), remove_ho_nodes(), moab::EntitySequence::type(), and moab::CN::VerticesPerEntity().

Referenced by convert_sequence().

◆ tag_for_deletion()

bool moab::HigherOrderFactory::tag_for_deletion ( EntityHandle  element_with_node,
int  node_index_in_elem_connectivity,
ElementSequence sequence 
)
private

Definition at line 827 of file HigherOrderFactory.cpp.

828 {
829  // get type of this sequence
830  EntityType this_type = seq->type();
831 
832  // get dimension of 'parent' element
833  int this_dimension = mMB->dimension_from_handle( parent_handle );
834 
835  // tells us if higher order node is on
836  int dimension, side_number;
837  CN::HONodeParent( this_type, seq->nodes_per_element(), conn_index, dimension, side_number );
838 
839  // it MUST be a higher-order node
840  bool delete_node = false;
841 
842  assert( dimension != -1 );
843  assert( side_number != -1 );
844 
845  // could be a mid-volume/face/edge node on a hex/face/edge respectively
846  // if so...delete it bc/ no one else owns it too
847  std::vector< EntityHandle > connectivity;
848  if( dimension == this_dimension && side_number == 0 )
849  delete_node = true;
850  else // the node could also be on a lower order entity of 'tmp_entity'
851  {
852  // get 'side' of 'parent_handle' that node is on
853  EntityHandle target_entity = 0;
854  mMB->side_element( parent_handle, dimension, side_number, target_entity );
855 
856  if( target_entity )
857  {
858  AEntityFactory* a_fact = mMB->a_entity_factory();
859  EntityHandle low_meshset;
860  int dum;
861  low_meshset = CREATE_HANDLE( MBENTITYSET, 0, dum );
862 
863  // just get corner nodes of target_entity
864  connectivity.clear();
865  ErrorCode rval;
866  rval = mMB->get_connectivity( &( target_entity ), 1, connectivity, true );MB_CHK_ERR( rval );
867 
868  // for each node, get all common adjacencies of nodes in 'parent_handle'
869  std::vector< EntityHandle > adj_list_1, adj_list_2, adj_entities;
870  a_fact->get_adjacencies( connectivity[0], adj_list_1 );
871 
872  // remove meshsets
873  adj_list_1.erase(
874  std::remove_if( adj_list_1.begin(), adj_list_1.end(),
875  std::bind( std::greater< EntityHandle >(), std::placeholders::_1, low_meshset ) ),
876  adj_list_1.end() );
877  // std::bind2nd(std::greater<EntityHandle>(),low_meshset)), adj_list_1.end());
878  // https://stackoverflow.com/questions/32739018/a-replacement-for-stdbind2nd
879 
880  size_t i;
881  for( i = 1; i < connectivity.size(); i++ )
882  {
883  adj_list_2.clear();
884  a_fact->get_adjacencies( connectivity[i], adj_list_2 );
885 
886  // remove meshsets
887  adj_list_2.erase(
888  std::remove_if( adj_list_2.begin(), adj_list_2.end(),
889  std::bind( std::greater< EntityHandle >(), std::placeholders::_1, low_meshset ) ),
890  adj_list_2.end() );
891  // std::bind2nd(std::greater<EntityHandle>(),low_meshset)), adj_list_2.end());
892  // https://stackoverflow.com/questions/32739018/a-replacement-for-stdbind2nd
893 
894  // intersect the 2 lists
895  adj_entities.clear();
896  std::set_intersection( adj_list_1.begin(), adj_list_1.end(), adj_list_2.begin(), adj_list_2.end(),
897  std::back_inserter< std::vector< EntityHandle > >( adj_entities ) );
898  adj_list_1.clear();
899  adj_list_1 = adj_entities;
900  }
901 
902  assert( adj_entities.size() ); // has to have at least one adjacency
903 
904  // see if node is in other elements, not in this sequence...if so, delete it
905  for( i = 0; i < adj_entities.size(); i++ )
906  {
907  if( adj_entities[i] >= seq->start_handle() && adj_entities[i] <= seq->end_handle() )
908  {
909  delete_node = false;
910  break;
911  }
912  else
913  delete_node = true;
914  }
915  }
916  else // there is no lower order entity that also contains node
917  delete_node = true;
918  }
919 
920  return delete_node;
921 }

References moab::Core::a_entity_factory(), moab::CREATE_HANDLE(), moab::Core::dimension_from_handle(), moab::dum, moab::EntitySequence::end_handle(), ErrorCode, moab::AEntityFactory::get_adjacencies(), moab::Core::get_connectivity(), moab::CN::HONodeParent(), MB_CHK_ERR, MBENTITYSET, mMB, moab::ElementSequence::nodes_per_element(), moab::Core::side_element(), moab::side_number(), moab::EntitySequence::start_handle(), and moab::EntitySequence::type().

Referenced by remove_ho_nodes().

◆ zero_mid_edge_nodes()

ErrorCode moab::HigherOrderFactory::zero_mid_edge_nodes ( ElementSequence dst)
private

Definition at line 628 of file HigherOrderFactory.cpp.

629 {
630  if( !dst->has_mid_edge_nodes() ) return MB_FAILURE;
631 
632  unsigned num_corners = CN::VerticesPerEntity( dst->type() );
633  unsigned num_edges = ( dst->type() == MBEDGE ) ? 1 : CN::NumSubEntities( dst->type(), 1 );
634  return zero_nodes( dst, num_edges, num_corners );
635 }

References moab::ElementSequence::has_mid_edge_nodes(), MBEDGE, moab::CN::NumSubEntities(), moab::EntitySequence::type(), moab::CN::VerticesPerEntity(), and zero_nodes().

Referenced by convert_sequence().

◆ zero_mid_face_nodes()

ErrorCode moab::HigherOrderFactory::zero_mid_face_nodes ( ElementSequence dst)
private

Definition at line 649 of file HigherOrderFactory.cpp.

650 {
651  if( !dst->has_mid_face_nodes() ) return MB_FAILURE;
652 
653  unsigned dst_offset = CN::VerticesPerEntity( dst->type() );
654  if( dst->has_mid_edge_nodes() ) dst_offset += CN::NumSubEntities( dst->type(), 1 );
655  unsigned num_faces = ( CN::Dimension( dst->type() ) == 2 ) ? 1 : CN::NumSubEntities( dst->type(), 2 );
656  return zero_nodes( dst, num_faces, dst_offset );
657 }

References moab::CN::Dimension(), moab::ElementSequence::has_mid_edge_nodes(), moab::ElementSequence::has_mid_face_nodes(), moab::CN::NumSubEntities(), moab::EntitySequence::type(), moab::CN::VerticesPerEntity(), and zero_nodes().

Referenced by convert_sequence().

◆ zero_mid_volume_nodes()

ErrorCode moab::HigherOrderFactory::zero_mid_volume_nodes ( ElementSequence dst)
private

Definition at line 672 of file HigherOrderFactory.cpp.

673 {
674  if( !dst->has_mid_volume_nodes() ) return MB_FAILURE;
675 
676  unsigned dst_offset = CN::VerticesPerEntity( dst->type() );
677  if( dst->has_mid_edge_nodes() ) dst_offset += CN::NumSubEntities( dst->type(), 1 );
678  if( dst->has_mid_face_nodes() ) dst_offset += CN::NumSubEntities( dst->type(), 2 );
679  return zero_nodes( dst, 1, dst_offset );
680 }

References moab::ElementSequence::has_mid_edge_nodes(), moab::ElementSequence::has_mid_face_nodes(), moab::ElementSequence::has_mid_volume_nodes(), moab::CN::NumSubEntities(), moab::EntitySequence::type(), moab::CN::VerticesPerEntity(), and zero_nodes().

Referenced by convert_sequence().

◆ zero_nodes()

ErrorCode moab::HigherOrderFactory::zero_nodes ( ElementSequence dst,
unsigned  nodes_per_elem_to_zero,
unsigned  dst_conn_offset 
)
private

Definition at line 711 of file HigherOrderFactory.cpp.

712 {
713  unsigned dst_stride = dst->nodes_per_element();
714  EntityHandle* dst_conn = dst->get_connectivity_array();
715  if( !dst_conn ) return MB_FAILURE;
716 
717  EntityID count = dst->size();
718  for( EntityID i = 0; i < count; ++i )
719  {
720  std::fill( dst_conn + offset, dst_conn + offset + nodes_per_elem, 0 );
721  dst_conn += dst_stride;
722  }
723 
724  return MB_SUCCESS;
725 }

References moab::ElementSequence::get_connectivity_array(), MB_SUCCESS, moab::ElementSequence::nodes_per_element(), and moab::EntitySequence::size().

Referenced by zero_mid_edge_nodes(), zero_mid_face_nodes(), and zero_mid_volume_nodes().

Member Data Documentation

◆ mHONodeAddedRemoved

Interface::HONodeAddedRemoved* moab::HigherOrderFactory::mHONodeAddedRemoved
private

◆ mMB

◆ mNodeMap

unsigned char moab::HigherOrderFactory::mNodeMap[MBMAXTYPE][8][8]

Definition at line 54 of file HigherOrderFactory.hpp.

Referenced by add_center_node(), center_node_exist(), and initialize_map().


The documentation for this class was generated from the following files: