cgma
Body Class Reference

Body class. More...

#include <Body.hpp>

Inheritance diagram for Body:
GroupingEntity RefEntity TopologyEntity CubitEntity CubitObservable ToolDataUser CubitAttribUser

List of all members.

Public Member Functions

virtual ~Body ()
DagType dag_type () const
 Gets the dag type.
void get_parent_ref_entities (DLIList< RefEntity * > &entity_list)
const std::type_info & entity_type_info () const
 Gets the type info.
virtual const char * class_name () const
 Gets the class name: "Body".
BodySMget_body_sm_ptr () const
 Gets the underlying BodySM pointer.
virtual CubitBox bounding_box ()
 Returns the bounding box of this body.
virtual CubitVector center_point ()
 Return a CubitVector set to the centroid of this body.
CubitBoolean get_mass_props (CubitVector &cofg)
 Get certain mass props, cofg is center of gravity.
CubitPointContainment point_containment (CubitVector &point)
virtual double measure ()
 Returns the volume of this body.
CubitBoolean is_sheet_body ()
 Query to see if this is a sheet body.
virtual int validate ()
 Do a measure and api entity check.
virtual CubitString measure_label ()
 Functions related to "measuring" the Body.
virtual void color (int value)
 Sets the color.
virtual int color () const
 Gets the color.

Static Public Member Functions

static const char * get_class_name ()
 Gets the class name: "Body".

Protected Member Functions

 Body ()
 Body (BodySM *OSMEPtr)

Private Member Functions

 Body (const Body &)
void operator= (const Body &)

Friends

class RefEntityFactory

Detailed Description

Body class.

Definition at line 34 of file Body.hpp.


Constructor & Destructor Documentation

Body::~Body ( ) [virtual]

Definition at line 94 of file Body.cpp.

{
}
Body::Body ( ) [protected]

Definition at line 46 of file Body.cpp.

{
}
Body::Body ( BodySM OSMEPtr) [protected]

Definition at line 60 of file Body.cpp.

{
   // Set the new Body's OSME pointer
   if (OSMEPtr != NULL)
   { 
      set_topology_bridge(OSMEPtr) ;
   }
   else
   {
      PRINT_ERROR("In the Body(OSME*) constructor\n");
      PRINT_ERROR("       Input OSME pointer is NULL\n");
      assert(OSMEPtr != NULL);
   }

   // Set the Entity ID for this new Body
   entityId = RefEntityFactory::instance()->next_body_id();

     // read and initialize attributes
   auto_read_cubit_attrib();
   auto_actuate_cubit_attrib();

     // Assign a default entity name
   assign_default_name();   
}
Body::Body ( const Body ) [private]

Member Function Documentation

Returns the bounding box of this body.

Implements CubitEntity.

Definition at line 160 of file Body.cpp.

{
   // Get the list of RefVolumes. Perform the union of the bounding
   // boxes of all the RefVolumes to obtain the bounding box of 
   // the Body.
   DLIList<RefVolume*> ref_volume_list ;
   /*CubitStatus status = */
   ref_volumes(ref_volume_list);

   if ( ref_volume_list.size() == 0 )
   {
     CubitVector vec(0.0, 0.0, 0.0);
     return CubitBox( vec, vec );
   }
   RefVolume* ref_volume_ptr = NULL ;

   ref_volume_list.reset() ;
   CubitBox result_box = ref_volume_list.get_and_step()->bounding_box();
   for(int i = 1 ; i < ref_volume_list.size() ; i++)
   {
      ref_volume_ptr = ref_volume_list.get_and_step() ;
      result_box |= ref_volume_ptr->bounding_box() ;
   }

   return result_box ;
}

Return a CubitVector set to the centroid of this body.

Reimplemented from RefEntity.

Definition at line 133 of file Body.cpp.

{
  return bounding_box().center();
}
virtual const char* Body::class_name ( ) const [inline, virtual]

Gets the class name: "Body".

Reimplemented from TopologyEntity.

Definition at line 64 of file Body.hpp.

     {
       return get_class_name();
     }
