Back to index

salome-med  6.5.0
Public Member Functions | Private Attributes
INTERP_KERNEL::TriangleFaceKey Class Reference

Class representing a triangular face, used as key in caching hash map in SplitterTetra. More...

#include <SplitterTetra.hxx>

List of all members.

Public Member Functions

 TriangleFaceKey (int node1, int node2, int node3)
 Constructor Sorts the given nodes (so that the order in which they are passed does not matter) and calculates a hash value for the key.
bool operator== (const TriangleFaceKey &key) const
 Equality comparison operator.
bool operator< (const TriangleFaceKey &key) const
 Less than operator.
int hashVal () const
 Returns a hash value for the object, based on its three nodes.
void sort3Ints (int *sorted, int node1, int node2, int node3)
 Method to sort three integers in ascending order.

Private Attributes

int _nodes [3]
 global numbers of the three nodes, sorted in ascending order
int _hashVal
 hash value for the object, calculated in the constructor

Detailed Description

Class representing a triangular face, used as key in caching hash map in SplitterTetra.

Definition at line 41 of file SplitterTetra.hxx.


Constructor & Destructor Documentation

INTERP_KERNEL::TriangleFaceKey::TriangleFaceKey ( int  node1,
int  node2,
int  node3 
) [inline]

Constructor Sorts the given nodes (so that the order in which they are passed does not matter) and calculates a hash value for the key.

Parameters:
node1global number of the first node of the face
node2global number of the second node of the face
node3global number of the third node of the face

Definition at line 54 of file SplitterTetra.hxx.

    {
      sort3Ints(_nodes, node1, node2, node3);
      _hashVal = ( _nodes[0] + _nodes[1] + _nodes[2] ) % 29;
    }

Here is the call graph for this function:


Member Function Documentation

Returns a hash value for the object, based on its three nodes.

This value is not unique for each face.

Returns:
a hash value for the object

Definition at line 100 of file SplitterTetra.hxx.

    {
      return _hashVal;
    }

Here is the caller graph for this function:

bool INTERP_KERNEL::TriangleFaceKey::operator< ( const TriangleFaceKey key) const [inline]

Less than operator.

Parameters:
keyTriangleFaceKey with which to compare
Returns:
true if this object has the three nodes less than the nodes of the key object, false if not

Definition at line 78 of file SplitterTetra.hxx.

    {
      for (int i = 0; i < 3; ++i)
        {
          if (_nodes[i] < key._nodes[i])
            {
              return true;
            }
          else if (_nodes[i] > key._nodes[i])
            {
              return false;
            }
        }
      return false;
    }
bool INTERP_KERNEL::TriangleFaceKey::operator== ( const TriangleFaceKey key) const [inline]

Equality comparison operator.

Compares this TriangleFaceKey object to another and determines if they represent the same face.

Parameters:
keyTriangleFaceKey with which to compare
Returns:
true if key has the same three nodes as this object, false if not

Definition at line 67 of file SplitterTetra.hxx.

    {
      return _nodes[0] == key._nodes[0] && _nodes[1] == key._nodes[1] && _nodes[2] == key._nodes[2];
    }
void INTERP_KERNEL::TriangleFaceKey::sort3Ints ( int *  sorted,
int  x1,
int  x2,
int  x3 
) [inline]

Method to sort three integers in ascending order.

Parameters:
sortedint[3] array in which to store the result
x1first integer
x2second integer
x3third integer

Definition at line 123 of file SplitterTetra.hxx.

  {
    if(x1 < x2)
      {
        if(x1 < x3)
          {
            // x1 is min
            sorted[0] = x1;
            sorted[1] = x2 < x3 ? x2 : x3;
            sorted[2] = x2 < x3 ? x3 : x2;
          }
        else
          {
            // x3, x1, x2
            sorted[0] = x3;
            sorted[1] = x1;
            sorted[2] = x2;
          }
      }
    else // x2 < x1
      {
        if(x2 < x3)
          {
            // x2 is min
            sorted[0] = x2;
            sorted[1] = x1 < x3 ? x1 : x3;
            sorted[2] = x1 < x3 ? x3 : x1;
          } 
        else
          {
            // x3, x2, x1
            sorted[0] = x3;
            sorted[1] = x2;
            sorted[2] = x1;
          }
      }
  }

Here is the caller graph for this function:


Member Data Documentation

hash value for the object, calculated in the constructor

Definition at line 112 of file SplitterTetra.hxx.

global numbers of the three nodes, sorted in ascending order

Definition at line 109 of file SplitterTetra.hxx.


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