cgma
CompositeLump Class Reference

#include <CompositeLump.hpp>

Inheritance diagram for CompositeLump:
Lump TBOwner GeometryEntity TopologyBridge

List of all members.

Public Member Functions

 CompositeLump (Lump *real_lump)
 CompositeLump (CompositeGeom *geom)
virtual ~CompositeLump ()
int num_lumps () const
Lumpget_lump (int index) const
int index_of (Lump *) const
void update ()
CubitStatus add (Lump *lump)
CubitStatus remove (Lump *lump)
CubitStatus remove_lump (int index)
HiddenEntitySethidden_entities ()
bool has_hidden_entities () const
void get_hidden_surfaces (DLIList< Surface * > &surfaces)
CompositeShellfirst_shell () const
CompositeShellnext_shell (CompositeShell *after_this) const
CubitStatus add (CompositeShell *shell)
CubitStatus remove (CompositeShell *shell)
CompositeBodyget_body () const
CubitBox bounding_box () const
double measure ()
void get_parents_virt (DLIList< TopologyBridge * > &parents)
void get_children_virt (DLIList< TopologyBridge * > &children)
int layer () const
GeometryQueryEngineget_geometry_query_engine () const
void append_simple_attribute_virt (const CubitSimpleAttrib &simple_attrib_ptr)
void remove_simple_attribute_virt (const CubitSimpleAttrib &simple_attrib_ptr)
void remove_all_simple_attribute_virt ()
CubitStatus get_simple_attribute (DLIList< CubitSimpleAttrib > &attrib_list)
CubitStatus get_simple_attribute (const CubitString &name, DLIList< CubitSimpleAttrib > &attrib_list)
CubitStatus remove_bridge (TopologyBridge *bridge)
CubitStatus swap_bridge (TopologyBridge *old_tb, TopologyBridge *new_tb, bool)
CubitBoolean contains_bridge (TopologyBridge *bridge) const
void notify_reversed (TopologyBridge *bridge)
CompositeLumpsplit (VGArray< int > &indices_to_move)
CubitStatus combine (CompositeLump *dead_vol)
void print_debug_info (const char *line_prefix=0, bool brief=false)
virtual CubitStatus mass_properties (CubitVector &centroid, double &volume)

Private Attributes

CompositeBodymyBody
CompositeLumpnextLump
CompositeGeomcompGeom
CompositeShellfirstShell
HiddenEntitySethiddenSet

Friends

class CompositeBody

Detailed Description

Definition at line 26 of file CompositeLump.hpp.


Constructor & Destructor Documentation

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 );
}

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);
  }
}

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;
}

Member Function Documentation

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;
}    

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.

CubitBox CompositeLump::bounding_box ( void  ) const [virtual]

Implements GeometryEntity.

Definition at line 129 of file CompositeLump.cpp.

  { return compGeom->bounding_box(); }

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;
}

Reimplemented from TBOwner.

Definition at line 224 of file CompositeLump.cpp.

{
  return compGeom->index_of(bridge) < 0 ? CUBIT_FALSE : CUBIT_TRUE;
}

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 );
}

Implements TopologyBridge.

Definition at line 154 of file CompositeLump.cpp.

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.

  { return dynamic_cast<Lump*>(compGeom->entity( index )); }
void CompositeLump::get_parents_virt ( DLIList< TopologyBridge * > &  parents) [virtual]

Implements TopologyBridge.

Definition at line 135 of file CompositeLump.cpp.

  { if( myBody ) parents.append( myBody ); }

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;
}

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.

  { return compGeom->index_of( lump ); }
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]

Implements TBOwner.

Definition at line 229 of file CompositeLump.cpp.

  { assert(0); }
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;
}

Definition at line 168 of file CompositeLump.cpp.

  { return remove_lump( index_of( lump ) ); }

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;
}

Implements TopologyBridge.

Definition at line 246 of file CompositeLump.cpp.

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;
}

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.

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.


Friends And Related Function Documentation

friend class CompositeBody [friend]

Definition at line 28 of file CompositeLump.hpp.


Member Data Documentation

Definition at line 88 of file CompositeLump.hpp.

Definition at line 90 of file CompositeLump.hpp.

Definition at line 92 of file CompositeLump.hpp.

Definition at line 85 of file CompositeLump.hpp.

Definition at line 86 of file CompositeLump.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines