|
cgma
|
#include <FacetLump.hpp>
Definition at line 40 of file FacetLump.hpp.
| FacetLump::FacetLump | ( | DLIList< ShellSM * > & | my_shells, |
| BodySM * | body_sm_ptr = NULL |
||
| ) |
Definition at line 56 of file FacetLump.cpp.
| FacetLump::~FacetLump | ( | ) | [virtual] |
Definition at line 64 of file FacetLump.cpp.
{}
| void FacetLump::add_body | ( | BodySM * | new_body | ) | [inline] |
Definition at line 51 of file FacetLump.hpp.
{myBodyPtr = new_body;}
| void FacetLump::add_shell | ( | FacetShell * | shell | ) |
| void FacetLump::append_simple_attribute_virt | ( | const CubitSimpleAttrib & | csa | ) | [virtual] |
Implements TopologyBridge.
Definition at line 79 of file FacetLump.cpp.
{ attribSet.append_attribute(csa); }
| CubitBox FacetLump::bounding_box | ( | void | ) | const [virtual] |
Implements GeometryEntity.
Definition at line 141 of file FacetLump.cpp.
{
CubitBox my_box, temp_box;
DLIList<FacetSurface*> surfaces;
int ii;
const_cast<FacetLump*>(this)->get_surfaces(surfaces);
if (surfaces.size() > 0)
{
Surface* surface = surfaces.get_and_step();
my_box = surface->bounding_box();
for ( ii = surfaces.size(); ii > 1; ii-- )
{
surface = surfaces.get_and_step();
temp_box = surface->bounding_box();
//unite the boxes..
my_box |= temp_box;
}
}
return my_box;
}
| void FacetLump::disconnect_all_shells | ( | ) |
Definition at line 335 of file FacetLump.cpp.
{
myShells.reset();
for (int i = myShells.size(); i--; )
{
ShellSM* sm_ptr = myShells.get_and_step();
FacetShell* shell = dynamic_cast<FacetShell*>(sm_ptr);
if (shell)
{
assert(shell->get_lump() == this);
shell->remove_lump();
}
}
myShells.clean_out();
}
| void FacetLump::get_bodies | ( | DLIList< FacetBody * > & | bodies | ) |
Definition at line 250 of file FacetLump.cpp.
| BodySM* FacetLump::get_body | ( | ) | const [inline] |
Definition at line 143 of file FacetLump.hpp.
{ return myBodyPtr; }
| void FacetLump::get_children_virt | ( | DLIList< TopologyBridge * > & | children | ) | [virtual] |
Implements TopologyBridge.
Definition at line 241 of file FacetLump.cpp.
{
int ii;
for ( ii = myShells.size(); ii > 0; ii-- )
{
shellsms.append_unique(myShells.get_and_step());
}
}
| void FacetLump::get_coedges | ( | DLIList< FacetCoEdge * > & | coedges | ) |
Definition at line 280 of file FacetLump.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 FacetLump::get_curves | ( | DLIList< FacetCurve * > & | curves | ) |
Definition at line 289 of file FacetLump.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 * FacetLump::get_geometry_query_engine | ( | ) | const [virtual] |
Implements TopologyBridge.
Definition at line 169 of file FacetLump.cpp.
{
return FacetQueryEngine::instance();
}
| void FacetLump::get_parents_virt | ( | DLIList< TopologyBridge * > & | parents | ) | [virtual] |
Implements TopologyBridge.
Definition at line 235 of file FacetLump.cpp.
| void FacetLump::get_shells | ( | DLIList< FacetShell * > & | shells | ) |
Definition at line 257 of file FacetLump.cpp.
| CubitStatus FacetLump::get_simple_attribute | ( | DLIList< CubitSimpleAttrib > & | csa_list | ) | [virtual] |
Implements TopologyBridge.
Definition at line 119 of file FacetLump.cpp.
{ return attribSet.get_attributes( csa_list ); }
| CubitStatus FacetLump::get_simple_attribute | ( | const CubitString & | name, |
| DLIList< CubitSimpleAttrib > & | csa_list | ||
| ) | [virtual] |
Implements TopologyBridge.
Definition at line 122 of file FacetLump.cpp.
{ return attribSet.get_attributes( name, csa_list ); }
| void FacetLump::get_surfaces | ( | DLIList< FacetSurface * > & | surfaces | ) |
Definition at line 265 of file FacetLump.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 );
}
}
Definition at line 456 of file FacetLump.cpp.
{
FacetShell *facet_shell;
int i;
//if any of the shells are sheets, the body is assume to be a sheet
// for our purposes...
for(i=myShells.size(); i--;)
{
facet_shell = dynamic_cast<FacetShell*>(myShells.get_and_step());
if(facet_shell->is_sheet()){
return CUBIT_TRUE;
}
}
return CUBIT_FALSE;
}
| CubitStatus FacetLump::mass_properties | ( | CubitVector & | centroid, |
| double & | volume | ||
| ) | [virtual] |
Implements Lump.
Definition at line 361 of file FacetLump.cpp.
{
int i;
DLIList<FacetShell*> shells( myShells.size() );
CAST_LIST( myShells, shells, FacetShell );
assert( myShells.size() == shells.size() );
DLIList<FacetSurface*> surfaces;
DLIList<FacetShell*> surf_shells;
get_surfaces( surfaces );
DLIList<CubitFacet*> facets, surf_facets;
DLIList<CubitPoint*> junk;
DLIList<CubitSense> senses;
for (i = surfaces.size(); i--; )
{
FacetSurface* surf = surfaces.step_and_get();
surf_shells.clean_out();
surf->get_shells( surf_shells );
surf_shells.intersect( shells );
assert( surf_shells.size() );
CubitSense sense = surf->get_shell_sense( surf_shells.get() );
if (surf_shells.size() == 1 && CUBIT_UNKNOWN != sense)
{
surf_facets.clean_out();
junk.clean_out();
surf->get_my_facets( surf_facets, junk );
facets += surf_facets;
for (int j = surf_facets.size(); j--; )
senses.append(sense);
}
}
const CubitVector p0 = bounding_box().center();
CubitVector p1, p2, p3, normal;
centroid.set( 0.0, 0.0, 0.0 );
volume = 0.0;
facets.reset();
senses.reset();
for (i = facets.size(); i--; )
{
CubitFacet* facet = facets.get_and_step();
CubitSense sense = senses.get_and_step();
p1 = facet->point(0)->coordinates();
p2 = facet->point(1)->coordinates();
p3 = facet->point(2)->coordinates();
normal = (p3 - p1) * (p2 - p1);
double two_area = normal.length();
if (two_area > CUBIT_RESABS )
{
if (CUBIT_REVERSED == sense)
normal = -normal;
normal /= two_area;
double height = normal % (p0 - p1);
double vol = two_area * height;
volume += vol;
centroid += vol * (p0 + p1 + p2 + p3);
}
}
if (volume > CUBIT_RESABS)
centroid /= 4.0 * volume;
volume /= 6.0;
return CUBIT_SUCCESS;
}
| double FacetLump::measure | ( | ) | [virtual] |
Implements GeometryEntity.
Definition at line 183 of file FacetLump.cpp.
{
DLIList<CubitFacet*> bounding_facets;
DLIList<CubitPoint*> bounding_points;
DLIList<FacetSurface*> surfaces;
Surface *curr_surface;
FacetSurface *facet_surface;
//if this is a sheet body... return 0.0
//Body *tmp_body = CAST_TO(myBodyPtr->topology_entity(), Body);
if( is_sheet() )
return 0.0;
int ii;
get_surfaces(surfaces);
if (surfaces.size() > 0)
{
for ( ii = surfaces.size(); ii > 0; ii-- )
{
curr_surface = surfaces.get_and_step();
facet_surface = CAST_TO(curr_surface, FacetSurface);
if ( facet_surface == NULL )
{
PRINT_ERROR("Facet lump has surfaces that aren't facets?");
return 1;
}
facet_surface->get_my_facets(bounding_facets, bounding_points);
}
}
double volume, curr_facet_area, summation = 0.0;
CubitFacet *curr_facet;
CubitVector normal_of_curr_facet, vector_of_point;
CubitPoint *point_1, *point_2, *point_3;
for( int jj = bounding_facets.size(); jj > 0; jj-- )
{
curr_facet = bounding_facets.get_and_step();
curr_facet_area = curr_facet->area(); // Current facet's area
normal_of_curr_facet = curr_facet->normal(); // Current facet's normal
curr_facet->points(point_1, point_2, point_3); // Current facet's points
vector_of_point = point_1->coordinates(); // One point's vector
summation += ( double(vector_of_point % normal_of_curr_facet) * curr_facet_area);
}
volume = summation / 3;
return volume;
}
| virtual CubitStatus FacetLump::merge | ( | GeometryEntity * | ) | [inline, virtual] |
Definition at line 104 of file FacetLump.hpp.
{
PRINT_ERROR("BUG: In FacetLump::merge\n"
" This function should not be called at all\n"
" This is a Bug -- please report it!\n");
return CUBIT_FAILURE;
}
| CubitPointContainment FacetLump::point_containment | ( | const CubitVector & | point, |
| double | tolerance | ||
| ) |
Definition at line 434 of file FacetLump.cpp.
{
CubitPointContainment pc_value;
FacetShell *facet_shell;
int i;
for(i=myShells.size(); i--;)
{
facet_shell = dynamic_cast<FacetShell*>(myShells.get_and_step());
pc_value = facet_shell->point_containment( point, tolerance );
if( pc_value == CUBIT_PNT_OUTSIDE )
return CUBIT_PNT_OUTSIDE;
else if( pc_value == CUBIT_PNT_BOUNDARY )
return CUBIT_PNT_BOUNDARY;
}
return CUBIT_PNT_INSIDE;
}
| void FacetLump::remove_all_simple_attribute_virt | ( | ) | [virtual] |
Implements TopologyBridge.
Definition at line 108 of file FacetLump.cpp.
{ attribSet.remove_all_attributes(); }
| void FacetLump::remove_body | ( | ) | [inline] |
Definition at line 145 of file FacetLump.hpp.
{myBodyPtr = 0;}
| void FacetLump::remove_shell | ( | FacetShell * | shell | ) |
Definition at line 315 of file FacetLump.cpp.
{
ShellSM* sm_ptr;
sm_ptr = dynamic_cast<ShellSM*>(shell);
if( sm_ptr )
myShells.remove( sm_ptr );
shell->remove_lump();
}
| void FacetLump::remove_simple_attribute_virt | ( | const CubitSimpleAttrib & | csa | ) | [virtual] |
Implements TopologyBridge.
Definition at line 93 of file FacetLump.cpp.
{ attribSet.remove_attribute(csa); }
| CubitStatus FacetLump::restore_attribs | ( | FILE * | file_ptr, |
| unsigned int | endian | ||
| ) |
Definition at line 129 of file FacetLump.cpp.
{ return attribSet.restore_attributes( file_ptr, endian ); }
| CubitStatus FacetLump::save_attribs | ( | FILE * | file_ptr | ) |
Definition at line 126 of file FacetLump.cpp.
{ return attribSet.save_attributes( file_ptr ); }
| virtual TopologyEntity* FacetLump::unmerge | ( | DLIList< RefVolume * > | ) | [inline, virtual] |
Definition at line 112 of file FacetLump.hpp.
{
PRINT_ERROR( "BUG: In FacetLump::unmerge\n"
" This function should not be called\n"
" This is a Bug -- please report it!\n" );
return (TopologyEntity*)NULL;
}
FacetAttribSet FacetLump::attribSet [private] |
Definition at line 165 of file FacetLump.hpp.
BodySM* FacetLump::myBodyPtr [private] |
Definition at line 163 of file FacetLump.hpp.
DLIList<ShellSM*> FacetLump::myShells [private] |
Definition at line 162 of file FacetLump.hpp.