Point avant test

This commit is contained in:
Anthony Geay 2021-04-27 08:05:01 +02:00
parent 9bd2dd723e
commit 10cad68d7e
4 changed files with 101 additions and 39 deletions

View File

@ -20,6 +20,7 @@
# --- options --- # --- options ---
# additional include directories # additional include directories
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(
${MEDCOUPLING_INCLUDE_DIRS}
${MEDFILE_INCLUDE_DIRS} ${MEDFILE_INCLUDE_DIRS}
${HDF5_INCLUDE_DIRS} ${HDF5_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS} ${KERNEL_INCLUDE_DIRS}

View File

@ -24,6 +24,7 @@ INCLUDE_DIRECTORIES(
${HDF5_INCLUDE_DIRS} ${HDF5_INCLUDE_DIRS}
${MEDFILE_INCLUDE_DIRS} ${MEDFILE_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS} ${KERNEL_INCLUDE_DIRS}
${MEDCOUPLING_INCLUDE_DIRS}
) )
# additional preprocessor / compiler flags # additional preprocessor / compiler flags
@ -37,6 +38,7 @@ SET(_link_LIBRARIES
${HDF5_LIBS} ${HDF5_LIBS}
${MEDFILE_C_LIBRARIES} ${MEDFILE_C_LIBRARIES}
${KERNEL_SALOMELocalTrace} ${KERNEL_SALOMELocalTrace}
${MEDCoupling_medloader}
) )
# --- headers --- # --- headers ---
@ -72,6 +74,7 @@ SET(MEDWrapper_SOURCES
MED_Structures.cxx MED_Structures.cxx
MED_Utilities.cxx MED_Utilities.cxx
MED_Wrapper.cxx MED_Wrapper.cxx
MEDCoupling_Wrapper.cxx
) )
# --- rules --- # --- rules ---

View File

@ -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<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());
}

View File

