|
cgma
|
#include <RefVolume.hpp>
Public Types | |
| typedef RefFace | ChildType |
| typedef Body | ParentType |
Public Member Functions | |
| virtual | ~RefVolume () |
| DagType | dag_type () const |
| Gets the dag type. | |
| const std::type_info & | entity_type_info () const |
| Gets the type info of this RefVolume. | |
| void | get_parent_ref_entities (DLIList< RefEntity * > &entity_list) |
| virtual const char * | class_name () const |
| Gets the class name for a volume: "Volume". | |
| Lump * | get_lump_ptr () |
| Gets the lump pointer. | |
| Lump const * | get_lump_ptr () const |
| Body * | get_body_ptr () |
| Gets the owning Body of this RefVolume. | |
| int | num_boundary_components () |
| CubitBoolean | about_spatially_equal (RefVolume *ref_vol_ptr_2, double tolerance_factor) |
| int | genus () |
| virtual CubitVector | center_point () |
| Returns centroid of the RefVolume. | |
| CubitBoolean | is_sheet () |
| Returns true if all Shells of RefVolume are sheets. | |
| virtual int | dimension () const |
| returns dimension of the actual entity. | |
| virtual CubitString | measure_label () |
| Returns the type of measure: (volume, area, length, or N/A) | |
| int | validate () |
| Do a an api entity check. | |
| CubitStatus | mass_properties (CubitVector ¢roid, double &volume) |
| Get the mass properties from the underlying lump. | |
| CubitStatus | mass_properties (CubitVector principal_axes[3], CubitVector &principal_moments, CubitVector ¢roid, double &volume) |
| Get the mass properties from the underlying lump. | |
Static Public Member Functions | |
| static const char * | get_class_name () |
| Gets the class name for a volume: "Volume". | |
Protected Member Functions | |
| RefVolume (Lump *lumpPtr) | |
Private Member Functions | |
| void | initialize () |
| RefVolume (const RefVolume &) | |
| void | operator= (const RefVolume &) |
Friends | |
| class | RefEntityFactory |
RefVolume class.
Definition at line 48 of file RefVolume.hpp.
| typedef RefFace RefVolume::ChildType |
Definition at line 52 of file RefVolume.hpp.
| typedef Body RefVolume::ParentType |
Definition at line 53 of file RefVolume.hpp.
| RefVolume::~RefVolume | ( | ) | [virtual] |
Definition at line 89 of file RefVolume.cpp.
{
}
| RefVolume::RefVolume | ( | Lump * | lumpPtr | ) | [protected] |
Definition at line 52 of file RefVolume.cpp.
{
// Set the GeometryEntity pointer
if (lumpPtr != NULL)
{
set_geometry_entity_ptr(lumpPtr) ;
// Commented-out code from Phil Tuchinsky for FUTURE meshing
// from a surface mesh with no solid model.
//
// hasGeometry = CUBIT_TRUE;
//
// initialize the surface mesh entity lists exactly once
// nodes_boundary ( surfaceNodes );
// edges_inclusive ( surfaceEdges );
// faces_inclusive ( surfaceFaces );
}
else
{
PRINT_ERROR("In the RefVolume(Lump*) constructor\n");
PRINT_ERROR(" Input Lump pointer is NULL\n");
assert(CUBIT_FALSE);
}
// Initialize the member data
initialize();
}
| RefVolume::RefVolume | ( | const RefVolume & | ) | [private] |
| CubitBoolean RefVolume::about_spatially_equal | ( | RefVolume * | ref_vol_ptr_2, |
| double | tolerance_factor | ||
| ) |
R CubitBoolean R-CUBIT_TRUE/CUBIT_FALSE I RefVolume* O CubitBoolean O- If the two RefVolumes are spatially equal within the GEOMETRY_RESABS* the tolerance_factor, then CUBIT_TRUE will be returned. Otherwise CUBIT_FALSE is returned. The comparison is done by checking the bounding boxes of the RefVolumes.
Definition at line 308 of file RefVolume.cpp.
{
// Get rid of the trivial case...
if( this == ref_vol_ptr_2)
{
return CUBIT_TRUE;
}
DLIList<RefEdge*> ref_edge_list_1, ref_edge_list_2;
this->ref_edges( ref_edge_list_1 );
ref_vol_ptr_2->ref_edges( ref_edge_list_2 );
//compare the size of the two lists.
if ( ref_edge_list_1.size() != ref_edge_list_2.size() )
return CUBIT_FALSE;
DLIList<RefFace*> ref_face_list_1, ref_face_list_2;
this->ref_faces( ref_face_list_1 );
ref_vol_ptr_2->ref_faces( ref_face_list_2 );
//compare the size of the two lists.
if ( ref_face_list_1.size() != ref_face_list_2.size() )
return CUBIT_FALSE;
//This compare precedure does the following :
// 1. Test the bounding boxes of the 2 volumes for equality;
CubitBox box_1 = this->bounding_box();
CubitBox box_2 = ref_vol_ptr_2->bounding_box();
CubitBoolean passes_b_box = CUBIT_FALSE;
// This test checks to see that the min and max vectors of the
// bounding boxes are within 10% of the length of the bbox diagonal.
// Note that this assumes the default values of resabs=1e-6 and
// tolerance_factor=500
CubitVector tol_vect(
CUBIT_MIN(box_1.x_range(), box_2.x_range()),
CUBIT_MIN(box_1.y_range(), box_2.y_range()),
CUBIT_MIN(box_1.z_range(), box_2.z_range()) );
tol_vect *= 200.0 * tolerance_factor * GEOMETRY_RESABS;
if( tol_vect.x() < GEOMETRY_RESABS )
tol_vect.x(GEOMETRY_RESABS);
if( tol_vect.y() < GEOMETRY_RESABS )
tol_vect.y(GEOMETRY_RESABS);
if( tol_vect.z() < GEOMETRY_RESABS )
tol_vect.z(GEOMETRY_RESABS);
if((fabs(box_1.minimum().x() - box_2.minimum().x()) < tol_vect.x()) &&
(fabs(box_1.maximum().x() - box_2.maximum().x()) < tol_vect.x()) &&
(fabs(box_1.minimum().y() - box_2.minimum().y()) < tol_vect.y()) &&
(fabs(box_1.maximum().y() - box_2.maximum().y()) < tol_vect.y()) &&
(fabs(box_1.minimum().z() - box_2.minimum().z()) < tol_vect.z()) &&
(fabs(box_1.maximum().z() - box_2.maximum().z()) < tol_vect.z()))
{
passes_b_box = CUBIT_TRUE;
}
return passes_b_box;
}
| CubitVector RefVolume::center_point | ( | ) | [virtual] |
Returns centroid of the RefVolume.
Reimplemented from RefEntity.
Definition at line 150 of file RefVolume.cpp.
{
return bounding_box().center();
}
| virtual const char* RefVolume::class_name | ( | ) | const [inline, virtual] |
Gets the class name for a volume: "Volume".
Reimplemented from BasicTopologyEntity.
Definition at line 80 of file RefVolume.hpp.
{
return get_class_name();
}
| DagType RefVolume::dag_type | ( | ) | const [inline, virtual] |
Gets the dag type.
Implements BasicTopologyEntity.
Definition at line 66 of file RefVolume.hpp.
{ return DagType::ref_volume_type(); }
| int RefVolume::dimension | ( | ) | const [virtual] |
returns dimension of the actual entity.
Reimplemented from RefEntity.
Definition at line 155 of file RefVolume.cpp.
{
return 3;
}
| const std::type_info& RefVolume::entity_type_info | ( | ) | const [inline, virtual] |
Gets the type info of this RefVolume.
Implements RefEntity.
Definition at line 69 of file RefVolume.hpp.
{ return typeid(RefVolume); }
| int RefVolume::genus | ( | ) |
returns the genus of the volume, where g = 1 - .5(v - e + f - gs), and v,e,f = # vertices, edges, faces, and gs = summed genus of surfaces
Definition at line 138 of file RefVolume.cpp.
{
int i;
DLIList<RefFace*> faces;
ref_faces(faces);
int gs = 0;
for (i = faces.size(); i > 0; i--)
gs += faces.get_and_step()->genus();
return 1 - (num_ref_vertices() - num_ref_edges() + faces.size() - gs)/2;
}
| Body * RefVolume::get_body_ptr | ( | ) |
Gets the owning Body of this RefVolume.
Definition at line 122 of file RefVolume.cpp.
{
SenseEntity* co_volume_ptr = get_first_sense_entity_ptr();
if (!co_volume_ptr // no covolume
|| co_volume_ptr->next_on_bte() ) // multiple covolumes )
{
PRINT_ERROR("%s:%d RefVolume %d has other than one parent CoVolume.\n"
"This is a BUG -- please report it.\n",
__FILE__, __LINE__, id() );
return 0;
}
return dynamic_cast<Body*>(co_volume_ptr->get_grouping_entity_ptr());
}
| static const char* RefVolume::get_class_name | ( | ) | [inline, static] |
Gets the class name for a volume: "Volume".
Reimplemented from BasicTopologyEntity.
Definition at line 74 of file RefVolume.hpp.
{
return "Volume";
}
| Lump * RefVolume::get_lump_ptr | ( | ) |
Gets the lump pointer.
Definition at line 103 of file RefVolume.cpp.
{
return CAST_TO(get_geometry_entity_ptr(), Lump);
}
| Lump const * RefVolume::get_lump_ptr | ( | ) | const |
R Lump* R- A pointer to the Lump to which the current R- volume points. This function returns a pointer to the Lump to which the current volume points.
Definition at line 108 of file RefVolume.cpp.
{
return CAST_TO(get_geometry_entity_ptr(), Lump);
}
| void RefVolume::get_parent_ref_entities | ( | DLIList< RefEntity * > & | entity_list | ) | [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 416 of file RefVolume.cpp.
{
// First get the type of RefEntity that is a child of "this" one
DagType parent_type = get_parent_ref_entity_type();;
DLIList<TopologyEntity*> tempList ;
CubitStatus result = ModelQueryEngine::instance()->
query_model( *this, parent_type, tempList );
if (result == CUBIT_FAILURE)
{
PRINT_ERROR("In RefEntity::get_parent_ref_entities\n");
PRINT_ERROR(" Query failed for unknown reason.\n");
return;
}
entity_list.clean_out();
for(int i=0; i<tempList.size(); i++)
{
entity_list.append(static_cast<ParentType*>(tempList[i]));
}
}
| void RefVolume::initialize | ( | ) | [private] |
Definition at line 227 of file RefVolume.cpp.
{
// Set the Entity and Block IDs for this new RefVolume
GeometryEntity* geom_ptr = get_geometry_entity_ptr();
int saved_id = geom_ptr->get_saved_id();
if ( !saved_id || RefEntityFactory::instance()->get_ref_volume(saved_id) )
{
saved_id = RefEntityFactory::instance()->next_ref_volume_id();
geom_ptr->set_saved_id(saved_id);
}
entityId = saved_id;
// read and initialize attributes
auto_read_cubit_attrib();
auto_actuate_cubit_attrib();
// Assign a default entity name
assign_default_name();
}
Returns true if all Shells of RefVolume are sheets.
Definition at line 381 of file RefVolume.cpp.
{
DLIList<Shell*> shells;
this->shells(shells);
while (shells.size())
if (!shells.pop()->is_sheet())
return CUBIT_FALSE;
return CUBIT_TRUE;
}
| CubitStatus RefVolume::mass_properties | ( | CubitVector & | centroid, |
| double & | volume | ||
| ) |
Get the mass properties from the underlying lump.
Definition at line 160 of file RefVolume.cpp.
{
DLIList<Body*> bodies;
this->bodies( bodies );
if( bodies.get()->is_sheet_body() )
{
centroid.set(0,0,0);
volume = 0;
return CUBIT_SUCCESS;
}
else
{
Lump *lump = get_lump_ptr();
return lump->mass_properties( centroid, volume );
}
}
| CubitStatus RefVolume::mass_properties | ( | CubitVector | principal_axes[3], |
| CubitVector & | principal_moments, | ||
| CubitVector & | centroid, | ||
| double & | volume | ||
| ) |
Get the mass properties from the underlying lump.
Definition at line 177 of file RefVolume.cpp.
{
DLIList<Body*> bodies;
this->bodies( bodies );
if( bodies.get()->is_sheet_body() )
{
centroid.set(0,0,0);
volume = 0;
return CUBIT_SUCCESS;
}
else
{
Lump *lump = get_lump_ptr();
return lump->mass_properties( principal_axes, principal_moments, centroid, volume );
}
}
| CubitString RefVolume::measure_label | ( | ) | [virtual] |
Returns the type of measure: (volume, area, length, or N/A)
Reimplemented from RefEntity.
Definition at line 197 of file RefVolume.cpp.
{
return "volume";
}
Return the number of connected components bounding this volume. Note: this counts the number of ref_edge-connected ref_face components, which may not be the same as the number of acis shells.
Definition at line 271 of file RefVolume.cpp.
{
// get all the surfaces
// march from one to the next, using shared-ref_edge connectivity
int num_components = 0;
DLIList<RefFace*> face_list;
ref_faces( face_list );
// mark them as belonging to this volume and not seen yet.
int i;
RefFace *face;
for( i = face_list.size(); i--; )
{
face = face_list.get_and_step();
face->marked( CUBIT_FALSE );
}
for ( i = face_list.size(); i--; )
{
face = face_list.get_and_step();
assert( !face->marked() );
face->marked( CUBIT_TRUE );
}
for ( i = face_list.size(); i--; )
{
face = face_list.get_and_step();
if ( face->marked() )
{
num_components++;
unmark_component( face );
}
}
return num_components;
}
| void RefVolume::operator= | ( | const RefVolume & | ) | [private] |
| int RefVolume::validate | ( | ) | [virtual] |
Do a an api entity check.
Reimplemented from RefEntity.
Definition at line 391 of file RefVolume.cpp.
{
//- This function determines whether the entity is valid.
//- Several types of checks can be done,
int error = 0;
// Perform general RefEntity checks (measure > 0)
error += RefEntity::validate();
// Pass through to surface and add in its validation
Lump *lump = this->get_lump_ptr();
// check surface ptr
if (lump != NULL) {
// Check underlying surface
DLIList <TopologyEntity*> bad_entities;
error += lump->validate(entity_name(), bad_entities);
} else {
PRINT_WARNING("\tWARNING: Null underlying volume for %s, (%s %d)\n",
entity_name().c_str(), class_name(), id());
error++;
}
return error;
}
friend class RefEntityFactory [friend] |
Definition at line 55 of file RefVolume.hpp.