Branch data Line data Source code
1 : : //- Class: TDFacetboolData
2 : : //- Description: Tool data for holding surface and curve index information.
3 : : //- Owner: John Fowler
4 : : //- Checked by:
5 : : //- Version:
6 : : #include "TDFacetboolData.hpp"
7 : : #include "CastTo.hpp"
8 : : #include "TDFacetboolData.hpp"
9 : : #include "CubitFacet.hpp"
10 : :
11 : 0 : TDFacetboolData::TDFacetboolData()
12 : : {
13 : 0 : isReversed=false;
14 : 0 : }
15 : :
16 : 0 : TDFacetboolData::~TDFacetboolData()
17 : : {
18 : :
19 [ # # ]: 0 : }
20 : :
21 : 1056 : int TDFacetboolData::is_facetbool_facet(const ToolData* td)
22 : : {
23 [ + - ][ - + ]: 1056 : return (CAST_TO(const_cast<ToolData*>(td), TDFacetboolData) != NULL);
24 : : }
25 : :
26 : 0 : CubitStatus TDFacetboolData::add_facetbool_facet( FacetEntity *facet_ptr )
27 : : {
28 : : TDFacetboolData* td = (TDFacetboolData*)
29 : 0 : facet_ptr->get_TD( &TDFacetboolData::is_facetbool_facet );
30 [ # # ]: 0 : if ( td == NULL )
31 : : {
32 [ # # ]: 0 : td = new TDFacetboolData;
33 : 0 : facet_ptr->add_TD( td );
34 : : }
35 : :
36 : 0 : return CUBIT_SUCCESS;
37 : : }
38 : :
39 : 0 : void TDFacetboolData::set(int sv, int e0v, int e1v, int e2v, bool parent, bool is_reversed)
40 : 0 : { surfaceIndex = sv;
41 : 0 : edgeIndex[0] = e0v;
42 : 0 : edgeIndex[1] = e1v;
43 : 0 : edgeIndex[2] = e2v;
44 : 0 : body_1_flag = parent;
45 : 0 : isReversed=is_reversed;
46 : 0 : }
47 : :
48 : 1056 : TDFacetboolData* TDFacetboolData::get(CubitFacet *facet_ptr)
49 : : {
50 : : TDFacetboolData *td = (TDFacetboolData*)
51 : 1056 : facet_ptr->get_TD(&TDFacetboolData::is_facetbool_facet);
52 [ - + ]: 1056 : if ( td != NULL )
53 : : {
54 : 0 : return td;
55 : : }
56 : 1056 : return (TDFacetboolData*) NULL;
57 : : }
58 : :
59 : : //manually set the isReversed flag
60 : 0 : void TDFacetboolData::is_reversed(bool rev_flag)
61 : : {
62 [ # # ]: 0 : if(rev_flag != isReversed){
63 : 0 : isReversed = rev_flag;
64 : : int temp_int;
65 : 0 : temp_int = edgeIndex[0];
66 : 0 : edgeIndex[0]=edgeIndex[2];
67 : 0 : edgeIndex[2]=temp_int;
68 : : }
69 : 0 : }
70 : : //get indices. We force the caller to pass in the rev_flag of the
71 : : //associated facet so that we can be sure to return the edges in the
72 : : //correct order.
73 : 0 : int *TDFacetboolData::get_edge_indices(bool rev_flag)
74 : : {
75 : 0 : is_reversed(rev_flag);
76 : 0 : return get_edge_indices();
77 : : }
|