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

#include <ScdInterface.hpp>

+ Collaboration diagram for moab::ScdBox:

Public Member Functions

 ~ScdBox ()
 Destructor. More...
 
ScdInterfacesc_impl () const
 Return the ScdInterface responsible for this box. More...
 
ErrorCode add_vbox (ScdBox *vbox, HomCoord from1, HomCoord to1, HomCoord from2, HomCoord to2, HomCoord from3, HomCoord to3, bool bb_input=false, const HomCoord &bb_min=HomCoord::getUnitv(0), const HomCoord &bb_max=HomCoord::getUnitv(0))
 Add a vertex box to this box. More...
 
bool boundary_complete () const
 Return whether this box has all its vertices defined. More...
 
int box_dimension () const
 Return highest topological dimension of box. More...
 
EntityHandle start_vertex () const
 Starting vertex handle for this box. More...
 
EntityHandle start_element () const
 Starting entity handle for this box. More...
 
int num_elements () const
 Return the number of elements in the box. More...
 
int num_vertices () const
 Return the number of vertices in the box. More...
 
const int * box_dims () const
 Return the parametric coordinates for this box. More...
 
HomCoord box_min () const
 Return the lower corner parametric coordinates for this box. More...
 
HomCoord box_max () const
 Return the upper corner parametric coordinates for this box. More...
 
HomCoord box_size () const
 Return the parameter extents for this box. More...
 
void box_size (int *ijk) const
 Return the parametric extents for this box. More...
 
void box_size (int &i, int &j, int &k) const
 Return the parametric extents for this box. More...
 
EntityHandle get_element (const HomCoord &ijk) const
 Get the element at the specified coordinates. More...
 
EntityHandle get_element (int i, int j=0, int k=0) const
 Get the element at the specified coordinates. More...
 
EntityHandle get_vertex (const HomCoord &ijk) const
 Get the vertex at the specified coordinates. More...
 
EntityHandle get_vertex (int i, int j=0, int k=0) const
 Get the vertex at the specified coordinates. More...
 
ErrorCode get_params (EntityHandle ent, int &i, int &j, int &k, int &dir) const
 Get parametric coordinates of the specified entity. More...
 
ErrorCode get_params (EntityHandle ent, int &i, int &j, int &k) const
 Get parametric coordinates of the specified entity, intermediate entities not allowed (no dir parameter) More...
 
ErrorCode get_params (EntityHandle ent, HomCoord &ijkd) const
 Get parametric coordinates of the specified entity. More...
 
ErrorCode get_adj_edge_or_face (int dim, int i, int j, int k, int dir, EntityHandle &ent, bool create_if_missing=true) const
 Get the adjacent edge or face at a parametric location This function gets the left (i=0), front (j=0), or bottom (k=0) edge or face for a parametric element. Left, front, or bottom is indicated by dir = 0, 1, or 2, resp. All edges and faces in a structured mesh block can be accessed using these parameters. More...
 
bool contains (int i, int j, int k) const
 Return whether the box contains the parameters passed in. More...
 
bool contains (const HomCoord &ijk) const
 Return whether the box contains the parameters passed in. More...
 
void box_set (EntityHandle this_set)
 Set/Get the entity set representing the box. More...
 
EntityHandle box_set ()
 
ErrorCode get_coordinate_arrays (double *&xc, double *&yc, double *&zc)
 Get coordinate arrays for vertex coordinates for a structured block. More...
 
ErrorCode get_coordinate_arrays (const double *&xc, const double *&yc, const double *&zc) const
 Get read-only coordinate arrays for vertex coordinates for a structured block. More...
 
bool locally_periodic_i () const
 Return whether box is locally periodic in i. More...
 
bool locally_periodic_j () const
 Return whether box is locally periodic in j. More...
 
bool locally_periodic_k () const
 Return whether box is locally periodic in k. More...
 
void locally_periodic (bool lperiodic[3])
 Set local periodicity. More...
 
const int * locally_periodic () const
 Get local periodicity. More...
 
ScdParDatapar_data ()
 Return parallel data. More...
 
const ScdParDatapar_data () const
 Return parallel data. More...
 
void par_data (const ScdParData &par_datap)
 set parallel data More...
 

Private Member Functions

 ScdBox (ScdInterface *sc_impl, EntityHandle box_set, EntitySequence *seq1, EntitySequence *seq2=NULL)
 Constructor. More...
 
EntityHandle get_vertex_from_seq (int i, int j, int k) const
 function to get vertex handle directly from sequence More...
 
ErrorCode vert_dat (ScdVertexData *vert_dat)
 set the vertex sequence More...
 
ScdVertexDatavert_dat () const
 get the vertex sequence More...
 
ErrorCode elem_seq (EntitySequence *elem_seq)
 set the element sequence More...
 
StructuredElementSeqelem_seq () const
 get the element sequence More...
 
void start_vertex (EntityHandle startv)
 Set the starting vertex handle for this box. More...
 
void start_element (EntityHandle starte)
 Set the starting entity handle for this box. More...
 

Private Attributes

ScdInterfacescImpl
 interface instance More...
 
EntityHandle boxSet
 entity set representing this box More...
 
ScdVertexDatavertDat
 vertex sequence this box represents, if there's only one, otherwise they're retrieved from the element sequence More...
 
StructuredElementSeqelemSeq
 element sequence this box represents More...
 
EntityHandle startVertex
 starting vertex handle for this box More...
 
EntityHandle startElem
 starting element handle for this box More...
 
int boxDims [6]
 lower and upper corners More...
 
int locallyPeriodic [3]
 is locally periodic in i or j or k More...
 
ScdParData parData
 parallel data associated with this box, if any More...
 
HomCoord boxSize
 parameter extents More...
 
int boxSizeIJ
 convenience parameters, (boxSize[1]-1)*(boxSize[0]-1) and boxSize[0]-1 More...
 
int boxSizeIJM1
 
int boxSizeIM1
 

Friends

class ScdInterface
 

Detailed Description

Definition at line 506 of file ScdInterface.hpp.

Constructor & Destructor Documentation

◆ ~ScdBox()

moab::ScdBox::~ScdBox ( )

Destructor.

Definition at line 548 of file ScdInterface.cpp.

549 {
550  // Reset the tag on the set
551  if( boxSet )
552  {
553  // It is possible that the box set entity has been deleted (e.g. by
554  // Core::clean_up_failed_read)
555  Core* mbcore = dynamic_cast< Core* >( scImpl->mbImpl );
556  assert( mbcore != NULL );
557  if( mbcore->is_valid( boxSet ) )
558  {
559  ScdBox* tmp_ptr = NULL;
560  scImpl->mbImpl->tag_set_data( scImpl->box_set_tag(), &boxSet, 1, &tmp_ptr );
561  }
562  else
563  boxSet = 0;
564  }
565 
566  scImpl->remove_box( this );
567 }

References moab::ScdInterface::box_set_tag(), boxSet, moab::Core::is_valid(), moab::ScdInterface::mbImpl, moab::ScdInterface::remove_box(), scImpl, and moab::Interface::tag_set_data().

◆ ScdBox()

moab::ScdBox::ScdBox ( ScdInterface sc_impl,
EntityHandle  box_set,
EntitySequence seq1,
EntitySequence seq2 = NULL 
)
private

Constructor.

Create a structured box instance; this constructor is private because it should only be called from ScdInterface, a friend class. This constructor takes two sequences, one of which can be NULL. If both sequences come in non-NULL, the first should be a VertexSequence* corresponding to a structured vertex sequence and the second should be a StructuredElementSeq*. If the 2nd is NULL, the first can be either of those types. The other members of this class are taken from the sequences (e.g. parametric space) or the box set argument. Tags on the box set should be set from the caller.

Parameters
sc_implA ScdInterface instance
box_setEntity set representing this rectangle
seq1An EntitySequence (see ScdBox description)
seq2An EntitySequence (see ScdBox description), or NULL

Definition at line 474 of file ScdInterface.cpp.

475  : scImpl( impl ), boxSet( bset ), vertDat( NULL ), elemSeq( NULL ), startVertex( 0 ), startElem( 0 )
476 {
477  for( int i = 0; i < 6; i++ )
478  boxDims[i] = 0;
479  for( int i = 0; i < 3; i++ )
480  locallyPeriodic[i] = false;
481  VertexSequence* vseq = dynamic_cast< VertexSequence* >( seq1 );
482  if( vseq ) vertDat = dynamic_cast< ScdVertexData* >( vseq->data() );
483  if( vertDat )
484  {
485  // retrieve the parametric space
486  for( int i = 0; i < 3; i++ )
487  {
488  boxDims[i] = vertDat->min_params()[i];
489  boxDims[3 + i] = vertDat->max_params()[i];
490  }
492  }
493  else if( impl->boxDimsTag )
494  {
495  // look for parametric space info on set
496  ErrorCode rval = impl->mbImpl->tag_get_data( impl->boxDimsTag, &bset, 1, boxDims );
497  if( MB_SUCCESS == rval )
498  {
499  Range verts;
500  impl->mbImpl->get_entities_by_dimension( bset, 0, verts );
501  if( !verts.empty() ) startVertex = *verts.begin();
502  }
503  }
504 
505  elemSeq = dynamic_cast< StructuredElementSeq* >( seq2 );
506  if( !elemSeq ) elemSeq = dynamic_cast< StructuredElementSeq* >( seq1 );
507 
508  if( elemSeq )
509  {
510  if( vertDat )
511  {
512  // check the parametric space to make sure it's consistent
513  assert( elemSeq->sdata()->min_params() == HomCoord( boxDims, 3 ) &&
514  ( elemSeq->sdata()->max_params() + HomCoord( 1, 1, 1 ) ) == HomCoord( boxDims, 3 ) );
515  }
516  else
517  {
518  // get the parametric space from the element sequence
519  for( int i = 0; i < 3; i++ )
520  {
521  boxDims[i] = elemSeq->sdata()->min_params()[i];
522  boxDims[3 + i] = elemSeq->sdata()->max_params()[i];
523  }
524  }
525 
527  }
528  else
529  {
530  Range elems;
531  impl->mbImpl->get_entities_by_dimension(
532  bset, ( boxDims[2] == boxDims[5] ? ( boxDims[1] == boxDims[4] ? 1 : 2 ) : 3 ), elems );
533  if( !elems.empty() ) startElem = *elems.begin();
534  // call the following w/o looking at return value, since it doesn't really need to be there
535  if( impl->boxPeriodicTag ) impl->mbImpl->tag_get_data( impl->boxPeriodicTag, &bset, 1, locallyPeriodic );
536  }
537 
538  assert( vertDat || elemSeq || boxDims[0] != boxDims[3] || boxDims[1] != boxDims[4] || boxDims[2] != boxDims[5] );
539 
540  boxSize = HomCoord( boxDims + 3, 3 ) - HomCoord( boxDims, 3 ) + HomCoord( 1, 1, 1 );
541  boxSizeIJ = ( boxSize[1] ? boxSize[1] : 1 ) * boxSize[0];
542  boxSizeIM1 = boxSize[0] - ( locallyPeriodic[0] ? 0 : 1 );
543  boxSizeIJM1 = ( boxSize[1] ? ( boxSize[1] - ( locallyPeriodic[1] ? 0 : 1 ) ) : 1 ) * boxSizeIM1;
544 
545  scImpl->add_box( this );
546 }

References moab::ScdInterface::add_box(), moab::Range::begin(), boxDims, moab::ScdInterface::boxDimsTag, moab::ScdInterface::boxPeriodicTag, boxSize, boxSizeIJ, boxSizeIJM1, boxSizeIM1, moab::EntitySequence::data(), elemSeq, moab::Range::empty(), ErrorCode, moab::Interface::get_entities_by_dimension(), locallyPeriodic, moab::ScdElementData::max_params(), moab::ScdVertexData::max_params(), MB_SUCCESS, moab::ScdInterface::mbImpl, moab::ScdElementData::min_params(), moab::ScdVertexData::min_params(), scImpl, moab::StructuredElementSeq::sdata(), moab::EntitySequence::start_handle(), moab::SequenceData::start_handle(), startElem, startVertex, moab::Interface::tag_get_data(), and vertDat.

Member Function Documentation

◆ add_vbox()

ErrorCode moab::ScdBox::add_vbox ( ScdBox vbox,
HomCoord  from1,
HomCoord  to1,
HomCoord  from2,
HomCoord  to2,
HomCoord  from3,
HomCoord  to3,
bool  bb_input = false,
const HomCoord bb_min = HomCoord::getUnitv( 0 ),
const HomCoord bb_max = HomCoord::getUnitv( 0 ) 
)

Add a vertex box to this box.

Definition at line 580 of file ScdInterface.cpp.

590 {
591  if( !vbox->vertDat ) return MB_FAILURE;
592  ScdVertexData* dum_data = dynamic_cast< ScdVertexData* >( vbox->vertDat );
593  ErrorCode rval =
594  elemSeq->sdata()->add_vsequence( dum_data, from1, to1, from2, to2, from3, to3, bb_input, bb_min, bb_max );
595  return rval;
596 }

References moab::ScdElementData::add_vsequence(), elemSeq, ErrorCode, moab::StructuredElementSeq::sdata(), and vertDat.

Referenced by moab::ScdInterface::construct_box().

◆ boundary_complete()

bool moab::ScdBox::boundary_complete ( ) const

Return whether this box has all its vertices defined.

Tests whether vertex boxs added with add_vbox have completely defined the vertex parametric space for this box.

Definition at line 598 of file ScdInterface.cpp.

599 {
600  return elemSeq->boundary_complete();
601 }

References moab::StructuredElementSeq::boundary_complete(), and elemSeq.

Referenced by moab::ScdNCHelper::create_mesh().

◆ box_dimension()

int moab::ScdBox::box_dimension ( ) const
inline

Return highest topological dimension of box.

Definition at line 575 of file ScdInterface.cpp.

576 {
577  return ( startElem ? scImpl->mbImpl->dimension_from_handle( startElem ) : -1 );
578 }

References moab::Interface::dimension_from_handle(), moab::ScdInterface::mbImpl, scImpl, and startElem.

Referenced by get_params(), and moab::ScdInterface::tag_shared_vertices().

◆ box_dims()

const int * moab::ScdBox::box_dims ( ) const
inline

Return the parametric coordinates for this box.

Returns
IJK parameters of lower and upper corners

Definition at line 1520 of file ScdInterface.hpp.

1521 {
1522  return boxDims;
1523 }

References boxDims.

Referenced by moab::ScdInterface::assign_global_ids(), and moab::ScdInterface::get_shared_vertices().

◆ box_max()

HomCoord moab::ScdBox::box_max ( ) const
inline

Return the upper corner parametric coordinates for this box.

Definition at line 1530 of file ScdInterface.hpp.

1531 {
1532  return HomCoord( boxDims + 3, 3 );
1533 }

References boxDims.

Referenced by moab::Skinner::skin_box().

◆ box_min()

HomCoord moab::ScdBox::box_min ( ) const
inline

Return the lower corner parametric coordinates for this box.

Definition at line 1525 of file ScdInterface.hpp.

1526 {
1527  return HomCoord( boxDims, 3 );
1528 }

References boxDims.

Referenced by moab::Skinner::skin_box().

◆ box_set() [1/2]

EntityHandle moab::ScdBox::box_set ( )
inline

Definition at line 1594 of file ScdInterface.hpp.

1595 {
1596  return boxSet;
1597 }

References boxSet.

◆ box_set() [2/2]

void moab::ScdBox::box_set ( EntityHandle  this_set)
inline

Set/Get the entity set representing the box.

Definition at line 1589 of file ScdInterface.hpp.

1590 {
1591  boxSet = this_set;
1592 }

References boxSet.

Referenced by moab::ScdInterface::construct_box(), moab::ScdNCHelper::create_mesh(), and moab::ScdInterface::tag_shared_vertices().

◆ box_size() [1/3]

HomCoord moab::ScdBox::box_size ( ) const
inline

Return the parameter extents for this box.

Definition at line 1535 of file ScdInterface.hpp.

1536 {
1537  return boxSize;
1538 }

References boxSize.

Referenced by moab::ScdInterface::construct_box().

