cgma
TDFacetboolData.cpp
Go to the documentation of this file.
00001 //- Class:       TDFacetboolData
00002 //- Description: Tool data for holding surface and curve index information.
00003 //- Owner:       John Fowler
00004 //- Checked by:
00005 //- Version:
00006 #include "TDFacetboolData.hpp"
00007 #include "CastTo.hpp"
00008 #include "TDFacetboolData.hpp"
00009 #include "CubitFacet.hpp"
00010 
00011 TDFacetboolData::TDFacetboolData()
00012 {
00013   isReversed=false;
00014 }
00015 
00016 TDFacetboolData::~TDFacetboolData()
00017 {
00018 
00019 }
00020 
00021 int TDFacetboolData::is_facetbool_facet(const ToolData* td)
00022 {
00023   return (CAST_TO(const_cast<ToolData*>(td), TDFacetboolData) != NULL);
00024 }
00025 
00026 CubitStatus TDFacetboolData::add_facetbool_facet( FacetEntity *facet_ptr )
00027 {
00028   TDFacetboolData* td = (TDFacetboolData*) 
00029                            facet_ptr->get_TD( &TDFacetboolData::is_facetbool_facet );
00030   if ( td == NULL )
00031   {
00032     td = new TDFacetboolData;
00033     facet_ptr->add_TD( td );
00034   }
00035 
00036   return CUBIT_SUCCESS;
00037 }
00038 
00039 void TDFacetboolData::set(int sv, int e0v, int e1v, int e2v, bool parent, bool is_reversed)
00040     { surfaceIndex = sv; 
00041       edgeIndex[0] = e0v; 
00042       edgeIndex[1] = e1v; 
00043       edgeIndex[2] = e2v;
00044       body_1_flag = parent;
00045       isReversed=is_reversed;
00046     } 
00047 
00048 TDFacetboolData* TDFacetboolData::get(CubitFacet *facet_ptr)
00049 {
00050   TDFacetboolData *td = (TDFacetboolData*) 
00051                            facet_ptr->get_TD(&TDFacetboolData::is_facetbool_facet);
00052   if ( td != NULL )
00053   {
00054     return td;
00055   }
00056   return (TDFacetboolData*) NULL;
00057 }
00058 
00059 //manually set the isReversed flag
00060 void TDFacetboolData::is_reversed(bool rev_flag)
00061 {
00062   if(rev_flag != isReversed){
00063     isReversed = rev_flag;
00064     int temp_int;
00065     temp_int = edgeIndex[0];
00066     edgeIndex[0]=edgeIndex[2];
00067     edgeIndex[2]=temp_int;
00068   }
00069 }
00070 //get indices.  We force the caller to pass in the rev_flag of the
00071 //associated facet so that we can be sure to return the edges in the
00072 //correct order.
00073 int *TDFacetboolData::get_edge_indices(bool rev_flag)
00074 {
00075   is_reversed(rev_flag);
00076   return get_edge_indices();
00077 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines