|
cgma
|
#include <FacetBody.hpp>
Definition at line 43 of file FacetBody.hpp.
| FacetBody::FacetBody | ( | DLIList< Lump * > & | myLumps | ) |
Definition at line 54 of file FacetBody.cpp.
{
myLumps += my_lumps;
}
| FacetBody::~FacetBody | ( | ) | [virtual] |
Definition at line 58 of file FacetBody.cpp.
{
//Not sure what to do..
}
| void FacetBody::add_lump | ( | FacetLump * | lump_to_add | ) |
| void FacetBody::append_simple_attribute_virt | ( | const CubitSimpleAttrib & | csa | ) | [virtual] |
Implements TopologyBridge.
Definition at line 68 of file FacetBody.cpp.
{ attribSet.append_attribute(csa); }
| CubitBoolean FacetBody::can_be_deleted | ( | DLIList< Body * > & | body_list | ) |
Definition at line 530 of file FacetBody.cpp.
{
CubitBoolean delete_ok = CUBIT_TRUE;
DLIList<FacetSurface *>surf_list;
get_surfaces(surf_list);
int ii;
for (ii=0; ii<surf_list.size() && delete_ok; ii++)
{
FacetSurface *surf_ptr = surf_list.get_and_step();
DLIList<FacetBody*>my_body_list;
surf_ptr->get_bodies(my_body_list);
int jj;
if (my_body_list.size() >= 2)
{
for (jj=0; jj<my_body_list.size() && delete_ok; jj++)
{
BodySM *my_body_ptr = my_body_list.get_and_step();
if (my_body_ptr != this)
{
int kk;
int found = 0;
for (kk=0; kk<body_list.size() && !found; kk++)
{
Body *body_ptr = body_list.get_and_step();
FacetBody* fbody_ptr = CAST_TO(body_ptr->get_body_sm_ptr(), FacetBody);
if (fbody_ptr)
{
if (my_body_ptr == fbody_ptr)
found = 1;
}
}
if (!found)
{
delete_ok = CUBIT_FALSE;
PRINT_ERROR("Body cannot be deleted because it is merged with adjacent Body\n");
PRINT_INFO(" Mesh Based Geometry entities cannot be unmerged.\n"
" Try using the no_merge option when importing the mesh\n");
}
}
}
}
}
return delete_ok;
}
| BodySM * FacetBody::copy | ( | ) | [virtual] |
Definition at line 97 of file FacetBody.cpp.
{
CubitStatus rv;
// ----------Copy the points on the body------------------------
std::map<TopologyBridge*, TopologyBridge*> old_to_new_map;
std::map<CubitPoint*, CubitPoint*> old_to_new_cubit_pts;
int ii;
DLIList<FacetPoint*> point_list;
get_points(point_list);
DLIList<TBPoint*> copy_points;
point_list.reset();
TBPoint *point_ptr;
TBPoint *point_copy;
for(ii=0; ii<point_list.size(); ii++)
{
point_ptr = point_list.get_and_step();
CubitVector temp_vector = point_ptr->coordinates();
CubitPoint *new_cubit_point = new CubitPointData( temp_vector );
rv = FacetModifyEngine::instance()->make_facet_point( new_cubit_point,
point_copy);
if(rv != CUBIT_SUCCESS)
{
PRINT_ERROR("Couldn't copy points");
return (BodySM *)NULL;
}
copy_points.append( point_copy );
FacetPoint *old_fp = static_cast<FacetPoint*>(point_ptr);
old_to_new_cubit_pts.insert(
std::make_pair(old_fp->get_cubit_point(), new_cubit_point ) );
old_to_new_map.insert(
std::make_pair( point_ptr, point_copy ) );
}
// ------------------Copy the curves-------------------------
int jj;
std::map<FacetCurve*, FacetCurve*> hard_line_curve_map;
DLIList<FacetCurve*> curve_list;
get_curves( curve_list );
DLIList<Curve*> copy_curves;
curve_list.reset();
Curve *curve_ptr, *curve_copy;
FacetCurve *fcurve;
TBPoint *ptsm_ptr;
TBPoint *start_ptr, *end_ptr, *copy_start = NULL, *copy_end = NULL;
for (ii=0; ii<curve_list.size(); ii++)
{
curve_ptr = curve_list.get_and_step();
fcurve = CAST_TO( curve_ptr, FacetCurve );
start_ptr = fcurve->start_point();
end_ptr = fcurve->end_point();
int found0 = 0;
int found1 = 0;
// find the end points
point_list.reset();
copy_points.reset();
for (jj=0; jj<point_list.size() && (!found0 || !found1); jj++)
{
point_ptr = point_list.get_and_step();
ptsm_ptr = CAST_TO(point_ptr, TBPoint);
point_copy = copy_points.get_and_step();
if (ptsm_ptr == start_ptr)
{
copy_start = point_copy;
found0 = 1;
}
if (ptsm_ptr == end_ptr)
{
copy_end = point_copy;
found1 = 1;
}
}
// create the new curve and update the points
rv = FacetModifyEngine::instance()->make_facet_curve(copy_start,
copy_end,
curve_copy);
if(rv != CUBIT_SUCCESS)
{
PRINT_ERROR("Couldn't copy curves");
return (BodySM *)NULL;
}
CurveFacetEvalTool *eval_tool = fcurve->get_eval_tool();
DLIList<CubitFacetEdge*> facet_edges;
eval_tool->get_facets( facet_edges );
CubitFacetEdge *tmp_facet_edge = facet_edges.get();
DLIList<CubitFacet*> adj_facets;
tmp_facet_edge->facets( adj_facets );
CubitFacet *tmp_facet = adj_facets.get_and_step();
tmp_facet->tool_id();
for( int k=adj_facets.size(); k--; )
{
if( tmp_facet_edge->num_adj_facets_on_surf( adj_facets.get_and_step()->tool_id() ) > 1 )
{
hard_line_curve_map.insert(
std::map<FacetCurve*, FacetCurve*>::value_type( static_cast<FacetCurve*>( CAST_TO( curve_copy, FacetCurve )),fcurve ));
break;
}
}
old_to_new_map.insert(
std::make_pair( curve_ptr, curve_copy ) );
copy_curves.append( curve_copy );
}
// ------------------copy coedges-----------------------
DLIList<FacetCoEdge*> coedge_list;
get_coedges( coedge_list );
DLIList<CoEdgeSM*> copy_coedges;
coedge_list.reset();
Curve *curvsm_ptr;
Curve *curvsm_copy = NULL;
CoEdgeSM *coedge_ptr, *coedge_copy;
FacetCoEdge *fcoedge;
for (ii=0; ii<coedge_list.size(); ii++)
{
coedge_ptr = coedge_list.get_and_step();
fcoedge = CAST_TO( coedge_ptr, FacetCoEdge );
Curve *curve_at_coedge = fcoedge->curve();
int found = 0;
// find the associated curve
curve_list.reset();
copy_curves.reset();
for (jj=0; jj<curve_list.size() && !found; jj++)
{
curve_ptr = curve_list.get_and_step();
curvsm_ptr = CAST_TO(curve_ptr, Curve);
curvsm_copy = copy_curves.get_and_step();
if (curve_at_coedge == curvsm_ptr)
{
found = 1;
}
}
// create the new coedge
CubitSense sense = fcoedge->sense();
rv = FacetModifyEngine::instance()->make_facet_coedge(curvsm_copy,
sense, coedge_copy);
if(rv != CUBIT_SUCCESS)
{
PRINT_ERROR("Couldn't copy coedge");
return (BodySM *)NULL;
}
copy_coedges.append( coedge_copy );
}
// ----------------------copy loops--------------------------
int kk;
DLIList<FacetLoop*> loop_list;
get_loops( loop_list );
DLIList<LoopSM*> copy_loops;
loop_list.reset();
LoopSM *loop_ptr, *loop_copy;
FacetLoop *floop;
for (ii=0; ii<loop_list.size(); ii++)
{
floop = loop_list.get_and_step();
DLIList<FacetCoEdge *>coedges_on_loop;
floop->get_coedges(coedges_on_loop);
DLIList<CoEdgeSM *>copy_coedges_on_loop;
// find all associated coedges on the loop
for(kk=0; kk<coedges_on_loop.size(); kk++)
{
int found = 0;
coedge_list.reset();
copy_coedges.reset();
CoEdgeSM *coedge_on_loop = coedges_on_loop.get_and_step();
for (jj=0; jj<coedge_list.size() && !found; jj++)
{
coedge_ptr = coedge_list.get_and_step();
coedge_copy = copy_coedges.get_and_step();
if (coedge_on_loop == coedge_ptr)
{
found = 1;
copy_coedges_on_loop.append(coedge_copy);
}
}
}
// create the new loop
rv = FacetModifyEngine::instance()->make_facet_loop(copy_coedges_on_loop,
loop_copy);
if(rv != CUBIT_SUCCESS)
{
PRINT_ERROR("Couldn't copy loops");
return (BodySM *)NULL;
}
copy_loops.append( loop_copy );
}
// ----------------------copy surfaces--------------------------
DLIList<FacetSurface*> surface_list;
get_surfaces(surface_list);
DLIList<Surface*> copy_surfaces;
surface_list.reset();
Surface *surface_ptr, *surface_copy;
FacetSurface *fsurface;
for (ii=0; ii<surface_list.size(); ii++)
{
fsurface = surface_list.get_and_step();
DLIList<FacetLoop *>loops_on_surface;
fsurface->get_loops(loops_on_surface);
DLIList<LoopSM *>copy_loops_on_surface;
// find all associated loops on the surface
for(kk=0; kk<loops_on_surface.size(); kk++)
{
int found = 0;
loop_list.reset();
copy_loops.reset();
LoopSM *loop_on_surface = loops_on_surface.get_and_step();
for (jj=0; jj<loop_list.size() && !found; jj++)
{
loop_ptr = loop_list.get_and_step();
loop_copy = copy_loops.get_and_step();
if (loop_on_surface == loop_ptr)
{
found = 1;
copy_loops_on_surface.append(loop_copy);
}
}
}
// create the new surface
DLIList<CubitFacet*>facet_list;
DLIList<CubitPoint*>cpoint_list;
rv = fsurface->copy_facets( facet_list, cpoint_list, old_to_new_cubit_pts );
if (rv != CUBIT_SUCCESS)
{
return (BodySM *)NULL;
}
int interp_order = fsurface->interp_order();
double min_dot = fsurface->min_dot();
const CubitEvaluatorData *eval_data = fsurface->evaluator_data();
CubitBoolean use_point_addresses = CUBIT_FALSE;
rv = FacetModifyEngine::instance()->make_facet_surface(eval_data,
facet_list,
cpoint_list,
copy_loops_on_surface,
interp_order,
min_dot,
surface_copy,
use_point_addresses,
NULL,
&hard_line_curve_map);
if(rv != CUBIT_SUCCESS)
{
PRINT_ERROR("Couldn't copy surfaces");
return (BodySM *)NULL;
}
old_to_new_map.insert(
std::make_pair( fsurface, surface_copy ) );
copy_surfaces.append( surface_copy );
}
// ----------------------copy shells--------------------------
DLIList<FacetShell*> shell_list;
get_shells(shell_list);
DLIList<ShellSM*> copy_shells;
shell_list.reset();
ShellSM *shell_ptr, *shell_copy;
FacetShell *fshell;
for (ii=0; ii<shell_list.size(); ii++)
{
fshell = shell_list.get_and_step();
DLIList<FacetSurface *>surfaces_on_shell;
fshell->get_surfaces(surfaces_on_shell);
DLIList<Surface *>copy_surfaces_on_shell;
// find all associated loops on the surface
for(kk=0; kk<surfaces_on_shell.size(); kk++)
{
int found = 0;
surface_list.reset();
copy_surfaces.reset();
Surface *surface_on_shell = surfaces_on_shell.get_and_step();
for (jj=0; jj<surface_list.size() && !found; jj++)
{
surface_ptr = surface_list.get_and_step();
surface_copy = copy_surfaces.get_and_step();
if (surface_on_shell == surface_ptr)
{
found = 1;
copy_surfaces_on_shell.append(surface_copy);
}
}
}
// create the new shell
rv = FacetModifyEngine::instance()->make_facet_shell(copy_surfaces_on_shell,
shell_copy);
if(rv != CUBIT_SUCCESS)
{
PRINT_ERROR("Couldn't copy shell");
return (BodySM *)NULL;
}
// set the sense of the surfaces on the shell - copy from the old shell
FacetShell *fshell_copy = CAST_TO(shell_copy, FacetShell);
surfaces_on_shell.reset();
copy_surfaces_on_shell.reset();
for (kk=0; kk<surfaces_on_shell.size(); kk++)
{
Surface *surface_on_shell = surfaces_on_shell.get_and_step();
Surface *copy_surface_on_shell = copy_surfaces_on_shell.get_and_step();
fsurface = CAST_TO( surface_on_shell, FacetSurface );
CubitSense sense = fsurface->get_shell_sense(fshell);
FacetSurface *copy_fsurface = CAST_TO( copy_surface_on_shell, FacetSurface );
copy_fsurface->set_shell_sense( fshell_copy, sense );
}
copy_shells.append( shell_copy );
}
// ----------------------copy lumps--------------------------
DLIList<FacetLump*> lump_list;
get_lumps(lump_list);
DLIList<Lump*> copy_lumps;
lump_list.reset();
Lump *lump_copy;
FacetLump *flump;
for (ii=0; ii<lump_list.size(); ii++)
{
flump = lump_list.get_and_step();
DLIList<FacetShell *>shells_on_lump;
flump->get_shells(shells_on_lump);
DLIList<ShellSM *>copy_shells_on_lump;
// find all associated loops on the surface
for(kk=0; kk<shells_on_lump.size(); kk++)
{
int found = 0;
shell_list.reset();
copy_shells.reset();
ShellSM *shell_on_lump = shells_on_lump.get_and_step();
for (jj=0; jj<shell_list.size() && !found; jj++)
{
shell_ptr = shell_list.get_and_step();
shell_copy = copy_shells.get_and_step();
if (shell_on_lump == shell_ptr)
{
found = 1;
copy_shells_on_lump.append(shell_copy);
}
}
}
// create the new lump
rv = FacetModifyEngine::instance()->make_facet_lump(copy_shells_on_lump,
lump_copy);
if(rv != CUBIT_SUCCESS)
{
PRINT_ERROR("Couldn't copy lump");
return (BodySM *)NULL;
}
old_to_new_map.insert(
std::make_pair( flump, lump_copy ) );
copy_lumps.append( lump_copy );
}
// ----------------------copy body--------------------------
BodySM *body_copy;
rv = FacetModifyEngine::instance()->make_facet_body(copy_lumps,
body_copy);
if(rv != CUBIT_SUCCESS)
{
PRINT_ERROR("Couldn't copy lump");
return (BodySM *)NULL;
}
//copy the attributes from old to new
std::map<TopologyBridge*, TopologyBridge*>::iterator iter;
for( iter= old_to_new_map.begin(); iter != old_to_new_map.end(); iter++ )
{
TopologyBridge *old_tb = iter->first;
TopologyBridge *new_tb = iter->second;
DLIList<CubitSimpleAttrib> old_attribs;
old_tb->get_simple_attribute( old_attribs );
for( int i=old_attribs.size(); i--; )
{
const CubitSimpleAttrib& copy = old_attribs.get_and_step();
new_tb->append_simple_attribute_virt( copy );
}
}
return (BodySM*)body_copy;
}
| void FacetBody::disconnect_all_lumps | ( | ) |
| void FacetBody::get_children_virt | ( | DLIList< TopologyBridge * > & | children | ) | [virtual] |
Implements TopologyBridge.
Definition at line 917 of file FacetBody.cpp.
{ CAST_LIST_TO_PARENT( myLumps, lumps ); }
| void FacetBody::get_coedges | ( | DLIList< FacetCoEdge * > & | coedges | ) |
Definition at line 960 of file FacetBody.cpp.
{
DLIList<FacetSurface*> surface_list;
get_surfaces( surface_list );
surface_list.reset();
for ( int i = 0; i < surface_list.size(); i++ )
surface_list.next(i)->get_coedges( result_list );
}
| void FacetBody::get_curves | ( | DLIList< FacetCurve * > & | curves | ) |
Definition at line 969 of file FacetBody.cpp.
{
DLIList<FacetCoEdge*> coedge_list;
get_coedges( coedge_list );
coedge_list.reset();
for ( int i = coedge_list.size(); i--; )
{
FacetCoEdge* coedge = coedge_list.get_and_step();
FacetCurve* curve = dynamic_cast<FacetCurve*>(coedge->curve());
if (curve)
result_list.append_unique(curve);
}
}
| GeometryQueryEngine * FacetBody::get_geometry_query_engine | ( | ) | const [virtual] |
Implements TopologyBridge.
Definition at line 63 of file FacetBody.cpp.
{
return FacetQueryEngine::instance();
}
| void FacetBody::get_loops | ( | DLIList< FacetLoop * > & | loops | ) |
Definition at line 951 of file FacetBody.cpp.
{
DLIList<FacetSurface*> surface_list;
get_surfaces( surface_list );
surface_list.reset();
for ( int i = 0; i < surface_list.size(); i++ )
surface_list.next(i)->get_loops( result_list );
}
| void FacetBody::get_lumps | ( | DLIList< FacetLump * > & | lumps | ) |
| void FacetBody::get_parents_virt | ( | DLIList< TopologyBridge * > & | parents | ) | [virtual] |
| void FacetBody::get_points | ( | DLIList< FacetPoint * > & | points | ) |
Definition at line 983 of file FacetBody.cpp.
{
DLIList<FacetCurve*> curve_list;
get_curves( curve_list );
curve_list.reset();
for ( int i = curve_list.size(); i--; )
{
FacetCurve* curve = curve_list.get_and_step();
FacetPoint* point = dynamic_cast<FacetPoint*>(curve->start_point());
if (point)
result_list.append_unique(point);
point = dynamic_cast<FacetPoint*>(curve->end_point());
if (point)
result_list.append_unique(point);
}
}
| void FacetBody::get_shells | ( | DLIList< FacetShell * > & | shells | ) |
Definition at line 928 of file FacetBody.cpp.
{
DLIList<FacetLump*> lump_list;
get_lumps( lump_list );
lump_list.reset();
for ( int i = 0; i < lump_list.size(); i++ )
lump_list.next(i)->get_shells( result_list );
}
| CubitStatus FacetBody::get_simple_attribute | ( | DLIList< CubitSimpleAttrib > & | csa_list | ) | [virtual] |
Implements TopologyBridge.
Definition at line 77 of file FacetBody.cpp.
{ return attribSet.get_attributes(csa_list); }
| CubitStatus FacetBody::get_simple_attribute | ( | const CubitString & | name, |
| DLIList< CubitSimpleAttrib > & | csa_list | ||
| ) | [virtual] |
Implements TopologyBridge.
Definition at line 80 of file FacetBody.cpp.
{ return attribSet.get_attributes( name, csa_list ); }
| void FacetBody::get_surfaces | ( | DLIList< FacetSurface * > & | surfaces | ) |
Definition at line 937 of file FacetBody.cpp.
{
DLIList<FacetShell*> shell_list;
DLIList<FacetSurface*> tmp_list;
get_shells(shell_list);
shell_list.reset();
for ( int i = 0; i < shell_list.size(); i++ )
{
tmp_list.clean_out();
shell_list.next(i)->get_surfaces( tmp_list );
result_list.merge_unique( tmp_list );
}
}
| CubitStatus FacetBody::get_transforms | ( | CubitTransformMatrix & | tfm | ) | [virtual] |
Implements BodySM.
Definition at line 896 of file FacetBody.cpp.
{
tfm = myTransforms;
return CUBIT_SUCCESS;
}
| void FacetBody::init_edge_flags | ( | DLIList< Surface * > & | surf_list, |
| int | flag | ||
| ) | [private] |
Definition at line 869 of file FacetBody.cpp.
{
int ii, jj;
Surface *surf;
FacetSurface *fsurf;
FacetEvalTool *ftool;
CubitFacetEdge *edge_ptr;
for (ii=0; ii<surf_list.size(); ii++)
{
DLIList<CubitFacetEdge*>edge_list;
surf = surf_list.get_and_step();
fsurf = CAST_TO( surf, FacetSurface );
ftool = fsurf->get_eval_tool();
if (ftool->interp_order() == 4)
{
ftool->get_edges( edge_list );
for (jj=0; jj<edge_list.size(); jj++)
{
edge_ptr = edge_list.get_and_step();
edge_ptr->set_flag( 0 );
}
}
}
}
| CubitStatus FacetBody::mass_properties | ( | CubitVector & | result, |
| double & | volume | ||
| ) | [virtual] |
Implements BodySM.
Definition at line 1056 of file FacetBody.cpp.
{
centroid.set( 0.0, 0.0, 0.0 );
volume = 0.0;
DLIList<FacetLump*> lumps (myLumps.size());
CAST_LIST( myLumps, lumps, FacetLump );
assert( myLumps.size() == lumps.size() );
for (int i = lumps.size(); i--; )
{
CubitVector cent;
double vol;
if (CUBIT_SUCCESS != lumps.get_and_step()->mass_properties(cent,vol))
return CUBIT_FAILURE;
centroid += vol*cent;
volume += vol;
}
if (volume > CUBIT_RESABS)
{
centroid /= volume;
}
else
{
centroid.set( 0.0, 0.0, 0.0 );
volume = 0.0;
}
return CUBIT_SUCCESS;
}
| CubitStatus FacetBody::move | ( | double | dx, |
| double | dy, | ||
| double | dz | ||
| ) | [virtual] |
Definition at line 581 of file FacetBody.cpp.
{
CubitTransformMatrix tfmat;
tfmat.translate( dx, dy, dz );
CubitStatus stat = transform( tfmat, CUBIT_FALSE );
if (stat == CUBIT_SUCCESS)
myTransforms.translate( dx, dy, dz );
return stat;
}
| CubitPointContainment FacetBody::point_containment | ( | const CubitVector & | pos, |
| double | tolerance | ||
| ) | [virtual] |
Implements BodySM.
Definition at line 1096 of file FacetBody.cpp.
{
CubitPointContainment pc_value;
FacetLump *facet_lump;
int i;
for(i=myLumps.size(); i--;)
{
facet_lump = dynamic_cast<FacetLump*>(myLumps.get_and_step());
pc_value = facet_lump->point_containment( point, tolerance );
if( pc_value == CUBIT_PNT_INSIDE )
return CUBIT_PNT_INSIDE;
else if( pc_value == CUBIT_PNT_BOUNDARY )
return CUBIT_PNT_BOUNDARY;
}
return CUBIT_PNT_OUTSIDE;
}
| CubitStatus FacetBody::reflect | ( | double | reflect_axis_x, |
| double | reflect_axis_y, | ||
| double | reflect_axis_z | ||
| ) |
Definition at line 699 of file FacetBody.cpp.
{
CubitTransformMatrix reflectmat;
CubitVector reflect_vector( reflect_axis_x,
reflect_axis_y,
reflect_axis_z );
reflectmat.reflect( reflect_vector );
CubitStatus stat = transform( reflectmat, CUBIT_TRUE );
if (stat == CUBIT_SUCCESS)
myTransforms.reflect( reflect_vector );
return stat;
}
| void FacetBody::remove_all_simple_attribute_virt | ( | ) | [virtual] |
Implements TopologyBridge.
Definition at line 74 of file FacetBody.cpp.
{ attribSet.remove_all_attributes(); }
| void FacetBody::remove_lump | ( | FacetLump * | lump_to_remove | ) |
Definition at line 1010 of file FacetBody.cpp.
| void FacetBody::remove_simple_attribute_virt | ( | const CubitSimpleAttrib & | csa | ) | [virtual] |
Implements TopologyBridge.
Definition at line 71 of file FacetBody.cpp.
{ attribSet.remove_attribute(csa); }
| CubitStatus FacetBody::restore | ( | ) | [virtual] |
Definition at line 677 of file FacetBody.cpp.
{
// invert the transformation matrix and apply to entities
// (assumes an orthogonal matrix (ie. no shear or non-uniform scaling)
CubitTransformMatrix inverse_mat;
inverse_mat = myTransforms.inverse();
CubitStatus stat = transform( inverse_mat, CUBIT_TRUE );
if (stat == CUBIT_SUCCESS)
myTransforms.set_to_identity();
return stat;
}
| CubitStatus FacetBody::restore_attribs | ( | FILE * | file_ptr, |
| unsigned int | endian | ||
| ) |
Definition at line 87 of file FacetBody.cpp.
{ return attribSet.restore_attributes( file_ptr, endian ); }
| CubitStatus FacetBody::rotate | ( | double | x, |
| double | y, | ||
| double | z, | ||
| double | angle_in_degrees | ||
| ) | [virtual] |
Definition at line 601 of file FacetBody.cpp.
{
CubitTransformMatrix rotmat;
CubitVector axis( x, y, z );
rotmat.rotate( angle_in_degrees, axis );
CubitStatus stat = transform( rotmat, CUBIT_TRUE );
if (stat == CUBIT_SUCCESS)
myTransforms.rotate( angle_in_degrees, axis );
return stat;
}
| CubitStatus FacetBody::save_attribs | ( | FILE * | file_ptr | ) |
Definition at line 84 of file FacetBody.cpp.
{ return attribSet.save_attributes( file_ptr); }
| CubitStatus FacetBody::scale | ( | double | scale_factor_x, |
| double | scale_factor_y, | ||
| double | scale_factor_z | ||
| ) | [virtual] |
Definition at line 635 of file FacetBody.cpp.
{
CubitTransformMatrix scalemat;
scalemat.scale_about_origin( scale_factor_x,
scale_factor_y,
scale_factor_z );
CubitStatus stat = transform( scalemat, CUBIT_FALSE );
if (stat == CUBIT_SUCCESS)
myTransforms.scale_about_origin( scale_factor_x,
scale_factor_y,
scale_factor_z );
// scale the facetcurve
DLIList<FacetCurve *> curve_list;
get_curves(curve_list);
Curve *curv_ptr;
for (int ii=0; ii<curve_list.size(); ii++)
{
curv_ptr = curve_list.get_and_step();
FacetCurve *fcurve = CAST_TO( curv_ptr, FacetCurve );
if (fcurve)
{
fcurve->reset_length();
}
}
return stat;
}
| CubitStatus FacetBody::scale | ( | double | scale_factor | ) | [virtual] |
Definition at line 624 of file FacetBody.cpp.
{
return scale(scale_factor,scale_factor,scale_factor);
}
Definition at line 902 of file FacetBody.cpp.
{
myTransforms = tfm;
return CUBIT_SUCCESS;
}
| CubitStatus FacetBody::transform | ( | CubitTransformMatrix & | tfmat, |
| CubitBoolean | is_rotation | ||
| ) | [private] |
Definition at line 725 of file FacetBody.cpp.
{
int ii;
// get the list of surfaces on the body
DLIList<FacetSurface *>surf_list;
get_surfaces( surf_list );
Surface *surf;
FacetSurface *fsurf;
FacetEvalTool *ftool;
//CubitVector min, max;
// go through all the surfaces and collect the list of all points.
// (some may be listed on multiple surfaces)
DLIList<CubitPoint *>point_list;
for (ii=0; ii<surf_list.size(); ii++)
{
surf = surf_list.get_and_step();
fsurf = CAST_TO( surf, FacetSurface );
fsurf->get_my_points( point_list );
}
// unmark all the points so we can keep track of the ones that have
// already been transformed
CubitPoint *cp;
for (ii=0; ii<point_list.size(); ii++)
{
cp = point_list.get_and_step();
cp->marked( 0 );
}
// transform the points
//CubitVector norm, du, dv;
for (ii=0; ii<point_list.size(); ii++)
{
cp = point_list.get_and_step();
if (!cp->marked())
{
cp->transform( tfmat );
if (is_rotation)
cp->rotate_normal( tfmat );
cp->marked( 1 );
}
}
// check the vertices - make sure they are transformed
FacetPoint *fpt;
TBPoint *pt;
DLIList<FacetPoint*>gpoint_list;
get_points(gpoint_list);
for (ii=0; ii<gpoint_list.size(); ii++)
{
pt = gpoint_list.get_and_step();
fpt = CAST_TO( pt, FacetPoint );
// only transform the point if it isn't already part of the facets
// (they could be points by themselves)
cp = fpt->get_cubit_point();
if (cp->num_adj_facets() == 0)
{
cp->transform( tfmat );
if (is_rotation)
cp->rotate_normal( tfmat );
}
}
// reset the bounding box and update the facet normal and plane
// init flags on edges to 0
DLIList<Surface*> tmp_surf_list( surf_list.size() );
CAST_LIST_TO_PARENT( surf_list, tmp_surf_list );
init_edge_flags( tmp_surf_list, 0 );
for (ii=0; ii<surf_list.size(); ii++)
{
surf = surf_list.get_and_step();
fsurf = CAST_TO( surf, FacetSurface );
// if we are using a bspline representation, then we also need to
// transform the control points on the edges and facets
ftool = fsurf->get_eval_tool();
if (ftool->interp_order() == 4)
{
ftool->transform_control_points( tfmat );
}
DLIList<CubitFacet *>flist;
DLIList<CubitPoint *>plist;
fsurf->get_my_facets( flist, plist);
int jj;
CubitFacet *facet_ptr;
for (jj=0; jj<flist.size(); jj++)
{
facet_ptr = flist.get_and_step();
facet_ptr->update_plane();
facet_ptr->reset_bounding_box();
}
//must be done after facet's are reset...
ftool->reset_bounding_box();
// if this facet surface has a primitive evaluator, then we need
// to tell it about the transformation also.
fsurf->add_transformation( tfmat );
//re-calculate the area of the surface in case it changed
fsurf->update_measurement();
}
init_edge_flags( tmp_surf_list, 0 );
// Some transforms (those incorporating reflections)
// invert the geometry. Correct for it.
// -- jason k.
if ( tfmat.sub_matrix(3,3).determinant() < 0.0 )
{
// Flip CoFace senses
DLIList<FacetShell*> shells;
get_shells( shells );
//modified. mbrewer. doing both a reverse and a
//reverse_surfaces. the latter actually changes the
// underlying surfaces so that the normals can all
// still be outward pointing. It automatically changes
// the sense, therefore we also still need excplicity
// call reverse so that sense is corrected.
while (shells.size()){
shells.get()->reverse_surfaces();
shells.pop()->reverse();
}
}
return CUBIT_SUCCESS;
}
| int FacetBody::validate | ( | const CubitString & | , |
| DLIList< TopologyEntity * > & | |||
| ) | [virtual] |
Reimplemented from TopologyBridge.
Definition at line 908 of file FacetBody.cpp.
{
PRINT_ERROR("This option is not available for mesh defined geometry.\n");
return 0;
}
FacetAttribSet FacetBody::attribSet [private] |
Definition at line 195 of file FacetBody.hpp.
DLIList<Lump*> FacetBody::myLumps [private] |
Definition at line 193 of file FacetBody.hpp.
CubitTransformMatrix FacetBody::myTransforms [private] |
Definition at line 192 of file FacetBody.hpp.