From: Anthony Geay Date: Tue, 27 Apr 2021 06:05:01 +0000 (+0200) Subject: Point avant test X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=10cad68d7e61d395fd549484c67e2421cf768ff8;p=modules%2Fsmesh.git Point avant test --- diff --git a/src/DriverMED/CMakeLists.txt b/src/DriverMED/CMakeLists.txt index a1dcd1a49..2186564d4 100644 --- a/src/DriverMED/CMakeLists.txt +++ b/src/DriverMED/CMakeLists.txt @@ -20,6 +20,7 @@ # --- options --- # additional include directories INCLUDE_DIRECTORIES( + ${MEDCOUPLING_INCLUDE_DIRS} ${MEDFILE_INCLUDE_DIRS} ${HDF5_INCLUDE_DIRS} ${KERNEL_INCLUDE_DIRS} diff --git a/src/MEDWrapper/CMakeLists.txt b/src/MEDWrapper/CMakeLists.txt index 7c3478e24..5b0b7837e 100644 --- a/src/MEDWrapper/CMakeLists.txt +++ b/src/MEDWrapper/CMakeLists.txt @@ -24,6 +24,7 @@ INCLUDE_DIRECTORIES( ${HDF5_INCLUDE_DIRS} ${MEDFILE_INCLUDE_DIRS} ${KERNEL_INCLUDE_DIRS} + ${MEDCOUPLING_INCLUDE_DIRS} ) # additional preprocessor / compiler flags @@ -37,6 +38,7 @@ SET(_link_LIBRARIES ${HDF5_LIBS} ${MEDFILE_C_LIBRARIES} ${KERNEL_SALOMELocalTrace} + ${MEDCoupling_medloader} ) # --- headers --- @@ -72,6 +74,7 @@ SET(MEDWrapper_SOURCES MED_Structures.cxx MED_Utilities.cxx MED_Wrapper.cxx + MEDCoupling_Wrapper.cxx ) # --- rules --- diff --git a/src/MEDWrapper/MEDCoupling_Wrapper.cxx b/src/MEDWrapper/MEDCoupling_Wrapper.cxx new file mode 100644 index 000000000..b975c7580 --- /dev/null +++ b/src/MEDWrapper/MEDCoupling_Wrapper.cxx @@ -0,0 +1,77 @@ +// 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(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()); +} diff --git a/src/MEDWrapper/MEDCoupling_Wrapper.hxx b/src/MEDWrapper/MEDCoupling_Wrapper.hxx index a7ef7759d..9d278d23b 100644 --- a/src/MEDWrapper/MEDCoupling_Wrapper.hxx +++ b/src/MEDWrapper/MEDCoupling_Wrapper.hxx @@ -21,9 +21,7 @@ #include "MED_Wrapper.hxx" -#include "med.h" - -#include +#include "MEDFileMesh.hxx" namespace MED { @@ -38,13 +36,9 @@ 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, @@ -54,15 +48,10 @@ namespace MED 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 @@ -72,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 @@ -84,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 @@ -97,18 +86,14 @@ 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 - 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, @@ -118,19 +103,15 @@ 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 - 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, @@ -138,10 +119,8 @@ namespace MED //! 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 @@ -157,11 +136,13 @@ namespace MED 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 _mc_mesh; + MEDCoupling::MCAuto _coords; + std::string _mesh_name; + int _space_dim; + int _mesh_dim; }; using MCPWrapper = std::shared_ptr;