|
cgma
|
#include <FacetorTool.hpp>
Public Member Functions | |
| FacetorTool () | |
| FacetorTool (SURF *ref_face_ptr, DLIList< NODE * > &bounding_nodes, NODE **boundary_edge_start_nodes, NODE **boundary_edge_end_nodes, int num_boundary_edges, SIZEFUNC *sizing_function, ParamTool *ptool) | |
| ~FacetorTool (void) | |
| CubitStatus | mesh_surf (DLIList< TRI * > &facet_list) |
| CubitStatus | mesh_surfwoIP (DLIList< TRI * > &facet_list) |
| CubitStatus | mesh_surfwoIPBC (DLIList< TRI * > &facet_list) |
Private Member Functions | |
| CubitStatus | insert_hard_points (DLIList< NODE * > &hard_points) |
| CubitStatus | init_box () |
| CubitStatus | insert_nodes (DLIList< NODE * > *&bounding_nodes) |
| CubitStatus | constrain_boundary (void) |
| CubitStatus | delete_exterior (void) |
| CubitStatus | delete_tris (DLIList< TRI * > &tri_list, int marked_flag) |
| CubitStatus | mark_tris (TRI *tri_ptr, int &num_found_edges) |
| CubitStatus | refine_interior (DLIList< TRI * > &tri_list) |
| CubitStatus | classify_triangles (DLIList< TRI * > &tri_list, DLIList< TRI * > *sorted_lists, const int num_lists, const double interval) |
| TRI * | next_triangle (DLIList< TRI * > *sorted_lists, const int num_lists) |
| void | clean_up_data (void) |
Private Attributes | |
| ParamTool * | pTool |
| SURF * | refFacePtr |
| DLIList< TRI * > * | facetList |
| DLIList< NODE * > * | boundingNodes |
| NODE ** | boundaryEdgeStartNodes |
| NODE ** | boundaryEdgeEndNodes |
| SIZEFUNC * | sizingFunction |
| int | numBoundaryEdges |
| NODE * | boxNodes [4] |
| int | curVisitFlag |
Definition at line 34 of file FacetorTool.hpp.
| FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::FacetorTool | ( | ) | [inline] |
Definition at line 37 of file FacetorTool.hpp.
{};
| MY_INLINE FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::FacetorTool | ( | SURF * | ref_face_ptr, |
| DLIList< NODE * > & | bounding_nodes, | ||
| NODE ** | boundary_edge_start_nodes, | ||
| NODE ** | boundary_edge_end_nodes, | ||
| int | num_boundary_edges, | ||
| SIZEFUNC * | sizing_function, | ||
| ParamTool * | ptool | ||
| ) |
Definition at line 47 of file FacetorTool.cpp.
{
//update private variables
pTool = p_tool;
refFacePtr = ref_face_ptr;
boundingNodes = &bounding_nodes;
boundaryEdgeStartNodes = boundary_edge_start_nodes;
boundaryEdgeEndNodes = boundary_edge_end_nodes;
numBoundaryEdges = num_boundary_edges;
sizingFunction = sizing_function;
curVisitFlag = INT_MIN+1;
boxNodes[0] = boxNodes[1] = boxNodes[2] = boxNodes[3] = NULL;
}
| MY_INLINE FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::~FacetorTool | ( | void | ) |
Definition at line 76 of file FacetorTool.cpp.
{
numBoundaryEdges = 0;
}
| MY_INLINE CubitStatus FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::classify_triangles | ( | DLIList< TRI * > & | tri_list, |
| DLIList< TRI * > * | sorted_lists, | ||
| const int | num_lists, | ||
| const double | interval | ||
| ) | [private] |
Definition at line 584 of file FacetorTool.cpp.
{
CubitStatus rv = CUBIT_SUCCESS;
// Create an array of lists that will hold triangles as they are
// created (and deleted). Each list will hold triangles whose angles
// fall within a specified interval. Triangles will be processed
// from smallest angle to best angle
// classify each trriangle and place into sort lists
TRI *tri_ptr;
int ii;
for(ii=0; ii<tri_list.size() && rv == CUBIT_SUCCESS; ii++)
{
tri_ptr = tri_list.get_and_step();
//rv =
FacetorUtil<SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC>::classify_tri_by_angle(
tri_ptr, sorted_lists, num_lists, interval, QUALITY_ANGLE);
}
return rv;
}
| MY_INLINE void FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::clean_up_data | ( | void | ) | [private] |
Definition at line 644 of file FacetorTool.cpp.
{
EDGE *del_edge_ptr;
DLIList<EDGE *> del_edge_list;
TRI *tri_ptr;
DLIList<TRI *> tri_list;
int ii, jj, kk;
//loop over facets and remove marks
for(ii=0; ii<facetList->size(); ii++)
{
tri_ptr = facetList->get_and_step();
tri_ptr->marked(CUBIT_FALSE);
ToolData *td = tri_ptr->remove_TD( TDDelaunay< TRI, NODE >::is_delaunay );
if (td != NULL)
{
TDDelaunay< TRI, NODE > *td_del = dynamic_cast<TDDelaunay< TRI, NODE >*> (td);
delete td_del;
}
}
//loop over the box ndes
//if meshing was successful, some of the below is unnecessary
for(ii=0; ii<4; ii++)
{
if (boxNodes[ii] != NULL){
tri_list.clean_out();
//if there are tris attached, delete them.
boxNodes[ii]->tris(tri_list);
for (jj=0; jj<tri_list.size(); jj++)
{
tri_ptr = tri_list.get_and_step();
del_edge_list.clean_out();
tri_ptr->edges( del_edge_list );
delete tri_ptr;
// also deltet the attached, unused edges
for (kk=0; kk<del_edge_list.size(); kk++)
{
del_edge_ptr = del_edge_list.get_and_step();
if (del_edge_ptr->number_tris() == 0)
delete del_edge_ptr;
}
}
}
//finally delete the nodes
delete boxNodes[ii];
}
// clean off the edge marks
EDGE *edge_ptr;
for (ii=0; ii<numBoundaryEdges; ii++)
{
edge_ptr = boundaryEdgeStartNodes[ii]->shared_edge( boundaryEdgeEndNodes[ii] );
if (edge_ptr)
edge_ptr->marked( CUBIT_FALSE );
}
}
| MY_INLINE CubitStatus FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::constrain_boundary | ( | void | ) | [private] |
Definition at line 339 of file FacetorTool.cpp.
{
CubitStatus rv = CUBIT_SUCCESS;
BoundaryConstrainTool<SURF,TRI,EDGE,NODE,TRICHILD> bctool( refFacePtr );
EDGE *edge_ptr = NULL;
int ii;
for (ii=0; ii<numBoundaryEdges && rv == CUBIT_SUCCESS; ii++)
{
rv = bctool.recover_edge( boundaryEdgeStartNodes[ii],
boundaryEdgeEndNodes[ii],
edge_ptr,
facetList);
//assert(edge_ptr != NULL);
if (edge_ptr == NULL)
{
PRINT_ERROR("Could not recover a boundary in Delaunay facetor.\n"
"Indicates potential problems with input loop geometry\n");
rv = CUBIT_FAILURE;
}
}
return rv;
}
| MY_INLINE CubitStatus FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::delete_exterior | ( | void | ) | [private] |
Definition at line 372 of file FacetorTool.cpp.
{
CubitStatus rv = CUBIT_SUCCESS;
// mark edges at the boundary
EDGE *edge_ptr;
int ii;
for (ii=0; ii<numBoundaryEdges; ii++)
{
edge_ptr = boundaryEdgeStartNodes[ii]->shared_edge( boundaryEdgeEndNodes[ii] );
if(!edge_ptr){
PRINT_ERROR("Boundary edges were not successfully recovered.\n");
return CUBIT_FAILURE;
}
edge_ptr->marked( CUBIT_TRUE );
}
// get a tri adjacent to a bounding box node
DLIList<TRI*> adjtris;
boxNodes[0]->tris( adjtris );
TRI *tri_ptr = adjtris.get();
// mark the tris on the outside starting from this triangle
int num_edges_found=0;
rv = mark_tris( tri_ptr, num_edges_found );
if (rv != CUBIT_SUCCESS)
return rv;
// delete the exterior triangles
int marked_flag = 1;
rv = delete_tris( *facetList, marked_flag );
// check to see if we've found all the edges
//PRINT_INFO("num_edges_found = %i, numBoundaryEdges = %i\n",num_edges_found,numBoundaryEdges);
if (num_edges_found != numBoundaryEdges)
{
// if not, then there are interior loops(holes) that need to have their
// triangles removed
// find a triangle at the boundary
TRI *adjtri;
int jj;
CubitBoolean found = CUBIT_FALSE;
if(!facetList->size()){
PRINT_ERROR("Problem marking exterior facets.\n");
return CUBIT_FAILURE;
}
for (ii=0; ii<facetList->size() && !found; ii++)
{
tri_ptr = facetList->get_and_step();
for (jj=0; jj<3 && !found; jj++)
{
int kk = jj;
adjtri = tri_ptr->adjacent( kk, refFacePtr );
if (adjtri == NULL)
{
found = CUBIT_TRUE;
}
}
}
// mark all the tris we want to keep
if(!found){
PRINT_WARNING("Possible problem. No boundary edge found.\n");
}
rv = mark_tris( tri_ptr, num_edges_found );
// delete all the rest
marked_flag = 0;
rv = delete_tris( *facetList, marked_flag );
}
return rv;
}
| MY_INLINE CubitStatus FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::delete_tris | ( | DLIList< TRI * > & | tri_list, |
| int | marked_flag | ||
| ) | [private] |
Definition at line 465 of file FacetorTool.cpp.
{
CubitStatus rv = CUBIT_SUCCESS;
int ii, jj;
EDGE *edge_ptr;
TRI *tri_ptr;
DLIList<EDGE *> edge_list;
DLIList<TRI *> new_list;
int ntri = tri_list.size();
for(ii=0; ii<ntri; ii++)
{
tri_ptr = tri_list.pop();
if (tri_ptr->marked() == marked_flag)
{
edge_list.clean_out();
tri_ptr->edges( edge_list );
delete tri_ptr;
for(jj=0; jj<3; jj++)
{
edge_ptr = edge_list.get_and_step();
if(edge_ptr->number_tris() == 0 && edge_ptr->number_faces() == 0)
delete edge_ptr;
}
}
else
new_list.append(tri_ptr);
}
tri_list+=new_list;
return rv;
}
| MY_INLINE CubitStatus FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::init_box | ( | void | ) | [private] |
Definition at line 246 of file FacetorTool.cpp.
{
// find the bounding box
int ii;
CubitVector min_box, max_box;
min_box.x( CUBIT_DBL_MAX );min_box.y( CUBIT_DBL_MAX );
max_box.x( -CUBIT_DBL_MAX );max_box.y( -CUBIT_DBL_MAX );
NODE *node_ptr;
CubitVector node_loc;
for (ii=0; ii<boundingNodes->size(); ii++)
{
node_ptr = boundingNodes->get_and_step();
node_loc = node_ptr->coordinates();
if (node_loc.x() < min_box.x()) min_box.x( node_loc.x() );
if (node_loc.y() < min_box.y()) min_box.y( node_loc.y() );
if (node_loc.x() > max_box.x()) max_box.x( node_loc.x() );
if (node_loc.y() > max_box.y()) max_box.y( node_loc.y() );
}
// expand the box by 10%
double dx = max_box.x() - min_box.x();
double dy = max_box.y() - min_box.y();
double expand;
if (dx > dy)
expand = 0.1 * dx;
else
expand = 0.1 * dy;
min_box.x( min_box.x() - expand );
min_box.y( min_box.y() - expand );
max_box.x( max_box.x() + expand );
max_box.y( max_box.y() + expand );
// create four new nodes
boxNodes[0] = (NODE *) new NODECHILD(min_box.x(), min_box.y(), 0.0, refFacePtr);
boxNodes[1] = (NODE *) new NODECHILD(max_box.x(), min_box.y(), 0.0, refFacePtr);
boxNodes[2] = (NODE *) new NODECHILD(max_box.x(), max_box.y(), 0.0, refFacePtr);
boxNodes[3] = (NODE *) new NODECHILD(min_box.x(), max_box.y(), 0.0, refFacePtr);
// create the two triangles
TRI *new_facet1 = (TRI *) new TRICHILD( boxNodes[0], boxNodes[1],
boxNodes[3], refFacePtr );
TRI *new_facet2 = (TRI *) new TRICHILD( boxNodes[1], boxNodes[2],
boxNodes[3], refFacePtr );
facetList->append(new_facet1);
facetList->append(new_facet2);
return CUBIT_SUCCESS;
}
| CubitStatus FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::insert_hard_points | ( | DLIList< NODE * > & | hard_points | ) | [private] |
| MY_INLINE CubitStatus FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::insert_nodes | ( | DLIList< NODE * > *& | bounding_nodes | ) | [private] |
Definition at line 313 of file FacetorTool.cpp.
{
CubitStatus rv = CUBIT_SUCCESS;
int ii;
NODE *point_ptr;
TRI* start_tri = NULL;
for (ii=0; ii<bounding_nodes->size() && rv == CUBIT_SUCCESS; ii++){
point_ptr = bounding_nodes->get_and_step();
rv = FacetorUtil<SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC>::insert_node(
point_ptr, *facetList,
refFacePtr, curVisitFlag,
start_tri);
}
return rv;
}
| MY_INLINE CubitStatus FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::mark_tris | ( | TRI * | tri_ptr, |
| int & | num_found_edges | ||
| ) | [private] |
Definition at line 505 of file FacetorTool.cpp.
{
CubitStatus rv = CUBIT_SUCCESS;
tri_ptr->marked( CUBIT_TRUE );
int ii;
EDGE *edge_ptr;
TRI *adjtri;
for (ii=0; ii<3 && rv == CUBIT_SUCCESS; ii++)
{
int jj = ii;
adjtri = tri_ptr->adjacent( jj, refFacePtr );
edge_ptr = tri_ptr->edge( jj );
if(edge_ptr->marked()) {
num_edges_found++;
}
else {
if (adjtri != NULL && !adjtri->marked())
rv = mark_tris( adjtri, num_edges_found );
}
}
return rv;
}
| MY_INLINE CubitStatus FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::mesh_surf | ( | DLIList< TRI * > & | facet_list | ) |
Definition at line 89 of file FacetorTool.cpp.
{
CubitStatus ret_value = CUBIT_SUCCESS;
// update private variables
facetList = &facet_list;
// create two initial bounding triangles
if (ret_value == CUBIT_SUCCESS)
{
ret_value = init_box();
}
// insert the boundary nodes
if (ret_value == CUBIT_SUCCESS)
{
//PRINT_INFO("Inserting boundary nodes \n");
ret_value = insert_nodes( boundingNodes );
}
// constrain the boundary
if (ret_value == CUBIT_SUCCESS)
{
//PRINT_INFO("Constraining the mesh to the boundary\n");
ret_value = constrain_boundary();
}
// delete the triangles on the outside of the boundary
if (ret_value == CUBIT_SUCCESS)
{
//PRINT_INFO("Deleting the exterior entities\n");
ret_value = delete_exterior();
}
// insert the hards
// insert interior points
if (ret_value == CUBIT_SUCCESS) {
//PRINT_INFO("Refining the interior mesh\n");
ret_value = refine_interior(*facetList);
}
// clean up
//PRINT_INFO("Cleaning up some data\n");
clean_up_data();
return ret_value;
}
| MY_INLINE CubitStatus FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::mesh_surfwoIP | ( | DLIList< TRI * > & | facet_list | ) |
Definition at line 151 of file FacetorTool.cpp.
{
CubitStatus ret_value = CUBIT_SUCCESS;
//update private variables
facetList = &facet_list;
// create two initial bounding triangles
if (ret_value == CUBIT_SUCCESS)
{
ret_value = init_box();
}
// insert the boundary nodes
if (ret_value == CUBIT_SUCCESS)
{
ret_value = insert_nodes( boundingNodes );
}
// constrain the boundary
if (ret_value == CUBIT_SUCCESS)
{
ret_value = constrain_boundary();
}
// delete the triangles on the outside of the boundary
if (ret_value == CUBIT_SUCCESS)
{
ret_value = delete_exterior();
}
// insert the hard points
// clean up
clean_up_data();
return ret_value;
}
| MY_INLINE CubitStatus FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::mesh_surfwoIPBC | ( | DLIList< TRI * > & | facet_list | ) |
Definition at line 202 of file FacetorTool.cpp.
{
CubitStatus ret_value = CUBIT_SUCCESS;
// update private variables
facetList = &facet_list;
// create two initial bounding triangles
if (ret_value == CUBIT_SUCCESS)
{
ret_value = init_box();
}
// insert the boundary nodes
if (ret_value == CUBIT_SUCCESS)
{
ret_value = insert_nodes( boundingNodes );
}
// delete the triangles on the outside of the boundary
if (ret_value == CUBIT_SUCCESS){
ret_value = delete_exterior();
}
// insert the hard points
// clean up
clean_up_data();
return ret_value;
}
| MY_INLINE TRI * FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::next_triangle | ( | DLIList< TRI * > * | sorted_lists, |
| const int | num_lists | ||
| ) | [private] |
Definition at line 619 of file FacetorTool.cpp.
| MY_INLINE CubitStatus FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::refine_interior | ( | DLIList< TRI * > & | tri_list | ) | [private] |
Definition at line 540 of file FacetorTool.cpp.
{
CubitStatus rv = CUBIT_SUCCESS;
// classify the triangles based on their minimum angle
//rv =
const int num_lists = 64;
const double interval = QUALITY_ANGLE / double( num_lists - 1 );
DLIList<TRI*>* tri_sort_array = new DLIList<TRI *> [num_lists];
classify_triangles(tri_list, tri_sort_array, num_lists, interval );
// process each of the triangles until done
TRI *tri_ptr;
TRI* start_tri = NULL;
while ((tri_ptr = next_triangle(tri_sort_array, num_lists)) != NULL && rv == CUBIT_SUCCESS)
{
rv = FacetorUtil<SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC>::insert_at_circumcenter(tri_ptr,
*facetList,
start_tri,
curVisitFlag,
refFacePtr,
tri_sort_array,
num_lists,
interval,
QUALITY_ANGLE,
sizingFunction,
pTool);
}
delete [] tri_sort_array;
tri_sort_array = NULL;
return rv;
}
NODE** FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::boundaryEdgeEndNodes [private] |
Definition at line 65 of file FacetorTool.hpp.
NODE** FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::boundaryEdgeStartNodes [private] |
Definition at line 64 of file FacetorTool.hpp.
DLIList<NODE *>* FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::boundingNodes [private] |
Definition at line 63 of file FacetorTool.hpp.
NODE* FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::boxNodes[4] [private] |
Definition at line 71 of file FacetorTool.hpp.
int FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::curVisitFlag [private] |
Definition at line 75 of file FacetorTool.hpp.
DLIList<TRI *>* FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::facetList [private] |
Definition at line 62 of file FacetorTool.hpp.
int FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::numBoundaryEdges [private] |
Definition at line 67 of file FacetorTool.hpp.
ParamTool* FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::pTool [private] |
Definition at line 60 of file FacetorTool.hpp.
SURF* FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::refFacePtr [private] |
Definition at line 61 of file FacetorTool.hpp.
SIZEFUNC* FacetorTool< SURF, TRI, EDGE, NODE, TRICHILD, NODECHILD, SIZEFUNC >::sizingFunction [private] |
Definition at line 66 of file FacetorTool.hpp.