-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2013 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
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// SMESH DriverMED : driver to read and write 'med' files
// File : DriverMED_R_SMESHDS_Mesh.cxx
using namespace MED;
using namespace std;
+typedef std::map<int, DriverMED_FamilyPtr> TID2FamilyMap;
+
+namespace DriverMED
+{
+ bool buildMeshGrille(const MED::PWrapper& theWrapper,
+ const MED::PMeshInfo& theMeshInfo,
+ SMESHDS_Mesh* theMesh,
+ const TID2FamilyMap& myFamilies);
+ /*!
+ * \brief Ensure aFamily has a required ID
+ * \param aFamily - a family to check
+ * \param anID - an ID aFamily should have
+ * \param myFamilies - a map of the family ID to the Family
+ * \retval bool - true if successful
+ */
+ bool checkFamilyID(DriverMED_FamilyPtr & aFamily,
+ int anID,
+ const TID2FamilyMap& myFamilies);
+}
+
void
DriverMED_R_SMESHDS_Mesh
::SetMeshName(string theMeshName)
}
if (aMeshInfo->GetType() == MED::eSTRUCTURE){
- /*bool aRes = */buildMeshGrille(aMed,aMeshInfo);
+ /*bool aRes = */DriverMED::buildMeshGrille(aMed,aMeshInfo,myMesh,myFamilies);
continue;
}
// Save reference to this node from its family
TInt aFamNum = aNodeInfo->GetFamNum(iElem);
- if ( checkFamilyID ( aFamily, aFamNum ))
+ if ( DriverMED::checkFamilyID ( aFamily, aFamNum, myFamilies ))
{
aFamily->AddElement(aNode);
aFamily->SetType(SMDSAbs_Node);
// Save reference to this element from its family
TInt aFamNum = aBallInfo->GetFamNum(iBall);
- if ( checkFamilyID ( aFamily, aFamNum ))
+ if ( DriverMED::checkFamilyID ( aFamily, aFamNum, myFamilies ))
{
aFamily->AddElement(anElement);
aFamily->SetType( SMDSAbs_Ball );
if(aResult < DRS_WARN_RENUMBER)
aResult = DRS_WARN_RENUMBER;
}
- if ( checkFamilyID ( aFamily, aFamNum ))
+ if ( DriverMED::checkFamilyID ( aFamily, aFamNum, myFamilies ))
{
// Save reference to this element from its family
aFamily->AddElement(anElement);
if (aResult < DRS_WARN_RENUMBER)
aResult = DRS_WARN_RENUMBER;
}
- if ( checkFamilyID ( aFamily, aFamNum )) {
+ if ( DriverMED::checkFamilyID ( aFamily, aFamNum, myFamilies )) {
// Save reference to this element from its family
aFamily->AddElement(anElement);
aFamily->SetType(anElement->GetType());
case eSEG3: aNbNodes = 3; break;
case eTRIA3: aNbNodes = 3; break;
case eTRIA6: aNbNodes = 6; break;
+ case eTRIA7: aNbNodes = 7; break;
case eQUAD4: aNbNodes = 4; break;
case eQUAD8: aNbNodes = 8; break;
case eQUAD9: aNbNodes = 9; break;
isRenum = anIsElemNum;
}
break;
+ case eTRIA7:
+ aNbNodes = 7;
+ if(anIsElemNum)
+ anElement = myMesh->AddFaceWithID(aNodeIds[0], aNodeIds[1],
+ aNodeIds[2], aNodeIds[3],
+ aNodeIds[4], aNodeIds[5], aNodeIds[6],
+ aCellInfo->GetElemNum(iElem));
+ if (!anElement) {
+ anElement = myMesh->AddFace(FindNode(myMesh,aNodeIds[0]),
+ FindNode(myMesh,aNodeIds[1]),
+ FindNode(myMesh,aNodeIds[2]),
+ FindNode(myMesh,aNodeIds[3]),
+ FindNode(myMesh,aNodeIds[4]),
+ FindNode(myMesh,aNodeIds[5]),
+ FindNode(myMesh,aNodeIds[6]));
+ isRenum = anIsElemNum;
+ }
+ break;
case eQUAD4:
aNbNodes = 4;
if(anIsElemNum)
if (aResult < DRS_WARN_RENUMBER)
aResult = DRS_WARN_RENUMBER;
}
- if ( checkFamilyID ( aFamily, aFamNum )) {
+ if ( DriverMED::checkFamilyID ( aFamily, aFamNum, myFamilies )) {
// Save reference to this element from its family
myFamilies[aFamNum]->AddElement(anElement);
myFamilies[aFamNum]->SetType(anElement->GetType());
* \param anID - an ID aFamily should have
* \retval bool - true if successful
*/
-bool DriverMED_R_SMESHDS_Mesh::checkFamilyID(DriverMED_FamilyPtr & aFamily, int anID) const
+bool DriverMED::checkFamilyID(DriverMED_FamilyPtr & aFamily,
+ int anID,
+ const TID2FamilyMap& myFamilies)
{
if ( !aFamily || aFamily->GetId() != anID ) {
map<int, DriverMED_FamilyPtr>::const_iterator i_fam = myFamilies.find(anID);
return ( aFamily->GetId() == anID );
}
-
-/*! \brief Reading the structured mesh and convert to non structured (by filling of smesh structure for non structured mesh)
+/*!
+ * \brief Reading the structured mesh and convert to non structured
+ * (by filling of smesh structure for non structured mesh)
* \param theWrapper - PWrapper const pointer
* \param theMeshInfo - PMeshInfo const pointer
+ * \param myFamilies - a map of the family ID to the Family
* \return TRUE, if successfully. Else FALSE
*/
-bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper,
- const MED::PMeshInfo& theMeshInfo)
+bool DriverMED::buildMeshGrille(const MED::PWrapper& theWrapper,
+ const MED::PMeshInfo& theMeshInfo,
+ SMESHDS_Mesh* myMesh,
+ const TID2FamilyMap& myFamilies)
{
bool res = true;
if((aGrilleInfo->myFamNumNode).size() > 0){
TInt aFamNum = aGrilleInfo->GetFamNumNode(iNode);
- if ( checkFamilyID ( aFamily, aFamNum ))
+ if ( DriverMED::checkFamilyID ( aFamily, aFamNum, myFamilies ))
{
aFamily->AddElement(aNode);
aFamily->SetType(SMDSAbs_Node);
}
if((aGrilleInfo->myFamNum).size() > 0){
TInt aFamNum = aGrilleInfo->GetFamNum(iCell);
- if ( checkFamilyID ( aFamily, aFamNum )){
+ if ( DriverMED::checkFamilyID ( aFamily, aFamNum, myFamilies )){
aFamily->AddElement(anElement);
aFamily->SetType(anElement->GetType());
}