void Body::color ( int  value) [virtual]

Sets the color.

Reimplemented from RefEntity.

Definition at line 230 of file Body.cpp.

{
  int i;
  DLIList<RefVolume*> refVolumeList;
  ref_volumes ( refVolumeList );

  refVolumeList.reset();
  for (i = refVolumeList.size(); i--; )
    refVolumeList.get_and_step()->color(value);
}
int Body::color ( ) const [virtual]

Gets the color.

Reimplemented from RefEntity.

Definition at line 241 of file Body.cpp.

{
  return RefEntity::color();
}
DagType Body::dag_type ( ) const [inline, virtual]

Gets the dag type.

Implements RefEntity.

Definition at line 50 of file Body.hpp.

{ return DagType::body_type(); }
const std::type_info& Body::entity_type_info ( ) const [inline, virtual]

Gets the type info.

Implements RefEntity.

Definition at line 55 of file Body.hpp.

{ return typeid(Body); }

Gets the underlying BodySM pointer.

Definition at line 108 of file Body.cpp.

{
  TopologyBridge* bridge = bridge_manager()->topology_bridge();
  return dynamic_cast<BodySM*>(bridge);
}
static const char* Body::get_class_name ( ) [inline, static]

Gets the class name: "Body".

Reimplemented from TopologyEntity.

Definition at line 58 of file Body.hpp.

     {
       return "Body";
     }

Get certain mass props, cofg is center of gravity.

Definition at line 143 of file Body.cpp.

{
  double vol;
  CubitStatus result = get_body_sm_ptr()->mass_properties(cofg, vol);
  return result ? CUBIT_TRUE : CUBIT_FALSE;
}
void Body::get_parent_ref_entities ( DLIList< RefEntity * > &  entity_list) [inline, virtual]

Appends all RefEntities that own this (parent RefEntities) to entity_list. (The query goes up just one dimension. For example, if this is a vertex, the resulting list contains only RefEdges).

Implements RefEntity.

Definition at line 52 of file Body.hpp.

{ entity_list.clean_out(); }

Query to see if this is a sheet body.

Definition at line 123 of file Body.cpp.

{
  DLIList<RefVolume*> volumes;
  ref_volumes(volumes);
  while (volumes.size())
    if (!volumes.pop()->is_sheet())
      return CUBIT_FALSE;
  return CUBIT_TRUE;
}
double Body::measure ( ) [virtual]

Returns the volume of this body.

Reimplemented from RefEntity.

Definition at line 188 of file Body.cpp.

{
  DLIList<RefVolume*> volumes;
  ref_volumes(volumes);
  double volume = 0.0;
  for (int i = volumes.size(); i > 0; i--)
  {
     volume += volumes.get_and_step()->measure();
  }
  
  return volume;
}

Functions related to "measuring" the Body.

Reimplemented from RefEntity.

Definition at line 201 of file Body.cpp.

{
  return "volume";
}
void Body::operator= ( const Body ) [private]

Determines whether a point is inside, outside, or on boundary of a volume.

Definition at line 138 of file Body.cpp.

{
  return get_body_sm_ptr()->point_containment( point );
}
int Body::validate ( ) [virtual]

Do a measure and api entity check.

Reimplemented from RefEntity.

Definition at line 206 of file Body.cpp.

{
  int error = 0;

      // Perform general RefEntity checks (measure > 0)
  error += RefEntity::validate();
  
    // check the body from acis
  BodySM* osme_ptr = get_body_sm_ptr();
  DLIList <TopologyEntity*> bad_entities;
  if ( osme_ptr != NULL )
  {
    
    error += osme_ptr->validate( entity_name(), bad_entities);
  }
  else 
  {
    PRINT_WARNING("\tWARNING: Null underlying solid modeling body for %s, (%s %d)\n",
                  entity_name().c_str(), class_name(), id());
    error++;
  }
  return error;
}

Friends And Related Function Documentation

friend class RefEntityFactory [friend]

Definition at line 40 of file Body.hpp.


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