Salome HOME
Approche brute force laborieuse. On va tenter l'approche MEDmemFileOpen
authorAnthony Geay <anthony.geay@edf.fr>
Wed, 28 Apr 2021 09:35:05 +0000 (11:35 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Wed, 28 Apr 2021 09:35:05 +0000 (11:35 +0200)
src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
src/MEDWrapper/MEDCoupling_Wrapper.cxx
src/MEDWrapper/MEDCoupling_Wrapper.hxx

index d09ce5713b43ab571fc0347b83e24fa2eef90d90..a49dc01c59839ce4defb8a112d80feecaeacb1ab 100644 (file)
@@ -346,6 +346,7 @@ namespace
 
 Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
 {
+  PerformMedcoupling();
   MED::PWrapper myMed = CrWrapperW(myFile, myVersion);
   return this->PerformInternal<MED::PWrapper>(myMed);
 }
index b975c7580b415bf4e8768973ae3ab084842201fa..88a50b02997b1d361b096ae6c941b424f64532f5 100644 (file)
@@ -64,9 +64,20 @@ void MCTWrapper::SetNodeInfo(const TNodeInfo& theInfo)
   MED::TInt aNbElem(anInfo.myNbElem);
   std::string aCoordNames(anInfo.myCoordNames.data());
   std::string aCoordUnits(anInfo.myCoordUnits.data());
+  std::vector<std::string> comps( DataArray::SplitStringInChuncks(aCoordNames,MED_SNAME_SIZE) );
+  std::vector<std::string> units( DataArray::SplitStringInChuncks(aCoordUnits,MED_SNAME_SIZE) );
+  std::size_t nbComps( comps.size() );
+  if( nbComps != units.size() )
+    THROW_IK_EXCEPTION("MCTWrapper::SetNodeInfo : mismatch length " << nbComps << " != " << units.size() << " !");
+  std::vector<std::string> compUnits(nbComps);
+  for( std::size_t i = 0 ; i < nbComps ; ++i )
+  {
+    compUnits[i] = DataArray::BuildInfoFromVarAndUnit(comps[i],units[i]) ;
+  }
   _coords = DataArrayDouble::New();
   _coords->alloc(aNbElem,this->_space_dim);
   std::copy(aCoord->data(),aCoord->data()+aNbElem*this->_space_dim,_coords->getPointer());
+  _coords->setInfoOnComponents(compUnits);
 }
 
 void MCTWrapper::GetFamilyInfo(TInt theFamId, TFamilyInfo& theInfo)
@@ -75,3 +86,127 @@ void MCTWrapper::GetFamilyInfo(TInt theFamId, TFamilyInfo& theInfo)
   MED::TInt aFamilyId(theInfo.myId);
   std::string aGroupNames(theInfo.myGroupNames.data());
 }
+
+//copie
+  PFamilyInfo
+  MCTWrapper::CrFamilyInfo(const PMeshInfo& theMeshInfo,
+                 const std::string& theValue,
+                 TInt theId,
+                 const MED::TStringSet& theGroupNames,
+                 const MED::TStringVector& theAttrDescs,
+                 const MED::TIntVector& theAttrIds,
+                 const MED::TIntVector& theAttrVals)
+  {
+    return PFamilyInfo(new TTFamilyInfo
+                       (theMeshInfo,
+                        theValue,
+                        theId,
+                        theGroupNames,
+                        theAttrDescs,
+                        theAttrIds,
+                        theAttrVals));
+  }
+
+  //copie
+  PPolygoneInfo
+  MCTWrapper::CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+                   EEntiteMaillage theEntity,
+                   EGeometrieElement theGeom,
+                   TInt theNbElem,
+                   TInt theConnSize,
+                   EConnectivite theConnMode,
+                   EBooleen theIsElemNum,
+                   EBooleen theIsElemNames)
+  {
+    return PPolygoneInfo(new TTPolygoneInfo
+                         (theMeshInfo,
+                          theEntity,
+                          theGeom,
+                          theNbElem,
+                          theConnSize,
+                          theConnMode,
+                          theIsElemNum,
+                          theIsElemNames));
+  }
+
+  //copie
+  PPolygoneInfo
+  MCTWrapper
+  ::CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+                   EEntiteMaillage theEntity,
+                   EGeometrieElement theGeom,
+                   const TIntVector& theIndexes,
+                   const TIntVector& theConnectivities,
+                   EConnectivite theConnMode,
+                   const TIntVector& theFamilyNums,
+                   const TIntVector& theElemNums,
+                   const TStringVector& theElemNames)
+  {
+    return PPolygoneInfo(new TTPolygoneInfo
+                         (theMeshInfo,
+                          theEntity,
+                          theGeom,
+                          theIndexes,
+                          theConnectivities,
+                          theConnMode,
+                          theFamilyNums,
+                          theElemNums,
+                          theElemNames));
+  }
+
+  //copie
+  PPolyedreInfo
+  MCTWrapper
+  ::CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+                   EEntiteMaillage theEntity,
+                   EGeometrieElement theGeom,
+                   TInt theNbElem,
+                   TInt theNbFaces,
+                   TInt theConnSize,
+                   EConnectivite theConnMode,
+                   EBooleen theIsElemNum,
+                   EBooleen theIsElemNames)
+  {
+    return PPolyedreInfo(new TTPolyedreInfo
+                         (theMeshInfo,
+                          theEntity,
+                          theGeom,
+                          theNbElem,
+                          theNbFaces,
+                          theConnSize,
+                          theConnMode,
+                          theIsElemNum,
+                          theIsElemNames));
+  }
+
+//copie
+    PBallInfo
+  MCTWrapper
+  ::CrBallInfo(const PMeshInfo& theMeshInfo,
+               TInt theNbBalls,
+               EBooleen theIsElemNum)
+  {
+    return PBallInfo(new TTBallInfo(theMeshInfo, theNbBalls, theIsElemNum));
+  }
+
+    PCellInfo
+  MCTWrapper
+  ::CrCellInfo(const PMeshInfo& theMeshInfo,
+               EEntiteMaillage theEntity,
+               EGeometrieElement theGeom,
+               TInt theNbElem,
+               EConnectivite theConnMode,
+               EBooleen theIsElemNum,
+               EBooleen theIsElemNames,
+               EModeSwitch theMode)
+  {
+    return PCellInfo(new TTCellInfo
+                     (theMeshInfo,
+                      theEntity,
+                      theGeom,
+                      theNbElem,
+                      theConnMode,
+                      theIsElemNum,
+                      theIsElemNames,
+                      theMode));
+  }
index 9d278d23b71cc7388cc8f424e03d5c1ea2725207..57ba0a3167d6282c2632a5822fb716994836a1d1 100644 (file)
@@ -61,7 +61,7 @@ namespace MED
                  const TStringSet& theGroupNames,
                  const TStringVector& theAttrDescs = TStringVector(),
                  const TIntVector& theAttrIds = TIntVector(),
-                 const TIntVector& theAttrVals = TIntVector()) { }
+                 const TIntVector& theAttrVals = TIntVector());
     
     //! Create a MEDWrapper MED Polygones representation
     virtual
@@ -73,7 +73,7 @@ namespace MED
                    TInt theConnSize,
                    EConnectivite theConnMode = eNOD,
                    EBooleen theIsElemNum = eVRAI,
-                   EBooleen theIsElemNames = eVRAI) { }
+                   EBooleen theIsElemNames = eVRAI);
     
     //! Create a MEDWrapper MED Polygones representation
     virtual
@@ -86,7 +86,7 @@ namespace MED
                    EConnectivite theConnMode = eNOD,
                    const TIntVector& theFamilyNums = TIntVector(),
                    const TIntVector& theElemNums = TIntVector(),
-                   const TStringVector& theElemNames = TStringVector()) { }
+                   const TStringVector& theElemNames = TStringVector());
                    
                    
     //! Write a MEDWrapper MED Polygones representation into the MED file
@@ -103,7 +103,7 @@ namespace MED
                    TInt theConnSize,
                    EConnectivite theConnMode = eNOD,
                    EBooleen theIsElemNum = eVRAI,
-                   EBooleen theIsElemNames = eVRAI) { }
+                   EBooleen theIsElemNames = eVRAI);
                    
                    
     //! Write a MEDWrapper MED Polyedres representation into the MED file