cgma
|
#include <CompositeLump.hpp>
Definition at line 26 of file CompositeLump.hpp.
CompositeLump::CompositeLump | ( | Lump * | real_lump | ) |
Definition at line 28 of file CompositeLump.cpp.
: myBody(0), nextLump(0), firstShell(0), hiddenSet(0) { assert( lump != NULL ); compGeom = new CompositeGeom(1); compGeom->append( lump, CUBIT_FORWARD ); if( lump->owner() ) lump->owner()->swap_bridge( lump, this, false ); lump->owner( this ); }
CompositeLump::CompositeLump | ( | CompositeGeom * | geom | ) |
Definition at line 48 of file CompositeLump.cpp.
: myBody(0), nextLump(0), compGeom( geometry ), firstShell(0), hiddenSet(0) { assert( geometry != NULL ); for( int i = 0; i < compGeom->num_entities(); i++ ) { GeometryEntity* entity = compGeom->entity(i); assert( !entity->owner() ); entity->owner(this); } }
CompositeLump::~CompositeLump | ( | ) | [virtual] |
Definition at line 73 of file CompositeLump.cpp.
{ int i; assert( !myBody ); while( firstShell ) remove( firstShell ); for( i = 0; i < num_lumps(); i++ ) if( get_lump(i)->owner() == this ) get_lump(i)->owner(0); delete hiddenSet; delete compGeom; }
CubitStatus CompositeLump::add | ( | Lump * | lump | ) |
Definition at line 158 of file CompositeLump.cpp.
{ if( !lump->owner() && compGeom->append(lump,CUBIT_FORWARD) ) { lump->owner(this); return CUBIT_SUCCESS; } return CUBIT_FAILURE; }
CubitStatus CompositeLump::add | ( | CompositeShell * | shell | ) |
Definition at line 89 of file CompositeLump.cpp.
{ if( shell->myLump ) return CUBIT_FAILURE; shell->lumpNext = firstShell; firstShell = shell; shell->myLump = this; return CUBIT_SUCCESS; }
void CompositeLump::append_simple_attribute_virt | ( | const CubitSimpleAttrib & | simple_attrib_ptr | ) | [virtual] |
Implements TopologyBridge.
Definition at line 242 of file CompositeLump.cpp.
{ compGeom->add_attribute(csa); }
CubitBox CompositeLump::bounding_box | ( | void | ) | const [virtual] |
Implements GeometryEntity.
Definition at line 129 of file CompositeLump.cpp.
{ return compGeom->bounding_box(); }
CubitStatus CompositeLump::combine | ( | CompositeLump * | dead_vol | ) |
Definition at line 294 of file CompositeLump.cpp.
{ int old_size = compGeom->num_entities(); compGeom->merge( *(dead_lump->compGeom) ); if( dead_lump->hiddenSet != 0 ) hidden_entities().merge( dead_lump->hiddenSet ); for( int i = old_size; i < compGeom->num_entities(); i++ ) { TopologyBridge* bridge = compGeom->entity(i); assert( bridge->owner() == dead_lump ); bridge->owner( this ); } return CUBIT_SUCCESS; }
CubitBoolean CompositeLump::contains_bridge | ( | TopologyBridge * | bridge | ) | const [virtual] |
Reimplemented from TBOwner.
Definition at line 224 of file CompositeLump.cpp.
{ return compGeom->index_of(bridge) < 0 ? CUBIT_FALSE : CUBIT_TRUE; }
CompositeShell * CompositeLump::first_shell | ( | ) | const [inline] |
Definition at line 95 of file CompositeLump.hpp.
{ return firstShell; }
CompositeBody * CompositeLump::get_body | ( | ) | const [inline] |
Definition at line 113 of file CompositeLump.hpp.
{ return myBody; }
void CompositeLump::get_children_virt | ( | DLIList< TopologyBridge * > & | children | ) | [virtual] |
Implements TopologyBridge.
Definition at line 138 of file CompositeLump.cpp.
{ for( CompositeShell* shell = firstShell; shell; shell = shell->lumpNext ) children.append( shell ); }
GeometryQueryEngine * CompositeLump::get_geometry_query_engine | ( | ) | const [virtual] |
Implements TopologyBridge.
Definition at line 154 of file CompositeLump.cpp.
{ return VirtualQueryEngine::instance(); }
void CompositeLump::get_hidden_surfaces | ( | DLIList< Surface * > & | surfaces | ) |
Definition at line 345 of file CompositeLump.cpp.
{ if (hiddenSet) hiddenSet->hidden_surfaces( surfs ); }
Lump * CompositeLump::get_lump | ( | int | index | ) | const [inline] |
Definition at line 104 of file CompositeLump.hpp.
void CompositeLump::get_parents_virt | ( | DLIList< TopologyBridge * > & | parents | ) | [virtual] |
Implements TopologyBridge.
Definition at line 135 of file CompositeLump.cpp.
CubitStatus CompositeLump::get_simple_attribute | ( | DLIList< CubitSimpleAttrib > & | attrib_list | ) | [virtual] |
Implements TopologyBridge.
Definition at line 248 of file CompositeLump.cpp.
{ compGeom->get_attributes( list ); return CUBIT_SUCCESS; }
CubitStatus CompositeLump::get_simple_attribute | ( | const CubitString & | name, |
DLIList< CubitSimpleAttrib > & | attrib_list | ||
) | [virtual] |
Implements TopologyBridge.
Definition at line 250 of file CompositeLump.cpp.
{ compGeom->get_attributes( name.c_str(), attrib_list ); return CUBIT_SUCCESS; }
bool CompositeLump::has_hidden_entities | ( | ) | const |
HiddenEntitySet & CompositeLump::hidden_entities | ( | ) | [inline] |
Definition at line 116 of file CompositeLump.hpp.
{ if( !hiddenSet ) hiddenSet = new HiddenEntitySet(this); return *hiddenSet; }
int CompositeLump::index_of | ( | Lump * | lump | ) | const [inline] |
Definition at line 107 of file CompositeLump.hpp.
int CompositeLump::layer | ( | ) | const [inline, virtual] |
Reimplemented from TopologyBridge.
Definition at line 61 of file CompositeLump.hpp.
{ return COMPOSITE_LAYER; }
CubitStatus CompositeLump::mass_properties | ( | CubitVector & | centroid, |
double & | volume | ||
) | [virtual] |
Implements Lump.
Definition at line 351 of file CompositeLump.cpp.
{ PRINT_ERROR("CompositeLump::mass_properties is not implemented\n"); centroid.set(0,0,0); volume = 0; return CUBIT_FAILURE; }
double CompositeLump::measure | ( | ) | [virtual] |
Implements GeometryEntity.
Definition at line 132 of file CompositeLump.cpp.
{ return compGeom->measure( compGeom->num_entities() -1 ); }
CompositeShell * CompositeLump::next_shell | ( | CompositeShell * | after_this | ) | const [inline] |
Definition at line 98 of file CompositeLump.hpp.
{ return !after ? firstShell : after->myLump == this ? after->lumpNext : 0; }
void CompositeLump::notify_reversed | ( | TopologyBridge * | bridge | ) | [virtual] |
int CompositeLump::num_lumps | ( | ) | const [inline] |
Definition at line 101 of file CompositeLump.hpp.
{ return compGeom->num_entities(); }
void CompositeLump::print_debug_info | ( | const char * | line_prefix = 0 , |
bool | brief = false |
||
) |
Definition at line 319 of file CompositeLump.cpp.
{ if( prefix == 0 ) prefix = ""; CompositeShell* shell = 0; if (brief) { int count = 0; while ((shell = next_shell(shell)) != NULL ) ++count; PRINT_INFO( "%sCompositeLump %p : %d shells, %d lumps.\n", prefix, (void*)this, count, num_lumps() ); return; } PRINT_INFO("%sCompositeLump %p:\n", prefix, (void*)this ); char* new_prefix = new char[strlen(prefix)+3]; strcpy( new_prefix, prefix ); strcat( new_prefix, " " ); if (hiddenSet) hiddenSet->print_debug_info( new_prefix ); else PRINT_INFO("%sNo Hidden Entities.\n", new_prefix ); while ((shell = next_shell( shell )) != NULL ) shell->print_debug_info( new_prefix ); delete [] new_prefix; }
CubitStatus CompositeLump::remove | ( | Lump * | lump | ) |
Definition at line 168 of file CompositeLump.cpp.
{ return remove_lump( index_of( lump ) ); }
CubitStatus CompositeLump::remove | ( | CompositeShell * | shell | ) |
Definition at line 100 of file CompositeLump.cpp.
{ if( shell->myLump != this ) return CUBIT_FAILURE; if( firstShell == shell ) { firstShell = firstShell->lumpNext; } else { CompositeShell *prev = firstShell, *next = firstShell->lumpNext; while( next != shell ) { assert( next != NULL ); prev = next; next = next->lumpNext; } prev->lumpNext = shell->lumpNext; } shell->lumpNext = 0; shell->myLump = 0; return CUBIT_SUCCESS; }
void CompositeLump::remove_all_simple_attribute_virt | ( | ) | [virtual] |
Implements TopologyBridge.
Definition at line 246 of file CompositeLump.cpp.
{ compGeom->rem_all_attributes(); }
CubitStatus CompositeLump::remove_bridge | ( | TopologyBridge * | bridge | ) | [virtual] |
Implements TBOwner.
Definition at line 186 of file CompositeLump.cpp.
{ int i = compGeom->index_of(bridge); if (i < 0) return CUBIT_FAILURE; assert (bridge->owner() == this); bridge->owner(0); if (!compGeom->remove(i, true)) return CUBIT_FAILURE; if (compGeom->num_entities() == 0) CompositeEngine::instance().notify_deactivated(this); return CUBIT_SUCCESS; }
CubitStatus CompositeLump::remove_lump | ( | int | index | ) |
Definition at line 171 of file CompositeLump.cpp.
{ if( index < 0 || index >= num_lumps() ) return CUBIT_FAILURE; TopologyBridge* lump = compGeom->entity(index); if( compGeom->remove( index, false ) ) { if( lump->owner() == this ) lump->owner(0); return CUBIT_SUCCESS; } return CUBIT_FAILURE; }
void CompositeLump::remove_simple_attribute_virt | ( | const CubitSimpleAttrib & | simple_attrib_ptr | ) | [virtual] |
Implements TopologyBridge.
Definition at line 244 of file CompositeLump.cpp.
{ compGeom->rem_attribute(csa); }
CompositeLump * CompositeLump::split | ( | VGArray< int > & | indices_to_move | ) |
Definition at line 267 of file CompositeLump.cpp.
{ int i; for( i = 0; i < indices_to_move.size(); i++ ) if( indices_to_move[i] < 0 || indices_to_move[i] >= num_lumps() ) return 0; CompositeGeom* new_geom = compGeom->split( indices_to_move ); if( !new_geom ) return 0; for( i = 0; i < new_geom->num_entities(); i++ ) new_geom->entity(i)->owner( 0 ); return new CompositeLump( new_geom ); }
CubitStatus CompositeLump::swap_bridge | ( | TopologyBridge * | old_tb, |
TopologyBridge * | new_tb, | ||
bool | |||
) | [virtual] |
Implements TBOwner.
Definition at line 204 of file CompositeLump.cpp.
{ if( new_tb->owner() ) return CUBIT_FAILURE; int index = compGeom->index_of( old_tb ); GeometryEntity* ge = dynamic_cast<GeometryEntity*>(new_tb); if( index >= 0 && ge != 0 ) { if( old_tb->owner() == this ) old_tb->owner(0); new_tb->owner(this); return compGeom->swap( index, ge ); } return CUBIT_FAILURE; }
void CompositeLump::update | ( | ) | [inline] |
Definition at line 110 of file CompositeLump.hpp.
{ compGeom->update_cached_data(); }
friend class CompositeBody [friend] |
Definition at line 28 of file CompositeLump.hpp.
CompositeGeom* CompositeLump::compGeom [private] |
Definition at line 88 of file CompositeLump.hpp.
CompositeShell* CompositeLump::firstShell [private] |
Definition at line 90 of file CompositeLump.hpp.
HiddenEntitySet* CompositeLump::hiddenSet [private] |
Definition at line 92 of file CompositeLump.hpp.
CompositeBody* CompositeLump::myBody [private] |
Definition at line 85 of file CompositeLump.hpp.
CompositeLump* CompositeLump::nextLump [private] |
Definition at line 86 of file CompositeLump.hpp.