|
cgma
|
#include <CompositeBody.hpp>
Definition at line 23 of file CompositeBody.hpp.
Definition at line 19 of file CompositeBody.cpp.
: firstLump(0) { }
Definition at line 24 of file CompositeBody.cpp.
{
int i;
for( i = 0; i < realBodies.size(); i++ )
if( realBodies[i]->owner() == this )
realBodies[i]->owner(0);
while( firstLump )
remove( firstLump );
}
| CubitStatus CompositeBody::add | ( | CompositeLump * | lump | ) |
Definition at line 42 of file CompositeBody.cpp.
{
if( lump->myBody != 0 )
return CUBIT_FAILURE;
lump->myBody = this;
lump->nextLump = firstLump;
firstLump = lump;
return CUBIT_SUCCESS;
}
| CubitStatus CompositeBody::add | ( | BodySM * | body | ) |
Definition at line 77 of file CompositeBody.cpp.
{
if( index_of( body ) >= 0 )
return CUBIT_FAILURE;
if( body->owner() )
body->owner()->swap_bridge( body, this, false );
body->owner(this);
realBodies.push( body );
return CUBIT_SUCCESS;
}
| void CompositeBody::append_simple_attribute_virt | ( | const CubitSimpleAttrib & | simple_attrib_ptr | ) | [virtual] |
| void CompositeBody::combine | ( | CompositeBody * | other | ) |
Definition at line 364 of file CompositeBody.cpp.
{
int oldsize = realBodies.size();
realBodies.size( oldsize + other->realBodies.size() );
for (int i = 0; i < other->realBodies.size(); i++)
{
BodySM* bod = other->realBodies[i];
realBodies[i+oldsize] = bod;
bod->owner(this);
}
other->realBodies.size(0);
}
| CubitBoolean CompositeBody::contains_bridge | ( | TopologyBridge * | bridge | ) | const [virtual] |
Reimplemented from TBOwner.
Definition at line 254 of file CompositeBody.cpp.
{
return index_of(dynamic_cast<BodySM*>(bridge)) < 0 ? CUBIT_FALSE : CUBIT_TRUE;
}
| BodySM * CompositeBody::get_body | ( | int | index | ) | const [inline] |
Definition at line 88 of file CompositeBody.hpp.
{ return realBodies[index]; }
| void CompositeBody::get_children_virt | ( | DLIList< TopologyBridge * > & | children | ) | [virtual] |
Implements TopologyBridge.
Definition at line 194 of file CompositeBody.cpp.
| GeometryQueryEngine * CompositeBody::get_geometry_query_engine | ( | ) | const [virtual] |
Implements TopologyBridge.
Definition at line 210 of file CompositeBody.cpp.
{ return VirtualQueryEngine::instance(); }
| void CompositeBody::get_parents_virt | ( | DLIList< TopologyBridge * > & | parents | ) | [virtual] |
| CubitStatus CompositeBody::get_simple_attribute | ( | DLIList< CubitSimpleAttrib > & | attrib_list | ) | [virtual] |
Implements TopologyBridge.
Definition at line 277 of file CompositeBody.cpp.
{ return CUBIT_FAILURE; }
| CubitStatus CompositeBody::get_simple_attribute | ( | const CubitString & | name, |
| DLIList< CubitSimpleAttrib > & | attrib_list | ||
| ) | [virtual] |
Implements TopologyBridge.
Definition at line 279 of file CompositeBody.cpp.
{ return CUBIT_FAILURE; }
| CubitStatus CompositeBody::get_transforms | ( | CubitTransformMatrix & | tfm | ) | [virtual] |
| int CompositeBody::index_of | ( | BodySM * | body | ) | const [inline] |
Definition at line 91 of file CompositeBody.hpp.
{ return realBodies.find( body ); }
| int CompositeBody::layer | ( | ) | const [inline, virtual] |
Reimplemented from TopologyBridge.
Definition at line 55 of file CompositeBody.hpp.
{ return COMPOSITE_LAYER; }
| CubitStatus CompositeBody::mass_properties | ( | CubitVector & | centroid, |
| double & | volume | ||
| ) | [virtual] |
Implements BodySM.
Definition at line 333 of file CompositeBody.cpp.
{
double vol;
CubitVector centroid;
result.set( 0.0, 0.0, 0.0 );
volume = 0;
for (int i = 0; i < realBodies.size(); ++i)
{
if (CUBIT_FAILURE == realBodies[i]->mass_properties( centroid, vol ))
return CUBIT_FAILURE;
result += vol * centroid;
volume += vol;
}
if (volume > CUBIT_RESABS)
result /= volume;
return CUBIT_SUCCESS;
}
| CompositeLump * CompositeBody::next_lump | ( | CompositeLump * | after_this = 0 | ) | const |
Definition at line 37 of file CompositeBody.cpp.
{
return prev ? prev->nextLump : firstLump;
}
| void CompositeBody::notify_reversed | ( | TopologyBridge * | bridge | ) | [virtual] |
| int CompositeBody::num_bodies | ( | ) | const [inline] |
Definition at line 85 of file CompositeBody.hpp.
{ return realBodies.size(); }
| CubitPointContainment CompositeBody::point_containment | ( | const CubitVector & | pos, |
| double | tolerance = -1.0 |
||
| ) | [virtual] |
Implements BodySM.
Definition at line 292 of file CompositeBody.cpp.
{
int inside = 0;
int boundary = 0;
for (int i = 0; i < realBodies.size(); ++i)
{
switch( realBodies[i]->point_containment( pos, tolerance ) )
{
case CUBIT_PNT_BOUNDARY:
boundary++;
break;
case CUBIT_PNT_INSIDE:
inside++;
break;
case CUBIT_PNT_OUTSIDE:
break;
default:
return CUBIT_PNT_UNKNOWN;
}
}
if (inside)
return CUBIT_PNT_INSIDE;
else if (boundary > 1)
return CUBIT_PNT_INSIDE;
else if (boundary)
return CUBIT_PNT_BOUNDARY;
else
return CUBIT_PNT_OUTSIDE;
}
| CubitStatus CompositeBody::remove | ( | CompositeLump * | lump | ) |
Definition at line 53 of file CompositeBody.cpp.
{
if( lump->myBody != this )
return CUBIT_FAILURE;
if( firstLump == lump )
{
firstLump = lump->nextLump;
}
else
{
CompositeLump* prev = firstLump;
while( prev && prev->nextLump != lump )
prev = prev->nextLump;
assert( prev != NULL );
prev->nextLump = lump->nextLump;
}
lump->myBody = 0;
lump->nextLump = 0;
return CUBIT_SUCCESS;
}
| CubitStatus CompositeBody::remove | ( | BodySM * | body | ) |
Definition at line 90 of file CompositeBody.cpp.
{ return remove_body( index_of( body ) ); }
| void CompositeBody::remove_all_simple_attribute_virt | ( | ) | [virtual] |
| CubitStatus CompositeBody::remove_body | ( | int | index | ) |
Definition at line 93 of file CompositeBody.cpp.
{
if( index < 0 ) return CUBIT_FAILURE;
if( realBodies[index]->owner() == this )
realBodies[index]->owner(0);
realBodies.remove(index);
return CUBIT_SUCCESS;
}
| CubitStatus CompositeBody::remove_bridge | ( | TopologyBridge * | bridge | ) | [virtual] |
Implements TBOwner.
Definition at line 214 of file CompositeBody.cpp.
{
int i;
for (i = realBodies.size() - 1; i >= 0 && realBodies[i] != bridge; --i);
if (i < 0)
return CUBIT_FAILURE;
assert( bridge->owner() == this );
bridge->owner( 0 );
realBodies.remove( i );
if (realBodies.size() == 0)
CompositeEngine::instance().notify_deactivated( this );
return CUBIT_SUCCESS;
}
| void CompositeBody::remove_simple_attribute_virt | ( | const CubitSimpleAttrib & | simple_attrib_ptr | ) | [virtual] |
| CubitStatus CompositeBody::swap_bridge | ( | TopologyBridge * | old_tb, |
| TopologyBridge * | new_tb, | ||
| bool | reversed | ||
| ) | [virtual] |
Implements TBOwner.
Definition at line 232 of file CompositeBody.cpp.
{
if( new_tb->owner() )
return CUBIT_FAILURE;
BodySM* new_body = dynamic_cast<BodySM*>(new_tb);
BodySM* old_body = dynamic_cast<BodySM*>(old_tb);
int index = realBodies.find( old_body );
if( index >= 0 && new_body != 0 && realBodies.find(new_body) < 0 )
{
if( old_body->owner() == this )
old_body->owner(0);
new_body->owner(this);
realBodies[index] = new_body;
return CUBIT_SUCCESS;
}
return CUBIT_FAILURE;
}
CompositeLump* CompositeBody::firstLump [private] |
Definition at line 80 of file CompositeBody.hpp.
VGArray<BodySM*> CompositeBody::realBodies [private] |
Definition at line 81 of file CompositeBody.hpp.