◆ box_size() [2/3]

void moab::ScdBox::box_size ( int &  i,
int &  j,
int &  k 
) const
inline

Return the parametric extents for this box.

Parameters
iI extent of this box
jJ extent of this box
kK extent of this box

Definition at line 1547 of file ScdInterface.hpp.

1548 {
1549  i = boxSize[0];
1550  j = boxSize[1];
1551  k = boxSize[2];
1552 }

References boxSize.

◆ box_size() [3/3]

void moab::ScdBox::box_size ( int *  ijk) const
inline

Return the parametric extents for this box.

Parameters
ijkIJK extents of this box

Definition at line 1540 of file ScdInterface.hpp.

1541 {
1542  ijk[0] = boxSize[0];
1543  ijk[1] = boxSize[1];
1544  ijk[2] = boxSize[2];
1545 }

References boxSize.

◆ contains() [1/2]

bool moab::ScdBox::contains ( const HomCoord ijk) const
inline

Return whether the box contains the parameters passed in.

Parameters
iParametric coordinates being evaluated
jParametric coordinates being evaluated
kParametric coordinates being evaluated

Definition at line 1579 of file ScdInterface.hpp.

1580 {
1581  return ( ijk >= HomCoord( boxDims, 3 ) && ijk <= HomCoord( boxDims + 3, 3 ) );
1582 }

References boxDims.

◆ contains() [2/2]

bool moab::ScdBox::contains ( int  i,
int  j,
int  k 
) const
inline

Return whether the box contains the parameters passed in.

Parameters
iParametric coordinates being evaluated
jParametric coordinates being evaluated
kParametric coordinates being evaluated

Definition at line 1584 of file ScdInterface.hpp.

1585 {
1586  return contains( HomCoord( i, j, k ) );
1587 }

◆ elem_seq() [1/2]

StructuredElementSeq * moab::ScdBox::elem_seq ( ) const
inlineprivate

get the element sequence

Definition at line 1604 of file ScdInterface.hpp.

1605 {
1606  return elemSeq;
1607 }

References elemSeq.

◆ elem_seq() [2/2]

ErrorCode moab::ScdBox::elem_seq ( EntitySequence elem_seq)
private

set the element sequence

Definition at line 628 of file ScdInterface.cpp.

629 {
630  elemSeq = dynamic_cast< StructuredElementSeq* >( elem_sq );
632 
633  if( locallyPeriodic[0] ) boxSizeIM1 = boxSize[0] - ( locallyPeriodic[0] ? 0 : 1 );
634  if( locallyPeriodic[0] || locallyPeriodic[1] )
635  boxSizeIJM1 = ( boxSize[1] ? ( boxSize[1] - ( locallyPeriodic[1] ? 0 : 1 ) ) : 1 ) * boxSizeIM1;
636 
637  return ( elemSeq ? MB_SUCCESS : MB_FAILURE );
638 }

References boxSize, boxSizeIJM1, boxSizeIM1, elemSeq, moab::StructuredElementSeq::is_periodic(), locallyPeriodic, and MB_SUCCESS.

Referenced by moab::ScdInterface::construct_box().

◆ get_adj_edge_or_face()

ErrorCode moab::ScdBox::get_adj_edge_or_face ( int  dim,
int  i,
int  j,
int  k,
int  dir,
EntityHandle ent,
bool  create_if_missing = true 
) const

Get the adjacent edge or face at a parametric location This function gets the left (i=0), front (j=0), or bottom (k=0) edge or face for a parametric element. Left, front, or bottom is indicated by dir = 0, 1, or 2, resp. All edges and faces in a structured mesh block can be accessed using these parameters.

Get the entity of specified dimension adjacent to parametric element.

Parameters
dimDimension of adjacent entity being requested
iParametric coordinates of cell being evaluated
jParametric coordinates of cell being evaluated
kParametric coordinates of cell being evaluated
dirDirection (0, 1, or 2), for getting adjacent edges (2d, 3d) or faces (3d)
entEntity returned from this function
create_if_missingIf true, creates the entity if it doesn't already exist
dimDimension of adjacent entity being requested
iParametric coordinates of cell being evaluated
jParametric coordinates of cell being evaluated
kParametric coordinates of cell being evaluated
dirDirection (0, 1, or 2), for getting adjacent edges (2d, 3d) or faces (3d)
entEntityHandle of adjacent entity
create_if_missingIf true, creates the entity if it doesn't already exist

Definition at line 669 of file ScdInterface.cpp.

676 {
677  // describe connectivity of sub-element in static array
678  // subconnect[dim-1][dir][numv][ijk] where dimensions are:
679  // [dim-1]: dim=1 or 2, so this is 0 or 1
680  // [dir]: one of 0..2, for ijk directions in a hex
681  // [numv]: number of vertices describing sub entity = 2*dim <= 4
682  // [ijk]: 3 values for i, j, k
683  int subconnect[2][3][4][3] = { { { { 0, 0, 0 }, { 1, 0, 0 }, { -1, -1, -1 }, { -1, -1, -1 } }, // i edge
684  { { 0, 0, 0 }, { 0, 1, 0 }, { -1, -1, -1 }, { -1, -1, -1 } }, // j edge
685  { { 0, 0, 0 }, { 0, 0, 1 }, { -1, -1, -1 }, { -1, -1, -1 } } }, // k edge
686 
687  { { { 0, 0, 0 }, { 0, 1, 0 }, { 0, 1, 1 }, { 0, 0, 1 } }, // i face
688  { { 0, 0, 0 }, { 1, 0, 0 }, { 1, 0, 1 }, { 0, 0, 1 } }, // j face
689  { { 0, 0, 0 }, { 1, 0, 0 }, { 1, 1, 0 }, { 0, 1, 0 } } } }; // k face
690 
691  // check proper input dimensions and lower bound
692  if( dim < 1 || dim > 2 || i < boxDims[0] || j < boxDims[1] || k < boxDims[2] ) return MB_FAILURE;
693 
694  // now check upper bound; parameters must be <= upper corner, since edges/faces
695  // follow element parameterization, not vertex parameterization
696  else if( ( boxDims[3] != boxDims[0] && i > ( locallyPeriodic[0] ? boxDims[3] + 1 : boxDims[3] ) ) ||
697  ( boxDims[4] != boxDims[1] && j > ( locallyPeriodic[1] ? boxDims[4] + 1 : boxDims[4] ) ) ||
698  ( boxDims[5] != boxDims[2] && k > boxDims[5] ) )
699  return MB_FAILURE;
700 
701  // get the vertices making up this entity
702  EntityHandle verts[4];
703  for( int ind = 0; ind < 2 * dim; ind++ )
704  {
705  int i1 = i + subconnect[dim - 1][dir][ind][0];
706  int j1 = j + subconnect[dim - 1][dir][ind][1];
707  // if periodic in i and i1 is boxDims[3]+1, wrap around
708  if( locallyPeriodic[0] && i1 == boxDims[3] + 1 ) i1 = boxDims[0];
709  // if periodic in j and j1 is boxDims[4]+1, wrap around
710  if( locallyPeriodic[1] && j1 == boxDims[4] + 1 ) j1 = boxDims[1];
711  verts[ind] = get_vertex( i1, j1, k + subconnect[dim - 1][dir][ind][2] );
712  if( !verts[ind] ) return MB_FAILURE;
713  }
714 
715  Range ents;
716  ErrorCode rval = scImpl->impl()->get_adjacencies( verts, 2 * dim, dim, false, ents );
717  if( MB_SUCCESS != rval ) return rval;
718 
719  if( ents.size() > 1 )
720  return MB_FAILURE;
721 
722  else if( ents.size() == 1 )
723  {
724  ent = *ents.begin();
725  }
726  else if( create_if_missing )
727  rval = scImpl->impl()->create_element( ( 1 == dim ? MBEDGE : MBQUAD ), verts, 2 * dim, ent );
728 
729  return rval;
730 }

References moab::Range::begin(), boxDims, moab::Interface::create_element(), dim, ErrorCode, moab::Interface::get_adjacencies(), get_vertex(), moab::ScdInterface::impl(), locallyPeriodic, MB_SUCCESS, MBEDGE, MBQUAD, scImpl, and moab::Range::size().

Referenced by moab::Skinner::skin_box().

◆ get_coordinate_arrays() [1/2]

ErrorCode moab::ScdBox::get_coordinate_arrays ( const double *&  xc,
const double *&  yc,
const double *&  zc 
) const

Get read-only coordinate arrays for vertex coordinates for a structured block.

Returns error if there isn't a single vertex sequence associated with this structured block

Parameters
xcX coordinate array pointer returned
ycY coordinate array pointer returned
zcZ coordinate array pointer returned

Definition at line 613 of file ScdInterface.cpp.

614 {
615  if( !vertDat ) return MB_FAILURE;
616  xc = reinterpret_cast< const double* >( vertDat->get_sequence_data( 0 ) );
617  yc = reinterpret_cast< const double* >( vertDat->get_sequence_data( 1 ) );
618  zc = reinterpret_cast< const double* >( vertDat->get_sequence_data( 2 ) );
619  return MB_SUCCESS;
620 }

References moab::SequenceData::get_sequence_data(), MB_SUCCESS, and vertDat.

◆ get_coordinate_arrays() [2/2]

ErrorCode moab::ScdBox::get_coordinate_arrays ( double *&  xc,
double *&  yc,
double *&  zc 
)

Get coordinate arrays for vertex coordinates for a structured block.

Returns error if there isn't a single vertex sequence associated with this structured block

Parameters
xcX coordinate array pointer returned
ycY coordinate array pointer returned
zcZ coordinate array pointer returned

Definition at line 603 of file ScdInterface.cpp.

604 {
605  if( !vertDat ) return MB_FAILURE;
606 
607  xc = reinterpret_cast< double* >( vertDat->get_sequence_data( 0 ) );
608  yc = reinterpret_cast< double* >( vertDat->get_sequence_data( 1 ) );
609  zc = reinterpret_cast< double* >( vertDat->get_sequence_data( 2 ) );
610  return MB_SUCCESS;
611 }

References moab::SequenceData::get_sequence_data(), MB_SUCCESS, and vertDat.

Referenced by moab::ScdInterface::construct_box(), and moab::ScdNCHelper::create_mesh().

◆ get_element() [1/2]

EntityHandle moab::ScdBox::get_element ( const HomCoord ijk) const
inline

Get the element at the specified coordinates.

Parameters
ijkParametric coordinates being evaluated

Definition at line 1561 of file ScdInterface.hpp.

1562 {
1563  return get_element( ijk[0], ijk[1], ijk[2] );
1564 }

Referenced by moab::Core::create_scd_sequence(), and main().

◆ get_element() [2/2]

EntityHandle moab::ScdBox::get_element ( int  i,
int  j = 0,
int  k = 0 
) const
inline