@ -21,9 +21,7 @@
#include "MED_Wrapper.hxx" #include "MED_Wrapper.hxx"
#include "med.h" #include "MEDFileMesh.hxx"
#include <memory>
namespace MED namespace MED
{ {
@ -38,13 +36,9 @@ namespace MED
EMaillage theType = eNON_STRUCTURE, EMaillage theType = eNON_STRUCTURE,
const std::string& theDesc = ""); const std::string& theDesc = "");
//! Write the MEDWrapper MED Mesh representation into the MED file //! Write the MEDWrapper MED Mesh representation into the MED file
void void SetMeshInfo(const TMeshInfo& theInfo);
SetMeshInfo(const TMeshInfo& theInfo,
TErr* theErr = NULL);
//! Write a MEDWrapper MED Family representation into the MED file //! Write a MEDWrapper MED Family representation into the MED file
void void SetFamilyInfo(const TFamilyInfo& theInfo) { }
SetFamilyInfo(const TFamilyInfo& theInfo,
TErr* theErr = NULL);
//! Create a MEDWrapper MED Nodes representation //! Create a MEDWrapper MED Nodes representation
PNodeInfo PNodeInfo
CrNodeInfo(const PMeshInfo& theMeshInfo, CrNodeInfo(const PMeshInfo& theMeshInfo,
@ -54,15 +48,10 @@ namespace MED
EBooleen theIsElemNum = eVRAI, EBooleen theIsElemNum = eVRAI,
EBooleen theIsElemNames = eFAUX); EBooleen theIsElemNames = eFAUX);
//! Write the MEDWrapper MED Nodes representation into the MED file //! Write the MEDWrapper MED Nodes representation into the MED file
void void SetNodeInfo(const TNodeInfo& theInfo);
SetNodeInfo(const TNodeInfo& theInfo,
TErr* theErr = NULL);
//! Read a MEDWrapper MED Family representation by its numbers //! Read a MEDWrapper MED Family representation by its numbers
void void GetFamilyInfo(TInt theFamId, TFamilyInfo& theInfo);
GetFamilyInfo(TInt theFamId,
TFamilyInfo& theInfo,
TErr* theErr = NULL);
//! Create a MEDWrapper MED Family representation //! Create a MEDWrapper MED Family representation
PFamilyInfo PFamilyInfo
@ -72,7 +61,7 @@ namespace MED
const TStringSet& theGroupNames, const TStringSet& theGroupNames,
const TStringVector& theAttrDescs = TStringVector(), const TStringVector& theAttrDescs = TStringVector(),
const TIntVector& theAttrIds = TIntVector(), const TIntVector& theAttrIds = TIntVector(),
const TIntVector& theAttrVals = TIntVector()); const TIntVector& theAttrVals = TIntVector()) { }
//! Create a MEDWrapper MED Polygones representation //! Create a MEDWrapper MED Polygones representation
virtual virtual
@ -84,7 +73,7 @@ namespace MED
TInt theConnSize, TInt theConnSize,
EConnectivite theConnMode = eNOD, EConnectivite theConnMode = eNOD,
EBooleen theIsElemNum = eVRAI, EBooleen theIsElemNum = eVRAI,
EBooleen theIsElemNames = eVRAI); EBooleen theIsElemNames = eVRAI) { }
//! Create a MEDWrapper MED Polygones representation //! Create a MEDWrapper MED Polygones representation
virtual virtual
@ -97,18 +86,14 @@ namespace MED
EConnectivite theConnMode = eNOD, EConnectivite theConnMode = eNOD,
const TIntVector& theFamilyNums = TIntVector(), const TIntVector& theFamilyNums = TIntVector(),
const TIntVector& theElemNums = TIntVector(), const TIntVector& theElemNums = TIntVector(),
const TStringVector& theElemNames = TStringVector()); const TStringVector& theElemNames = TStringVector()) { }
//! Write a MEDWrapper MED Polygones representation into the MED file //! Write a MEDWrapper MED Polygones representation into the MED file
virtual void SetPolygoneInfo(const TPolygoneInfo& theInfo) { }
void
SetPolygoneInfo(const TPolygoneInfo& theInfo,
TErr* theErr = NULL);
//! Create a MEDWrapper MED Polyedres representation //! Create a MEDWrapper MED Polyedres representation
virtual
PPolyedreInfo PPolyedreInfo
CrPolyedreInfo(const PMeshInfo& theMeshInfo, CrPolyedreInfo(const PMeshInfo& theMeshInfo,
EEntiteMaillage theEntity, EEntiteMaillage theEntity,
@ -118,19 +103,15 @@ namespace MED
TInt theConnSize, TInt theConnSize,
EConnectivite theConnMode = eNOD, EConnectivite theConnMode = eNOD,
EBooleen theIsElemNum = eVRAI, EBooleen theIsElemNum = eVRAI,
EBooleen theIsElemNames = eVRAI); EBooleen theIsElemNames = eVRAI) { }
//! Write a MEDWrapper MED Polyedres representation into the MED file //! Write a MEDWrapper MED Polyedres representation into the MED file
virtual void SetPolyedreInfo(const TPolyedreInfo& theInfo) { }
void
SetPolyedreInfo(const TPolyedreInfo& theInfo,
TErr* theErr = NULL);
//! Create a MEDWrapper MED Balls representation //! Create a MEDWrapper MED Balls representation
/*! This feature is supported since version 3.0 */ /*! This feature is supported since version 3.0 */
virtual
PBallInfo PBallInfo
CrBallInfo(const PMeshInfo& theMeshInfo, CrBallInfo(const PMeshInfo& theMeshInfo,
TInt theNbBalls, TInt theNbBalls,
@ -138,10 +119,8 @@ namespace MED
//! Write a MEDWrapper representation of MED_BALL into the MED file //! Write a MEDWrapper representation of MED_BALL into the MED file
/*! This feature is supported since version 3.0 */ /*! This feature is supported since version 3.0 */
virtual
void void
SetBallInfo(const TBallInfo& theInfo, SetBallInfo(const TBallInfo& theInfo) { }
TErr* theErr = NULL);
//! Create a MEDWrapper MED Cells representation //! Create a MEDWrapper MED Cells representation
@ -157,11 +136,13 @@ namespace MED
EModeSwitch theMode = eFULL_INTERLACE); EModeSwitch theMode = eFULL_INTERLACE);
//! Write the MEDWrapper MED Cells representation into the MED file //! Write the MEDWrapper MED Cells representation into the MED file
virtual void SetCellInfo(const TCellInfo& theInfo) { }
void private:
SetCellInfo(const TCellInfo& theInfo, MEDCoupling::MCAuto<MEDCoupling::MEDFileUMesh> _mc_mesh;
TErr* theErr = NULL); MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> _coords;
std::string _mesh_name;
int _space_dim;
int _mesh_dim;
}; };
using MCPWrapper = std::shared_ptr<MCTWrapper>; using MCPWrapper = std::shared_ptr<MCTWrapper>;