+ if ( _preMeshInfo )
+ return _preMeshInfo->GetMeshInfo();
+
+ SMESH::smIdType_array_var aRes = new SMESH::smIdType_array();
+ aRes->length(SMESH::Entity_Last);
+ for (int i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++)
+ aRes[i] = 0;
+
+ // get number of nodes
+ aRes[ SMESH::Entity_Node ] = GetNumberOfNodes(true);
+
+ ::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
+
+ // get statistic from child sub-meshes
+ TListOfSubMeshes smList;
+ if ( getSubMeshes( aSubMesh, smList ) )
+ for ( TListOfSubMeshes::iterator sm = smList.begin(); sm != smList.end(); ++sm )
+ SMESH_Mesh_i::CollectMeshInfo( (*sm)->GetElements(), aRes );
+
+ return aRes._retn();
+}
+
+//=======================================================================
+/*
+ * Returns number of mesh elements of each \a ElementType
+ */
+//=======================================================================
+
+SMESH::smIdType_array* SMESH_subMesh_i::GetNbElementsByType()
+{
+ SMESH::smIdType_array_var aRes = new SMESH::smIdType_array();
+ aRes->length(SMESH::NB_ELEMENT_TYPES);
+ for (int i = 0; i < SMESH::NB_ELEMENT_TYPES; i++)
+ if ( _preMeshInfo )
+ aRes[ i ] = _preMeshInfo->NbElements( SMDSAbs_ElementType( i ));
+ else
+ aRes[ i ] = 0;
+
+ if ( !_preMeshInfo )
+ {
+ aRes[ SMESH::NODE ] = GetNumberOfNodes(true);
+
+ ::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
+ TListOfSubMeshes smList;
+ if ( getSubMeshes( aSubMesh, smList ))
+ {
+ TListOfSubMeshes::iterator smDS = smList.begin();
+ for ( ; smDS != smList.end(); ++smDS )
+ {
+ SMDS_ElemIteratorPtr eIt = (*smDS)->GetElements();
+ if ( eIt->more() )
+ aRes[ eIt->next()->GetType() ] = (*smDS)->NbElements();
+ }
+ }
+ }
+ return aRes._retn();
+}
+
+
+//=======================================================================
+//function : GetTypes
+//purpose : Returns types of elements it contains
+//=======================================================================
+
+SMESH::array_of_ElementType* SMESH_subMesh_i::GetTypes()
+{
+ if ( _preMeshInfo )
+ return _preMeshInfo->GetTypes();
+
+ SMESH::array_of_ElementType_var types = new SMESH::array_of_ElementType;
+
+ ::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
+
+ TListOfSubMeshes smList;
+ if ( getSubMeshes( aSubMesh, smList ))
+ {
+ TListOfSubMeshes::iterator smDS = smList.begin();
+ for ( ; smDS != smList.end(); ++smDS )
+ {
+ SMDS_ElemIteratorPtr eIt = (*smDS)->GetElements();
+ if ( eIt->more() )
+ {
+ types->length( 1 );
+ types[0] = SMESH::ElementType( eIt->next()->GetType());
+ break;
+ }
+ }
+
+ if ( types->length() == 0 )
+ {
+ for ( smDS = smList.begin(); smDS != smList.end(); ++smDS )
+ {
+ if ( (*smDS)->GetNodes()->more() )
+ {
+ int smID = (*smDS)->GetID();
+ TopoDS_Shape shape = (*smDS)->GetParent()->IndexToShape( smID );
+ if ( !shape.IsNull() && shape.ShapeType() == TopAbs_VERTEX )
+ {
+ types->length( 1 );
+ types[0] = SMESH::NODE;
+ break;
+ }
+ }
+ }
+ }
+ }
+ return types._retn();
+}
+
+//=======================================================================
+//function : GetMesh
+//purpose : interface SMESH_IDSource
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr SMESH_subMesh_i::GetMesh()
+{
+ return GetFather();
+}
+
+//=======================================================================
+//function : IsMeshInfoCorrect
+//purpose : * Returns false if GetMeshInfo() returns incorrect information that may
+// * happen if mesh data is not yet fully loaded from the file of study.
+//=======================================================================
+
+bool SMESH_subMesh_i::IsMeshInfoCorrect()
+{
+ return _preMeshInfo ? _preMeshInfo->IsMeshInfoCorrect() : true;
+}
+
+//=======================================================================
+//function : GetVtkUgStream
+//purpose : Return data vtk unstructured grid (not implemented)
+//=======================================================================
+
+SALOMEDS::TMPFile* SMESH_subMesh_i::GetVtkUgStream()
+{
+ SALOMEDS::TMPFile_var SeqFile;
+ return SeqFile._retn();
+}
+
+//=======================================================================
+//function : SMESH_Invalid_subMesh_i
+//purpose : constructor of "invalid sub-mesh" created by SMESH_Gen_i::CopyMeshWithGeom()
+//=======================================================================
+
+SMESH_Invalid_subMesh_i::SMESH_Invalid_subMesh_i( PortableServer::POA_ptr thePOA,
+ SMESH_Gen_i* gen_i,
+ SMESH_Mesh_i* mesh_i,
+ int localId,
+ GEOM::GEOM_Object_ptr shape )
+ : SALOME::GenericObj_i( thePOA ),
+ SMESH_subMesh_i( thePOA, gen_i, mesh_i, localId )
+{
+ _geom = GEOM::GEOM_Object::_duplicate( shape );
+}
+
+//=======================================================================
+//function : GetSubShape
+//purpose : return geometry which is not a sub-shape of the main shape
+//=======================================================================
+
+GEOM::GEOM_Object_ptr SMESH_Invalid_subMesh_i::GetSubShape()
+{
+ return GEOM::GEOM_Object::_duplicate( _geom );