Get the element at the specified coordinates.

Parameters
iParametric coordinates being evaluated
jParametric coordinates being evaluated
kParametric coordinates being evaluated

Definition at line 1554 of file ScdInterface.hpp.

1555 {
1556  return ( !startElem
1557  ? 0
1558  : startElem + ( k - boxDims[2] ) * boxSizeIJM1 + ( j - boxDims[1] ) * boxSizeIM1 + i - boxDims[0] );
1559 }

References boxDims, boxSizeIJM1, boxSizeIM1, and startElem.

◆ get_params() [1/3]

ErrorCode moab::ScdBox::get_params ( EntityHandle  ent,
HomCoord ijkd 
) const

Get parametric coordinates of the specified entity.

This function returns MB_ENTITY_NOT_FOUND if the entity is not in this ScdBox.

Parameters
entEntity being queried
ijkdParametric coordinates returned (including direction, in case of getting adjacent edges (2d, 3d) or faces (3d))

Definition at line 640 of file ScdInterface.cpp.

641 {
642  // check first whether this is an intermediate entity, so we know what to do
643  int dimension = box_dimension();
644  int this_dim = scImpl->impl()->dimension_from_handle( ent );
645 
646  if( ( 0 == this_dim && !vertDat ) || ( this_dim && this_dim == dimension ) )
647  {
648  assert( elemSeq );
649  return elemSeq->get_params( ent, ijkd[0], ijkd[1], ijkd[2] );
650  }
651 
652  else if( !this_dim && vertDat )
653  return vertDat->get_params( ent, ijkd[0], ijkd[1], ijkd[2] );
654 
655  else
656  return MB_NOT_IMPLEMENTED;
657 }

References box_dimension(), moab::Interface::dimension_from_handle(), elemSeq, moab::StructuredElementSeq::get_params(), moab::ScdVertexData::get_params(), moab::ScdInterface::impl(), MB_NOT_IMPLEMENTED, scImpl, and vertDat.

◆ get_params() [2/3]

ErrorCode moab::ScdBox::get_params ( EntityHandle  ent,
int &  i,
int &  j,
int &  k 
) const
inline

Get parametric coordinates of the specified entity, intermediate entities not allowed (no dir parameter)

This function returns MB_ENTITY_NOT_FOUND if the entity is not in this ScdBox, or MB_FAILURE if the entity is an intermediate-dimension entity.

Parameters
entEntity being queried
iParametric coordinates returned
jParametric coordinates returned
kParametric coordinates returned

Definition at line 1624 of file ScdInterface.hpp.

1625 {
1626  HomCoord hc;
1627  ErrorCode rval = get_params( ent, hc );
1628  if( MB_SUCCESS == rval )
1629  {
1630  i = hc[0];
1631  j = hc[1];
1632  k = hc[2];
1633  }
1634 
1635  return rval;
1636 }

References ErrorCode, get_params(), and MB_SUCCESS.

◆ get_params() [3/3]

ErrorCode moab::ScdBox::get_params ( EntityHandle  ent,
int &  i,
int &  j,
int &  k,
int &  dir 
) const
inline

Get parametric coordinates of the specified entity.

This function returns MB_ENTITY_NOT_FOUND if the entity is not in this ScdBox.

