cgma
|
#include <PartitionBody.hpp>
Definition at line 23 of file PartitionBody.hpp.
PartitionBody::PartitionBody | ( | BodySM * | body | ) |
Definition at line 33 of file PartitionBody.cpp.
: childList(0) { SubEntitySet* set = new SubEntitySet( body,this ); set->bodyNext = 0; set->bodyPtr = this; }
Definition at line 51 of file PartitionBody.cpp.
{ assert(! sub_entity_set().bodyNext); sub_entity_set().bodyPtr = 0; while( SubEntitySet* dead = childList ) { childList = dead->bodyNext; dead->bodyNext = 0; dead->bodyPtr = 0; } }
void PartitionBody::add | ( | SubEntitySet & | set | ) |
Definition at line 195 of file PartitionBody.cpp.
void PartitionBody::append_simple_attribute_virt | ( | const CubitSimpleAttrib & | csa | ) | [virtual] |
Implements TopologyBridge.
Definition at line 87 of file PartitionBody.cpp.
{ real_body()->append_simple_attribute_virt(csa); }
CubitBox PartitionBody::bounding_box | ( | void | ) | const [virtual] |
Implements PartitionEntity.
Definition at line 160 of file PartitionBody.cpp.
{ DLIList<TopologyBridge*> lumps; real_body()->get_children_virt(lumps); CubitBox result = dynamic_cast<Lump*>(lumps.step_and_get())->bounding_box(); for( int i = 1; i < lumps.size(); i++ ) result |= dynamic_cast<Lump*>(lumps.step_and_get())->bounding_box(); return result; }
void PartitionBody::destroy_all_children | ( | ) |
Definition at line 243 of file PartitionBody.cpp.
{ DLIList<PartitionLump*> lumps; DLIList<PartitionSurface*> surfs; DLIList<PartitionCoEdge*> coedges; DLIList<PartitionCurve*> curves; DLIList<PartitionPoint*> points; DLIList<PartitionEntity*> sub_geom, split_geom; for ( SubEntitySet* ptr = childList; ptr; ptr = ptr->next_in_body() ) { ptr->get_sub_entities( sub_geom ); ptr->get_lower_order( split_geom ); sub_geom += split_geom; split_geom.clean_out(); while( sub_geom.size() ) { PartitionEntity* ent = sub_geom.pop(); if ( PartitionPoint* point = dynamic_cast<PartitionPoint*>(ent) ) points.append(point); else if( PartitionCoEdge* coedge = dynamic_cast<PartitionCoEdge*>(ent) ) coedges.append(coedge); else if( PartitionCurve* curve = dynamic_cast<PartitionCurve*>(ent) ) curves.append(curve); else if( PartitionSurface* surf = dynamic_cast<PartitionSurface*>(ent) ) surfs.append(surf); else if ( PartitionLump* lump = dynamic_cast<PartitionLump*>(ent) ) lumps.append(lump); else assert(0); } } while( lumps.size() ) { PartitionLump* lump = lumps.pop(); while( PartitionShell* shell = lump->first_shell() ) { lump->remove(shell); shell->remove_all_surfaces(); delete shell; } delete lump; } while( surfs.size() ) { PartitionSurface* surf = surfs.pop(); while( PartitionLoop* loop = surf->next_loop(NULL) ) { surf->remove(loop); loop->remove_all_coedges(); delete loop; } delete surf; } while( coedges.size() ) { PartitionCoEdge* coedge = coedges.pop(); if (coedge->get_curve() != NULL) coedge->get_curve()->remove( coedge ); delete coedge; } while( curves.size() ) { PartitionCurve* curve = curves.pop(); assert( !curve->next_coedge(NULL) ); delete curve; } while( points.size() ) { PartitionPoint* point = points.pop(); assert( !point->num_curves() ); delete point; } // All child SubEntitySets should have been deleted when they // became empty, and should be removed from the list in this // body as they are destroyed. However, when the last SubEntitySet // in this body is destroyed, this body will be destroyed as well. // So don't do this check! //assert(!childList); }
void PartitionBody::get_all_children | ( | DLIList< PartitionEntity * > & | list | ) |
Definition at line 433 of file PartitionBody.cpp.
{ DLIList<PartitionEntity*> tmp; for (SubEntitySet* ptr = childList; ptr; ptr = ptr->bodyNext ) { tmp.clean_out(); ptr->get_sub_entities( tmp ); list += tmp; tmp.clean_out(); ptr->get_lower_order( tmp ); list += tmp; } }
void PartitionBody::get_children_virt | ( | DLIList< TopologyBridge * > & | list | ) | [virtual] |
Implements TopologyBridge.
Definition at line 122 of file PartitionBody.cpp.
{ real_body()->get_children_virt(list); }
GeometryQueryEngine * PartitionBody::get_geometry_query_engine | ( | ) | const [virtual] |
Implements TopologyBridge.
Definition at line 134 of file PartitionBody.cpp.
{ return VirtualQueryEngine::instance(); }
void PartitionBody::get_parents_virt | ( | DLIList< TopologyBridge * > & | ) | [virtual] |
CubitStatus PartitionBody::get_simple_attribute | ( | DLIList< CubitSimpleAttrib > & | list | ) | [virtual] |
Implements TopologyBridge.
Definition at line 93 of file PartitionBody.cpp.
{ return real_body()->get_simple_attribute(list); }
CubitStatus PartitionBody::get_simple_attribute | ( | const CubitString & | name, |
DLIList< CubitSimpleAttrib > & | list | ||
) | [virtual] |
Implements TopologyBridge.
Definition at line 95 of file PartitionBody.cpp.
{ return real_body()->get_simple_attribute(name,list); }
CubitStatus PartitionBody::get_transforms | ( | CubitTransformMatrix & | xforms | ) | [virtual] |
Implements BodySM.
Definition at line 73 of file PartitionBody.cpp.
{ return real_body()->get_transforms( xforms ); }
bool PartitionBody::has_children | ( | ) | const [inline] |
Definition at line 96 of file PartitionBody.hpp.
{ return !!childList; }
int PartitionBody::layer | ( | ) | const [virtual] |
Reimplemented from TopologyBridge.
Definition at line 108 of file PartitionBody.cpp.
{ return sub_entity_set().get_owner_layer(); }
CubitStatus PartitionBody::mass_properties | ( | CubitVector & | centroid, |
double & | volume | ||
) | [virtual] |
Implements BodySM.
Definition at line 339 of file PartitionBody.cpp.
{ DLIList<Lump*> lump_list; lumps( lump_list ); DLIList<PartitionLump*> part_list; CAST_LIST( lump_list, part_list, PartitionLump ); if (part_list.size() < lump_list.size()) return real_body()->mass_properties( result, volume ); CubitVector centroid(0.0, 0.0, 0.0), tmp_centroid; volume = 0.0; double tmp_volume; for (int i = part_list.size(); i--; ) { if (CUBIT_FAILURE == part_list.get_and_step()->mass_properties( tmp_centroid, tmp_volume )) return CUBIT_FAILURE; centroid += tmp_volume * tmp_centroid; volume += tmp_volume; } if (volume > CUBIT_RESABS) { result = centroid / volume; } else { result.set( 0.0, 0.0, 0.0 ); volume = 0.0; } return CUBIT_SUCCESS; }
void PartitionBody::notify_split | ( | FacetEntity * | , |
FacetEntity * | |||
) | [virtual] |
CubitPointContainment PartitionBody::point_containment | ( | const CubitVector & | pos, |
double | tolerance = -1.0 |
||
) | [virtual] |
Implements BodySM.
Definition at line 383 of file PartitionBody.cpp.
{ DLIList<Lump*> lump_list; lumps( lump_list ); DLIList<PartitionLump*> part_list; CAST_LIST( lump_list, part_list, PartitionLump ); if (part_list.size() < lump_list.size()) { return real_body()->point_containment( pos, tolerance ); } bool inside = false, on = false; part_list.reset(); for (int i = part_list.size(); i--; ) { switch( part_list.get_and_step()->point_containment( pos ) ) { case CUBIT_PNT_INSIDE: inside = true; break; case CUBIT_PNT_BOUNDARY: on = true; break; case CUBIT_PNT_OUTSIDE: break; default: return CUBIT_PNT_UNKNOWN; } } if (inside) return CUBIT_PNT_INSIDE; else if(on) return CUBIT_PNT_BOUNDARY; else return CUBIT_PNT_OUTSIDE; }
BodySM * PartitionBody::real_body | ( | ) | const |
Definition at line 182 of file PartitionBody.cpp.
{ return dynamic_cast<BodySM*>(partitioned_entity()); }
void PartitionBody::remove | ( | SubEntitySet & | set | ) |
Definition at line 212 of file PartitionBody.cpp.
void PartitionBody::remove_all_simple_attribute_virt | ( | ) | [virtual] |
Implements TopologyBridge.
Definition at line 91 of file PartitionBody.cpp.
{ real_body()->remove_all_simple_attribute_virt(); }
void PartitionBody::remove_simple_attribute_virt | ( | const CubitSimpleAttrib & | csa | ) | [virtual] |
Implements TopologyBridge.
Definition at line 89 of file PartitionBody.cpp.
{ real_body()->remove_simple_attribute_virt(csa); }
void PartitionBody::reverse_sense | ( | ) | [virtual] |
CubitStatus PartitionBody::save | ( | CubitSimpleAttrib & | ) | [virtual] |
Implements PartitionEntity.
Definition at line 148 of file PartitionBody.cpp.
{ return CUBIT_FAILURE; }
void PartitionBody::transform | ( | const CubitTransformMatrix & | ) | [inline, virtual] |
SubEntitySet* PartitionBody::childList [private] |
Definition at line 108 of file PartitionBody.hpp.