LCOV - code coverage report
Current view: top level - geom/facet - TDOctreeRefFace.cpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 1 206 0.5 %
Date: 2020-06-30 00:58:45 Functions: 2 14 14.3 %
Branches: 2 322 0.6 %

           Branch data     Line data    Source code
       1                 :            : //- Class:       TDOctreeRefFace
       2                 :            : //- Description: Tool data for storing additional information needed for MAT generation.
       3                 :            : //- Owner:       W. R. Quadors
       4                 :            : //- Checked by:
       5                 :            : //- Version:
       6                 :            :  
       7                 :            : #include "TDOctreeRefFace.hpp"
       8                 :            : #include "CubitDefines.h"
       9                 :            : #include "ToolData.hpp"
      10                 :            : #include "MemoryManager.hpp" 
      11                 :            : #include "DLIList.hpp"
      12                 :            : #include "CubitVector.hpp" 
      13                 :            : #include "CastTo.hpp"
      14                 :            : 
      15                 :            : #include "CubitTransformMatrix.hpp"
      16                 :            : #include "RefFace.hpp"
      17                 :            : #include "CubitFacet.hpp"
      18                 :            : #include "CubitFacetData.hpp"
      19                 :            : #include "CubitFacetEdge.hpp"
      20                 :            : #include "CubitFacetEdgeData.hpp"
      21                 :            : #include "CubitPointData.hpp"
      22                 :            : #include "CubitOctreeConstants.hpp"
      23                 :            : #include "FacetDataUtil.hpp"
      24                 :            : 
      25                 :            : 
      26                 :            : // Constructor  
      27         [ #  # ]:          0 : TDOctreeRefFace::TDOctreeRefFace(){
      28                 :            : 
      29                 :          0 :   ptrCubitPointList = NULL;
      30                 :          0 :   ptrCubitFacetEdgeList = NULL;
      31                 :          0 :   ptrCubitFacetList = NULL;
      32                 :          0 :   visit = CUBIT_FALSE;
      33                 :          0 :   create_2dmat = CUBIT_TRUE;
      34                 :          0 : }
      35                 :            : 
      36                 :            : // Distructor
      37         [ #  # ]:          0 : TDOctreeRefFace::~TDOctreeRefFace()
      38                 :            : {
      39         [ #  # ]:          0 :   if (ptrCubitFacetList != NULL)
      40                 :            :   {
      41         [ #  # ]:          0 :     FacetDataUtil::delete_facets(*ptrCubitFacetList);
      42         [ #  # ]:          0 :     if( ptrCubitFacetList )
      43 [ #  # ][ #  # ]:          0 :       delete ptrCubitFacetList;
      44                 :          0 :     ptrCubitFacetList = NULL;
      45                 :            : 
      46         [ #  # ]:          0 :     if( ptrCubitFacetEdgeList )
      47 [ #  # ][ #  # ]:          0 :       delete ptrCubitFacetEdgeList;
      48                 :          0 :     ptrCubitFacetEdgeList = NULL;
      49                 :            : 
      50         [ #  # ]:          0 :     if( ptrCubitPointList )
      51 [ #  # ][ #  # ]:          0 :       delete ptrCubitPointList;
      52                 :          0 :     ptrCubitPointList = NULL;
      53                 :            :   }
      54                 :            :   
      55                 :            : //PRINT_INFO("Inside ~TDOctreeRefFace\n");
      56         [ #  # ]:          0 : }
      57                 :            : 
      58                 :            : //-------------------------------------------------------------------------
      59                 :            : // Purpose       : To create TDOctreeRefFace to RefFace
      60                 :            : //
      61                 :            : // Special Notes :
      62                 :            : //
      63                 :            : // Creator       : W R Quadros
      64                 :            : //
      65                 :            : // Creation Date : 07/03
      66                 :            : //------------------------------------------------------------------------- 
      67                 :          0 : CubitStatus TDOctreeRefFace::add_td(  RefFace *ref_face )
      68                 :            : {
      69                 :            :   ToolData *td;
      70                 :          0 :   td = ref_face->get_TD(&TDOctreeRefFace::is_td_octree_ref_face);
      71         [ #  # ]:          0 :   if ( td == NULL )
      72                 :            :   {
      73         [ #  # ]:          0 :     TDOctreeRefFace *td_gm = new TDOctreeRefFace;
      74                 :          0 :     ref_face->add_TD( td_gm);
      75                 :          0 :     td_gm->set_ref_face( ref_face );
      76                 :            :   }
      77                 :            :   else
      78                 :            :   {
      79         [ #  # ]:          0 :     TDOctreeRefFace *td_gm = CAST_TO(td, TDOctreeRefFace);
      80                 :          0 :     td_gm->set_ref_face( ref_face );
      81                 :            : 
      82                 :            :   }
      83                 :          0 :   return CUBIT_SUCCESS;
      84                 :            : }
      85                 :            : 
      86                 :            : //-------------------------------------------------------------------------
      87                 :            : // Purpose       : get the TDOctreeRefFace for a RefFace
      88                 :            : //
      89                 :            : // Special Notes :
      90                 :            : //
      91                 :            : // Creator       : W R Quadros
      92                 :            : //
      93                 :            : // Creation Date : 07/03
      94                 :            : //------------------------------------------------------------------------- 
      95                 :          0 : TDOctreeRefFace* TDOctreeRefFace::get_td( RefFace *ref_face )
      96                 :            : {
      97                 :            :   ToolData *td;
      98                 :          0 :   td = ref_face->get_TD(&TDOctreeRefFace::is_td_octree_ref_face);
      99         [ #  # ]:          0 :   if ( td != NULL )
     100                 :            :   {
     101         [ #  # ]:          0 :     TDOctreeRefFace *td_gm = CAST_TO(td, TDOctreeRefFace);
     102                 :          0 :     return td_gm;
     103                 :            :   }
     104                 :          0 :   return (TDOctreeRefFace*) NULL;
     105                 :            : } 
     106                 :          0 : CubitBoolean TDOctreeRefFace::is_adj_curves( int id1, int id2 ){
     107                 :            : 
     108                 :            :   int loop_index1, loop_index2;
     109                 :            :   int i;
     110                 :            :   int first_curve_id, last_curve_id, start_curve_id;
     111                 :            :                 
     112                 :          0 :   loopIndex.reset();
     113                 :          0 :   loop_index1 = CUBIT_INT_MAX;
     114                 :            :     // i indicates loop index
     115         [ #  # ]:          0 :   for( i = 0; i < loopIndex.size(); i++ ){
     116                 :          0 :     start_curve_id = loopIndex.get_and_step();
     117         [ #  # ]:          0 :     if( id1 < start_curve_id ){
     118                 :          0 :       loop_index1 = i - 1;
     119                 :          0 :       break;
     120                 :            :     }
     121                 :            :   }
     122         [ #  # ]:          0 :   if( loop_index1 == CUBIT_INT_MAX ){
     123                 :          0 :     loop_index1 = i - 1;
     124                 :            :   }
     125                 :            :         
     126                 :          0 :   loopIndex.reset();
     127                 :          0 :   loop_index2 = CUBIT_INT_MAX;
     128                 :            :     // i indicates loop index
     129         [ #  # ]:          0 :   for( i = 0; i < loopIndex.size(); i++ ){
     130                 :          0 :     start_curve_id = loopIndex.get_and_step();
     131         [ #  # ]:          0 :     if( id2 < start_curve_id ){
     132                 :          0 :       loop_index2 = i - 1;
     133                 :          0 :       break;
     134                 :            :     }
     135                 :            :   }
     136                 :            : 
     137         [ #  # ]:          0 :   if( loop_index2 == CUBIT_INT_MAX ){
     138                 :          0 :     loop_index2 = i - 1;
     139                 :            :   }
     140                 :            :         
     141         [ #  # ]:          0 :   if( loop_index1 != loop_index2 ){
     142                 :            :       // curves are not in same loop
     143                 :          0 :     return CUBIT_FALSE;
     144                 :            :   }
     145                 :            :   else{
     146         [ #  # ]:          0 :     if( abs(id1 - id2) == 1 ){
     147                 :            :         // adj curves of same loop
     148                 :          0 :       return CUBIT_TRUE;
     149                 :            :     }
     150                 :          0 :     loopIndex.reset();
     151                 :          0 :     loopIndex.step( loop_index1 );
     152                 :          0 :     first_curve_id = loopIndex.get_and_step();
     153                 :          0 :     last_curve_id = loopIndex.get() - 1;
     154                 :            : 
     155         [ #  # ]:          0 :     if( last_curve_id < first_curve_id ){
     156                 :            : //      PRINT_DEBUG_157(" id1 = %d and id2 = %d", id1, id2 );
     157                 :            : //      PRINT_DEBUG_157(" Note: Last curve id ( %d ) is less than first curve id ( %d ) \n", last_curve_id, first_curve_id );
     158                 :          0 :       last_curve_id = lastCurveID;  
     159                 :            : //      PRINT_DEBUG_157(" last_curve_id is reset to %d \n", lastCurveID );      
     160                 :            :     }
     161                 :            : 
     162         [ #  # ]:          0 :     if( abs(id1 - id2) == (last_curve_id - first_curve_id ) ){
     163                 :            :         // firs and last curve of same loop
     164                 :          0 :       return CUBIT_TRUE;
     165                 :            :     }
     166                 :            : 
     167                 :            :       // part of same curve
     168         [ #  # ]:          0 :     if( abs(id1 - id2) == 0 ){
     169                 :          0 :       return CUBIT_TRUE;
     170                 :            :     }
     171                 :            :                 
     172                 :            :       // same loop but non-adj curves
     173                 :          0 :     return CUBIT_FALSE;
     174                 :            :   }
     175                 :            : }
     176                 :            : 
     177                 :          0 : CubitBoolean TDOctreeRefFace::split_facet_type_03( CubitFacet *target_facet, DLIList<CubitFacet*> &facet_list, DLIList<CubitFacetEdge*> &facet_edge_list, DLIList<CubitPoint*> &point_list ){
     178                 :            : 
     179                 :            :     // Do Nothing 
     180                 :            :     // During CAT centroid will give the approximate branch point
     181                 :          0 :   return CUBIT_TRUE;
     182                 :            : }
     183                 :            : 
     184                 :          0 : CubitBoolean TDOctreeRefFace::split_facet_type_13( CubitFacet *target_facet, DLIList<CubitFacet*> &facet_list, DLIList<CubitFacetEdge*> &facet_edge_list, DLIList<CubitPoint*> &point_list ){
     185                 :            :   int i;
     186                 :          0 :   CubitFacetEdge *boundary_edge = NULL, *ptr_edge;
     187                 :            :   CubitPoint *boundary_edge_pnt0, *boundary_edge_pnt1, *other_boundary_point;
     188                 :            :   double internal_angle;
     189                 :            :   int num_of_segments;
     190                 :            : 
     191         [ #  # ]:          0 :   for( i = 0; i < 3; i++ ){
     192                 :          0 :     ptr_edge = target_facet->edge(i);
     193         [ #  # ]:          0 :     if( abs( ptr_edge->marked() ) == 1 ){
     194                 :          0 :       boundary_edge = ptr_edge;
     195                 :          0 :       break;
     196                 :            :     }
     197                 :            :   }
     198                 :            : 
     199                 :          0 :   boundary_edge_pnt0 = boundary_edge->point(0);
     200                 :          0 :   boundary_edge_pnt1 = boundary_edge->point(1);
     201                 :            : 
     202         [ #  # ]:          0 :   for( i = 0; i < 3; i++ ){
     203                 :          0 :     other_boundary_point = target_facet->point(i);
     204 [ #  # ][ #  # ]:          0 :     if( other_boundary_point->id() != boundary_edge_pnt0->id() &&  other_boundary_point->id() != boundary_edge_pnt1->id() ){
                 [ #  # ]
     205                 :          0 :       break;
     206                 :            :     }
     207                 :            :   }
     208                 :            : 
     209                 :          0 :   internal_angle = target_facet->angle( other_boundary_point );
     210                 :            : 
     211                 :          0 :   num_of_segments = (int)(floor( (internal_angle / (FACET_SPLITTING_INTERNAL_ANGLE )) + 0.5));
     212                 :            : 
     213         [ #  # ]:          0 :   if( num_of_segments > 1 )
     214                 :          0 :     split_facet_locally_along_edge( target_facet, boundary_edge_pnt0, boundary_edge_pnt1, boundary_edge, num_of_segments, facet_list, facet_edge_list, point_list );
     215                 :            : 
     216                 :          0 :   return CUBIT_TRUE;
     217                 :            : }
     218                 :            : 
     219                 :          0 : CubitBoolean TDOctreeRefFace::split_facet_type_23( CubitFacet *target_facet, DLIList<CubitFacet*> &facet_list, DLIList<CubitFacetEdge*> &facet_edge_list, DLIList<CubitPoint*> &point_list ){
     220                 :            : 
     221                 :            :   int i;
     222                 :          0 :   CubitFacetEdge *ptr_edge, *boundary_edge1, *boundary_edge2 = NULL,
     223                 :            :       *boundary_split_edge;
     224                 :            :   CubitPoint *other_boundary_point;
     225                 :            :   double internal_angle;
     226                 :            :   int num_of_segments;
     227                 :            :   
     228                 :          0 :   boundary_edge1 = NULL;
     229         [ #  # ]:          0 :   for( i = 0; i < 3; i++ ){
     230                 :          0 :     ptr_edge = target_facet->edge(i);
     231         [ #  # ]:          0 :     if( abs( ptr_edge->marked() ) == 1 ){
     232         [ #  # ]:          0 :       if( boundary_edge1 == NULL ){
     233                 :          0 :         boundary_edge1 = ptr_edge;
     234                 :            :       }
     235                 :            :       else{
     236                 :          0 :         boundary_edge2 = ptr_edge;
     237                 :          0 :         break;
     238                 :            :       }
     239                 :            :     }
     240                 :            :   }
     241                 :            : 
     242                 :            : 
     243         [ #  # ]:          0 :   CubitFacetEdgeData *boundary_edge1_data = dynamic_cast<CubitFacetEdgeData*>( boundary_edge1 );
     244         [ #  # ]:          0 :   CubitFacetEdgeData *boundary_edge2_data = dynamic_cast<CubitFacetEdgeData*>( boundary_edge2 );
     245                 :            : 
     246         [ #  # ]:          0 :   if( boundary_edge1_data->length() > boundary_edge2_data->length() ){
     247                 :          0 :     boundary_split_edge = boundary_edge1;
     248                 :            :   }
     249                 :            :   else{
     250                 :          0 :     boundary_split_edge = boundary_edge2;
     251                 :            :   }
     252                 :            : 
     253         [ #  # ]:          0 :   for( i = 0; i < 3; i++ ){
     254                 :          0 :     other_boundary_point = target_facet->point(i);
     255 [ #  # ][ #  # ]:          0 :     if( other_boundary_point->id() != boundary_split_edge->point(0)->id() &&  other_boundary_point->id() != boundary_split_edge->point(1)->id() ){
                 [ #  # ]
     256                 :          0 :       break;
     257                 :            :     }
     258                 :            :   }
     259                 :            : 
     260                 :          0 :   internal_angle = target_facet->angle( other_boundary_point );
     261                 :            : 
     262                 :          0 :   num_of_segments = (int)(floor( (internal_angle / (FACET_SPLITTING_INTERNAL_ANGLE )) + 0.5));
     263                 :            : 
     264         [ #  # ]:          0 :   if( num_of_segments > 1 )
     265                 :          0 :     split_facet_locally_along_edge( target_facet, boundary_split_edge->point(0), boundary_split_edge->point(1), boundary_split_edge, num_of_segments, facet_list, facet_edge_list, point_list );
     266                 :            : 
     267                 :          0 :   return CUBIT_TRUE;
     268                 :            : }
     269                 :            : 
     270                 :          0 : CubitBoolean TDOctreeRefFace::split_facet_type_33( CubitFacet *target_facet, DLIList<CubitFacet*> &facet_list, DLIList<CubitFacetEdge*> &facet_edge_list, DLIList<CubitPoint*> &point_list ){
     271                 :            : 
     272                 :            :     // Do Nothing
     273                 :            :     // 
     274                 :            :     // WARNING: Degenerate Case
     275                 :            :     // A triangualar surface patch is a facet.  
     276                 :            :     // Skeleton should be calculated by taking circum/in center and radius.
     277                 :          0 :   return CUBIT_TRUE;
     278                 :            : }
     279                 :            : 
     280                 :          0 : CubitBoolean TDOctreeRefFace::split_facet_locally_along_edge( CubitFacet *target_facet, CubitPoint *edge1_pt, CubitPoint *edge2_pt, CubitFacetEdge *ptr_edge, int num_of_segments, DLIList<CubitFacet*> &facet_list, DLIList<CubitFacetEdge*> &facet_edge_list, DLIList<CubitPoint*> &point_list){ 
     281                 :            :   int i;
     282                 :            :   CubitFacet *new_facet;
     283 [ #  # ][ #  # ]:          0 :   CubitVector position, delta_length;
     284                 :            :         
     285 [ #  # ][ #  # ]:          0 :   delta_length = (edge2_pt->coordinates() - edge1_pt->coordinates()) / num_of_segments; 
         [ #  # ][ #  # ]
                 [ #  # ]
     286                 :            : 
     287         [ #  # ]:          0 :   for( i = num_of_segments - 1; i >= 1; i-- ){
     288 [ #  # ][ #  # ]:          0 :     position = edge1_pt->coordinates() + ( delta_length * i );
         [ #  # ][ #  # ]
     289                 :            : 
     290 [ #  # ][ #  # ]:          0 :     CubitPointData* new_pt_data = new CubitPointData( position );
     291                 :            :                 
     292                 :            :       // update TD and append the list
     293                 :          0 :     CubitPoint *new_pt = CAST_TO(new_pt_data, CubitPoint);
     294         [ #  # ]:          0 :     new_facet = split_facet_into_two_facets( target_facet, edge1_pt, edge2_pt, ptr_edge, new_pt, facet_list, facet_edge_list, point_list );
     295                 :            :                 
     296                 :            :       // mark the newly created facets so that they are not checked for 
     297                 :            :       // further splitting.  "this" facet is marked in Octree.cpp.
     298         [ #  # ]:          0 :     new_facet->marked( -1 );
     299                 :          0 :     edge2_pt = new_pt;
     300                 :            :   }
     301                 :          0 :   return CUBIT_TRUE; 
     302                 :            : } 
     303                 :            : 
     304                 :          0 : CubitFacet *TDOctreeRefFace::split_facet_into_two_facets( CubitFacet *target_facet, CubitPoint* edge1_pt, CubitPoint* edge2_pt, CubitFacetEdge *edge, CubitPoint* new_pt, DLIList<CubitFacet*> &facet_list, DLIList<CubitFacetEdge*> &facet_edge_list, DLIList<CubitPoint*> &point_list){ 
     305                 :            : 
     306                 :            :     //add new_pt to point_list
     307         [ #  # ]:          0 :   point_list.append( new_pt );
     308 [ #  # ][ #  # ]:          0 :   new_pt->marked( abs( edge->marked() ));
     309                 :            : 
     310                 :            :     // split triangle
     311         [ #  # ]:          0 :   CubitFacetData* facet_d = dynamic_cast<CubitFacetData*>(target_facet);
     312         [ #  # ]:          0 :   assert(!!facet_d);
     313                 :            : 
     314                 :            :     // fix up existing facet
     315         [ #  # ]:          0 :   int pt2_index = target_facet->point_index( edge2_pt );
     316         [ #  # ]:          0 :   bool edge_reversed = ( edge1_pt == target_facet->point( (pt2_index+1) % 3 ) );
     317                 :          0 :   int edge_index = (pt2_index + 1 + edge_reversed) % 3;
     318                 :            :         
     319         [ #  # ]:          0 :   edge2_pt->remove_facet( target_facet );
     320         [ #  # ]:          0 :   facet_d->set_point( new_pt, pt2_index );
     321         [ #  # ]:          0 :   new_pt->add_facet( target_facet );
     322         [ #  # ]:          0 :   target_facet->update_plane();
     323                 :            : 
     324                 :            :     // make new facet and update facet list  
     325         [ #  # ]:          0 :   CubitPoint* other_pt = target_facet->point( edge_index );
     326                 :            :   CubitFacetData* new_facet;
     327         [ #  # ]:          0 :   if( edge_reversed )
     328 [ #  # ][ #  # ]:          0 :     new_facet = new CubitFacetData( other_pt, edge2_pt, new_pt );
     329                 :            :   else
     330 [ #  # ][ #  # ]:          0 :     new_facet = new CubitFacetData( other_pt, new_pt, edge2_pt );
     331                 :            : 
     332                 :            :     // facet constructor takes care of this
     333                 :            :     // update the facets in points
     334                 :            :     // this takes care of adj facets of new edges and 
     335                 :            :     // conversely edges of two facets
     336                 :            :     //edge2_pt->add_facet( new_facet ); 
     337                 :            :     //new_pt->add_facet( new_facet );
     338                 :            :     //other_pt->add_facet( new_facet );
     339                 :            : 
     340                 :            : 
     341                 :            :     // Facets list in the points should be updated before creating new edge
     342                 :            :     // the edge constructor generates adjacet facets.
     343                 :            :     // split edge, if there is one
     344                 :            :     //CubitFacetEdge* edge = edge1_pt->shared_edge( edge2_pt );
     345                 :          0 :   CubitFacetEdgeData* new_edge = 0;
     346         [ #  # ]:          0 :   if( edge ){
     347         [ #  # ]:          0 :     CubitFacetEdgeData* edge_d = dynamic_cast<CubitFacetEdgeData*>(edge);
     348         [ #  # ]:          0 :     assert(!!edge_d);
     349                 :            :                 
     350                 :            :                 
     351                 :            :       // make sure new edge has same orientation as old edge
     352 [ #  # ][ #  # ]:          0 :     new_edge = dynamic_cast<CubitFacetEdgeData*>(new_pt->shared_edge(edge2_pt));
     353 [ #  # ][ #  # ]:          0 :     if( edge->point(0) == edge1_pt ){
     354         [ #  # ]:          0 :       edge_d->set_point(new_pt, 1);
     355         [ #  # ]:          0 :       if ( !new_edge )
     356 [ #  # ][ #  # ]:          0 :         new_edge = new CubitFacetEdgeData( new_pt, edge2_pt );
     357 [ #  # ][ #  # ]:          0 :       else if( new_edge->point(0) != new_pt )
     358         [ #  # ]:          0 :         new_edge->flip();
     359                 :            :     } 
     360                 :            :     else {
     361         [ #  # ]:          0 :       edge_d->set_point(new_pt, 0);
     362         [ #  # ]:          0 :       if ( !new_edge )
     363 [ #  # ][ #  # ]:          0 :         new_edge = new CubitFacetEdgeData( edge2_pt, new_pt );
     364 [ #  # ][ #  # ]:          0 :       else if( new_edge->point(1) != new_pt )
     365         [ #  # ]:          0 :         new_edge->flip();
     366                 :            :     }
     367                 :            :                 
     368 [ #  # ][ #  # ]:          0 :     new_edge->marked( abs( edge->marked() ) );
     369         [ #  # ]:          0 :     facet_edge_list.append( new_edge );
     370                 :            :   }
     371                 :            :   else{
     372 [ #  # ][ #  # ]:          0 :     PRINT_INFO("ERROR:Edge is doesn't exist. Splitting is not possible");
         [ #  # ][ #  # ]
     373                 :            :   }
     374                 :            : 
     375                 :            :   int sense;
     376                 :            : 
     377                 :            :     /*
     378                 :            :       // constructor takes care of this
     379                 :            :       if ( new_edge ) {
     380                 :            :       assert(!new_facet->edge(0));
     381                 :            :       new_facet->edge( new_edge, 0 );
     382                 :            :       new_edge->add_facet( new_facet ); 
     383                 :            :       sense = new_facet->point( 1 ) == new_edge->point(0) ? 1 : -1;
     384                 :            :       new_facet->edge_use( sense, 0 );
     385                 :            :       }
     386                 :            :     */
     387                 :            :     // facet_list appended
     388         [ #  # ]:          0 :   facet_list.append( new_facet );
     389                 :            : 
     390                 :            :     // move other edge, if there is one
     391                 :          0 :   int pt1_index = ( pt2_index + 2 - edge_reversed ) % 3;
     392         [ #  # ]:          0 :   CubitFacetEdge* other_edge = target_facet->edge( pt1_index );
     393                 :            :   int e_index;
     394         [ #  # ]:          0 :   if( other_edge ){
     395         [ #  # ]:          0 :     other_edge->remove_facet(target_facet);
     396                 :            :       //target_facet->edge( 0, pt1_index );
     397                 :          0 :     e_index = 1 + edge_reversed;
     398 [ #  # ][ #  # ]:          0 :     assert(!new_facet->edge(e_index));
     399         [ #  # ]:          0 :     new_facet->edge( other_edge, e_index );
     400         [ #  # ]:          0 :     other_edge->add_facet( new_facet ); 
     401 [ #  # ][ #  # ]:          0 :     sense = new_facet->point( ( e_index + 1 ) % 3 ) == other_edge->point(0) ? 1 : -1;
                 [ #  # ]
     402         [ #  # ]:          0 :     new_facet->edge_use( sense, e_index );
     403                 :            :   }
     404                 :            : 
     405                 :            :     // Add new mid edge in two facets
     406                 :            : 
     407                 :            :   CubitFacetEdgeData *new_mid_edge_data;
     408                 :            :   CubitFacetEdge *new_mid_edge;
     409         [ #  # ]:          0 :   if( edge_reversed )
     410 [ #  # ][ #  # ]:          0 :     new_mid_edge_data = new CubitFacetEdgeData( other_pt, new_pt );
     411                 :            :   else
     412 [ #  # ][ #  # ]:          0 :     new_mid_edge_data = new CubitFacetEdgeData( new_pt, other_pt );
     413                 :            : 
     414                 :          0 :   new_mid_edge = CAST_TO( new_mid_edge_data, CubitFacetEdge );
     415                 :            : 
     416         [ #  # ]:          0 :   new_mid_edge->marked(2);
     417                 :            : 
     418                 :            :     // new_mid_edge is appended
     419         [ #  # ]:          0 :   facet_edge_list.append( new_mid_edge );
     420                 :            : 
     421                 :            :     /* ////edge constructor takes care of this
     422                 :            :        target_facet->edge( new_mid_edge, pt1_index ); 
     423                 :            :         
     424                 :            :        if( !edge_reversed ){  // new_mid_edge index 2
     425                 :            :        new_facet->edge( new_mid_edge, ( e_index + 1 ) % 3 );
     426                 :            :        sense = new_facet->point( ( e_index + 2 ) % 3 ) == new_mid_edge->point(0) ? 1 : -1;
     427                 :            :        new_facet->edge_use( sense, (e_index + 1 ) % 3);
     428                 :            :        }
     429                 :            :        else{ // edge index 1
     430                 :            :        new_facet->edge( new_mid_edge, ( e_index - 1 ) % 3 );
     431                 :            :        sense = new_facet->point( ( e_index  ) % 3 ) == new_mid_edge->point(0) ? 1 : -1;
     432                 :            :        new_facet->edge_use( sense, (e_index - 1 ) % 3);
     433                 :            :        }
     434                 :            :     */
     435                 :            : 
     436                 :            : 
     437                 :            : #ifndef NDEBUG
     438                 :            :     /* ---------------------- TESTING ----------------------- */
     439                 :            :     // Testing the oerientation of faces w.r.t. the common edge
     440                 :            :   
     441                 :            :   int index0, index1;
     442                 :            : 
     443 [ #  # ][ #  # ]:          0 :   if( new_mid_edge->num_adj_facets() != 2 ){
     444 [ #  # ][ #  # ]:          0 :     PRINT_INFO("ERROR:number of adjacent faces of new mid edge is not equal to 2 \n");
         [ #  # ][ #  # ]
     445                 :          0 :     assert(0);
     446                 :            :   }
     447                 :            : 
     448         [ #  # ]:          0 :   CubitFacet *ptr_facet0 = new_mid_edge->adj_facet(0);
     449         [ #  # ]:          0 :   CubitFacet *ptr_facet1 = new_mid_edge->adj_facet(1);
     450                 :            : 
     451         [ #  # ]:          0 :   for( index0 = 0; index0 < 3; index0++ ){
     452 [ #  # ][ #  # ]:          0 :     if( ptr_facet0->edge(index0) == new_mid_edge )
     453                 :          0 :       break;
     454                 :            :   }
     455                 :            : 
     456         [ #  # ]:          0 :   for( index1 = 0; index1 < 3; index1++ ){
     457 [ #  # ][ #  # ]:          0 :     if( ptr_facet1->edge(index1) == new_mid_edge )
     458                 :          0 :       break;
     459                 :            :   }
     460                 :            : 
     461 [ #  # ][ #  # ]:          0 :   if( index0 == 3 || index1 == 3 ){
     462 [ #  # ][ #  # ]:          0 :     PRINT_INFO("ERROR: new edge doesn't exist at the adjacent facets \n");
         [ #  # ][ #  # ]
     463                 :          0 :     assert(0);
     464                 :            :   }
     465                 :            : 
     466 [ #  # ][ #  # ]:          0 :   if( ptr_facet0->edge_use(index0) == ptr_facet1->edge_use(index1) ){
                 [ #  # ]
     467 [ #  # ][ #  # ]:          0 :     PRINT_INFO("ERROR: The orientation of edges is adjacent facet is not proper \n");
         [ #  # ][ #  # ]
     468                 :          0 :     assert(0);
     469                 :            :   }
     470                 :            :   
     471                 :            : #endif
     472                 :            : 
     473                 :            :     //PRINT_DEBUG_157("Passes\n");
     474                 :            : 
     475                 :          0 :   return CAST_TO( new_facet, CubitFacet );
     476                 :            : }
     477                 :            : 
     478                 :            : // This only checks gfx facet edge valence right now (should be == 2)
     479                 :          0 : CubitBoolean TDOctreeRefFace::check_valid_facets(CubitBoolean disable_if_bad)
     480                 :            : {
     481                 :            :   int i;
     482                 :          0 :   CubitBoolean good_facets = CUBIT_TRUE;
     483                 :            :   CubitFacetEdge *facet_edge;
     484                 :            : 
     485         [ #  # ]:          0 :   for (i=0; i < ptrCubitFacetEdgeList->size(); ++i)
     486                 :            :   {
     487                 :          0 :     facet_edge = ptrCubitFacetEdgeList->get_and_step();
     488         [ #  # ]:          0 :     if (facet_edge->num_adj_facets() > 2)
     489                 :            :     {
     490                 :          0 :       good_facets = CUBIT_FALSE;
     491                 :          0 :       break;
     492                 :            :     }
     493                 :            :   }
     494                 :            : 
     495 [ #  # ][ #  # ]:          0 :   if (disable_if_bad && !good_facets) {set_create_2dmat(CUBIT_FALSE);}
     496                 :          0 :   return good_facets;
     497 [ +  - ][ +  - ]:       6540 : }
     498                 :            : 
     499                 :            : //EOF
     500                 :            : 

Generated by: LCOV version 1.11