Beispiel #1
0
unsigned TopologyInfo::find_edge( EntityTopology topo,
                                  const unsigned* side_vertices,
                                  bool& reversed_out,
                                  MsqError& err )
{
  if (dimension(topo) <= 1) {
    MSQ_SETERR(err)(MsqError::INVALID_ARG,"Invalid element dimension");
    return (unsigned)-1;
  }

  for (unsigned i = 0; i < edges(topo); ++i) {
    const unsigned* edge = edge_vertices( topo, i, err );
    MSQ_ERRZERO(err);

    if (edge[0] == side_vertices[0] &&
        edge[1] == side_vertices[1]) {
      reversed_out = false;
      return i;
    }

    if (edge[0] == side_vertices[1] &&
        edge[1] == side_vertices[0]) {
      reversed_out = true;
      return i;
    }
  }
  
  MSQ_SETERR(err)(MsqError::INVALID_ARG,"No such edge");
  return (unsigned)-1;
}
const unsigned* TopologyInfo::side_vertices( EntityTopology topo,
                                             unsigned dim,
                                             unsigned side,
                                             unsigned& count_out,
                                             MsqError& err )
{
  static const unsigned all[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
  const unsigned* result;
  
  if (dim != 0 && dim == dimension(topo))
  {
    count_out = corners( topo );
    result = all;
  }
  else if (dim == 1)
  {
    count_out = 2;
    result = edge_vertices( topo, side, err );
  }
  else if( dim == 2)
  {
    result = face_vertices( topo, side, count_out, err );
  } 
  else
  {
    MSQ_SETERR(err)(MsqError::INVALID_ARG);
    count_out = 0;
    result = 0;
  }    
  return result;
}
Beispiel #3
0
const unsigned* TopologyInfo::side_vertices( EntityTopology topo,
                                             unsigned dim,
                                             unsigned side,
                                             unsigned& count_out  )
{
  static const unsigned all[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
  const unsigned* result;
  
  if (dim != 0 && dim == dimension(topo))
  {
    count_out = corners( topo );
    result = all;
  }
  else if (dim == 1)
  {
    count_out = 2;
    result = edge_vertices( topo, side );
  }
  else if( dim == 2)
  {
    result = face_vertices( topo, side, count_out );
  } 
  else
  {
    result = 0;
  }    
  return result;
}