#include "SMESH_subMesh_i.hxx"
#include "DriverMED_R_SMESHDS_Mesh.h"
+#include "DriverMED_W_SMESHDS_Mesh.h"
#include "SMDS_VolumeTool.hxx"
#include "SMESHDS_Command.hxx"
#include "SMESHDS_CommandType.hxx"
#include "SMESH_Group.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_MesherHelper.hxx"
+#include "SMDS_EdgePosition.hxx"
+#include "SMDS_FacePosition.hxx"
#include "OpUtil.hxx"
#include "SALOME_NamingService.hxx"
// OCCT Includes
#include <BRep_Builder.hxx>
-#include <OSD_Path.hxx>
-#include <OSD_File.hxx>
#include <OSD_Directory.hxx>
+#include <OSD_File.hxx>
+#include <OSD_Path.hxx>
#include <OSD_Protection.hxx>
-#include <TColStd_MapOfInteger.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <TCollection_AsciiString.hxx>
+#include <TopExp_Explorer.hxx>
#include <TopoDS_Compound.hxx>
// STL Includes
return ConvertDriverMEDReadStatus(status);
}
+//================================================================================
+/*!
+ * \brief Return string representation of a MED file version comprising nbDigits
+ */
+//================================================================================
+
+char* SMESH_Mesh_i::GetVersionString(SMESH::MED_VERSION version, CORBA::Short nbDigits)
+{
+ std::string ver = DriverMED_W_SMESHDS_Mesh::GetVersionString(MED::EVersion(version),
+ nbDigits);
+ return CORBA::string_dup( ver.c_str() );
+}
+
//=============================================================================
/*!
* ImportUNVFile
SMESHDS_SubMesh* SDSM = SM->GetSubMeshDS();
if(!SDSM) return aResult._retn();
- map<int,const SMDS_MeshElement*> theElems;
- if( !all || (SDSM->NbElements()==0 && SDSM->NbNodes()==1) ) {
+ set<int> theElems;
+ if( !all || (SDSM->NbElements()==0) ) { // internal nodes or vertex submesh
SMDS_NodeIteratorPtr nIt = SDSM->GetNodes();
while ( nIt->more() ) {
const SMDS_MeshNode* elem = nIt->next();
- theElems.insert( make_pair(elem->GetID(),elem) );
+ theElems.insert( elem->GetID() );
}
}
else { // all nodes of submesh elements
SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
while ( nIt->more() ) {
const SMDS_MeshElement* elem = nIt->next();
- theElems.insert( make_pair(elem->GetID(),elem) );
+ theElems.insert( elem->GetID() );
}
}
}
aResult->length(theElems.size());
- map<int, const SMDS_MeshElement * >::iterator itElem;
+ set<int>::iterator itElem;
int i = 0;
for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
- aResult[i++] = (*itElem).first;
+ aResult[i++] = *itElem;
return aResult._retn();
}
return aResult._retn();
}
+//=============================================================================
+/*!
+ * \brief Return position of a node on shape
+ */
+//=============================================================================
+
+SMESH::NodePosition* SMESH_Mesh_i::GetNodePosition(CORBA::Long NodeID)
+{
+ SMESH::NodePosition* aNodePosition = new SMESH::NodePosition();
+ aNodePosition->shapeID = 0;
+ aNodePosition->shapeType = GEOM::SHAPE;
+
+ SMESHDS_Mesh* mesh = _impl->GetMeshDS();
+ if ( !mesh ) return aNodePosition;
+
+ if ( const SMDS_MeshNode* aNode = mesh->FindNode(NodeID) )
+ {
+ if ( SMDS_PositionPtr pos = aNode->GetPosition() )
+ {
+ aNodePosition->shapeID = pos->GetShapeId();
+ switch ( pos->GetTypeOfPosition() ) {
+ case SMDS_TOP_EDGE:
+ aNodePosition->shapeType = GEOM::EDGE;
+ aNodePosition->params.length(1);
+ aNodePosition->params[0] =
+ static_cast<SMDS_EdgePosition*>( pos.get() )->GetUParameter();
+ break;
+ case SMDS_TOP_FACE:
+ aNodePosition->shapeType = GEOM::FACE;
+ aNodePosition->params.length(2);
+ aNodePosition->params[0] =
+ static_cast<SMDS_FacePosition*>( pos.get() )->GetUParameter();
+ aNodePosition->params[1] =
+ static_cast<SMDS_FacePosition*>( pos.get() )->GetVParameter();
+ break;
+ case SMDS_TOP_VERTEX:
+ aNodePosition->shapeType = GEOM::VERTEX;
+ break;
+ case SMDS_TOP_3DSPACE:
+ if ( TopExp_Explorer(_impl->GetShapeToMesh(), TopAbs_SOLID).More() )
+ aNodePosition->shapeType = GEOM::SOLID;
+ else if ( TopExp_Explorer(_impl->GetShapeToMesh(), TopAbs_SHELL).More() )
+ aNodePosition->shapeType = GEOM::SHELL;
+ break;
+ default:;
+ }
+ }
+ }
+ return aNodePosition;
+}
//=============================================================================
/*!