--- /dev/null
+// Copyright (C) 2021 CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "MEDCoupling_Wrapper.hxx"
+#include "MED_TStructures.hxx"
+
+using namespace MED;
+using namespace MEDCoupling;
+
+//Copie directe
+PMeshInfo MCTWrapper::CrMeshInfo(TInt theDim,
+ TInt theSpaceDim,
+ const std::string& theValue,
+ EMaillage theType,
+ const std::string& theDesc)
+{
+ return PMeshInfo(new TTMeshInfo(theDim, theSpaceDim, theValue, theType, theDesc));
+}
+
+void MCTWrapper::SetMeshInfo(const TMeshInfo& theInfo)
+{
+ _mesh_name = theInfo.GetName();
+ _mesh_dim = theInfo.GetDim();
+ _space_dim = theInfo.GetSpaceDim();
+}
+
+//Copie directe
+PNodeInfo MCTWrapper::CrNodeInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbElem,
+ EModeSwitch theMode,
+ ERepere theSystem,
+ EBooleen theIsElemNum,
+ EBooleen theIsElemNames)
+{
+ return PNodeInfo(new TTNodeInfo
+ (theMeshInfo,
+ theNbElem,
+ theMode,
+ theSystem,
+ theIsElemNum,
+ theIsElemNames));
+}
+
+void MCTWrapper::SetNodeInfo(const TNodeInfo& theInfo)
+{
+ MED::TNodeInfo& anInfo = const_cast<MED::TNodeInfo&>(theInfo);
+ MED::PNodeCoord aCoord(anInfo.myCoord);
+ MED::TInt aNbElem(anInfo.myNbElem);
+ std::string aCoordNames(anInfo.myCoordNames.data());
+ std::string aCoordUnits(anInfo.myCoordUnits.data());
+ _coords = DataArrayDouble::New();
+ _coords->alloc(aNbElem,this->_space_dim);
+ std::copy(aCoord->data(),aCoord->data()+aNbElem*this->_space_dim,_coords->getPointer());
+}
+
+void MCTWrapper::GetFamilyInfo(TInt theFamId, TFamilyInfo& theInfo)
+{
+ std::string aFamilyName(theInfo.myName.data());
+ MED::TInt aFamilyId(theInfo.myId);
+ std::string aGroupNames(theInfo.myGroupNames.data());
+}
#include "MED_Wrapper.hxx"
-#include "med.h"
-
-#include <memory>
+#include "MEDFileMesh.hxx"
namespace MED
{
EMaillage theType = eNON_STRUCTURE,
const std::string& theDesc = "");
//! Write the MEDWrapper MED Mesh representation into the MED file
- void
- SetMeshInfo(const TMeshInfo& theInfo,
- TErr* theErr = NULL);
+ void SetMeshInfo(const TMeshInfo& theInfo);
//! Write a MEDWrapper MED Family representation into the MED file
- void
- SetFamilyInfo(const TFamilyInfo& theInfo,
- TErr* theErr = NULL);
+ void SetFamilyInfo(const TFamilyInfo& theInfo) { }
//! Create a MEDWrapper MED Nodes representation
PNodeInfo
CrNodeInfo(const PMeshInfo& theMeshInfo,
EBooleen theIsElemNum = eVRAI,
EBooleen theIsElemNames = eFAUX);
//! Write the MEDWrapper MED Nodes representation into the MED file
- void
- SetNodeInfo(const TNodeInfo& theInfo,
- TErr* theErr = NULL);
+ void SetNodeInfo(const TNodeInfo& theInfo);
//! Read a MEDWrapper MED Family representation by its numbers
- void
- GetFamilyInfo(TInt theFamId,
- TFamilyInfo& theInfo,
- TErr* theErr = NULL);
+ void GetFamilyInfo(TInt theFamId, TFamilyInfo& theInfo);
//! Create a MEDWrapper MED Family representation
PFamilyInfo
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
TInt theConnSize,
EConnectivite theConnMode = eNOD,
EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI);
+ EBooleen theIsElemNames = eVRAI) { }
//! Create a MEDWrapper MED Polygones representation
virtual
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
- virtual
- void
- SetPolygoneInfo(const TPolygoneInfo& theInfo,
- TErr* theErr = NULL);
+ void SetPolygoneInfo(const TPolygoneInfo& theInfo) { }
- //! Create a MEDWrapper MED Polyedres representation
- virtual
+ //! Create a MEDWrapper MED Polyedres representation
PPolyedreInfo
CrPolyedreInfo(const PMeshInfo& theMeshInfo,
EEntiteMaillage theEntity,
TInt theConnSize,
EConnectivite theConnMode = eNOD,
EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI);
+ EBooleen theIsElemNames = eVRAI) { }
//! Write a MEDWrapper MED Polyedres representation into the MED file
- virtual
- void
- SetPolyedreInfo(const TPolyedreInfo& theInfo,
- TErr* theErr = NULL);
+ void SetPolyedreInfo(const TPolyedreInfo& theInfo) { }
//! Create a MEDWrapper MED Balls representation
/*! This feature is supported since version 3.0 */
- virtual
PBallInfo
CrBallInfo(const PMeshInfo& theMeshInfo,
TInt theNbBalls,
//! Write a MEDWrapper representation of MED_BALL into the MED file
/*! This feature is supported since version 3.0 */
- virtual
void
- SetBallInfo(const TBallInfo& theInfo,
- TErr* theErr = NULL);
+ SetBallInfo(const TBallInfo& theInfo) { }
//! Create a MEDWrapper MED Cells representation
EModeSwitch theMode = eFULL_INTERLACE);
//! Write the MEDWrapper MED Cells representation into the MED file
- virtual
- void
- SetCellInfo(const TCellInfo& theInfo,
- TErr* theErr = NULL);
-
+ void SetCellInfo(const TCellInfo& theInfo) { }
+ private:
+ MEDCoupling::MCAuto<MEDCoupling::MEDFileUMesh> _mc_mesh;
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> _coords;
+ std::string _mesh_name;
+ int _space_dim;
+ int _mesh_dim;
};
using MCPWrapper = std::shared_ptr<MCTWrapper>;