Version: 6.3.1
Public Member Functions | Private Attributes

SMESHGUI_MeshOrderMgr Class Reference

Operator to check and modify mesh computation submesh priority (order) More...

#include <SMESHGUI_MeshOrderOp.h>

Public Member Functions

 SMESHGUI_MeshOrderMgr (SMESHGUI_MeshOrderBox *)
 Constructor.
virtual ~SMESHGUI_MeshOrderMgr ()
 Destructor.
void SetMesh (SMESH::SMESH_Mesh_var &theMesh)
 Set root mesh object.
bool GetMeshOrder ()
 Check for concurents between submesh objects.
bool GetMeshOrder (ListListId &theIds)
 Check for concurents between submesh objects.
bool SetMeshOrder ()
 Store submesh priority order.
bool SetMeshOrder (const ListListId &theIds)
 Store given submesh priority order.
bool IsOrderChanged () const
 Returns status is order changed by user.

Private Attributes

SMESH::SMESH_Mesh_var myMesh
SMESHGUI_MeshOrderBoxmyBox

Detailed Description

Operator to check and modify mesh computation submesh priority (order)

Definition at line 41 of file SMESHGUI_MeshOrderOp.h.


Constructor & Destructor Documentation

SMESHGUI_MeshOrderMgr::SMESHGUI_MeshOrderMgr ( SMESHGUI_MeshOrderBox theBox)

Constructor.

Definition at line 170 of file SMESHGUI_MeshOrderOp.cxx.

References myMesh.

: myBox( theBox )
{
  myMesh = SMESH::SMESH_Mesh::_nil();
}
SMESHGUI_MeshOrderMgr::~SMESHGUI_MeshOrderMgr ( ) [virtual]

Destructor.

Definition at line 182 of file SMESHGUI_MeshOrderOp.cxx.

{
}

Member Function Documentation

bool SMESHGUI_MeshOrderMgr::GetMeshOrder ( )

Check for concurents between submesh objects.

Definition at line 206 of file SMESHGUI_MeshOrderOp.cxx.

Referenced by SMESHGUI_MeshOrderOp.initDialog(), and SMESHGUI_PrecomputeOp.initDialog().

{
  ListListId   idListList;
  return GetMeshOrder(idListList);
}
bool SMESHGUI_MeshOrderMgr::GetMeshOrder ( ListListId theIds)

Check for concurents between submesh objects.

Definition at line 218 of file SMESHGUI_MeshOrderOp.cxx.

References _PTR(), SMESHGUI_MeshOrderBox.Clear(), myBox, myMesh, and SMESHGUI_MeshOrderBox.SetMeshes().

{
  if (!myBox || myMesh->_is_nil())
    return false;
  myBox->Clear();
  SMESH::submesh_array_array_var meshOrder = myMesh->GetMeshOrder();
  if ( !meshOrder.operator->() || !meshOrder->length() )
    return false;
  ListListName nameListList;
  for ( int i = 0, n = meshOrder->length(); i < n; i++ )
  {
    QList<int> idList;
    QStringList nameList;
    const SMESH::submesh_array& aSMArray = meshOrder[i];
    for ( int j = 0, jn = aSMArray.length(); j < jn; j++ )
    {
      const SMESH::SMESH_subMesh_var subMesh = aSMArray[j];
      
      _PTR(SObject) aSubMeshSObj = SMESH::FindSObject(subMesh);
      if ( !aSubMeshSObj )
        continue;

      idList.append(subMesh->GetId() );
      nameList.append( QString(aSubMeshSObj->GetName().c_str()) );
    }
    theIdListList.append(idList);
    nameListList.append(nameList);
  }
  myBox->SetMeshes(nameListList, theIdListList);
  return !theIdListList.isEmpty();
}
bool SMESHGUI_MeshOrderMgr::IsOrderChanged ( ) const

Returns status is order changed by user.

Definition at line 256 of file SMESHGUI_MeshOrderOp.cxx.

References SMESHGUI_MeshOrderBox.IsOrderChanged(), and myBox.

