cgma
OCCShell Class Reference

#include <OCCShell.hpp>

Inheritance diagram for OCCShell:
ShellSM TopologyBridge

List of all members.

Public Member Functions

 OCCShell (TopoDS_Shell *theShell, OCCSurface *surface=NULL)
virtual ~OCCShell ()
TopoDS_Shell * get_TopoDS_Shell ()
void set_TopoDS_Shell (TopoDS_Shell shell)
OCCLumpmy_lump ()
OCCBodymy_body ()
OCCSurfacemy_surface ()
void set_sheet_surface (OCCSurface *surface)
void set_lump (OCCLump *lump)
void set_body (OCCBody *body)
bool is_sheet () const
virtual GeometryQueryEngineget_geometry_query_engine () const
virtual void append_simple_attribute_virt (const CubitSimpleAttrib &)
virtual void remove_simple_attribute_virt (const CubitSimpleAttrib &)
virtual void remove_all_simple_attribute_virt ()
virtual CubitStatus get_simple_attribute (DLIList< CubitSimpleAttrib > &)
virtual CubitStatus get_simple_attribute (const CubitString &name, DLIList< CubitSimpleAttrib > &)
virtual void get_parents_virt (DLIList< TopologyBridge * > &parents)
virtual void get_children_virt (DLIList< TopologyBridge * > &children)
CubitStatus update_OCC_entity (BRepBuilderAPI_ModifyShape *aBRepTrsf, BRepAlgoAPI_BooleanOperation *op=NULL)
double measure ()
DLIList< OCCSurface * > getMemberSurfaces ()
void setMemberSurfaces (DLIList< OCCSurface * > surfaceList)

Static Public Member Functions

static CubitStatus update_OCC_entity (TopoDS_Shell &old_shell, TopoDS_Shape &new_shell, BRepBuilderAPI_MakeShape *op, LocOpe_SplitShape *sp=NULL)

Private Attributes

TopoDS_Shell * myTopoDSShell
OCCSurfacemySheetSurface
OCCLumpmyLump
OCCBodymyBody
DLIList< OCCSurface * > memberSurfaces

Detailed Description

Definition at line 39 of file OCCShell.hpp.


Constructor & Destructor Documentation

OCCShell::OCCShell ( TopoDS_Shell *  theShell,
OCCSurface surface = NULL 
)

Definition at line 63 of file OCCShell.cpp.

{
  myTopoDSShell = theShell;
  mySheetSurface = surface;
  if(myTopoDSShell && !myTopoDSShell->IsNull())
    assert (myTopoDSShell->ShapeType() == TopAbs_SHELL);
}
OCCShell::~OCCShell ( ) [virtual]

Definition at line 77 of file OCCShell.cpp.

{
  if(myTopoDSShell)
  {
    myTopoDSShell->Nullify();
    delete (TopoDS_Shell*)myTopoDSShell;
    myTopoDSShell = NULL;
  }
}

Member Function Documentation

Implements TopologyBridge.

Definition at line 110 of file OCCShell.cpp.

{
}
void OCCShell::get_children_virt ( DLIList< TopologyBridge * > &  children) [virtual]

Implements TopologyBridge.

Definition at line 176 of file OCCShell.cpp.

{
  if(mySheetSurface)
  {
    children.append(mySheetSurface);
    return;
  }
  TopTools_IndexedMapOfShape M;
  TopExp::MapShapes(*myTopoDSShell, TopAbs_FACE, M);
  int ii;
  for (ii=1; ii<=M.Extent(); ii++) {
      TopologyBridge *surface = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
          if(surface)
        children.append_unique(surface);
  }
}

Implements TopologyBridge.

Definition at line 105 of file OCCShell.cpp.

void OCCShell::get_parents_virt ( DLIList< TopologyBridge * > &  parents) [virtual]

Implements TopologyBridge.

Definition at line 136 of file OCCShell.cpp.

{ 
  if(mySheetSurface)
  {
    parents.append(mySheetSurface->my_lump());
    return;
  }

  OCCQueryEngine* oqe = (OCCQueryEngine*) get_geometry_query_engine();
  OCCBody * body = NULL;
  DLIList <OCCBody* > *bodies = oqe->BodyList;
  TopTools_IndexedDataMapOfShapeListOfShape M;
  for(int i = 0; i <  bodies->size(); i++)
  {
     body = bodies->get_and_step();
     TopoDS_Shape* shape ; 
     body->get_TopoDS_Shape(shape);
     assert(shape != NULL); 
     TopExp::MapShapesAndAncestors(*shape,
                   TopAbs_SHELL, TopAbs_SOLID, M);
     TopoDS_Shell *shell = get_TopoDS_Shell(); 
     if (!M.Contains(*shell))
    continue;

     const TopTools_ListOfShape& ListOfShapes = 
                M.FindFromKey(*(get_TopoDS_Shell()));
     if (!ListOfShapes.IsEmpty()) 
     {
         TopTools_ListIteratorOfListOfShape it(ListOfShapes) ;
         for (;it.More(); it.Next())
         {
       TopoDS_Solid Solid = TopoDS::Solid(it.Value());
           int k = oqe->OCCMap->Find(Solid);
       parents.append((OCCLump*)(oqe->OccToCGM->find(k))->second);
     }
     } 
  }
}

Implements TopologyBridge.

Definition at line 119 of file OCCShell.cpp.

{
  return CUBIT_FAILURE;
}

Implements TopologyBridge.

Definition at line 123 of file OCCShell.cpp.

  { return CUBIT_FAILURE; }
TopoDS_Shell* OCCShell::get_TopoDS_Shell ( ) [inline]

