From a5e541fb6ab923f57821ad319c5b9a68599dd69b Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Tue, 9 Oct 2018 16:06:32 +0200 Subject: [PATCH] Implementation of fake medfile methods --- src/MEDLoader/CMakeLists.txt | 1 + src/MEDLoader/MEDExt.cxx | 46 +++++++++++++++++++++++++++ src/MEDLoader/MEDExt.hxx | 31 ++++++++++++++++++ src/MEDLoader/MEDFileFieldMultiTS.cxx | 13 ++++++++ 4 files changed, 91 insertions(+) create mode 100644 src/MEDLoader/MEDExt.cxx create mode 100644 src/MEDLoader/MEDExt.hxx diff --git a/src/MEDLoader/CMakeLists.txt b/src/MEDLoader/CMakeLists.txt index b54b36b51..4d2787fbb 100644 --- a/src/MEDLoader/CMakeLists.txt +++ b/src/MEDLoader/CMakeLists.txt @@ -80,6 +80,7 @@ SET(medloader_SOURCES SauvMedConvertor.cxx SauvReader.cxx SauvWriter.cxx + MEDExt.cxx ) ADD_LIBRARY(medloader ${medloader_SOURCES}) diff --git a/src/MEDLoader/MEDExt.cxx b/src/MEDLoader/MEDExt.cxx new file mode 100644 index 000000000..81f609d7d --- /dev/null +++ b/src/MEDLoader/MEDExt.cxx @@ -0,0 +1,46 @@ +// Copyright (C) 2018 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 +// +// Author : Anthony Geay (EDF R&D) + +#include "MEDExt.hxx" + +med_int MEDfieldnEntityType(const med_idt fid, const char * const fieldname, const med_int numdt, const med_int numit) +{ + return 1; +} + +med_err MEDfieldEntityType(const med_idt fid, const char * const fieldname, const med_int numdt, const med_int numit, med_entity_type * const entitypes, med_int * const usedbyncs) +{ + entitypes[0]=MED_CELL; + *usedbyncs=1584; + return 0; +} + +med_int MEDfieldnGeotype(const med_idt fid, const char * const fieldname, const med_int numdt, const med_int numit, const med_entity_type entitype) +{ + return 1; +} + +med_err MEDfieldGeotype(const med_idt fid, const char * const fieldname, const med_int numdt, const med_int numit, const med_entity_type entitype, med_geometry_type *const geotypes, med_int * const usedbyncs) +{ + geotypes[0]=MED_QUAD4; + *usedbyncs=1584; + return 0; +} + diff --git a/src/MEDLoader/MEDExt.hxx b/src/MEDLoader/MEDExt.hxx new file mode 100644 index 000000000..f430d8768 --- /dev/null +++ b/src/MEDLoader/MEDExt.hxx @@ -0,0 +1,31 @@ +// Copyright (C) 2018 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 +// +// Author : Anthony Geay (EDF R&D) + +#include "med.h" + +constexpr med_int MED_ALL_NUMDT = 1999999999; + +med_int MEDfieldnEntityType(const med_idt fid, const char * const fieldname, const med_int numdt, const med_int numit); + +med_err MEDfieldEntityType(const med_idt fid, const char * const fieldname, const med_int numdt, const med_int numit, med_entity_type * const entitypes, med_int * const usedbyncs); + +med_int MEDfieldnGeotype(const med_idt fid, const char * const fieldname, const med_int numdt, const med_int numit, const med_entity_type entitype); + +med_err MEDfieldGeotype(const med_idt fid, const char * const fieldname, const med_int numdt, const med_int numit, const med_entity_type entitype, med_geometry_type *const geotypes, med_int * const usedbyncs); diff --git a/src/MEDLoader/MEDFileFieldMultiTS.cxx b/src/MEDLoader/MEDFileFieldMultiTS.cxx index 34dde39ad..7c3ba4d51 100644 --- a/src/MEDLoader/MEDFileFieldMultiTS.cxx +++ b/src/MEDLoader/MEDFileFieldMultiTS.cxx @@ -27,6 +27,8 @@ #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldTemplate.hxx" +#include "MEDExt.hxx" + #include using namespace MEDCoupling; @@ -484,6 +486,17 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope() void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively(med_idt fid, int nbPdt, med_field_type fieldTyp, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) { _time_steps.resize(nbPdt); + int nentitype(MEDfieldnEntityType(fid,_name.c_str(),MED_ALL_NUMDT,MED_ALL_NUMDT)); + INTERP_KERNEL::AutoPtr types(new med_entity_type[nentitype]); + med_int usedbyncs; + MEDFILESAFECALLERRD0(MEDfieldEntityType,(fid,_name.c_str(),MED_ALL_NUMDT,MED_ALL_NUMDT,types,&usedbyncs)); + for(int i=0;i geotypes(new med_geometry_type[ngeotype]); + med_int geousedbyncs; + MEDFILESAFECALLERRD0(MEDfieldGeotype,(fid,_name.c_str(),MED_ALL_NUMDT,MED_ALL_NUMDT,types[i],geotypes,&geousedbyncs)); + } for(int i=0;i > ts; -- 2.39.2