-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include "DriverMED_Family.h"
#include "MED_Factory.hxx"
#include "MED_Utilities.hxx"
+#include "SMDS_IteratorOnIterators.hxx"
#include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMDS_PolyhedralVolumeOfNodes.hxx"
+#include "SMDS_SetIterator.hxx"
#include "SMESHDS_Mesh.hxx"
#include <utilities.h>
if (myDoGroupOfBalls && nbBalls) myBallsDefaultFamilyId = REST_BALL_FAMILY;
MESSAGE("Perform - aFamilyInfo");
- //cout << " DriverMED_Family::MakeFamilies() " << endl;
list<DriverMED_FamilyPtr> aFamilies;
if (myAllSubMeshes) {
aFamilies = DriverMED_Family::MakeFamilies
myDoGroupOf0DElems && nb0DElements,
myDoGroupOfBalls && nbBalls);
}
- //cout << " myMed->SetFamilyInfo() " << endl;
list<DriverMED_FamilyPtr>::iterator aFamsIter;
for (aFamsIter = aFamilies.begin(); aFamsIter != aFamilies.end(); aFamsIter++)
{
const EConnectivite theConnMode = eNOD;
TInt aNbNodes = myMesh->NbNodes();
- //cout << " myMed->CrNodeInfo() aNbNodes = " << aNbNodes << endl;
PNodeInfo aNodeInfo = myMed->CrNodeInfo(aMeshInfo, aNbNodes,
theMode, theSystem, theIsElemNum, theIsElemNames);
int aNodeID = aCoordHelperPtr->GetID();
aNodeInfo->SetElemNum( iNode, aNodeID );
#ifdef _EDF_NODE_IDS_
- aNodeIdMap[aNodeID] = iNode+1;
+ aNodeIdMap.insert( aNodeIdMap.end(), make_pair( aNodeID, iNode+1 ));
#endif
// family number
const SMDS_MeshNode* aNode = aCoordHelperPtr->GetNode();
bool polyTypesSupported = myMed->CrPolygoneInfo(aMeshInfo,eMAILLE,ePOLYGONE,0,0);
TInt nbPolygonNodes = 0, nbPolyhedronNodes = 0, nbPolyhedronFaces = 0;
+ // nodes on VERTEXes where 0D elements are absent
+ std::vector<const SMDS_MeshElement*> nodesOf0D;
+ std::vector< SMDS_ElemIteratorPtr > iterVec;
+ SMDS_ElemIteratorPtr iterVecIter;
+ if ( myAddODOnVertices && getNodesOfMissing0DOnVert( myMesh, nodesOf0D ))
+ {
+ iterVec.resize(2);
+ iterVec[0] = myMesh->elementsIterator( SMDSAbs_0DElement );
+ iterVec[1] = SMDS_ElemIteratorPtr
+ ( new SMDS_ElementVectorIterator( nodesOf0D.begin(), nodesOf0D.end() ));
+
+ typedef SMDS_IteratorOnIterators
+ < const SMDS_MeshElement *, std::vector< SMDS_ElemIteratorPtr > > TItIterator;
+ iterVecIter = SMDS_ElemIteratorPtr( new TItIterator( iterVec ));
+ }
+
// collect info on all geom types
list< TElemTypeData > aTElemTypeDatas;
#endif
aTElemTypeDatas.push_back(TElemTypeData(anEntity,
ePOINT1,
- nbElemInfo.Nb0DElements(),
+ nbElemInfo.Nb0DElements() + nodesOf0D.size(),
SMDSAbs_0DElement));
#ifdef _ELEMENTS_BY_DIM_
anEntity = eSTRUCT_ELEMENT;
TInt aNbNodes = MED::GetNbNodes(aElemTypeData->_geomType);
elemIterator = myMesh->elementsIterator( aElemTypeData->_smdsType );
+ if ( aElemTypeData->_smdsType == SMDSAbs_0DElement && ! nodesOf0D.empty() )
+ elemIterator = iterVecIter;
while ( elemIterator->more() )
{
const SMDS_MeshElement* anElem = elemIterator->next();
mySubMeshes.clear();
return aResult;
}
+
+//================================================================================
+/*!
+ * \brief Returns nodes on VERTEXes where 0D elements are absent
+ */
+//================================================================================
+
+bool DriverMED_W_SMESHDS_Mesh::
+getNodesOfMissing0DOnVert(SMESHDS_Mesh* meshDS,
+ std::vector<const SMDS_MeshElement*>& nodes)
+{
+ nodes.clear();
+ for ( int i = 1; i <= meshDS->MaxShapeIndex(); ++i )
+ {
+ if ( meshDS->IndexToShape( i ).ShapeType() != TopAbs_VERTEX )
+ continue;
+ if ( SMESHDS_SubMesh* sm = meshDS->MeshElements(i) ) {
+ SMDS_NodeIteratorPtr nIt= sm->GetNodes();
+ while (nIt->more())
+ {
+ const SMDS_MeshNode* n = nIt->next();
+ if ( n->NbInverseElements( SMDSAbs_0DElement ) == 0 )
+ nodes.push_back( n );
+ }
+ }
+ }
+ return !nodes.empty();
+}