cgma
GeoNode.cpp
Go to the documentation of this file.
00001 //-------------------------------------------------------------------------
00002 // Filename      : GeoNode.cpp
00003 //
00004 // Purpose       : Node class used for geometry operations.  See also GeoTet.
00005 //
00006 // Description   : light-weight entity used for computational geometry 
00007 //                 tools.  Don't load this up with extra stuff!
00008 //
00009 // Creator       : Steve Owen
00010 //
00011 // Creation Date : 8/13/2003
00012 //
00013 // Owner         : Steve Owen
00014 //-------------------------------------------------------------------------
00015 
00016 
00017 #include "GeoNode.hpp"
00018 #include "GeoTet.hpp"
00019 
00020 
00021 //--------------------------------------------------------------------------
00022 // Function: GeoNode
00023 // Description: constructor
00024 // Author: sjowen
00025 // Date: 8/13/2003
00026 //---------------------------------------------------------------------------
00027 GeoNode::GeoNode( CubitVector &xx ) : ownerPtr(NULL)
00028 {
00029   mLocation = xx;
00030   isMarked = 0;
00031 }
00032 
00033 //--------------------------------------------------------------------------
00034 // Function: GeoNode
00035 // Description: destructor
00036 // Author: sjowen
00037 // Date: 8/13/2003
00038 //---------------------------------------------------------------------------
00039 GeoNode::~GeoNode()
00040 {
00041 }
00042 
00043 //--------------------------------------------------------------------------
00044 // Function: edge_between
00045 // Description: returns whether an edge exists between the two GeoNodes
00046 // Author: sjowen
00047 // Date: 1/26/2004
00048 //---------------------------------------------------------------------------
00049 CubitBoolean GeoNode::edge_between( GeoNode *other_node )
00050 {
00051   int ii;
00052   GeoTet *gtet_ptr;
00053   for (ii=0; ii<mTetList.size(); ii++)
00054   {
00055     gtet_ptr = mTetList.get_and_step();
00056     if (gtet_ptr->node_index( other_node ) >= 0)
00057       return CUBIT_TRUE;
00058   }
00059   return CUBIT_FALSE;
00060 }
00061 
00062 //--------------------------------------------------------------------------
00063 // Function: face_between
00064 // Description: returns whether a face exists between the three GeoNodes
00065 // Author: sjowen
00066 // Date: 1/27/2004
00067 //---------------------------------------------------------------------------
00068 CubitBoolean GeoNode::face_between( GeoNode *other_node0, GeoNode *other_node1 )
00069 {
00070   int ii;
00071   GeoTet *gtet_ptr;
00072   for (ii=0; ii<mTetList.size(); ii++)
00073   {
00074     gtet_ptr = mTetList.get_and_step();
00075     if (gtet_ptr->node_index( other_node0 ) >= 0 &&
00076         gtet_ptr->node_index( other_node1 ) >= 0)
00077       return CUBIT_TRUE;
00078   }
00079   return CUBIT_FALSE;
00080 }
00081 
00082 //--------------------------------------------------------------------------
00083 // Function: tets_at_edge
00084 // Description: get a list of tets shared by the two nodes
00085 //              returns number of tets in list
00086 // Author: sjowen
00087 // Date: 1/27/2004
00088 //---------------------------------------------------------------------------
00089 int GeoNode::tets_at_edge( GeoNode *other_node,                 
00090                            DLIList<GeoTet *> &gtet_list )
00091 {
00092   int ntets = 0;
00093   int ii;
00094   GeoTet *gtet_ptr;
00095   for (ii=0; ii<mTetList.size(); ii++)
00096   {
00097     gtet_ptr = mTetList.get_and_step();
00098     if (gtet_ptr->node_index( other_node ) >= 0)
00099     {
00100       gtet_list.append( gtet_ptr );
00101       ntets++;
00102     }
00103   }
00104   return ntets;
00105 }
00106 
00107 //--------------------------------------------------------------------------
00108 // Function: interior_edges
00109 // Description: get a list of opposite geonodes to this node
00110 //              don't return nodes that are external to the domain
00111 // Author: sjowen
00112 // Date: 3/14/2004
00113 //---------------------------------------------------------------------------
00114 int GeoNode::interior_edges( DLIList <GeoNode *> &node_list )
00115 {
00116   int nedges = 0;
00117   int ii, jj;
00118   GeoNode *node[4];
00119   GeoTet *gtet_ptr;
00120   for (ii=0; ii<mTetList.size(); ii++)
00121   {
00122     gtet_ptr = mTetList.get_and_step();
00123     if (gtet_ptr->inside())
00124     {
00125       gtet_ptr->tet_nodes(node[0], node[1], node[2], node[3]);
00126       for(jj=0; jj<4; jj++)
00127         node[jj]->marked(1);
00128     }
00129   }
00130   isMarked = 0;
00131 
00132   for (ii=0; ii<mTetList.size(); ii++)
00133   {
00134     gtet_ptr = mTetList.get_and_step();
00135     if (gtet_ptr->inside())
00136     {
00137       gtet_ptr->tet_nodes(node[0], node[1], node[2], node[3]);
00138       for(jj=0; jj<4; jj++)
00139       {
00140         if (node[jj]->marked())
00141         {
00142           node[jj]->marked(0);
00143           node_list.append(node[jj]);
00144           nedges++;
00145         }
00146       }
00147     }
00148   }
00149   return nedges; 
00150 }
00151 
00152 
00153 // EOF
00154 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines