|
cgma
|
#include <TDFacetBoundaryEdge.hpp>
Definition at line 31 of file TDFacetBoundaryEdge.hpp.
Definition at line 17 of file TDFacetBoundaryEdge.cpp.
{
edgePtr = NULL;
nextEdgePtr = NULL;
prevEdgePtr = NULL;
}
Definition at line 24 of file TDFacetBoundaryEdge.cpp.
{
int ii;
for (ii=0; ii<edgeDataList.size(); ii++)
{
BoundaryEdgeData *bed_ptr = edgeDataList.get_and_step();
delete bed_ptr;
}
}
| CubitStatus TDFacetBoundaryEdge::add_facet_boundary_edge | ( | CubitFacetEdge * | edge_ptr | ) | [static] |
Definition at line 44 of file TDFacetBoundaryEdge.cpp.
{
ToolData *td;
td = edge_ptr->get_TD(&TDFacetBoundaryEdge::is_facet_boundary_edge);
if ( td == NULL )
{
TDFacetBoundaryEdge *td_gm = new TDFacetBoundaryEdge;
edge_ptr->add_TD( td_gm);
td_gm->set_edge( edge_ptr );
}
else
{
TDFacetBoundaryEdge *td_gm = CAST_TO(td, TDFacetBoundaryEdge);
td_gm->set_edge( edge_ptr );
}
return CUBIT_SUCCESS;
}
| void TDFacetBoundaryEdge::add_surf | ( | int | new_id | ) |
| void TDFacetBoundaryEdge::add_surf_facet | ( | DLIList< CubitFacet * > & | facet_list | ) |
Definition at line 95 of file TDFacetBoundaryEdge.cpp.
{
CubitFacet *facet_ptr;
int found = 0;
int ii,jj;
for (ii=0; ii< facet_list.size(); ii++)
{
facet_ptr = facet_list.get_and_step();
if (facet_ptr->edge( 0 ) == edgePtr ||
facet_ptr->edge( 1 ) == edgePtr ||
facet_ptr->edge( 2 ) == edgePtr)
{
// check if has already been added
found = 0;
BoundaryEdgeData *bed_ptr;
for (jj=0; jj<edgeDataList.size() && !found; jj++)
{
bed_ptr = edgeDataList.get_and_step();
if(bed_ptr->adjFacet == facet_ptr)
{
found = 1;
}
}
if (!found)
{
// add a new bed and facet
BoundaryEdgeData *new_bed_ptr = new BoundaryEdgeData;
new_bed_ptr->adjFacet = facet_ptr;
new_bed_ptr->surfID = -1;
edgeDataList.append( new_bed_ptr );
}
}
}
}
| CubitStatus TDFacetBoundaryEdge::compute_curve_tangent | ( | int | surf_id, |
| CubitFacetEdge * | edge, | ||
| double | min_dot, | ||
| CubitVector & | T0, | ||
| CubitVector & | T3 | ||
| ) |
Definition at line 474 of file TDFacetBoundaryEdge.cpp.
{
int mydebug = 0;
CubitPoint *p0 = edge->point( 0 );
CubitPoint *p1 = edge->point( 1 );
CubitFacetEdge *prev_edge = NULL; //next_feature_edge( tool_id, edge, p0 );
//If ther is a previous edge that this one should be C1 with, get
// it, and make this one C1 with it.
if(get_prev_edge()){
prev_edge = get_prev_edge();
}
if (prev_edge == NULL) // could be end of a hard line
{
T0 = p1->coordinates() - p0->coordinates();
T0.normalize();
}
else
{
if(mydebug){
dcolor(CUBIT_WHITE_INDEX);
dedraw(prev_edge);
dcolor(CUBIT_MAGENTA_INDEX);
dedraw(edge);
dview();
}
CubitPoint *p2 = prev_edge->other_point( p0 );
if (p2)
{
T0 = (p0->coordinates() - p2->coordinates()) +
(p1->coordinates() - p0->coordinates());
}
else // fall back to chord
{
T0=p1->coordinates()-p0->coordinates();
}
T0.normalize();
}
CubitFacetEdge *next_edge = NULL; //next_feature_edge( tool_id, edge, p1 );
//If ther is a next edge that this one should be C1 with, get
// it, and make this one C1 with it.
if(get_next_edge()){
next_edge = get_next_edge();
}
if (next_edge == NULL) // could be end of a hard line
{
T3 = p1->coordinates() - p0->coordinates();
T3.normalize();
}
else
{
if(mydebug){
dcolor(CUBIT_YELLOW_INDEX);
dedraw(next_edge);
dcolor(CUBIT_GREEN_INDEX);
dedraw(edge);
dview();
}
CubitPoint *p2 = next_edge->other_point( p1 );
if (p2)
{
T3 = (p2->coordinates() - p1->coordinates()) +
(p1->coordinates() - p0->coordinates());
}
else
{
T3 = p1->coordinates() - p0->coordinates();
}
T3.normalize();
}
return CUBIT_SUCCESS;
}
| int TDFacetBoundaryEdge::control_points | ( | CubitVector * | ctrl_pts, |
| int | surf_id | ||
| ) |
Definition at line 172 of file TDFacetBoundaryEdge.cpp.
{
ctrl_pts[0] = edgePtr->point(0)->coordinates();
int ii;
int found = 0;
BoundaryEdgeData *bed_ptr = NULL;
for (ii=0; ii<edgeDataList.size(); ii++)
{
bed_ptr = edgeDataList.get_and_step();
if(bed_ptr->surfID == surf_id)
found = 1;
}
if (0 == found) {
PRINT_ERROR("The surf_id does not match any in the list.\n");
return -1;
}
for(int i=0; i<3; i++) {
ctrl_pts[i+1] = bed_ptr->bezierCtrlPts[i];
}
ctrl_pts[4] = edgePtr->point(1)->coordinates();
return 4;
}
| void TDFacetBoundaryEdge::control_points | ( | CubitVector * | ctrl_pts, |
| int | order, | ||
| int | surf_id | ||
| ) |
Definition at line 142 of file TDFacetBoundaryEdge.cpp.
{
assert(order<=4 && order >=0);
int found = 0;
BoundaryEdgeData *bed_ptr = NULL;
for (int ii=0; ii<edgeDataList.size(); ii++)
{
bed_ptr = edgeDataList.get_and_step();
if(bed_ptr->surfID == surf_id)
found = 1;
}
if (0 == found) {
PRINT_ERROR("The surf_id does not match any in the list.\n");
return;
}
int jj;
for(jj=0; jj<order-1; jj++){
bed_ptr->bezierCtrlPts[jj] = ctrl_pts[jj];
}
}
| CubitStatus TDFacetBoundaryEdge::control_points | ( | CubitFacet * | facet, |
| CubitVector * | ctrl_pts | ||
| ) |
Definition at line 204 of file TDFacetBoundaryEdge.cpp.
{
// find the edge on the facet
int index = -1;
CubitBoolean found = CUBIT_FALSE;
for (int i=0; i<3 && !found; i++) {
if (edgePtr == facet->edge(i)) {
index = i;
found = CUBIT_TRUE;
}
}
if (!found) {
return CUBIT_FAILURE;
}
// locate the facet in the boundary edge data
found = CUBIT_FALSE;
BoundaryEdgeData *bed_ptr = NULL;
for (int ii=0; ii<edgeDataList.size(); ii++)
{
bed_ptr = edgeDataList.get_and_step();
if(bed_ptr->adjFacet == facet)
found = CUBIT_TRUE;
}
if (!found) // the facet does not match any in the list
return CUBIT_FAILURE;
// retreive the control points
switch (facet->edge_use(index)) {
case 1:
ctrl_pts[0] = edgePtr->point(0)->coordinates();
ctrl_pts[1] = bed_ptr->bezierCtrlPts[0];
ctrl_pts[2] = bed_ptr->bezierCtrlPts[1];
ctrl_pts[3] = bed_ptr->bezierCtrlPts[2];
ctrl_pts[4] = edgePtr->point(1)->coordinates();
break;
case -1:
ctrl_pts[0] = edgePtr->point(1)->coordinates();
ctrl_pts[1] = bed_ptr->bezierCtrlPts[2];
ctrl_pts[2] = bed_ptr->bezierCtrlPts[1];
ctrl_pts[3] = bed_ptr->bezierCtrlPts[0];
ctrl_pts[4] = edgePtr->point(0)->coordinates();
break;
default:
return CUBIT_FAILURE;
}
return CUBIT_SUCCESS;
}
| static void TDFacetBoundaryEdge::destroy_memory | ( | ) | [inline, static] |
Definition at line 87 of file TDFacetBoundaryEdge.hpp.
| void TDFacetBoundaryEdge::get_control_points | ( | CubitPoint * | point_ptr, |
| CubitVector | ctrl_pts[3], | ||
| int | surf_id | ||
| ) |
Definition at line 267 of file TDFacetBoundaryEdge.cpp.
{
CubitBoolean found = CUBIT_FALSE;
BoundaryEdgeData *bed_ptr = NULL;
for (int ii=0; ii<edgeDataList.size(); ii++)
{
bed_ptr = edgeDataList.get_and_step();
if(bed_ptr->surfID == surf_id)
found = CUBIT_TRUE;
}
if (0 == found) {
PRINT_ERROR("The surf_id does not match any in the list.\n");
return;
}
if (point_ptr == edgePtr->point(0))
{
ctrl_pts[0] = bed_ptr->bezierCtrlPts[0];
ctrl_pts[1] = bed_ptr->bezierCtrlPts[1];
ctrl_pts[2] = bed_ptr->bezierCtrlPts[2];
}
else if(point_ptr == edgePtr->point(1))
{
ctrl_pts[0] = bed_ptr->bezierCtrlPts[2];
ctrl_pts[1] = bed_ptr->bezierCtrlPts[1];
ctrl_pts[2] = bed_ptr->bezierCtrlPts[0];
}
else
{
assert(0); // point_ptr does not match either point
}
}
| CubitFacetEdge* TDFacetBoundaryEdge::get_edge | ( | ) | [inline] |
Definition at line 61 of file TDFacetBoundaryEdge.hpp.
{ return edgePtr; }
| TDFacetBoundaryEdge * TDFacetBoundaryEdge::get_facet_boundary_edge | ( | CubitFacetEdge * | edge_ptr | ) | [static] |
Definition at line 72 of file TDFacetBoundaryEdge.cpp.
{
ToolData *td;
td = edge_ptr->get_TD(&TDFacetBoundaryEdge::is_facet_boundary_edge);
if ( td != NULL )
{
TDFacetBoundaryEdge *td_gm = CAST_TO(td, TDFacetBoundaryEdge);
return td_gm;
}
return (TDFacetBoundaryEdge*) NULL;
}
| CubitFacetEdge* TDFacetBoundaryEdge::get_next_edge | ( | ) | [inline] |
Definition at line 67 of file TDFacetBoundaryEdge.hpp.
{ return nextEdgePtr; }
| CubitFacetEdge* TDFacetBoundaryEdge::get_prev_edge | ( | ) | [inline] |
Definition at line 73 of file TDFacetBoundaryEdge.hpp.
{ return prevEdgePtr; }
| CubitStatus TDFacetBoundaryEdge::init_control_points | ( | double | min_dot | ) |
Definition at line 403 of file TDFacetBoundaryEdge.cpp.
{
int ii;
CubitStatus stat = CUBIT_SUCCESS;
CubitVector N0, N3;
for (ii=0; ii<edgeDataList.size(); ii++)
{
// get the normals specific to this facet.
BoundaryEdgeData *bed_ptr = edgeDataList.get_and_step();
TDFacetBoundaryPoint *td_fbp0 =
TDFacetBoundaryPoint::get_facet_boundary_point( edgePtr->point( 0 ) );
TDFacetBoundaryPoint *td_fbp1 =
TDFacetBoundaryPoint::get_facet_boundary_point( edgePtr->point( 1 ) );
if (!td_fbp0 || !td_fbp1)
return CUBIT_FAILURE;
stat = td_fbp0->get_normal( bed_ptr->adjFacet, N0 );
if (stat != CUBIT_SUCCESS)
return stat;
td_fbp1->get_normal( bed_ptr->adjFacet, N3 );
if (stat != CUBIT_SUCCESS)
return stat;
// determine the curve tangents
CubitVector T0, T3;
int tool_id = bed_ptr->adjFacet->tool_id();
stat = compute_curve_tangent( tool_id, edgePtr, min_dot, T0, T3 );
if (stat != CUBIT_SUCCESS)
return stat;
// init the control points
CubitVector P0 = edgePtr->point(0)->coordinates();
CubitVector P3 = edgePtr->point(1)->coordinates();
stat = FacetEvalTool::init_edge_control_points( P0, P3, N0, N3, T0, T3,
bed_ptr->bezierCtrlPts );
if (stat != CUBIT_SUCCESS)
return stat;
}
return CUBIT_SUCCESS;
}
| CubitBoolean TDFacetBoundaryEdge::is_at_surf | ( | int | surf_id | ) |
Definition at line 603 of file TDFacetBoundaryEdge.cpp.
{
CubitBoolean found = CUBIT_FALSE;
BoundaryEdgeData *bed_ptr;
for (int ii=0; ii<edgeDataList.size() && !found; ii++)
{
bed_ptr = edgeDataList.get_and_step();
if(bed_ptr->surfID == surf_id ||
bed_ptr->adjFacet->tool_id() == surf_id)
found = CUBIT_TRUE;
}
return found;
}
| static int TDFacetBoundaryEdge::is_facet_boundary_edge | ( | const ToolData * | td | ) | [inline, static] |
Definition at line 56 of file TDFacetBoundaryEdge.hpp.
{return (CAST_TO(const_cast<ToolData*>(td), TDFacetBoundaryEdge) != NULL);}
Definition at line 384 of file TDFacetBoundaryEdge.cpp.
{
if (edgeDataList.size() != 2)
return CUBIT_FALSE;
BoundaryEdgeData *bed0_ptr = edgeDataList.get_and_step();
BoundaryEdgeData *bed1_ptr = edgeDataList.get_and_step();
if (bed0_ptr->surfID == bed1_ptr->surfID)
{
return CUBIT_TRUE;
}
return CUBIT_FALSE;
}
Definition at line 452 of file TDFacetBoundaryEdge.cpp.
{
int ii, jj;
CubitVector ctrl_pts[3];
for (ii=0; ii<edgeDataList.size(); ii++)
{
BoundaryEdgeData *bed_ptr = edgeDataList.get_and_step();
for (jj=0; jj<3; jj++)
ctrl_pts[jj] += bed_ptr->bezierCtrlPts[jj];
}
for (ii=0; ii<3; ii++)
ctrl_pts[ii] = ctrl_pts[ii] / edgeDataList.size();
edgePtr->control_points( ctrl_pts, 4 );
return CUBIT_SUCCESS;
}
| CubitFacetEdge * TDFacetBoundaryEdge::next_feature_edge | ( | int | surf_id, |
| CubitFacetEdge * | this_edge, | ||
| CubitPoint * | p0 | ||
| ) |
Definition at line 567 of file TDFacetBoundaryEdge.cpp.
{
CubitFacetEdge *next_edge = NULL;
DLIList<CubitFacetEdge*> edge_list;
p0->edges( edge_list );
int ii;
CubitFacetEdge *edge_ptr = NULL;
TDFacetBoundaryEdge *td_fbe;
for (ii=0; ii<edge_list.size() && next_edge == NULL; ii++)
{
edge_ptr = edge_list.get_and_step();
if (edge_ptr != this_edge)
{
td_fbe = TDFacetBoundaryEdge::get_facet_boundary_edge( edge_ptr );
if (td_fbe != NULL && td_fbe->is_at_surf( tool_id ))
{
next_edge = edge_ptr;
}
}
}
return next_edge;
}
| void TDFacetBoundaryEdge::set_control_points | ( | CubitPoint * | point_ptr, |
| CubitVector | ctrl_pts[3], | ||
| int | surf_id | ||
| ) |
Definition at line 312 of file TDFacetBoundaryEdge.cpp.
{
CubitBoolean found = CUBIT_FALSE;
BoundaryEdgeData *bed_ptr = NULL;
for (int ii=0; ii<edgeDataList.size(); ii++)
{
bed_ptr = edgeDataList.get_and_step();
if(bed_ptr->surfID == surf_id)
found = CUBIT_TRUE;
}
if (0 == found) {
PRINT_ERROR("The surf_id does not match any in the list.\n");
return;
}
if (point_ptr == edgePtr->point(0))
{
bed_ptr->bezierCtrlPts[0] = ctrl_pts[0];
bed_ptr->bezierCtrlPts[1] = ctrl_pts[1];
bed_ptr->bezierCtrlPts[2] = ctrl_pts[2];
}
else if(point_ptr == edgePtr->point(1))
{
bed_ptr->bezierCtrlPts[0] = ctrl_pts[2];
bed_ptr->bezierCtrlPts[1] = ctrl_pts[1];
bed_ptr->bezierCtrlPts[2] = ctrl_pts[0];
}
else
{
assert(0); // point_ptr does not match either point
}
}
| void TDFacetBoundaryEdge::set_edge | ( | CubitFacetEdge * | edge_ptr | ) | [inline] |
Definition at line 64 of file TDFacetBoundaryEdge.hpp.
{ edgePtr = edge_ptr; }
| void TDFacetBoundaryEdge::set_next_edge | ( | CubitFacetEdge * | edge_ptr | ) | [inline] |
Definition at line 70 of file TDFacetBoundaryEdge.hpp.
{ nextEdgePtr = edge_ptr; }
| void TDFacetBoundaryEdge::set_prev_edge | ( | CubitFacetEdge * | edge_ptr | ) | [inline] |
Definition at line 76 of file TDFacetBoundaryEdge.hpp.
{ prevEdgePtr = edge_ptr; }
| void TDFacetBoundaryEdge::set_surf_id | ( | CubitFacet * | facet_ptr, |
| int | surf_id | ||
| ) |
Definition at line 357 of file TDFacetBoundaryEdge.cpp.
{
int found = 0;
int ii;
BoundaryEdgeData *bed_ptr;
for (ii=0; ii<edgeDataList.size() && !found; ii++)
{
bed_ptr = edgeDataList.get_and_step();
if (bed_ptr->adjFacet == facet_ptr)
{
found = 1;
bed_ptr->surfID = surf_id;
}
}
assert(found); // couldn't find the facet adjacent the surface
}
| TDFacetBoundaryEdge::SetDynamicMemoryAllocation | ( | memoryManager | ) | [inline, pure virtual] |
Definition at line 80 of file TDFacetBoundaryEdge.hpp.
{memoryManager.set_memory_allocation_increment(increment);}
DLIList<BoundaryEdgeData *> TDFacetBoundaryEdge::edgeDataList [private] |
Definition at line 47 of file TDFacetBoundaryEdge.hpp.
CubitFacetEdge* TDFacetBoundaryEdge::edgePtr [private] |
Definition at line 38 of file TDFacetBoundaryEdge.hpp.
MemoryManager TDFacetBoundaryEdge::memoryManager [static, private] |
Definition at line 35 of file TDFacetBoundaryEdge.hpp.
CubitFacetEdge* TDFacetBoundaryEdge::nextEdgePtr [private] |
Definition at line 45 of file TDFacetBoundaryEdge.hpp.
CubitFacetEdge* TDFacetBoundaryEdge::prevEdgePtr [private] |
Definition at line 46 of file TDFacetBoundaryEdge.hpp.