Definition at line 48 of file OCCShell.hpp.

  {if(myTopoDSShell && !myTopoDSShell->IsNull()) assert (myTopoDSShell->ShapeType() == TopAbs_SHELL); return myTopoDSShell;}

Definition at line 122 of file OCCShell.hpp.

{ return memberSurfaces; }
bool OCCShell::is_sheet ( ) const [inline]

Definition at line 60 of file OCCShell.hpp.

{ return mySheetSurface != 0; }
double OCCShell::measure ( )

Definition at line 244 of file OCCShell.cpp.

{
  GProp_GProps myProps;
  BRepGProp::SurfaceProperties(*myTopoDSShell, myProps);
  return myProps.Mass();
}
OCCBody* OCCShell::my_body ( ) [inline]

Definition at line 53 of file OCCShell.hpp.

{return myBody;}
OCCLump* OCCShell::my_lump ( ) [inline]

Definition at line 52 of file OCCShell.hpp.

{return myLump;}

Definition at line 54 of file OCCShell.hpp.

{return mySheetSurface;}

Implements TopologyBridge.

Definition at line 116 of file OCCShell.cpp.

{
}

Implements TopologyBridge.

Definition at line 113 of file OCCShell.cpp.

{
}
void OCCShell::set_body ( OCCBody body) [inline]

Definition at line 58 of file OCCShell.hpp.

{myBody = body;}
void OCCShell::set_lump ( OCCLump lump) [inline]

Definition at line 57 of file OCCShell.hpp.

{myLump = lump;}
void OCCShell::set_sheet_surface ( OCCSurface surface) [inline]

Definition at line 55 of file OCCShell.hpp.

{mySheetSurface = surface;}
void OCCShell::set_TopoDS_Shell ( TopoDS_Shell  shell)

Definition at line 87 of file OCCShell.cpp.

{
  if(myTopoDSShell && shell.IsEqual(*myTopoDSShell))
    return;

  if (myTopoDSShell)
    myTopoDSShell->Nullify();

  *myTopoDSShell = shell;
}
void OCCShell::setMemberSurfaces ( DLIList< OCCSurface * >  surfaceList) [inline]

Definition at line 123 of file OCCShell.hpp.

  {
    memberSurfaces = surfaceList;
  }
CubitStatus OCCShell::update_OCC_entity ( BRepBuilderAPI_ModifyShape *  aBRepTrsf,
BRepAlgoAPI_BooleanOperation *  op = NULL 
)

Definition at line 198 of file OCCShell.cpp.

{
  if(mySheetSurface && op == NULL)
    return CUBIT_FAILURE;

  assert (aBRepTrsf != NULL || op != NULL);

  TopoDS_Shape shape;
  if(aBRepTrsf)
    shape = aBRepTrsf->ModifiedShape(*get_TopoDS_Shell());

  else if(!mySheetSurface)
  {
    TopTools_ListOfShape shapes;
    shapes.Assign(op->Modified(*get_TopoDS_Shell()));
    if(shapes.Extent() == 0)
      shapes.Assign(op->Generated(*get_TopoDS_Shell()));
    if (shapes.Extent())
      shape = shapes.First();
    
    else if(op->IsDeleted(*get_TopoDS_Shell()))
      ;
    else
      return CUBIT_SUCCESS;
  } 
  TopoDS_Shell shell;
  if (!shape.IsNull())
    shell = TopoDS::Shell(shape);

  //set the surfaces
  DLIList<TopologyBridge *> surfaces;
  this->get_children_virt(surfaces);
  for (int i = 1; i <= surfaces.size(); i++)
  {
     OCCSurface *surface = CAST_TO(surfaces.get_and_step(), OCCSurface);
     surface->update_OCC_entity(aBRepTrsf, op);
  }
  OCCQueryEngine::instance()->update_OCC_map(*myTopoDSShell, shell);
  return CUBIT_SUCCESS;
}
CubitStatus OCCShell::update_OCC_entity ( TopoDS_Shell &  old_shell,
TopoDS_Shape &  new_shell,
BRepBuilderAPI_MakeShape *  op,
LocOpe_SplitShape *  sp = NULL 
) [static]

Definition at line 256 of file OCCShell.cpp.

{
  //set the surfaces
  TopTools_IndexedMapOfShape M;
  TopoDS_Shape shape;
  TopExp::MapShapes(old_shell, TopAbs_FACE, M);
  TopTools_ListOfShape shapes;
  for(int ii=1; ii<=M.Extent(); ii++)
  {
    TopoDS_Face face = TopoDS::Face(M(ii));
    if (op)
    {
      shapes.Assign(op->Modified(face));
      if(shapes.Extent() == 0)
         shapes.Assign(op->Generated(face));
    }
    else if(sp)
      shapes.Assign(sp->DescendantShapes(face));

    if(shapes.Extent() == 1)
      shape = shapes.First();
    else if(shapes.Extent() > 1)
    {
      shape = shapes.First() ;
    }
    else 
    {
      TopoDS_Face nullFace;
      shape = nullFace;
    }
    if(shapes.Extent() > 0 || (op && op->IsDeleted(face)))
      OCCSurface::update_OCC_entity(face,shape, op, NULL, sp);
  }
  if(!old_shell.IsSame(new_shell))
    OCCQueryEngine::instance()->update_OCC_map(old_shell, new_shell);
  return CUBIT_SUCCESS;
}

Member Data Documentation

Definition at line 134 of file OCCShell.hpp.

Definition at line 133 of file OCCShell.hpp.

Definition at line 132 of file OCCShell.hpp.

Definition at line 131 of file OCCShell.hpp.

TopoDS_Shell* OCCShell::myTopoDSShell [private]

Definition at line 130 of file OCCShell.hpp.


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