Parameters
entEntity being queried
iParametric coordinates returned
jParametric coordinates returned
kParametric coordinates returned
dirParametric coordinate direction returned (in case of getting adjacent edges (2d, 3d) or faces (3d); not modified otherwise

Definition at line 1609 of file ScdInterface.hpp.

1610 {
1611  HomCoord hc;
1612  ErrorCode rval = get_params( ent, hc );
1613  if( MB_SUCCESS == rval )
1614  {
1615  i = hc[0];
1616  j = hc[1];
1617  k = hc[2];
1618  dir = hc[3];
1619  }
1620 
1621  return rval;
1622 }

References ErrorCode, and MB_SUCCESS.

Referenced by get_params().

◆ get_vertex() [1/2]

EntityHandle moab::ScdBox::get_vertex ( const HomCoord ijk) const
inline

Get the vertex at the specified coordinates.

Parameters
ijkParametric coordinates being evaluated

Definition at line 1574 of file ScdInterface.hpp.

1575 {
1576  return get_vertex( ijk[0], ijk[1], ijk[2] );
1577 }

Referenced by moab::Core::create_scd_sequence(), get_adj_edge_or_face(), and main().

◆ get_vertex() [2/2]

EntityHandle moab::ScdBox::get_vertex ( int  i,
int  j = 0,
int  k = 0 
) const
inline

Get the vertex at the specified coordinates.

Parameters
iParametric coordinates being evaluated
jParametric coordinates being evaluated
kParametric coordinates being evaluated

Definition at line 1566 of file ScdInterface.hpp.

1567 {
1568  return ( vertDat
1569  ? startVertex + ( boxDims[2] == -1 && boxDims[5] == -1 ? 0 : ( k - boxDims[2] ) ) * boxSizeIJ +
1570  ( boxDims[1] == -1 && boxDims[4] == -1 ? 0 : ( j - boxDims[1] ) ) * boxSize[0] + i - boxDims[0]
1571  : get_vertex_from_seq( i, j, k ) );
1572 }

References boxDims, boxSize, boxSizeIJ, get_vertex_from_seq(), startVertex, and vertDat.

◆ get_vertex_from_seq()

EntityHandle moab::ScdBox::get_vertex_from_seq ( int  i,
int  j,
int  k 
) const
private

function to get vertex handle directly from sequence

Parameters
iParameter being queried
jParameter being queried
kParameter being queried

Definition at line 569 of file ScdInterface.cpp.

570 {
571  assert( elemSeq );
572  return elemSeq->get_vertex( i, j, k );
573 }

References elemSeq, and moab::StructuredElementSeq::get_vertex().

Referenced by get_vertex().

◆ locally_periodic() [1/2]

const int * moab::ScdBox::locally_periodic ( ) const
inline

Get local periodicity.

Returns
Vector of ijk periodicities for this box

Definition at line 1659 of file ScdInterface.hpp.

1660 {
1661  return locallyPeriodic;
1662 }

References locallyPeriodic.

◆ locally_periodic() [2/2]

void moab::ScdBox::locally_periodic ( bool  lperiodic[3])
inline

Set local periodicity.

Parameters
lperiodicVector of ijk periodicities to set this box to

Definition at line 1653 of file ScdInterface.hpp.

1654 {
1655  for( int i = 0; i < 3; i++ )
1656  locallyPeriodic[i] = lperiodic[i];
1657 }

References locallyPeriodic.

Referenced by moab::ScdInterface::assign_global_ids().

◆ locally_periodic_i()

bool moab::ScdBox::locally_periodic_i ( ) const
inline

Return whether box is locally periodic in i.

Return whether box is locally periodic in i

Returns
True if box is locally periodic in i direction

Definition at line 1638 of file ScdInterface.hpp.

1639 {
1640  return locallyPeriodic[0];
1641 }

References locallyPeriodic.

◆ locally_periodic_j()

bool moab::ScdBox::locally_periodic_j ( ) const
inline

Return whether box is locally periodic in j.

Return whether box is locally periodic in j

Returns
True if box is locally periodic in j direction

Definition at line 1643 of file ScdInterface.hpp.

1644 {
1645  return locallyPeriodic[1];
1646 }

References locallyPeriodic.

◆ locally_periodic_k()

bool moab::ScdBox::locally_periodic_k ( ) const
inline

Return whether box is locally periodic in k.

Return whether box is locally periodic in k

Returns
True if box is locally periodic in k direction

Definition at line 1648 of file ScdInterface.hpp.

1649 {
1650  return locallyPeriodic[2];
1651 }

References locallyPeriodic.

◆ num_elements()

int moab::ScdBox::num_elements ( ) const
inline

Return the number of elements in the box.

Definition at line 1493 of file ScdInterface.hpp.

1494 {
1495  if( !startElem ) return 0; // not initialized yet
1496 
1497  /* for a structured mesh, total number of elements is obtained by multiplying
1498  number of elements in each direction
1499  number of elements in each direction is given by number of vertices in that direction minus 1
1500  if periodic in that direction, the last vertex is the same as first one, count one more
1501  element
1502  */
1503  int num_e_i = ( -1 == boxSize[0] || 1 == boxSize[0] ) ? 1 : boxSize[0] - 1;
1504  if( locallyPeriodic[0] ) ++num_e_i;
1505 
1506  int num_e_j = ( -1 == boxSize[1] || 1 == boxSize[1] ) ? 1 : boxSize[1] - 1;
1507  if( locallyPeriodic[1] ) ++num_e_j;
1508 
1509  int num_e_k = ( -1 == boxSize[2] || 1 == boxSize[2] ) ? 1 : boxSize[2] - 1;
1510  if( locallyPeriodic[2] ) ++num_e_k;
1511 
1512  return num_e_i * num_e_j * num_e_k;
1513 }

References boxSize, locallyPeriodic, and startElem.

Referenced by moab::ScdInterface::construct_box(), moab::ScdNCHelper::create_mesh(), moab::ScdInterface::create_scd_sequence(), and moab::ScdInterface::tag_shared_vertices().

◆ num_vertices()

int moab::ScdBox::num_vertices ( ) const
inline

Return the number of vertices in the box.

Definition at line 1515 of file ScdInterface.hpp.

1516 {
1517  return boxSize[0] * ( !boxSize[1] ? 1 : boxSize[1] ) * ( !boxSize[2] ? 1 : boxSize[2] );
1518 }

References boxSize.

Referenced by moab::ScdInterface::assign_global_ids(), moab::ScdNCHelper::create_mesh(), and moab::ScdInterface::create_scd_sequence().

◆ par_data() [1/3]

ScdParData& moab::ScdBox::par_data ( )
inline

Return parallel data.

Return parallel data, if there is any

Returns
par_data Parallel data set on this box

Definition at line 749 of file ScdInterface.hpp.

750  {
751  return parData;
752  }

Referenced by moab::ScdInterface::assign_global_ids(), moab::ScdInterface::construct_box(), moab::ScdInterface::get_shared_vertices(), and moab::ScdInterface::tag_shared_vertices().

◆ par_data() [2/3]

const ScdParData& moab::ScdBox::par_data ( ) const
inline

Return parallel data.

Return parallel data, if there is any

Returns
par_data Parallel data set on this box

Definition at line 758 of file ScdInterface.hpp.

759  {
760  return parData;
761  }

◆ par_data() [3/3]

void moab::ScdBox::par_data ( const ScdParData par_datap)
inline

set parallel data

Set parallel data for this box

Parameters
par_dataParallel data to be set on this box

Definition at line 767 of file ScdInterface.hpp.

768  {
769  parData = par_datap;
770  }

◆ sc_impl()

ScdInterface * moab::ScdBox::sc_impl ( ) const
inline

Return the ScdInterface responsible for this box.

Definition at line 1468 of file ScdInterface.hpp.

1469 {
1470  return scImpl;
1471 }

References scImpl.

◆ start_element() [1/2]

EntityHandle moab::ScdBox::start_element ( ) const
inline

Starting entity handle for this box.

If this is a vertex box, the start vertex handle is returned.

Definition at line 1483 of file ScdInterface.hpp.

1484 {
1485  return startElem;
1486 }

References startElem.

Referenced by moab::ScdInterface::construct_box(), moab::ScdNCHelper::create_mesh(), and moab::ScdInterface::tag_shared_vertices().

◆ start_element() [2/2]

void moab::ScdBox::start_element ( EntityHandle  starte)
inlineprivate

Set the starting entity handle for this box.

Definition at line 1488 of file ScdInterface.hpp.

1489 {
1490  startElem = starte;
1491 }

References startElem.

◆ start_vertex() [1/2]

EntityHandle moab::ScdBox::start_vertex ( ) const
inline

Starting vertex handle for this box.

Definition at line 1473 of file ScdInterface.hpp.

1474 {
1475  return startVertex;
1476 }

References startVertex.

Referenced by moab::ScdInterface::assign_global_ids(), moab::ScdNCHelper::create_mesh(), and moab::ScdInterface::tag_shared_vertices().

◆ start_vertex() [2/2]

void moab::ScdBox::start_vertex ( EntityHandle  startv)
inlineprivate

Set the starting vertex handle for this box.

Definition at line 1478 of file ScdInterface.hpp.

1479 {
1480  startVertex = startv;
1481 }

References startVertex.

◆ vert_dat() [1/2]

ScdVertexData * moab::ScdBox::vert_dat ( ) const
inlineprivate

get the vertex sequence

Definition at line 1599 of file ScdInterface.hpp.

1600 {
1601  return vertDat;
1602 }

References vertDat.

◆ vert_dat() [2/2]

ErrorCode moab::ScdBox::vert_dat ( ScdVertexData vert_dat)
private

set the vertex sequence

Definition at line 622 of file ScdInterface.cpp.

623 {
624  vertDat = vert_dt;
625  return MB_SUCCESS;
626 }

References MB_SUCCESS, and vertDat.

Friends And Related Function Documentation

◆ ScdInterface

friend class ScdInterface
friend

Definition at line 508 of file ScdInterface.hpp.

Member Data Documentation

◆ boxDims

int moab::ScdBox::boxDims[6]
private

lower and upper corners

Definition at line 832 of file ScdInterface.hpp.

Referenced by box_dims(), box_max(), box_min(), contains(), get_adj_edge_or_face(), get_element(), get_vertex(), and ScdBox().

◆ boxSet

EntityHandle moab::ScdBox::boxSet
private

entity set representing this box

Definition at line 816 of file ScdInterface.hpp.

Referenced by box_set(), and ~ScdBox().

◆ boxSize

HomCoord moab::ScdBox::boxSize
private

parameter extents

Definition at line 841 of file ScdInterface.hpp.

Referenced by box_size(), elem_seq(), get_vertex(), num_elements(), num_vertices(), and ScdBox().

◆ boxSizeIJ

int moab::ScdBox::boxSizeIJ
private

convenience parameters, (boxSize[1]-1)*(boxSize[0]-1) and boxSize[0]-1

Definition at line 844 of file ScdInterface.hpp.

Referenced by get_vertex(), and ScdBox().

◆ boxSizeIJM1

int moab::ScdBox::boxSizeIJM1
private

Definition at line 845 of file ScdInterface.hpp.

Referenced by elem_seq(), get_element(), and ScdBox().

◆ boxSizeIM1

int moab::ScdBox::boxSizeIM1
private

Definition at line 846 of file ScdInterface.hpp.

Referenced by elem_seq(), get_element(), and ScdBox().

◆ elemSeq

StructuredElementSeq* moab::ScdBox::elemSeq
private

element sequence this box represents

Definition at line 823 of file ScdInterface.hpp.

Referenced by add_vbox(), boundary_complete(), elem_seq(), get_params(), get_vertex_from_seq(), and ScdBox().

◆ locallyPeriodic

int moab::ScdBox::locallyPeriodic[3]
private

◆ parData

ScdParData moab::ScdBox::parData
private

parallel data associated with this box, if any

Definition at line 838 of file ScdInterface.hpp.

◆ scImpl

ScdInterface* moab::ScdBox::scImpl
private

interface instance

Definition at line 813 of file ScdInterface.hpp.

Referenced by box_dimension(), get_adj_edge_or_face(), get_params(), sc_impl(), ScdBox(), and ~ScdBox().

◆ startElem

EntityHandle moab::ScdBox::startElem
private

starting element handle for this box

Definition at line 829 of file ScdInterface.hpp.

Referenced by box_dimension(), get_element(), num_elements(), ScdBox(), and start_element().

◆ startVertex

EntityHandle moab::ScdBox::startVertex
private

starting vertex handle for this box

Definition at line 826 of file ScdInterface.hpp.

Referenced by get_vertex(), ScdBox(), and start_vertex().

◆ vertDat

ScdVertexData* moab::ScdBox::vertDat
private

vertex sequence this box represents, if there's only one, otherwise they're retrieved from the element sequence

Definition at line 820 of file ScdInterface.hpp.

Referenced by add_vbox(), get_coordinate_arrays(), get_params(), get_vertex(), ScdBox(), and vert_dat().


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