Referenced by SMESHGUI_PrecomputeOp.onCancel(), SMESHGUI_PrecomputeOp.onCompute(), and SMESHGUI_PrecomputeOp.onPreview().

{
  return myBox && myBox->IsOrderChanged();
}
void SMESHGUI_MeshOrderMgr::SetMesh ( SMESH::SMESH_Mesh_var &  theMesh)

Set root mesh object.

Definition at line 192 of file SMESHGUI_MeshOrderOp.cxx.

References _PTR(), myBox, and myMesh.

Referenced by SMESHGUI_MeshOrderOp.initDialog(), and SMESHGUI_PrecomputeOp.initDialog().

{
  myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh);
  _PTR(SObject) aMeshSObj = SMESH::FindSObject(theMesh);
  if ( myBox && aMeshSObj )
    myBox->setTitle( aMeshSObj->GetName().c_str() );
}  
bool SMESHGUI_MeshOrderMgr::SetMeshOrder ( const ListListId theIds)

Store given submesh priority order.

Store submesh priority order.

Definition at line 278 of file SMESHGUI_MeshOrderOp.cxx.

References _PTR(), SMESHGUI.GetSMESHGUI(), SMESH_test.ids, SMESH.ModifiedMesh(), myMesh, SMESH.Tag_FirstSubMesh, and SMESH.Tag_LastSubMesh.

{
  if (theListListIds.isEmpty() || myMesh->_is_nil())
    return false;

  _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
  _PTR(SObject) aMeshSObj = SMESH::FindSObject(myMesh);
  if ( !aStudy || !aMeshSObj )
    return false;

  std::map<int, SMESH::SMESH_subMesh_var> mapOfSubMesh;
  for (int i = SMESH::Tag_FirstSubMesh; i <= SMESH::Tag_LastSubMesh; i++) {
    _PTR(SObject) aSubmeshRoot;
    if ( !aMeshSObj->FindSubObject( i, aSubmeshRoot ) )
      continue;
    _PTR(ChildIterator) smIter = aStudy->NewChildIterator( aSubmeshRoot );
    for ( ; smIter->More(); smIter->Next() ) {
      _PTR(SObject) aSmObj = smIter->Value();
      SMESH::SMESH_subMesh_var sm =
        SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( aSmObj );
      mapOfSubMesh[ sm->GetId() ] = SMESH::SMESH_subMesh::_duplicate(sm);
    }
  }

  // is it enought to set modifid attribute on root mesh objects only?
  //  it is seems that modifaction flag will be set on child submeshes 
  //  automatically  (see SMESH::ModifiedMesh for details)
  SMESH::ModifiedMesh( aMeshSObj, false, false );

  SMESH::submesh_array_array_var meshOrder = new SMESH::submesh_array_array();
  meshOrder->length(theListListIds.count() );
  ListListId::const_iterator it = theListListIds.constBegin();
  for ( int i = 0; it != theListListIds.constEnd(); ++it ) {
    const QList<int>& ids = *it;
    SMESH::submesh_array_var subMeshList = new SMESH::submesh_array();
    subMeshList->length( ids.count() );
    QList<int>::const_iterator subIt = ids.constBegin();
    for( int j = 0; subIt != ids.constEnd(); ++subIt )
      if ( mapOfSubMesh.find( *subIt ) != mapOfSubMesh.end() )
        subMeshList[ j++ ] = mapOfSubMesh[ *subIt ];

    meshOrder[ i++ ] = subMeshList;
  }
  // update object browser
  SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );

  return myMesh->SetMeshOrder(meshOrder);
}
bool SMESHGUI_MeshOrderMgr::SetMeshOrder ( )

Field Documentation

Definition at line 62 of file SMESHGUI_MeshOrderOp.h.

Referenced by GetMeshOrder(), IsOrderChanged(), SetMesh(), and SetMeshOrder().

SMESH::SMESH_Mesh_var SMESHGUI_MeshOrderMgr.myMesh [private]

Definition at line 61 of file SMESHGUI_MeshOrderOp.h.

Referenced by GetMeshOrder(), SetMesh(), SetMeshOrder(), and SMESHGUI_MeshOrderMgr().

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS