1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
//-------------------------------------------------------------------------
// Filename      : GeoNode.cpp
//
// Purpose       : Node class used for geometry operations.  See also GeoTet.
//
// Description   : light-weight entity used for computational geometry 
//                 tools.  Don't load this up with extra stuff!
//
// Creator       : Steve Owen
//
// Creation Date : 8/13/2003
//
// Owner         : Steve Owen
//-------------------------------------------------------------------------


#include "GeoNode.hpp"
#include "GeoTet.hpp"


//--------------------------------------------------------------------------
// Function: GeoNode
// Description: constructor
// Author: sjowen
// Date: 8/13/2003
//---------------------------------------------------------------------------
GeoNode::GeoNode( CubitVector &xx ) : ownerPtr(NULL)
{
  mLocation = xx;
  isMarked = 0;
}

//--------------------------------------------------------------------------
// Function: GeoNode
// Description: destructor
// Author: sjowen
// Date: 8/13/2003
//---------------------------------------------------------------------------
GeoNode::~GeoNode()
{
}

//--------------------------------------------------------------------------
// Function: edge_between
// Description: returns whether an edge exists between the two GeoNodes
// Author: sjowen
// Date: 1/26/2004
//---------------------------------------------------------------------------
CubitBoolean GeoNode::edge_between( GeoNode *other_node )
{
  int ii;
  GeoTet *gtet_ptr;
  for (ii=0; ii<mTetList.size(); ii++)
  {
    gtet_ptr = mTetList.get_and_step();
    if (gtet_ptr->node_index( other_node ) >= 0)
      return CUBIT_TRUE;
  }
  return CUBIT_FALSE;
}

//--------------------------------------------------------------------------
// Function: face_between
// Description: returns whether a face exists between the three GeoNodes
// Author: sjowen
// Date: 1/27/2004
//---------------------------------------------------------------------------
CubitBoolean GeoNode::face_between( GeoNode *other_node0, GeoNode *other_node1 )
{
  int ii;
  GeoTet *gtet_ptr;
  for (ii=0; ii<mTetList.size(); ii++)
  {
    gtet_ptr = mTetList.get_and_step();
    if (gtet_ptr->node_index( other_node0 ) >= 0 &&
        gtet_ptr->node_index( other_node1 ) >= 0)
      return CUBIT_TRUE;
  }
  return CUBIT_FALSE;
}

//--------------------------------------------------------------------------
// Function: tets_at_edge
// Description: get a list of tets shared by the two nodes
//              returns number of tets in list
// Author: sjowen
// Date: 1/27/2004
//---------------------------------------------------------------------------
int GeoNode::tets_at_edge( GeoNode *other_node,                 
                           DLIList<GeoTet *> &gtet_list )
{
  int ntets = 0;
  int ii;
  GeoTet *gtet_ptr;
  for (ii=0; ii<mTetList.size(); ii++)
  {
    gtet_ptr = mTetList.get_and_step();
    if (gtet_ptr->node_index( other_node ) >= 0)
    {
      gtet_list.append( gtet_ptr );
      ntets++;
    }
  }
  return ntets;
}

//--------------------------------------------------------------------------
// Function: interior_edges
// Description: get a list of opposite geonodes to this node
//              don't return nodes that are external to the domain
// Author: sjowen
// Date: 3/14/2004
//---------------------------------------------------------------------------
int GeoNode::interior_edges( DLIList <GeoNode *> &node_list )
{
  int nedges = 0;
  int ii, jj;
  GeoNode *node[4];
  GeoTet *gtet_ptr;
  for (ii=0; ii<mTetList.size(); ii++)
  {
    gtet_ptr = mTetList.get_and_step();
    if (gtet_ptr->inside())
    {
      gtet_ptr->tet_nodes(node[0], node[1], node[2], node[3]);
      for(jj=0; jj<4; jj++)
        node[jj]->marked(1);
    }
  }
  isMarked = 0;

  for (ii=0; ii<mTetList.size(); ii++)
  {
    gtet_ptr = mTetList.get_and_step();
    if (gtet_ptr->inside())
    {
      gtet_ptr->tet_nodes(node[0], node[1], node[2], node[3]);
      for(jj=0; jj<4; jj++)
      {
        if (node[jj]->marked())
        {
          node[jj]->marked(0);
          node_list.append(node[jj]);
          nedges++;
        }
      }
    }
  }
  return nedges; 
}


// EOF