From: Anthony GEAY Date: Wed, 23 Sep 2020 18:59:20 +0000 (+0200) Subject: Management of int64 fields into medcoupling. X-Git-Tag: V9_6_0a1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f2ab61e92f55ee52cf5196f7904f625d93c8c2d0;p=tools%2Fmedcoupling.git Management of int64 fields into medcoupling. --- diff --git a/src/MEDCoupling/CMakeLists.txt b/src/MEDCoupling/CMakeLists.txt index b5783acad..c039ca030 100644 --- a/src/MEDCoupling/CMakeLists.txt +++ b/src/MEDCoupling/CMakeLists.txt @@ -43,7 +43,8 @@ SET(medcoupling_SOURCES MEDCouplingField.cxx MEDCouplingFieldFloat.cxx MEDCouplingFieldDouble.cxx - MEDCouplingFieldInt.cxx + MEDCouplingFieldInt32.cxx + MEDCouplingFieldInt64.cxx MEDCouplingUMesh.cxx MEDCouplingUMesh_internal.cxx MEDCouplingUMesh_intersection.cxx diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx index 260b101d2..8ffea53bf 100755 --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -21,7 +21,7 @@ #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingFieldT.txx" -#include "MEDCouplingFieldInt.hxx" +#include "MEDCouplingFieldInt32.hxx" #include "MEDCouplingFieldFloat.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingTimeDiscretization.hxx" @@ -470,7 +470,7 @@ typename Traits::FieldType *ConvertToUField(const MEDCouplingFieldDouble *sel return ret.retn(); } -MEDCouplingFieldInt *MEDCouplingFieldDouble::convertToIntField() const +MEDCouplingFieldInt32 *MEDCouplingFieldDouble::convertToIntField() const { return ConvertToUField(this); } diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.hxx b/src/MEDCoupling/MEDCouplingFieldDouble.hxx index bd2c67391..e37db6428 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.hxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.hxx @@ -28,7 +28,7 @@ namespace MEDCoupling { class Voronizer; - class MEDCouplingFieldInt; + class MEDCouplingFieldInt32; class MEDCouplingFieldTemplate; class MEDCouplingFieldDouble : public MEDCouplingFieldT @@ -49,7 +49,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *nodeToCellDiscretization() const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *cellToNodeDiscretization() const; - MEDCOUPLING_EXPORT MEDCouplingFieldInt *convertToIntField() const; + MEDCOUPLING_EXPORT MEDCouplingFieldInt32 *convertToIntField() const; MEDCOUPLING_EXPORT MEDCouplingFieldFloat *convertToFloatField() const; MEDCOUPLING_EXPORT double getIJK(mcIdType cellId, int nodeIdInCell, int compoId) const; MEDCOUPLING_EXPORT double accumulate(int compId) const; diff --git a/src/MEDCoupling/MEDCouplingFieldInt.cxx b/src/MEDCoupling/MEDCouplingFieldInt.cxx deleted file mode 100644 index 8c5847440..000000000 --- a/src/MEDCoupling/MEDCouplingFieldInt.cxx +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2007-2020 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 : Yann Pora (EDF R&D) - -#include "MEDCouplingFieldInt.hxx" -#include "MEDCouplingFieldT.txx" -#include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingFieldTemplate.hxx" -#include "MEDCouplingMesh.hxx" -#include "MEDCouplingMemArray.txx" - -using namespace MEDCoupling; - -template class MEDCoupling::MEDCouplingFieldT; - -MEDCouplingFieldInt *MEDCouplingFieldInt::New(TypeOfField type, TypeOfTimeDiscretization td) -{ - return new MEDCouplingFieldInt(type,td); -} - -MEDCouplingFieldInt *MEDCouplingFieldInt::New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td) -{ - return new MEDCouplingFieldInt(ft,td); -} - -MEDCouplingFieldInt::MEDCouplingFieldInt(TypeOfField type, TypeOfTimeDiscretization td):MEDCouplingFieldT(type,MEDCouplingTimeDiscretizationInt::New(td)) -{ -} - -MEDCouplingFieldInt::MEDCouplingFieldInt(const MEDCouplingFieldInt& other, bool deepCpy):MEDCouplingFieldT(other,deepCpy) -{ -} - -MEDCouplingFieldInt::MEDCouplingFieldInt(NatureOfField n, MEDCouplingTimeDiscretizationInt *td, MEDCouplingFieldDiscretization *type):MEDCouplingFieldT(type,n,td) -{ -} - -/*! - * ** WARINING : This method do not deeply copy neither mesh nor spatial discretization. Only a shallow copy (reference) is done for mesh and spatial discretization ! ** - */ -MEDCouplingFieldInt::MEDCouplingFieldInt(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td):MEDCouplingFieldT(ft,MEDCouplingTimeDiscretizationInt::New(td),false) -{ -} - -MEDCouplingFieldInt *MEDCouplingFieldInt::deepCopy() const -{ - return cloneWithMesh(true); -} - -MEDCouplingFieldInt *MEDCouplingFieldInt::clone(bool recDeepCpy) const -{ - return new MEDCouplingFieldInt(*this,recDeepCpy); -} - -MEDCouplingFieldDouble *MEDCouplingFieldInt::convertToDblField() const -{ - MCAuto tmp(MEDCouplingFieldTemplate::New(*this)); - int t1,t2; - double t0(getTime(t1,t2)); - MCAuto ret(MEDCouplingFieldDouble::New(*tmp,getTimeDiscretization())); - ret->setTime(t0,t1,t2); - if(getArray()) - { - MCAuto arr(getArray()->convertToDblArr()); - ret->setArray(arr); - } - return ret.retn(); -} diff --git a/src/MEDCoupling/MEDCouplingFieldInt.hxx b/src/MEDCoupling/MEDCouplingFieldInt.hxx index 46f6df53c..ff8443e41 100644 --- a/src/MEDCoupling/MEDCouplingFieldInt.hxx +++ b/src/MEDCoupling/MEDCouplingFieldInt.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2020 CEA/DEN, EDF R&D +// Copyright (C) 2020 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 @@ -16,38 +16,13 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// Author : Yann Pora (EDF R&D) +// Author : Anthony Geay (EDF R&D) -#ifndef __MEDCOUPLINGFIELDINT_HXX__ -#define __MEDCOUPLINGFIELDINT_HXX__ +#pragma once -#include "MEDCoupling.hxx" -#include "MEDCouplingFieldT.hxx" -#include "MEDCouplingMemArray.hxx" - -#include +#include "MEDCouplingFieldInt32.hxx" namespace MEDCoupling { - class MEDCouplingFieldDouble; - class MEDCouplingFieldTemplate; - - class MEDCouplingFieldInt : public MEDCouplingFieldT - { - public: - MEDCOUPLING_EXPORT static MEDCouplingFieldInt *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME); - MEDCOUPLING_EXPORT static MEDCouplingFieldInt *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME); - MEDCOUPLING_EXPORT MEDCouplingFieldInt *deepCopy() const; - MEDCOUPLING_EXPORT MEDCouplingFieldInt *clone(bool recDeepCpy) const; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *convertToDblField() const; - MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldInt"); } - protected: - MEDCouplingFieldInt(TypeOfField type, TypeOfTimeDiscretization td); - MEDCouplingFieldInt(const MEDCouplingFieldInt& other, bool deepCopy); - MEDCouplingFieldInt(NatureOfField n, MEDCouplingTimeDiscretizationInt *td, MEDCouplingFieldDiscretization *type); - MEDCouplingFieldInt(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td); - ~MEDCouplingFieldInt() { } - }; + using MEDCouplingFieldInt = MEDCouplingFieldInt32; } - -#endif diff --git a/src/MEDCoupling/MEDCouplingFieldInt32.cxx b/src/MEDCoupling/MEDCouplingFieldInt32.cxx new file mode 100644 index 000000000..06f72baa8 --- /dev/null +++ b/src/MEDCoupling/MEDCouplingFieldInt32.cxx @@ -0,0 +1,84 @@ +// Copyright (C) 2007-2020 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 : Yann Pora (EDF R&D) + +#include "MEDCouplingFieldInt32.hxx" +#include "MEDCouplingFieldT.txx" +#include "MEDCouplingFieldDouble.hxx" +#include "MEDCouplingFieldTemplate.hxx" +#include "MEDCouplingMesh.hxx" +#include "MEDCouplingMemArray.txx" + +using namespace MEDCoupling; + +template class MEDCoupling::MEDCouplingFieldT; + +MEDCouplingFieldInt32 *MEDCouplingFieldInt32::New(TypeOfField type, TypeOfTimeDiscretization td) +{ + return new MEDCouplingFieldInt32(type,td); +} + +MEDCouplingFieldInt32 *MEDCouplingFieldInt32::New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td) +{ + return new MEDCouplingFieldInt32(ft,td); +} + +MEDCouplingFieldInt32::MEDCouplingFieldInt32(TypeOfField type, TypeOfTimeDiscretization td):MEDCouplingFieldT(type,MEDCouplingTimeDiscretizationInt32::New(td)) +{ +} + +MEDCouplingFieldInt32::MEDCouplingFieldInt32(const MEDCouplingFieldInt32& other, bool deepCpy):MEDCouplingFieldT(other,deepCpy) +{ +} + +MEDCouplingFieldInt32::MEDCouplingFieldInt32(NatureOfField n, MEDCouplingTimeDiscretizationInt32 *td, MEDCouplingFieldDiscretization *type):MEDCouplingFieldT(type,n,td) +{ +} + +/*! + * ** WARINING : This method do not deeply copy neither mesh nor spatial discretization. Only a shallow copy (reference) is done for mesh and spatial discretization ! ** + */ +MEDCouplingFieldInt32::MEDCouplingFieldInt32(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td):MEDCouplingFieldT(ft,MEDCouplingTimeDiscretizationInt32::New(td),false) +{ +} + +MEDCouplingFieldInt32 *MEDCouplingFieldInt32::deepCopy() const +{ + return cloneWithMesh(true); +} + +MEDCouplingFieldInt32 *MEDCouplingFieldInt32::clone(bool recDeepCpy) const +{ + return new MEDCouplingFieldInt32(*this,recDeepCpy); +} + +MEDCouplingFieldDouble *MEDCouplingFieldInt32::convertToDblField() const +{ + MCAuto tmp(MEDCouplingFieldTemplate::New(*this)); + int t1,t2; + double t0(getTime(t1,t2)); + MCAuto ret(MEDCouplingFieldDouble::New(*tmp,getTimeDiscretization())); + ret->setTime(t0,t1,t2); + if(getArray()) + { + MCAuto arr(getArray()->convertToDblArr()); + ret->setArray(arr); + } + return ret.retn(); +} diff --git a/src/MEDCoupling/MEDCouplingFieldInt32.hxx b/src/MEDCoupling/MEDCouplingFieldInt32.hxx new file mode 100644 index 000000000..5244bcdc6 --- /dev/null +++ b/src/MEDCoupling/MEDCouplingFieldInt32.hxx @@ -0,0 +1,50 @@ +// Copyright (C) 2007-2020 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 : Yann Pora (EDF R&D) + +#pragma once + +#include "MEDCoupling.hxx" +#include "MEDCouplingFieldT.hxx" +#include "MEDCouplingMemArray.hxx" + +#include + +namespace MEDCoupling +{ + class MEDCouplingFieldDouble; + class MEDCouplingFieldTemplate; + + class MEDCouplingFieldInt32 : public MEDCouplingFieldT + { + public: + MEDCOUPLING_EXPORT static MEDCouplingFieldInt32 *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME); + MEDCOUPLING_EXPORT static MEDCouplingFieldInt32 *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME); + MEDCOUPLING_EXPORT MEDCouplingFieldInt32 *deepCopy() const; + MEDCOUPLING_EXPORT MEDCouplingFieldInt32 *clone(bool recDeepCpy) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *convertToDblField() const; + MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldInt32"); } + protected: + MEDCouplingFieldInt32(TypeOfField type, TypeOfTimeDiscretization td); + MEDCouplingFieldInt32(const MEDCouplingFieldInt32& other, bool deepCopy); + MEDCouplingFieldInt32(NatureOfField n, MEDCouplingTimeDiscretizationInt32 *td, MEDCouplingFieldDiscretization *type); + MEDCouplingFieldInt32(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td); + ~MEDCouplingFieldInt32() { } + }; +} diff --git a/src/MEDCoupling/MEDCouplingFieldInt64.cxx b/src/MEDCoupling/MEDCouplingFieldInt64.cxx new file mode 100644 index 000000000..880d45a56 --- /dev/null +++ b/src/MEDCoupling/MEDCouplingFieldInt64.cxx @@ -0,0 +1,84 @@ +// Copyright (C) 2020 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 "MEDCouplingFieldInt64.hxx" +#include "MEDCouplingFieldT.txx" +#include "MEDCouplingFieldDouble.hxx" +#include "MEDCouplingFieldTemplate.hxx" +#include "MEDCouplingMesh.hxx" +#include "MEDCouplingMemArray.txx" + +using namespace MEDCoupling; + +template class MEDCoupling::MEDCouplingFieldT; + +MEDCouplingFieldInt64 *MEDCouplingFieldInt64::New(TypeOfField type, TypeOfTimeDiscretization td) +{ + return new MEDCouplingFieldInt64(type,td); +} + +MEDCouplingFieldInt64 *MEDCouplingFieldInt64::New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td) +{ + return new MEDCouplingFieldInt64(ft,td); +} + +MEDCouplingFieldInt64::MEDCouplingFieldInt64(TypeOfField type, TypeOfTimeDiscretization td):MEDCouplingFieldT(type,MEDCouplingTimeDiscretizationInt64::New(td)) +{ +} + +MEDCouplingFieldInt64::MEDCouplingFieldInt64(const MEDCouplingFieldInt64& other, bool deepCpy):MEDCouplingFieldT(other,deepCpy) +{ +} + +MEDCouplingFieldInt64::MEDCouplingFieldInt64(NatureOfField n, MEDCouplingTimeDiscretizationInt64 *td, MEDCouplingFieldDiscretization *type):MEDCouplingFieldT(type,n,td) +{ +} + +/*! + * ** WARINING : This method do not deeply copy neither mesh nor spatial discretization. Only a shallow copy (reference) is done for mesh and spatial discretization ! ** + */ +MEDCouplingFieldInt64::MEDCouplingFieldInt64(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td):MEDCouplingFieldT(ft,MEDCouplingTimeDiscretizationInt64::New(td),false) +{ +} + +MEDCouplingFieldInt64 *MEDCouplingFieldInt64::deepCopy() const +{ + return cloneWithMesh(true); +} + +MEDCouplingFieldInt64 *MEDCouplingFieldInt64::clone(bool recDeepCpy) const +{ + return new MEDCouplingFieldInt64(*this,recDeepCpy); +} + +MEDCouplingFieldDouble *MEDCouplingFieldInt64::convertToDblField() const +{ + MCAuto tmp(MEDCouplingFieldTemplate::New(*this)); + int t1,t2; + double t0(getTime(t1,t2)); + MCAuto ret(MEDCouplingFieldDouble::New(*tmp,getTimeDiscretization())); + ret->setTime(t0,t1,t2); + if(getArray()) + { + MCAuto arr(getArray()->convertToDblArr()); + ret->setArray(arr); + } + return ret.retn(); +} diff --git a/src/MEDCoupling/MEDCouplingFieldInt64.hxx b/src/MEDCoupling/MEDCouplingFieldInt64.hxx new file mode 100644 index 000000000..6aa59a05f --- /dev/null +++ b/src/MEDCoupling/MEDCouplingFieldInt64.hxx @@ -0,0 +1,50 @@ +// Copyright (C) 2020 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) + +#pragma once + +#include "MEDCoupling.hxx" +#include "MEDCouplingFieldT.hxx" +#include "MEDCouplingMemArray.hxx" + +#include + +namespace MEDCoupling +{ + class MEDCouplingFieldDouble; + class MEDCouplingFieldTemplate; + + class MEDCouplingFieldInt64 : public MEDCouplingFieldT + { + public: + MEDCOUPLING_EXPORT static MEDCouplingFieldInt64 *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME); + MEDCOUPLING_EXPORT static MEDCouplingFieldInt64 *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME); + MEDCOUPLING_EXPORT MEDCouplingFieldInt64 *deepCopy() const; + MEDCOUPLING_EXPORT MEDCouplingFieldInt64 *clone(bool recDeepCpy) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *convertToDblField() const; + MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldInt64"); } + protected: + MEDCouplingFieldInt64(TypeOfField type, TypeOfTimeDiscretization td); + MEDCouplingFieldInt64(const MEDCouplingFieldInt64& other, bool deepCopy); + MEDCouplingFieldInt64(NatureOfField n, MEDCouplingTimeDiscretizationInt64 *td, MEDCouplingFieldDiscretization *type); + MEDCouplingFieldInt64(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td); + ~MEDCouplingFieldInt64() { } + }; +} diff --git a/src/MEDCoupling/MEDCouplingFieldT.hxx b/src/MEDCoupling/MEDCouplingFieldT.hxx index 1110337fd..376f55b3c 100644 --- a/src/MEDCoupling/MEDCouplingFieldT.hxx +++ b/src/MEDCoupling/MEDCouplingFieldT.hxx @@ -18,8 +18,7 @@ // // Author : Anthony Geay (EDF R&D) -#ifndef __MEDCOUPLINGFIELDT_HXX__ -#define __MEDCOUPLINGFIELDT_HXX__ +#pragma once #include "MEDCouplingField.hxx" #include "MEDCouplingTraits.hxx" @@ -105,5 +104,3 @@ namespace MEDCoupling MEDCouplingTimeDiscretizationTemplate *_time_discr; }; } - -#endif diff --git a/src/MEDCoupling/MEDCouplingFieldTemplate.cxx b/src/MEDCoupling/MEDCouplingFieldTemplate.cxx index 4c10da495..671ad54f3 100644 --- a/src/MEDCoupling/MEDCouplingFieldTemplate.cxx +++ b/src/MEDCoupling/MEDCouplingFieldTemplate.cxx @@ -16,11 +16,12 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// Author : Anthony Geay (CEA/DEN) +// Author : Anthony Geay (EDF R&D) #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingMesh.hxx" -#include "MEDCouplingFieldInt.hxx" +#include "MEDCouplingFieldInt32.hxx" +#include "MEDCouplingFieldInt64.hxx" #include "MEDCouplingFieldFloat.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldDiscretization.hxx" @@ -39,7 +40,12 @@ MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::New(const MEDCouplingFieldFl return new MEDCouplingFieldTemplate(f,true); } -MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::New(const MEDCouplingFieldInt& f) +MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::New(const MEDCouplingFieldInt32& f) +{ + return new MEDCouplingFieldTemplate(f,true); +} + +MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::New(const MEDCouplingFieldInt64& f) { return new MEDCouplingFieldTemplate(f,true); } @@ -54,7 +60,12 @@ MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::NewWithoutCheck(const MEDCou return new MEDCouplingFieldTemplate(f,false); } -MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::NewWithoutCheck(const MEDCouplingFieldInt& f) +MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::NewWithoutCheck(const MEDCouplingFieldInt32& f) +{ + return new MEDCouplingFieldTemplate(f,false); +} + +MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::NewWithoutCheck(const MEDCouplingFieldInt64& f) { return new MEDCouplingFieldTemplate(f,false); } @@ -97,7 +108,14 @@ MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& checkConsistencyLight(); } -MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f, bool isChecked):MEDCouplingField(f,false) +MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldInt32& f, bool isChecked):MEDCouplingField(f,false) +{ + forceTimeOfThis(f); + if(isChecked) + checkConsistencyLight(); +} + +MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldInt64& f, bool isChecked):MEDCouplingField(f,false) { forceTimeOfThis(f); if(isChecked) diff --git a/src/MEDCoupling/MEDCouplingFieldTemplate.hxx b/src/MEDCoupling/MEDCouplingFieldTemplate.hxx index 118e1dab1..3361fd906 100644 --- a/src/MEDCoupling/MEDCouplingFieldTemplate.hxx +++ b/src/MEDCoupling/MEDCouplingFieldTemplate.hxx @@ -18,14 +18,14 @@ // // Author : Anthony Geay (EDF R&D) -#ifndef __PARAMEDMEM_MEDCOUPLINGFIELDTEMPLATE_HXX__ -#define __PARAMEDMEM_MEDCOUPLINGFIELDTEMPLATE_HXX__ +#pragma once #include "MEDCouplingField.hxx" namespace MEDCoupling { - class MEDCouplingFieldInt; + class MEDCouplingFieldInt32; + class MEDCouplingFieldInt64; class MEDCouplingFieldFloat; class MEDCouplingFieldDouble; /*! @@ -43,11 +43,13 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f); MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f); - MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt& f); + MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt32& f); + MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt64& f); MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *New(TypeOfField type); MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *NewWithoutCheck(const MEDCouplingFieldDouble& f); MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *NewWithoutCheck(const MEDCouplingFieldFloat& f); - MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *NewWithoutCheck(const MEDCouplingFieldInt& f); + MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *NewWithoutCheck(const MEDCouplingFieldInt32& f); + MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *NewWithoutCheck(const MEDCouplingFieldInt64& f); MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingFieldTemplate"); } MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldTemplate *other, double meshPrec, std::string& reason) const; MEDCOUPLING_EXPORT bool isEqual(const MEDCouplingFieldTemplate *other, double meshPrec) const; @@ -68,10 +70,9 @@ namespace MEDCoupling private: MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f, bool isChecked=true); MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f, bool isChecked=true); - MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f, bool isChecked=true); + MEDCouplingFieldTemplate(const MEDCouplingFieldInt32& f, bool isChecked=true); + MEDCouplingFieldTemplate(const MEDCouplingFieldInt64& f, bool isChecked=true); MEDCouplingFieldTemplate(TypeOfField type); MEDCouplingFieldTemplate(const MEDCouplingFieldTemplate& other, bool deepCopy); }; } - -#endif diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx index 6d19818f2..873193aba 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx @@ -694,27 +694,27 @@ void MEDCouplingTimeKeeper::checkTimePresence(double time, double eps) const //////////////////////// -MEDCouplingTimeDiscretizationInt::MEDCouplingTimeDiscretizationInt(const MEDCouplingTimeDiscretizationInt& other, bool deepCopy):MEDCouplingTimeDiscretizationSimple(other,deepCopy) +MEDCouplingTimeDiscretizationInt32::MEDCouplingTimeDiscretizationInt32(const MEDCouplingTimeDiscretizationInt32& other, bool deepCopy):MEDCouplingTimeDiscretizationSimple(other,deepCopy) { } -MEDCouplingTimeDiscretizationInt *MEDCouplingTimeDiscretizationInt::performCopyOrIncrRef(bool deepCopy) const +MEDCouplingTimeDiscretizationInt32 *MEDCouplingTimeDiscretizationInt32::performCopyOrIncrRef(bool deepCopy) const { - return new MEDCouplingTimeDiscretizationInt(*this,deepCopy); + return new MEDCouplingTimeDiscretizationInt32(*this,deepCopy); } -MEDCouplingTimeDiscretizationInt *MEDCouplingTimeDiscretizationInt::New(TypeOfTimeDiscretization type) +MEDCouplingTimeDiscretizationInt32 *MEDCouplingTimeDiscretizationInt32::New(TypeOfTimeDiscretization type) { switch(type) { - case MEDCouplingTimeDiscretizationInt::DISCRETIZATION: - return new MEDCouplingTimeDiscretizationInt; + case MEDCouplingTimeDiscretizationInt32::DISCRETIZATION: + return new MEDCouplingTimeDiscretizationInt32; default: throw INTERP_KERNEL::Exception("Time discretization not implemented yet for integers !"); } } -bool MEDCouplingTimeDiscretizationInt::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, int prec, std::string& reason) const +bool MEDCouplingTimeDiscretizationInt32::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, Int32 prec, std::string& reason) const { if(prec!=0) throw INTERP_KERNEL::Exception("isEqualIfNotWhy : only precision equal to 0 supported for int !"); @@ -723,10 +723,10 @@ bool MEDCouplingTimeDiscretizationInt::isEqualIfNotWhy(const MEDCouplingTimeDisc reason="Time discretization is NULL."; return false; } - const MEDCouplingTimeDiscretizationInt *otherC(dynamic_cast(other)); + const MEDCouplingTimeDiscretizationInt32 *otherC(dynamic_cast(other)); if(!otherC) - throw INTERP_KERNEL::Exception("isEqualIfNotWhy : other is not a MEDCouplingTimeDiscretizationInt !"); - if(!MEDCouplingTimeDiscretizationTemplate::areStrictlyCompatible(other,reason)) + throw INTERP_KERNEL::Exception("isEqualIfNotWhy : other is not a MEDCouplingTimeDiscretizationInt32 !"); + if(!MEDCouplingTimeDiscretizationTemplate::areStrictlyCompatible(other,reason)) return false; if(!_tk.isEqualIfNotWhy(otherC->_tk,_time_tolerance,reason)) return false; @@ -735,11 +735,72 @@ bool MEDCouplingTimeDiscretizationInt::isEqualIfNotWhy(const MEDCouplingTimeDisc return _array->isEqualIfNotWhy(*other->getArray(),reason); } -bool MEDCouplingTimeDiscretizationInt::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, int prec) const +bool MEDCouplingTimeDiscretizationInt32::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, Int32 prec) const { if(prec!=0) - throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretizationInt::isEqualWithoutConsideringStr : only precision 0 is supported !"); - const MEDCouplingTimeDiscretizationInt *otherC(dynamic_cast(other)); + throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretizationInt32::isEqualWithoutConsideringStr : only precision 0 is supported !"); + const MEDCouplingTimeDiscretizationInt32 *otherC(dynamic_cast(other)); + if(!otherC) + throw INTERP_KERNEL::Exception("isEqualWithoutConsideringStr : other is not a MEDCouplingTimeDiscretizationInt !"); + std::string tmp; + if(!areStrictlyCompatible(other,tmp)) + return false; + std::string reason; + if(!_tk.isEqualIfNotWhy(otherC->_tk,_time_tolerance,reason)) + return false; + if(_array==other->getArray()) + return true; + return _array->isEqualWithoutConsideringStr(*(other->getArray())); +} + +//////////////////////// + +MEDCouplingTimeDiscretizationInt64::MEDCouplingTimeDiscretizationInt64(const MEDCouplingTimeDiscretizationInt64& other, bool deepCopy):MEDCouplingTimeDiscretizationSimple(other,deepCopy) +{ +} + +MEDCouplingTimeDiscretizationInt64 *MEDCouplingTimeDiscretizationInt64::performCopyOrIncrRef(bool deepCopy) const +{ + return new MEDCouplingTimeDiscretizationInt64(*this,deepCopy); +} + +MEDCouplingTimeDiscretizationInt64 *MEDCouplingTimeDiscretizationInt64::New(TypeOfTimeDiscretization type) +{ + switch(type) + { + case MEDCouplingTimeDiscretizationInt64::DISCRETIZATION: + return new MEDCouplingTimeDiscretizationInt64; + default: + throw INTERP_KERNEL::Exception("Time discretization not implemented yet for integers !"); + } +} + +bool MEDCouplingTimeDiscretizationInt64::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, Int64 prec, std::string& reason) const +{ + if(prec!=0) + throw INTERP_KERNEL::Exception("isEqualIfNotWhy : only precision equal to 0 supported for int !"); + if(!other) + { + reason="Time discretization is NULL."; + return false; + } + const MEDCouplingTimeDiscretizationInt64 *otherC(dynamic_cast(other)); + if(!otherC) + throw INTERP_KERNEL::Exception("isEqualIfNotWhy : other is not a MEDCouplingTimeDiscretizationInt64 !"); + if(!MEDCouplingTimeDiscretizationTemplate::areStrictlyCompatible(other,reason)) + return false; + if(!_tk.isEqualIfNotWhy(otherC->_tk,_time_tolerance,reason)) + return false; + if(_array==other->getArray()) + return true; + return _array->isEqualIfNotWhy(*other->getArray(),reason); +} + +bool MEDCouplingTimeDiscretizationInt64::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, Int64 prec) const +{ + if(prec!=0) + throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretizationInt64::isEqualWithoutConsideringStr : only precision 0 is supported !"); + const MEDCouplingTimeDiscretizationInt64 *otherC(dynamic_cast(other)); if(!otherC) throw INTERP_KERNEL::Exception("isEqualWithoutConsideringStr : other is not a MEDCouplingTimeDiscretizationInt !"); std::string tmp; diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx index 21ca1b23a..480ac7d78 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx @@ -238,16 +238,28 @@ namespace MEDCoupling static const TypeOfTimeDiscretization DISCRETIZATION=ONE_TIME; }; - class MEDCouplingTimeDiscretizationInt : public MEDCouplingTimeDiscretizationSimple + class MEDCouplingTimeDiscretizationInt32 : public MEDCouplingTimeDiscretizationSimple { public: - MEDCouplingTimeDiscretizationInt() { } - std::string getClassName() const override { return std::string("MEDCouplingTimeDiscretizationInt"); } - MEDCouplingTimeDiscretizationInt(const MEDCouplingTimeDiscretizationInt& other, bool deepCopy); - static MEDCouplingTimeDiscretizationInt *New(TypeOfTimeDiscretization type); - MEDCouplingTimeDiscretizationInt *performCopyOrIncrRef(bool deepCopy) const; - bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, int prec, std::string& reason) const; - bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, int prec) const; + MEDCouplingTimeDiscretizationInt32() { } + std::string getClassName() const override { return std::string("MEDCouplingTimeDiscretizationInt32"); } + MEDCouplingTimeDiscretizationInt32(const MEDCouplingTimeDiscretizationInt32& other, bool deepCopy); + static MEDCouplingTimeDiscretizationInt32 *New(TypeOfTimeDiscretization type); + MEDCouplingTimeDiscretizationInt32 *performCopyOrIncrRef(bool deepCopy) const; + bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, Int32 prec, std::string& reason) const; + bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, Int32 prec) const; + }; + + class MEDCouplingTimeDiscretizationInt64 : public MEDCouplingTimeDiscretizationSimple + { + public: + MEDCouplingTimeDiscretizationInt64() { } + std::string getClassName() const override { return std::string("MEDCouplingTimeDiscretizationInt64"); } + MEDCouplingTimeDiscretizationInt64(const MEDCouplingTimeDiscretizationInt64& other, bool deepCopy); + static MEDCouplingTimeDiscretizationInt64 *New(TypeOfTimeDiscretization type); + MEDCouplingTimeDiscretizationInt64 *performCopyOrIncrRef(bool deepCopy) const; + bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate *other, Int64 prec, std::string& reason) const override; + bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate *other, Int64 prec) const override; }; class MEDCouplingTimeDiscretizationFloat : public MEDCouplingTimeDiscretizationSimple diff --git a/src/MEDCoupling/MEDCouplingTraits.hxx b/src/MEDCoupling/MEDCouplingTraits.hxx index 806c58efa..313e2db71 100644 --- a/src/MEDCoupling/MEDCouplingTraits.hxx +++ b/src/MEDCoupling/MEDCouplingTraits.hxx @@ -18,8 +18,7 @@ // // Author : Anthony Geay (EDF R&D) -#ifndef __MEDCOUPLINGTRAITS_HXX__ -#define __MEDCOUPLINGTRAITS_HXX__ +#pragma once #include "MEDCoupling.hxx" #include "MCType.hxx" @@ -41,7 +40,8 @@ namespace MEDCoupling class DataArrayInt64; class MEDCouplingFieldDouble; class MEDCouplingFieldFloat; - class MEDCouplingFieldInt; + class MEDCouplingFieldInt32; + class MEDCouplingFieldInt64; class DataArrayInt32Tuple; class DataArrayInt64Tuple; class DataArrayFloatTuple; @@ -87,7 +87,7 @@ namespace MEDCoupling static const char VTKReprStr[]; using ArrayType = DataArrayInt32; using ArrayTypeCh = DataArrayInt32; - using FieldType = MEDCouplingFieldInt; + using FieldType = MEDCouplingFieldInt32; using ArrayTuple = DataArrayInt32Tuple; using IteratorType = DataArrayInt32Iterator; }; @@ -102,7 +102,7 @@ namespace MEDCoupling static const char VTKReprStr[]; using ArrayType = DataArrayInt64; using ArrayTypeCh = DataArrayInt64; - //using FieldType = MEDCouplingFieldInt64; + using FieldType = MEDCouplingFieldInt64; using ArrayTuple = DataArrayInt64Tuple; using IteratorType = DataArrayInt64Iterator; }; @@ -117,5 +117,3 @@ namespace MEDCoupling using IteratorType = DataArrayByteIterator; }; } - -#endif diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 38f2d0f3c..b6d35cfe6 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -37,7 +37,8 @@ #include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingField.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingFieldInt.hxx" +#include "MEDCouplingFieldInt32.hxx" +#include "MEDCouplingFieldInt64.hxx" #include "MEDCouplingFieldFloat.hxx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingGaussLocalization.hxx" @@ -270,15 +271,24 @@ typedef long int mcIdType; %newobject MEDCoupling::MEDCouplingFieldDouble::cellToNodeDiscretization; %newobject MEDCoupling::MEDCouplingFieldDouble::getValueOnMulti; %newobject MEDCoupling::MEDCouplingFieldDouble::computeVectorFieldCyl; -%newobject MEDCoupling::MEDCouplingFieldInt::New; -%newobject MEDCoupling::MEDCouplingFieldInt::convertToDblField; -%newobject MEDCoupling::MEDCouplingFieldInt::getArray; -%newobject MEDCoupling::MEDCouplingFieldInt::deepCopy; -%newobject MEDCoupling::MEDCouplingFieldInt::clone; -%newobject MEDCoupling::MEDCouplingFieldInt::cloneWithMesh; -%newobject MEDCoupling::MEDCouplingFieldInt::buildSubPart; -%newobject MEDCoupling::MEDCouplingFieldInt::buildSubPartRange; -%newobject MEDCoupling::MEDCouplingFieldInt::__getitem__; +%newobject MEDCoupling::MEDCouplingFieldInt32::New; +%newobject MEDCoupling::MEDCouplingFieldInt32::convertToDblField; +%newobject MEDCoupling::MEDCouplingFieldInt32::getArray; +%newobject MEDCoupling::MEDCouplingFieldInt32::deepCopy; +%newobject MEDCoupling::MEDCouplingFieldInt32::clone; +%newobject MEDCoupling::MEDCouplingFieldInt32::cloneWithMesh; +%newobject MEDCoupling::MEDCouplingFieldInt32::buildSubPart; +%newobject MEDCoupling::MEDCouplingFieldInt32::buildSubPartRange; +%newobject MEDCoupling::MEDCouplingFieldInt32::__getitem__; +%newobject MEDCoupling::MEDCouplingFieldInt64::New; +%newobject MEDCoupling::MEDCouplingFieldInt64::convertToDblField; +%newobject MEDCoupling::MEDCouplingFieldInt64::getArray; +%newobject MEDCoupling::MEDCouplingFieldInt64::deepCopy; +%newobject MEDCoupling::MEDCouplingFieldInt64::clone; +%newobject MEDCoupling::MEDCouplingFieldInt64::cloneWithMesh; +%newobject MEDCoupling::MEDCouplingFieldInt64::buildSubPart; +%newobject MEDCoupling::MEDCouplingFieldInt64::buildSubPartRange; +%newobject MEDCoupling::MEDCouplingFieldInt64::__getitem__; %newobject MEDCoupling::MEDCouplingFieldFloat::New; %newobject MEDCoupling::MEDCouplingFieldFloat::convertToDblField; %newobject MEDCoupling::MEDCouplingFieldFloat::getArray; @@ -489,7 +499,8 @@ typedef long int mcIdType; %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();" %feature("unref") MEDCouplingFieldDouble "$this->decrRef();" %feature("unref") MEDCouplingFieldFloat "$this->decrRef();" -%feature("unref") MEDCouplingFieldInt "$this->decrRef();" +%feature("unref") MEDCouplingFieldInt32 "$this->decrRef();" +%feature("unref") MEDCouplingFieldInt64 "$this->decrRef();" %feature("unref") MEDCouplingMultiFields "$this->decrRef();" %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();" %feature("unref") MEDCouplingMultiFields "$this->decrRef();" @@ -3885,7 +3896,8 @@ namespace MEDCoupling public: static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f); static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f); - static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt& f); + static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt32& f); + static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt64& f); static MEDCouplingFieldTemplate *New(TypeOfField type); std::string simpleRepr() const; std::string advancedRepr() const; @@ -3903,7 +3915,12 @@ namespace MEDCoupling return MEDCouplingFieldTemplate::New(f); } - MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f) + MEDCouplingFieldTemplate(const MEDCouplingFieldInt32& f) + { + return MEDCouplingFieldTemplate::New(f); + } + + MEDCouplingFieldTemplate(const MEDCouplingFieldInt64& f) { return MEDCouplingFieldTemplate::New(f); } @@ -3953,7 +3970,8 @@ namespace MEDCoupling %template(MEDCouplingFieldTfloat) MEDCoupling::MEDCouplingFieldT; %template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT; - class MEDCouplingFieldInt; + class MEDCouplingFieldInt32; + class MEDCouplingFieldInt64; class MEDCouplingFieldFloat; class MEDCouplingFieldDouble : public MEDCouplingFieldT @@ -3971,7 +3989,7 @@ namespace MEDCoupling std::string simpleRepr() const; std::string advancedRepr() const; std::string writeVTK(const std::string& fileName, bool isBinary=true) const; - MEDCouplingFieldInt *convertToIntField() const; + MEDCouplingFieldInt32 *convertToIntField() const; MEDCouplingFieldFloat *convertToFloatField() const; MEDCouplingFieldDouble *clone(bool recDeepCpy) const; MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const; @@ -5165,34 +5183,34 @@ namespace MEDCoupling } }; - class MEDCouplingFieldInt : public MEDCouplingFieldT + class MEDCouplingFieldInt32 : public MEDCouplingFieldT { public: - static MEDCouplingFieldInt *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME); - static MEDCouplingFieldInt *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME); - bool isEqual(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const; - bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const; + static MEDCouplingFieldInt32 *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME); + static MEDCouplingFieldInt32 *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME); + bool isEqual(const MEDCouplingFieldInt32 *other, double meshPrec, int valsPrec) const; + bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt32 *other, double meshPrec, int valsPrec) const; void setTimeUnit(const std::string& unit); std::string getTimeUnit() const; void setTime(double val, int iteration, int order); void setArray(DataArrayInt32 *array); - MEDCouplingFieldInt *deepCopy() const; - MEDCouplingFieldInt *clone(bool recDeepCpy) const; - MEDCouplingFieldInt *cloneWithMesh(bool recDeepCpy) const; + MEDCouplingFieldInt32 *deepCopy() const; + MEDCouplingFieldInt32 *clone(bool recDeepCpy) const; + MEDCouplingFieldInt32 *cloneWithMesh(bool recDeepCpy) const; MEDCouplingFieldDouble *convertToDblField() const; - MEDCouplingFieldInt *buildSubPartRange(int begin, int end, int step) const; + MEDCouplingFieldInt32 *buildSubPartRange(int begin, int end, int step) const; %extend { - MEDCouplingFieldInt(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME) + MEDCouplingFieldInt32(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME) { - return MEDCouplingFieldInt::New(type,td); + return MEDCouplingFieldInt32::New(type,td); } - MEDCouplingFieldInt(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME) + MEDCouplingFieldInt32(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME) { - return MEDCouplingFieldInt::New(ft,td); + return MEDCouplingFieldInt32::New(ft,td); } - PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const + PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt32 *other, double meshPrec, int valsPrec) const { std::string ret1; bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1); @@ -5216,12 +5234,12 @@ namespace MEDCoupling return oss.str(); } - MEDCouplingFieldInt *buildSubPart(PyObject *li) const + MEDCouplingFieldInt32 *buildSubPart(PyObject *li) const { return fieldT_buildSubPart(self,li); } - MEDCouplingFieldInt *__getitem__(PyObject *li) const + MEDCouplingFieldInt32 *__getitem__(PyObject *li) const { return fieldT__getitem__(self,li); } @@ -5247,7 +5265,7 @@ namespace MEDCoupling PyObject *getTinySerializationInformation() const { - return field_getTinySerializationInformation(self); + return field_getTinySerializationInformation(self); } PyObject *serialize() const @@ -5257,7 +5275,7 @@ namespace MEDCoupling PyObject *__getstate__() const { - return field__getstate__(self,MEDCoupling_MEDCouplingFieldInt_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt_serialize); + return field__getstate__(self,MEDCoupling_MEDCouplingFieldInt32_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt32_serialize); } void __setstate__(PyObject *inp) @@ -5267,6 +5285,108 @@ namespace MEDCoupling } }; + class MEDCouplingFieldInt64 : public MEDCouplingFieldT + { + public: + static MEDCouplingFieldInt64 *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME); + static MEDCouplingFieldInt64 *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME); + bool isEqual(const MEDCouplingFieldInt64 *other, double meshPrec, int valsPrec) const; + bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt64 *other, double meshPrec, int valsPrec) const; + void setTimeUnit(const std::string& unit); + std::string getTimeUnit() const; + void setTime(double val, int iteration, int order); + void setArray(DataArrayInt64 *array); + MEDCouplingFieldInt64 *deepCopy() const; + MEDCouplingFieldInt64 *clone(bool recDeepCpy) const; + MEDCouplingFieldInt64 *cloneWithMesh(bool recDeepCpy) const; + MEDCouplingFieldDouble *convertToDblField() const; + MEDCouplingFieldInt64 *buildSubPartRange(int begin, int end, int step) const; + %extend { + MEDCouplingFieldInt64(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME) + { + return MEDCouplingFieldInt64::New(type,td); + } + + MEDCouplingFieldInt64(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME) + { + return MEDCouplingFieldInt64::New(ft,td); + } + + PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt64 *other, double meshPrec, int valsPrec) const + { + std::string ret1; + bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1); + PyObject *ret=PyTuple_New(2); + PyObject *ret0Py=ret0?Py_True:Py_False; + Py_XINCREF(ret0Py); + PyTuple_SetItem(ret,0,ret0Py); + PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str())); + return ret; + } + + std::string __str__() const + { + return self->simpleRepr(); + } + + std::string __repr__() const + { + std::ostringstream oss; + self->reprQuickOverview(oss); + return oss.str(); + } + + MEDCouplingFieldInt64 *buildSubPart(PyObject *li) const + { + return fieldT_buildSubPart(self,li); + } + + MEDCouplingFieldInt64 *__getitem__(PyObject *li) const + { + return fieldT__getitem__(self,li); + } + + DataArrayInt64 *getArray() + { + DataArrayInt64 *ret=self->getArray(); + if(ret) + ret->incrRef(); + return ret; + } + + PyObject *getTime() + { + int tmp1,tmp2; + double tmp0=self->getTime(tmp1,tmp2); + PyObject *res = PyList_New(3); + PyList_SetItem(res,0,SWIG_From_double(tmp0)); + PyList_SetItem(res,1,SWIG_From_int(tmp1)); + PyList_SetItem(res,2,SWIG_From_int(tmp2)); + return res; + } + + PyObject *getTinySerializationInformation() const + { + return field_getTinySerializationInformation(self); + } + + PyObject *serialize() const + { + return field_serialize(self); + } + + PyObject *__getstate__() const + { + return field__getstate__(self,MEDCoupling_MEDCouplingFieldInt64_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt64_serialize); + } + + void __setstate__(PyObject *inp) + { + field__setstate__(self,inp); + } + } + }; + class MEDCouplingFieldFloat : public MEDCouplingFieldT { public: @@ -5984,10 +6104,14 @@ def MEDCouplingFieldDoubleReduce(self): self.checkConsistencyLight() d=(self.getTypeOfField(),self.getTimeDiscretization()) return MEDCouplingStdReduceFunct,(MEDCouplingFieldDouble,(d,(self.__getstate__()),)) -def MEDCouplingFieldIntReduce(self): +def MEDCouplingFieldInt32Reduce(self): self.checkConsistencyLight() d=(self.getTypeOfField(),self.getTimeDiscretization()) - return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt,(d,(self.__getstate__()),)) + return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt32,(d,(self.__getstate__()),)) +def MEDCouplingFieldInt64Reduce(self): + self.checkConsistencyLight() + d=(self.getTypeOfField(),self.getTimeDiscretization()) + return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt64,(d,(self.__getstate__()),)) def MEDCouplingFieldFloatReduce(self): self.checkConsistencyLight() d=(self.getTypeOfField(),self.getTimeDiscretization()) @@ -6010,10 +6134,14 @@ def MEDCouplingFieldTemplateReduce(self): MEDCouplingUMesh.ExtractFromIndexedArrays = DataArrayInt.ExtractFromIndexedArrays MEDCouplingUMesh.ExtractFromIndexedArraysSlice = DataArrayInt.ExtractFromIndexedArraysSlice MEDCouplingUMesh.SetPartOfIndexedArrays = DataArrayInt.SetPartOfIndexedArrays -##MEDCouplingUMesh.SetPartOfIndexedArraysSlice = DataArrayInt.SetPartOfIndexedArraysSlice MEDCouplingUMesh.SetPartOfIndexedArraysSameIdx = DataArrayInt.SetPartOfIndexedArraysSameIdx MEDCouplingUMesh.RemoveIdsFromIndexedArrays = DataArrayInt.RemoveIdsFromIndexedArrays -##MEDCouplingUMesh.SetPartOfIndexedArraysSameIdxSlice = DataArrayInt.SetPartOfIndexedArraysSameIdxSlice +MEDCouplingFieldInt = MEDCouplingFieldInt32 + +if MEDCouplingUse64BitIDs(): + MEDCouplingFieldID = MEDCouplingFieldInt64 +else: + MEDCouplingFieldID = MEDCouplingFieldInt32 %} diff --git a/src/MEDCoupling_Swig/MEDCouplingFinalize.i b/src/MEDCoupling_Swig/MEDCouplingFinalize.i index 7ab5de4e7..b0ea9a4a0 100644 --- a/src/MEDCoupling_Swig/MEDCouplingFinalize.i +++ b/src/MEDCoupling_Swig/MEDCouplingFinalize.i @@ -86,7 +86,8 @@ MEDCouplingFieldDouble.__ifloordiv__=MEDCouplingFieldDoubleIdiv MEDCouplingFieldTemplate.__reduce__=MEDCouplingFieldTemplateReduce -MEDCouplingFieldInt.__reduce__=MEDCouplingFieldIntReduce +MEDCouplingFieldInt32.__reduce__=MEDCouplingFieldInt32Reduce +MEDCouplingFieldInt64.__reduce__=MEDCouplingFieldInt64Reduce MEDCouplingFieldFloat.__reduce__=MEDCouplingFieldFloatReduce @@ -185,7 +186,8 @@ del MEDCouplingFieldDoubleIpow del MEDCouplingFieldDoubleIsub del MEDCouplingFieldDoubleReduce del MEDCouplingFieldFloatReduce -del MEDCouplingFieldIntReduce +del MEDCouplingFieldInt32Reduce +del MEDCouplingFieldInt64Reduce del MEDCouplingFieldTemplateReduce del MEDCouplingIMeshReduce del MEDCouplingMappedExtrudedMeshReduce diff --git a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i index 2b49912aa..94c0ad0f8 100644 --- a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i @@ -16,10 +16,9 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// Author : Anthony Geay (CEA/DEN) +// Author : Anthony Geay (EDF R&D) -#ifndef __MEDCOUPLINGTYPEMAPS_I__ -#define __MEDCOUPLINGTYPEMAPS_I__ +#pragma once #include "MEDCouplingDataArrayTypemaps.i" #include "MEDCouplingUMesh.hxx" @@ -135,8 +134,10 @@ static PyObject *convertField(MEDCoupling::MEDCouplingField *f, int owner) } if(dynamic_cast(f)) ret=SWIG_NewPointerObj(reinterpret_cast(f),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,owner); - if(dynamic_cast(f)) - ret=SWIG_NewPointerObj(reinterpret_cast(f),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldInt,owner); + if(dynamic_cast(f)) + ret=SWIG_NewPointerObj(reinterpret_cast(f),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldInt32,owner); + if(dynamic_cast(f)) + ret=SWIG_NewPointerObj(reinterpret_cast(f),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldInt64,owner); if(dynamic_cast(f)) ret=SWIG_NewPointerObj(reinterpret_cast(f),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldFloat,owner); if(!ret) @@ -767,5 +768,3 @@ PyObject *Mesh_getCellsContainingPointsLike(PyObject *p, double eps, const MEDCo PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } - -#endif diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 4cfee0c64..768ee2db2 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -273,7 +273,12 @@ try:MEDFileFieldGlobsReal(fid) } case MED_INT32: { - _fields[i]=MEDFileIntFieldMultiTSWithoutSDA::New(fid,fieldName,meshName,typcha,infos,nbOfStep,dtunit,loadAll,ms,entities); + _fields[i]=MEDFileInt32FieldMultiTSWithoutSDA::New(fid,fieldName,meshName,typcha,infos,nbOfStep,dtunit,loadAll,ms,entities); + break; + } + case MED_INT64: + { + _fields[i]=MEDFileInt64FieldMultiTSWithoutSDA::New(fid,fieldName,meshName,typcha,infos,nbOfStep,dtunit,loadAll,ms,entities); break; } case MED_FLOAT32: @@ -285,13 +290,13 @@ try:MEDFileFieldGlobsReal(fid) { if(sizeof(med_int)==sizeof(int)) { - _fields[i]=MEDFileIntFieldMultiTSWithoutSDA::New(fid,fieldName,meshName,typcha,infos,nbOfStep,dtunit,loadAll,ms,entities); + _fields[i]=MEDFileInt32FieldMultiTSWithoutSDA::New(fid,fieldName,meshName,typcha,infos,nbOfStep,dtunit,loadAll,ms,entities); break; } } default: { - std::ostringstream oss; oss << "constructor MEDFileFields(fileName) : file \'" << FileNameFromFID(fid) << "\' at pos #" << i << " field has name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32] !"; + std::ostringstream oss; oss << "constructor MEDFileFields(fileName) : file \'" << FileNameFromFID(fid) << "\' at pos #" << i << " field has name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32, MED_INT64] !"; throw INTERP_KERNEL::Exception(oss.str()); } } @@ -848,17 +853,20 @@ MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldAtPos(int i) const return 0; MCAuto ret; const MEDFileFieldMultiTSWithoutSDA *fmtsC(dynamic_cast(fmts)); - const MEDFileIntFieldMultiTSWithoutSDA *fmtsC2(dynamic_cast(fmts)); + const MEDFileInt32FieldMultiTSWithoutSDA *fmtsC2(dynamic_cast(fmts)); + const MEDFileInt64FieldMultiTSWithoutSDA *fmtsC4(dynamic_cast(fmts)); const MEDFileFloatFieldMultiTSWithoutSDA *fmtsC3(dynamic_cast(fmts)); if(fmtsC) ret=MEDFileFieldMultiTS::New(*fmtsC,false); else if(fmtsC2) - ret=MEDFileIntFieldMultiTS::New(*fmtsC2,false); + ret=MEDFileInt32FieldMultiTS::New(*fmtsC2,false); + else if(fmtsC4) + ret=MEDFileInt64FieldMultiTS::New(*fmtsC4,false); else if(fmtsC3) ret=MEDFileFloatFieldMultiTS::New(*fmtsC3,false); else { - std::ostringstream oss; oss << "MEDFileFields::getFieldAtPos : At pos #" << i << " field is neither double (FLOAT64) nor float (FLOAT32) nor integer (INT32) !"; + std::ostringstream oss; oss << "MEDFileFields::getFieldAtPos : At pos #" << i << " field is neither double (FLOAT64) nor float (FLOAT32) nor integer (INT32) nor integer (INT64) !"; throw INTERP_KERNEL::Exception(oss.str()); } ret->shallowCpyGlobs(*this); diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index 2bc60251a..20153b152 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -18,8 +18,7 @@ // // Author : Anthony Geay (EDF R&D) -#ifndef __MEDFILEFIELD_HXX__ -#define __MEDFILEFIELD_HXX__ +#pragma once #include "MEDLoaderDefines.hxx" @@ -36,7 +35,6 @@ #include "MEDLoaderTraits.hxx" #include "MEDCouplingTraits.hxx" #include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingFieldInt.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingPartDefinition.hxx" @@ -154,5 +152,3 @@ namespace MEDCoupling int _nb_iter; }; } - -#endif diff --git a/src/MEDLoader/MEDFileField.txx b/src/MEDLoader/MEDFileField.txx index 0a10c74fe..254194fe8 100644 --- a/src/MEDLoader/MEDFileField.txx +++ b/src/MEDLoader/MEDFileField.txx @@ -18,12 +18,12 @@ // // Author : Anthony Geay (EDF R&D) -#ifndef __MEDFILEFIELD_TXX__ -#define __MEDFILEFIELD_TXX__ +#pragma once #include "MEDFileField.hxx" #include "MEDCouplingTraits.hxx" -#include "MEDCouplingFieldInt.hxx" +#include "MEDCouplingFieldInt32.hxx" +#include "MEDCouplingFieldInt64.hxx" #include "MEDCouplingFieldFloat.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldTemplate.hxx" @@ -1397,5 +1397,3 @@ namespace MEDCoupling return ret.retn(); } } - -#endif diff --git a/src/MEDLoader/MEDFileField1TS.cxx b/src/MEDLoader/MEDFileField1TS.cxx index 085a6d6a8..57c6879ed 100644 --- a/src/MEDLoader/MEDFileField1TS.cxx +++ b/src/MEDLoader/MEDFileField1TS.cxx @@ -31,19 +31,24 @@ using namespace MEDCoupling; extern INTERP_KERNEL::NormalizedCellType typmai2[MED_N_CELL_FIXED_GEO]; -template class MEDCoupling::MEDFileField1TSTemplateWithoutSDA; +template class MEDCoupling::MEDFileField1TSTemplateWithoutSDA; +template class MEDCoupling::MEDFileField1TSTemplateWithoutSDA; template class MEDCoupling::MEDFileField1TSTemplateWithoutSDA; template class MEDCoupling::MEDFileField1TSTemplateWithoutSDA; -template class MEDCoupling::MEDFileField1TSNDTemplateWithoutSDA; +template class MEDCoupling::MEDFileField1TSNDTemplateWithoutSDA; +template class MEDCoupling::MEDFileField1TSNDTemplateWithoutSDA; template class MEDCoupling::MEDFileField1TSNDTemplateWithoutSDA; -template class MEDCoupling::MEDFileTemplateField1TS; +template class MEDCoupling::MEDFileTemplateField1TS; +template class MEDCoupling::MEDFileTemplateField1TS; template class MEDCoupling::MEDFileTemplateField1TS; template class MEDCoupling::MEDFileTemplateField1TS; -template class MEDCoupling::MEDFileNDTemplateField1TS; +template class MEDCoupling::MEDFileNDTemplateField1TS; +template class MEDCoupling::MEDFileNDTemplateField1TS; template class MEDCoupling::MEDFileNDTemplateField1TS; const char MEDFileField1TSWithoutSDA::TYPE_STR[]="FLOAT64"; -const char MEDFileIntField1TSWithoutSDA::TYPE_STR[]="INT32"; +const char MEDFileInt32Field1TSWithoutSDA::TYPE_STR[]="INT32"; +const char MEDFileInt64Field1TSWithoutSDA::TYPE_STR[]="INT64"; const char MEDFileFloatField1TSWithoutSDA::TYPE_STR[]="FLOAT32"; //= MEDFileAnyTypeField1TSWithoutSDA @@ -1430,9 +1435,9 @@ const char *MEDFileField1TSWithoutSDA::getTypeStr() const return TYPE_STR; } -MEDFileIntField1TSWithoutSDA *MEDFileField1TSWithoutSDA::convertToInt() const +MEDFileInt32Field1TSWithoutSDA *MEDFileField1TSWithoutSDA::convertToInt() const { - MCAuto ret(new MEDFileIntField1TSWithoutSDA); + MCAuto ret(new MEDFileInt32Field1TSWithoutSDA); ret->MEDFileAnyTypeField1TSWithoutSDA::operator =(*this); ret->deepCpyLeavesFrom(*this); const DataArrayDouble *arr(_arr); @@ -1490,25 +1495,25 @@ MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::deepCopy() const return ret.retn(); } -//= MEDFileIntField1TSWithoutSDA +//= MEDFileInt32Field1TSWithoutSDA -MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos) +MEDFileInt32Field1TSWithoutSDA *MEDFileInt32Field1TSWithoutSDA::New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos) { - return new MEDFileIntField1TSWithoutSDA(fieldName,meshName,csit,iteration,order,infos); + return new MEDFileInt32Field1TSWithoutSDA(fieldName,meshName,csit,iteration,order,infos); } -MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA() +MEDFileInt32Field1TSWithoutSDA::MEDFileInt32Field1TSWithoutSDA() { } -MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, +MEDFileInt32Field1TSWithoutSDA::MEDFileInt32Field1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos):MEDFileField1TSNDTemplateWithoutSDA(fieldName,meshName,csit,iteration,order,infos) { DataArrayInt32 *arr(getOrCreateAndGetArrayTemplate()); arr->setInfoAndChangeNbOfCompo(infos); } -const char *MEDFileIntField1TSWithoutSDA::getTypeStr() const +const char *MEDFileInt32Field1TSWithoutSDA::getTypeStr() const { return TYPE_STR; } @@ -1529,7 +1534,7 @@ const char *MEDFileIntField1TSWithoutSDA::getTypeStr() const * \throw If no field values are available. * \sa getUndergroundDataArray() */ -DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const +DataArray *MEDFileInt32Field1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const { return getUndergroundDataArrayIntExt(entries); } @@ -1550,7 +1555,7 @@ DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< * \throw If no field values are available. * \sa getUndergroundDataArray() */ -DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const +DataArrayInt32 *MEDFileInt32Field1TSWithoutSDA::getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const { if(_field_per_mesh.size()!=1) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !"); @@ -1560,16 +1565,101 @@ DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayIntExt(std::v return getUndergroundDataArrayTemplate(); } -MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::shallowCpy() const +MEDFileInt32Field1TSWithoutSDA *MEDFileInt32Field1TSWithoutSDA::shallowCpy() const { - MCAuto ret(new MEDFileIntField1TSWithoutSDA(*this)); + MCAuto ret(new MEDFileInt32Field1TSWithoutSDA(*this)); ret->deepCpyLeavesFrom(*this); return ret.retn(); } -MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::deepCopy() const +MEDFileInt32Field1TSWithoutSDA *MEDFileInt32Field1TSWithoutSDA::deepCopy() const { - MCAuto ret(shallowCpy()); + MCAuto ret(shallowCpy()); + if(_arr.isNotNull()) + ret->_arr=_arr->deepCopy(); + return ret.retn(); +} + +//= MEDFileInt64Field1TSWithoutSDA + +MEDFileInt64Field1TSWithoutSDA *MEDFileInt64Field1TSWithoutSDA::New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos) +{ + return new MEDFileInt64Field1TSWithoutSDA(fieldName,meshName,csit,iteration,order,infos); +} + +MEDFileInt64Field1TSWithoutSDA::MEDFileInt64Field1TSWithoutSDA() +{ +} + +MEDFileInt64Field1TSWithoutSDA::MEDFileInt64Field1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, + const std::vector& infos):MEDFileField1TSNDTemplateWithoutSDA(fieldName,meshName,csit,iteration,order,infos) +{ + DataArrayInt64 *arr(getOrCreateAndGetArrayTemplate()); + arr->setInfoAndChangeNbOfCompo(infos); +} + +const char *MEDFileInt64Field1TSWithoutSDA::getTypeStr() const +{ + return TYPE_STR; +} + +/*! + * Returns a pointer to the underground DataArrayIdType instance and a + * sequence describing parameters of a support of each part of \a this field. The + * caller should not decrRef() the returned DataArrayIdType. This method allows for a + * direct access to the field values. This method is intended for the field lying on one + * mesh only. + * \param [in,out] entries - the sequence describing parameters of a support of each + * part of \a this field. Each item of this sequence consists of two parts. The + * first part describes a type of mesh entity and an id of discretization of a + * current field part. The second part describes a range of values [begin,end) + * within the returned array relating to the current field part. + * \return DataArrayIdType * - the pointer to the field values array. + * \throw If the number of underlying meshes is not equal to 1. + * \throw If no field values are available. + * \sa getUndergroundDataArray() + */ +DataArray *MEDFileInt64Field1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const +{ + return getUndergroundDataArrayIntExt(entries); +} + +/*! + * Returns a pointer to the underground DataArrayInt instance and a + * sequence describing parameters of a support of each part of \a this field. The + * caller should not decrRef() the returned DataArrayIdType. This method allows for a + * direct access to the field values. This method is intended for the field lying on one + * mesh only. + * \param [in,out] entries - the sequence describing parameters of a support of each + * part of \a this field. Each item of this sequence consists of two parts. The + * first part describes a type of mesh entity and an id of discretization of a + * current field part. The second part describes a range of values [begin,end) + * within the returned array relating to the current field part. + * \return DataArrayInt * - the pointer to the field values array. + * \throw If the number of underlying meshes is not equal to 1. + * \throw If no field values are available. + * \sa getUndergroundDataArray() + */ +DataArrayInt64 *MEDFileInt64Field1TSWithoutSDA::getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const +{ + if(_field_per_mesh.size()!=1) + throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !"); + if(_field_per_mesh[0]==0) + throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : no field specified !"); + _field_per_mesh[0]->getUndergroundDataArrayExt(entries); + return getUndergroundDataArrayTemplate(); +} + +MEDFileInt64Field1TSWithoutSDA *MEDFileInt64Field1TSWithoutSDA::shallowCpy() const +{ + MCAuto ret(new MEDFileInt64Field1TSWithoutSDA(*this)); + ret->deepCpyLeavesFrom(*this); + return ret.retn(); +} + +MEDFileInt64Field1TSWithoutSDA *MEDFileInt64Field1TSWithoutSDA::deepCopy() const +{ + MCAuto ret(shallowCpy()); if(_arr.isNotNull()) ret->_arr=_arr->deepCopy(); return ret.retn(); @@ -1683,7 +1773,12 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i } case MED_INT32: { - ret=MEDFileIntField1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector()); + ret=MEDFileInt32Field1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector()); + break; + } + case MED_INT64: + { + ret=MEDFileInt64Field1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector()); break; } case MED_FLOAT32: @@ -1695,13 +1790,13 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i { if(sizeof(med_int)==sizeof(int)) { - ret=MEDFileIntField1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector()); + ret=MEDFileInt32Field1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector()); break; } } default: { - std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fid) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of the first field is not in [MED_FLOAT64, MED_INT32] !"; + std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fid) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of the first field is not in [MED_FLOAT64, MED_FLOAT32, MED_INT32, MED_INT64] !"; throw INTERP_KERNEL::Exception(oss.str()); } } @@ -1751,7 +1846,12 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i } case MED_INT32: { - ret=MEDFileIntField1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector()); + ret=MEDFileInt32Field1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector()); + break; + } + case MED_INT64: + { + ret=MEDFileInt64Field1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector()); break; } case MED_FLOAT32: @@ -1763,13 +1863,13 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i { if(sizeof(med_int)==sizeof(int)) { - ret=MEDFileIntField1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector()); + ret=MEDFileInt32Field1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector()); break; } } default: { - std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fid,fieldName) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32] !"; + std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fid,fieldName) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32, MED_INT64] !"; throw INTERP_KERNEL::Exception(oss.str()); } } @@ -1816,9 +1916,15 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::BuildNewInstanceFromContent(MEDF ret->_content=c; c->incrRef(); return ret.retn(); } - if(dynamic_cast(c)) + if(dynamic_cast(c)) + { + MCAuto ret(MEDFileInt32Field1TS::New()); + ret->_content=c; c->incrRef(); + return ret.retn(); + } + if(dynamic_cast(c)) { - MCAuto ret(MEDFileIntField1TS::New()); + MCAuto ret(MEDFileInt64Field1TS::New()); ret->_content=c; c->incrRef(); return ret.retn(); } @@ -1911,7 +2017,12 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i } case MED_INT32: { - ret=MEDFileIntField1TSWithoutSDA::New(fieldName,meshName,-1,iteration,order,std::vector()); + ret=MEDFileInt32Field1TSWithoutSDA::New(fieldName,meshName,-1,iteration,order,std::vector()); + break; + } + case MED_INT64: + { + ret=MEDFileInt64Field1TSWithoutSDA::New(fieldName,meshName,-1,iteration,order,std::vector()); break; } case MED_FLOAT32: @@ -1923,13 +2034,13 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i { if(sizeof(med_int)==sizeof(int)) { - ret=MEDFileIntField1TSWithoutSDA::New(fieldName,meshName,-1,iteration,order,std::vector()); + ret=MEDFileInt32Field1TSWithoutSDA::New(fieldName,meshName,-1,iteration,order,std::vector()); break; } } default: { - std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fid,fieldName,iteration,order) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32] !"; + std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fid,fieldName,iteration,order) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32, MED_INT64] !"; throw INTERP_KERNEL::Exception(oss.str()); } } @@ -2542,22 +2653,22 @@ mcIdType MEDFileAnyTypeField1TS::copyTinyInfoFrom(const TimeHolder *th, const ME * * \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations) * By default (true) the globals are deeply copied. - * \return MEDFileIntField1TS * - a new object that is the result of the conversion of \a this to int32 field. + * \return MEDFileInt32Field1TS * - a new object that is the result of the conversion of \a this to int32 field. */ -MEDFileIntField1TS *MEDFileField1TS::convertToInt(bool isDeepCpyGlobs) const +MEDFileInt32Field1TS *MEDFileField1TS::convertToInt(bool isDeepCpyGlobs) const { - MCAuto ret; + MCAuto ret; const MEDFileAnyTypeField1TSWithoutSDA *content(_content); if(content) { const MEDFileField1TSWithoutSDA *contc=dynamic_cast(content); if(!contc) throw INTERP_KERNEL::Exception("MEDFileField1TS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !"); - MCAuto newc(contc->convertToInt()); - ret=static_cast(MEDFileAnyTypeField1TS::BuildNewInstanceFromContent((MEDFileIntField1TSWithoutSDA *)newc)); + MCAuto newc(contc->convertToInt()); + ret=static_cast(MEDFileAnyTypeField1TS::BuildNewInstanceFromContent((MEDFileInt32Field1TSWithoutSDA *)newc)); } else - ret=MEDFileIntField1TS::New(); + ret=MEDFileInt32Field1TS::New(); if(isDeepCpyGlobs) ret->deepCpyGlobs(*this); else @@ -2610,12 +2721,12 @@ std::vector< std::vector > MEDFileField1TS::getFieldSplitedBy return contentNotNull()->getFieldSplitedByType2(mname,types,typesF,pfls,locs); } -//= MEDFileIntField1TS +//= MEDFileInt32Field1TS -MCAuto MEDFileIntField1TS::ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt *f) +MCAuto MEDFileInt32Field1TS::ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt32 *f) { if(!f) - throw INTERP_KERNEL::Exception("MEDFileIntField1TS::ConvertFieldIntToFieldDouble : null input field !"); + throw INTERP_KERNEL::Exception("MEDFileInt32Field1TS::ConvertFieldIntToFieldDouble : null input field !"); int t1,t2; double t0(f->getTime(t1,t2)); std::string tu(f->getTimeUnit()); @@ -2625,6 +2736,18 @@ MCAuto MEDFileIntField1TS::ConvertFieldIntToFieldDouble( return ret; } -//= MEDFileFloatField1TS +//= MEDFileInt64Field1TS + +MCAuto MEDFileInt64Field1TS::ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt64 *f) +{ + if(!f) + throw INTERP_KERNEL::Exception("MEDFileInt64Field1TS::ConvertFieldIntToFieldDouble : null input field !"); + int t1,t2; + double t0(f->getTime(t1,t2)); + std::string tu(f->getTimeUnit()); + MCAuto ft(MEDCouplingFieldTemplate::New(*f)); + MCAuto ret(MEDCouplingFieldDouble::New(*ft)); + ret->setTime(t0,t1,t2); ret->setTimeUnit(tu); + return ret; +} -//= MEDFileFloatField1TS diff --git a/src/MEDLoader/MEDFileField1TS.hxx b/src/MEDLoader/MEDFileField1TS.hxx index 5784c02aa..91efa14a6 100644 --- a/src/MEDLoader/MEDFileField1TS.hxx +++ b/src/MEDLoader/MEDFileField1TS.hxx @@ -142,7 +142,7 @@ namespace MEDCoupling mutable mcIdType _nb_of_tuples_to_be_allocated; }; - class MEDFileIntField1TSWithoutSDA; + class MEDFileInt32Field1TSWithoutSDA; template class MEDFileField1TSTemplateWithoutSDA : public MEDFileAnyTypeField1TSWithoutSDA @@ -184,7 +184,7 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *deepCopy() const; - MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *convertToInt() const; + MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA *convertToInt() const; public: static const char TYPE_STR[]; }; @@ -202,19 +202,39 @@ namespace MEDCoupling /*! * SDA is for Shared Data Arrays such as profiles. */ - class MEDFileIntField1TSWithoutSDA : public MEDFileField1TSNDTemplateWithoutSDA + class MEDFileInt32Field1TSWithoutSDA : public MEDFileField1TSNDTemplateWithoutSDA { public: - MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA(); - MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileIntField1TSWithoutSDA"); } - MEDLOADER_EXPORT static MEDFileIntField1TSWithoutSDA *New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); - MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *deepCopy() const; - MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *shallowCpy() const; + MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA(); + MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt32Field1TSWithoutSDA"); } + MEDLOADER_EXPORT static MEDFileInt32Field1TSWithoutSDA *New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); + MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA *deepCopy() const; + MEDLOADER_EXPORT MEDFileInt32Field1TSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT const char *getTypeStr() const; MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; - MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const; + MEDLOADER_EXPORT DataArrayInt32 *getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const; protected: - MEDFileIntField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); + MEDFileInt32Field1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); + public: + MEDLOADER_EXPORT static const char TYPE_STR[]; + }; + + /*! + * SDA is for Shared Data Arrays such as profiles. + */ + class MEDFileInt64Field1TSWithoutSDA : public MEDFileField1TSNDTemplateWithoutSDA + { + public: + MEDLOADER_EXPORT MEDFileInt64Field1TSWithoutSDA(); + MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt64Field1TSWithoutSDA"); } + MEDLOADER_EXPORT static MEDFileInt64Field1TSWithoutSDA *New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); + MEDLOADER_EXPORT MEDFileInt64Field1TSWithoutSDA *deepCopy() const; + MEDLOADER_EXPORT MEDFileInt64Field1TSWithoutSDA *shallowCpy() const; + MEDLOADER_EXPORT const char *getTypeStr() const; + MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; + MEDLOADER_EXPORT DataArrayInt64 *getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const; + protected: + MEDFileInt64Field1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); public: MEDLOADER_EXPORT static const char TYPE_STR[]; }; @@ -337,7 +357,7 @@ namespace MEDCoupling MCAuto _content; }; - class MEDFileIntField1TS; + class MEDFileInt32Field1TS; template class MEDFileTemplateField1TS : public MEDFileAnyTypeField1TS @@ -392,7 +412,7 @@ namespace MEDCoupling { friend class MEDFileTemplateField1TS; public: - MEDLOADER_EXPORT MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const; + MEDLOADER_EXPORT MEDFileInt32Field1TS *convertToInt(bool isDeepCpyGlobs=true) const; public: MEDLOADER_EXPORT MEDFileField1TS *shallowCpy() const; MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, @@ -424,29 +444,54 @@ namespace MEDCoupling MEDFileNDTemplateField1TS(const typename MLFieldTraits::F1TSWSDAType& other, bool shallowCopyOfContent):MEDFileTemplateField1TS(other,shallowCopyOfContent) { } }; - class MEDFileIntField1TS : public MEDFileNDTemplateField1TS + class MEDFileInt32Field1TS : public MEDFileNDTemplateField1TS { - friend class MEDFileTemplateField1TS; + friend class MEDFileTemplateField1TS; public: - MEDLOADER_EXPORT MEDFileIntField1TS *shallowCpy() const { return new MEDFileIntField1TS(*this); } - MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileIntField1TS"); } + MEDLOADER_EXPORT MEDFileInt32Field1TS *shallowCpy() const { return new MEDFileInt32Field1TS(*this); } + MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt32Field1TS"); } public: - MEDLOADER_EXPORT static MCAuto ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt *f); + MEDLOADER_EXPORT static MCAuto ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt32 *f); private: med_field_type getMEDFileFieldType() const { return MED_INT32; } private: - ~MEDFileIntField1TS() { } - MEDFileIntField1TS() { } - MEDFileIntField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS(fid,loadAll,ms) { } - MEDFileIntField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS(fid,fieldName,loadAll,ms) { } - MEDFileIntField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS(fid,fieldName,iteration,order,loadAll,ms) { } + ~MEDFileInt32Field1TS() { } + MEDFileInt32Field1TS() { } + MEDFileInt32Field1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS(fid,loadAll,ms) { } + MEDFileInt32Field1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS(fid,fieldName,loadAll,ms) { } + MEDFileInt32Field1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS(fid,fieldName,iteration,order,loadAll,ms) { } + /*! + * This constructor is a shallow copy constructor. If \a shallowCopyOfContent is true the content of \a other is shallow copied. + * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this. + * + * \warning this is a shallow copy constructor + */ + MEDFileInt32Field1TS(const MEDFileInt32Field1TSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateField1TS(other,shallowCopyOfContent) { } + }; + + class MEDFileInt64Field1TS : public MEDFileNDTemplateField1TS + { + friend class MEDFileTemplateField1TS; + public: + MEDLOADER_EXPORT MEDFileInt64Field1TS *shallowCpy() const { return new MEDFileInt64Field1TS(*this); } + MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt64Field1TS"); } + public: + MEDLOADER_EXPORT static MCAuto ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt64 *f); + private: + med_field_type getMEDFileFieldType() const { return MED_INT64; } + private: + ~MEDFileInt64Field1TS() { } + MEDFileInt64Field1TS() { } + MEDFileInt64Field1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS(fid,loadAll,ms) { } + MEDFileInt64Field1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS(fid,fieldName,loadAll,ms) { } + MEDFileInt64Field1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS(fid,fieldName,iteration,order,loadAll,ms) { } /*! * This constructor is a shallow copy constructor. If \a shallowCopyOfContent is true the content of \a other is shallow copied. * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this. * * \warning this is a shallow copy constructor */ - MEDFileIntField1TS(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateField1TS(other,shallowCopyOfContent) { } + MEDFileInt64Field1TS(const MEDFileInt64Field1TSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateField1TS(other,shallowCopyOfContent) { } }; class MEDFileFloatField1TS : public MEDFileNDTemplateField1TS diff --git a/src/MEDLoader/MEDFileFieldInternal.cxx b/src/MEDLoader/MEDFileFieldInternal.cxx index 399b0ea08..2cb35d963 100644 --- a/src/MEDLoader/MEDFileFieldInternal.cxx +++ b/src/MEDLoader/MEDFileFieldInternal.cxx @@ -725,7 +725,14 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadBigArray(med_idt fid, const MEDFileF DataArrayInt32 *arrI(dynamic_cast(arr)); if(arrI) { - int *startFeeding(arrI->getPointer()+_start*nbOfCompo); + Int32 *startFeeding(arrI->getPointer()+_start*nbOfCompo); + goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast(startFeeding)); + return ; + } + DataArrayInt64 *arrI64(dynamic_cast(arr)); + if(arrI64) + { + Int64 *startFeeding(arrI64->getPointer()+_start*nbOfCompo); goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast(startFeeding)); return ; } @@ -919,16 +926,19 @@ void MEDFileFieldPerMeshPerTypePerDisc::writeLL(med_idt fid, const MEDFileFieldN throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : the array to be written is not allocated !"); const DataArrayDouble *arrD(dynamic_cast(arr)); const DataArrayInt32 *arrI(dynamic_cast(arr)); + const DataArrayInt64 *arrI64(dynamic_cast(arr)); const DataArrayFloat *arrF(dynamic_cast(arr)); const unsigned char *locToWrite=0; if(arrD) locToWrite=reinterpret_cast(arrD->getConstPointer()+_start*arr->getNumberOfComponents()); else if(arrI) locToWrite=reinterpret_cast(arrI->getConstPointer()+_start*arr->getNumberOfComponents()); + else if(arrI64) + locToWrite=reinterpret_cast(arrI64->getConstPointer()+_start*arr->getNumberOfComponents()); else if(arrF) locToWrite=reinterpret_cast(arrF->getConstPointer()+_start*arr->getNumberOfComponents()); else - throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : not recognized type of values ! Supported are FLOAT64 FLOAT32 and INT32 !"); + throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : not recognized type of values ! Supported are FLOAT64 FLOAT32 INT32 and INT64 !"); MEDFILESAFECALLERWR0(MEDfieldValueWithProfileWr,(fid,nasc.getName().c_str(),getIteration(),getOrder(),getTime(),menti,mgeoti, MED_COMPACT_PFLMODE,_profile.c_str(),_localization.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,ToMedInt(_nval), locToWrite)); diff --git a/src/MEDLoader/MEDFileFieldMultiTS.cxx b/src/MEDLoader/MEDFileFieldMultiTS.cxx index 117d84d63..672f1a5c3 100644 --- a/src/MEDLoader/MEDFileFieldMultiTS.cxx +++ b/src/MEDLoader/MEDFileFieldMultiTS.cxx @@ -31,15 +31,19 @@ using namespace MEDCoupling; -template class MEDCoupling::MEDFileTemplateFieldMultiTSWithoutSDA; +template class MEDCoupling::MEDFileTemplateFieldMultiTSWithoutSDA; +template class MEDCoupling::MEDFileTemplateFieldMultiTSWithoutSDA; template class MEDCoupling::MEDFileTemplateFieldMultiTSWithoutSDA; template class MEDCoupling::MEDFileTemplateFieldMultiTSWithoutSDA; -template class MEDCoupling::MEDFileNDTemplateFieldMultiTSWithoutSDA; +template class MEDCoupling::MEDFileNDTemplateFieldMultiTSWithoutSDA; +template class MEDCoupling::MEDFileNDTemplateFieldMultiTSWithoutSDA; template class MEDCoupling::MEDFileNDTemplateFieldMultiTSWithoutSDA; -template class MEDCoupling::MEDFileTemplateFieldMultiTS; +template class MEDCoupling::MEDFileTemplateFieldMultiTS; +template class MEDCoupling::MEDFileTemplateFieldMultiTS; template class MEDCoupling::MEDFileTemplateFieldMultiTS; template class MEDCoupling::MEDFileTemplateFieldMultiTS; -template class MEDCoupling::MEDFileNDTemplateFieldMultiTS; +template class MEDCoupling::MEDFileNDTemplateFieldMultiTS; +template class MEDCoupling::MEDFileNDTemplateFieldMultiTS; template class MEDCoupling::MEDFileNDTemplateFieldMultiTS; extern INTERP_KERNEL::NormalizedCellType ConvertGeometryType(med_geometry_type geotype); @@ -527,7 +531,12 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysR } case MED_INT32: { - _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt(numdt),FromMedInt(numo),_infos); + _time_steps[i]=MEDFileInt32Field1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt(numdt),FromMedInt(numo),_infos); + break; + } + case MED_INT64: + { + _time_steps[i]=MEDFileInt64Field1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt(numdt),FromMedInt(numo),_infos); break; } case MED_FLOAT32: @@ -539,12 +548,12 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysR { if(sizeof(med_int)==sizeof(int)) { - _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt(numdt),FromMedInt(numo),_infos); + _time_steps[i]=MEDFileInt32Field1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt(numdt),FromMedInt(numo),_infos); break; } } default: - throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively : managed field type are : FLOAT64, INT32, FLOAT32 !"); + throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively : managed field type are : FLOAT64, INT32, FLOAT32, INT64 !"); } if(loadAll) _time_steps[i]->loadStructureAndBigArraysRecursively(fid,*this,ms,entitiesForSubInstances); @@ -1080,7 +1089,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT(const MEDCoup void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller) { if(!field) - throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !"); + throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !"); if(!_time_steps.empty()) checkCoherencyOfTinyInfo(field,arr); MCAuto obj(createNew1TSWithoutSDAEmptyInstance()); @@ -1128,9 +1137,9 @@ std::vector< std::vector > MEDFileFieldMultiTSWithoutSDA::get return myF1TSC->getFieldSplitedByType2(mname,types,typesF,pfls,locs); } -MEDFileIntFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::convertToInt() const +MEDFileInt32FieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::convertToInt() const { - MCAuto ret(new MEDFileIntFieldMultiTSWithoutSDA); + MCAuto ret(new MEDFileInt32FieldMultiTSWithoutSDA); ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this); int i=0; for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) @@ -1183,7 +1192,12 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr } case MED_INT32: { - ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities); + ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities); + break; + } + case MED_INT64: + { + ret=new MEDFileInt64FieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities); break; } case MED_FLOAT32: @@ -1195,13 +1209,13 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr { if(sizeof(med_int)==sizeof(int)) { - ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities); + ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities); break; } } default: { - std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fid,fieldName) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32] !"; + std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fid,fieldName) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32, MED_INT64] !"; throw INTERP_KERNEL::Exception(oss.str()); } } @@ -1227,7 +1241,12 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr } case MED_INT32: { - ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0); + ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0); + break; + } + case MED_INT64: + { + ret=new MEDFileInt64FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0); break; } case MED_FLOAT32: @@ -1239,13 +1258,13 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr { if(sizeof(med_int)==sizeof(int)) { - ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0); + ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0); break; } } default: { - std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fid) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of the first field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32] !"; + std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fid) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of the first field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32, MED_INT64] !"; throw INTERP_KERNEL::Exception(oss.str()); } } @@ -1264,9 +1283,15 @@ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromCont ret->_content=c; c->incrRef(); return ret.retn(); } - if(dynamic_cast(c)) + if(dynamic_cast(c)) + { + MCAuto ret(MEDFileInt32FieldMultiTS::New()); + ret->_content=c; c->incrRef(); + return ret.retn(); + } + if(dynamic_cast(c)) { - MCAuto ret(MEDFileIntFieldMultiTS::New()); + MCAuto ret(MEDFileInt64FieldMultiTS::New()); ret->_content=c; c->incrRef(); return ret.retn(); } @@ -1301,10 +1326,10 @@ catch(INTERP_KERNEL::Exception& e) //= MEDFileAnyTypeFieldMultiTS /*! - * Returns a new instance of MEDFileFieldMultiTS or MEDFileIntFieldMultiTS holding data of the first field + * Returns a new instance of MEDFileFieldMultiTS or MEDFileInt32FieldMultiTS holding data of the first field * that has been read from a specified MED file. * \param [in] fileName - the name of the MED file to read. - * \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS or MEDFileIntFieldMultiTS. The caller + * \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS or MEDFileInt32FieldMultiTS. The caller * is to delete this field using decrRef() as it is no more needed. * \throw If reading the file fails. */ @@ -1323,11 +1348,11 @@ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(med_idt fid, bool lo } /*! - * Returns a new instance of MEDFileFieldMultiTS or MEDFileIntFieldMultiTS holding data of a given field + * Returns a new instance of MEDFileFieldMultiTS or MEDFileInt32FieldMultiTS holding data of a given field * that has been read from a specified MED file. * \param [in] fileName - the name of the MED file to read. * \param [in] fieldName - the name of the field to read. - * \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS or MEDFileIntFieldMultiTS. The caller + * \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS or MEDFileInt32FieldMultiTS. The caller * is to delete this field using decrRef() as it is no more needed. * \throw If reading the file fails. * \throw If there is no field named \a fieldName in the file. @@ -1741,10 +1766,10 @@ MCAuto MEDFileAnyTypeFieldMultiTS::getCont } /*! - * Returns a new MEDFileField1TS or MEDFileIntField1TS holding data of a given time step of \a this field. + * Returns a new MEDFileField1TS or MEDFileInt32Field1TS holding data of a given time step of \a this field. * \param [in] iteration - the iteration number of a required time step. * \param [in] order - the iteration order number of required time step. - * \return MEDFileField1TS * or MEDFileIntField1TS *- a new instance of MEDFileField1TS or MEDFileIntField1TS. The caller is to + * \return MEDFileField1TS * or MEDFileInt32Field1TS *- a new instance of MEDFileField1TS or MEDFileInt32Field1TS. The caller is to * delete this field using decrRef() as it is no more needed. * \throw If there is no required time step in \a this field. */ @@ -1755,7 +1780,7 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTS::getTimeStep(int iteration, i } /*! - * Returns a new MEDFileField1TS or MEDFileIntField1TS holding data of a given time step of \a this field. + * Returns a new MEDFileField1TS or MEDFileInt32Field1TS holding data of a given time step of \a this field. * \param [in] time - the time of the time step of interest. * \param [in] eps - a precision used to compare time values. * \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller is to @@ -2041,7 +2066,8 @@ MCAuto MEDFileAnyTypeFieldMultiTS::Aggregate(const s throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : input vector is empty !"); std::size_t sz(fmtss.size()); std::vector fmtss1; - std::vector fmtss2; + std::vector fmtss2; + std::vector fmtss3; for(std::vector::const_iterator it=fmtss.begin();it!=fmtss.end();it++) { if(!(*it)) @@ -2052,20 +2078,28 @@ MCAuto MEDFileAnyTypeFieldMultiTS::Aggregate(const s fmtss1.push_back(elt1); continue; } - const MEDFileIntFieldMultiTS *elt2(dynamic_cast(*it)); + const MEDFileInt32FieldMultiTS *elt2(dynamic_cast(*it)); if(elt2) { fmtss2.push_back(elt2); continue; } + const MEDFileInt64FieldMultiTS *elt3(dynamic_cast(*it)); + if(elt3) + { + fmtss3.push_back(elt3); + continue; + } throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : not recognized type !"); } - if(fmtss1.size()!=sz && fmtss2.size()!=sz) + if(fmtss1.size()!=sz && fmtss2.size()!=sz && fmtss3.size()!=sz) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : type of data is not homogeneous !"); if(fmtss1.size()==sz) return AggregateHelperFMTS(fmtss1,dts); if(fmtss2.size()!=sz) - return AggregateHelperFMTS(fmtss2,dts); + return AggregateHelperFMTS(fmtss2,dts); + if(fmtss3.size()!=sz) + return AggregateHelperFMTS(fmtss3,dts); throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : not implemented yet !"); } @@ -2087,22 +2121,22 @@ MEDFileAnyTypeFieldMultiTS *MEDFileFieldMultiTS::shallowCpy() const * * \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations) * By default (true) the globals are deeply copied. - * \return MEDFileIntFieldMultiTS * - a new object that is the result of the conversion of \a this to int32 field. + * \return MEDFileInt32FieldMultiTS * - a new object that is the result of the conversion of \a this to int32 field. */ -MEDFileIntFieldMultiTS *MEDFileFieldMultiTS::convertToInt(bool isDeepCpyGlobs) const +MEDFileInt32FieldMultiTS *MEDFileFieldMultiTS::convertToInt(bool isDeepCpyGlobs) const { - MCAuto ret; + MCAuto ret; const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content); if(content) { const MEDFileFieldMultiTSWithoutSDA *contc=dynamic_cast(content); if(!contc) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !"); - MCAuto newc(contc->convertToInt()); - ret=static_cast(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent((MEDFileIntFieldMultiTSWithoutSDA *)newc)); + MCAuto newc(contc->convertToInt()); + ret=static_cast(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent((MEDFileInt32FieldMultiTSWithoutSDA *)newc)); } else - ret=MEDFileIntFieldMultiTS::New(); + ret=MEDFileInt32FieldMultiTS::New(); if(isDeepCpyGlobs) ret->deepCpyGlobs(*this); else @@ -2162,4 +2196,4 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTSIterator::nextt() return 0; } -//= MEDFileIntFieldMultiTS +//= MEDFileInt32FieldMultiTS diff --git a/src/MEDLoader/MEDFileFieldMultiTS.hxx b/src/MEDLoader/MEDFileFieldMultiTS.hxx index c565a3e0a..508aeb7cc 100644 --- a/src/MEDLoader/MEDFileFieldMultiTS.hxx +++ b/src/MEDLoader/MEDFileFieldMultiTS.hxx @@ -18,8 +18,7 @@ // // Author : Anthony Geay (EDF R&D) -#ifndef __MEDFILEFIELDMULTITS_HXX__ -#define __MEDFILEFIELDMULTITS_HXX__ +#pragma once #include "MEDLoaderDefines.hxx" #include "MEDFileField1TS.hxx" @@ -119,7 +118,7 @@ namespace MEDCoupling std::vector< MCAuto > _time_steps; }; - class MEDFileIntFieldMultiTSWithoutSDA; + class MEDFileInt32FieldMultiTSWithoutSDA; template class MEDFileTemplateFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA @@ -145,7 +144,7 @@ namespace MEDCoupling public: MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) { } MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; - MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA *convertToInt() const; + MEDLOADER_EXPORT MEDFileInt32FieldMultiTSWithoutSDA *convertToInt() const; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileFieldMultiTSWithoutSDA(*this); } MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileFieldMultiTSWithoutSDA"); } protected: @@ -168,19 +167,34 @@ namespace MEDCoupling MEDFileNDTemplateFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { } }; - class MEDFileIntFieldMultiTSWithoutSDA : public MEDFileNDTemplateFieldMultiTSWithoutSDA + class MEDFileInt32FieldMultiTSWithoutSDA : public MEDFileNDTemplateFieldMultiTSWithoutSDA { - friend class MEDFileTemplateFieldMultiTSWithoutSDA; + friend class MEDFileTemplateFieldMultiTSWithoutSDA; public: - MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) { } - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileIntFieldMultiTSWithoutSDA(*this); } - MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileIntFieldMultiTSWithoutSDA"); } + MEDLOADER_EXPORT MEDFileInt32FieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) { } + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileInt32FieldMultiTSWithoutSDA(*this); } + MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt32FieldMultiTSWithoutSDA"); } protected: - MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileNDTemplateFieldMultiTSWithoutSDA(fieldName,meshName) { } - MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { } + MEDFileInt32FieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileNDTemplateFieldMultiTSWithoutSDA(fieldName,meshName) { } + MEDFileInt32FieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { } med_field_type getMEDFileFieldType() const { return MED_INT32; } public: - MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA() { } + MEDLOADER_EXPORT MEDFileInt32FieldMultiTSWithoutSDA() { } + }; + + class MEDFileInt64FieldMultiTSWithoutSDA : public MEDFileNDTemplateFieldMultiTSWithoutSDA + { + friend class MEDFileTemplateFieldMultiTSWithoutSDA; + public: + MEDLOADER_EXPORT MEDFileInt64FieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) { } + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileInt64FieldMultiTSWithoutSDA(*this); } + MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt64FieldMultiTSWithoutSDA"); } + protected: + MEDFileInt64FieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileNDTemplateFieldMultiTSWithoutSDA(fieldName,meshName) { } + MEDFileInt64FieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { } + med_field_type getMEDFileFieldType() const { return MED_INT64; } + public: + MEDLOADER_EXPORT MEDFileInt64FieldMultiTSWithoutSDA() { } }; class MEDFileFloatFieldMultiTSWithoutSDA : public MEDFileNDTemplateFieldMultiTSWithoutSDA @@ -347,7 +361,7 @@ namespace MEDCoupling friend class MEDFileTemplateFieldMultiTS; public: MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const; - MEDLOADER_EXPORT MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const; + MEDLOADER_EXPORT MEDFileInt32FieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const; MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileFieldMultiTS"); } // MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; @@ -377,19 +391,37 @@ namespace MEDCoupling /*! * User class. */ - class MEDFileIntFieldMultiTS : public MEDFileNDTemplateFieldMultiTS + class MEDFileInt32FieldMultiTS : public MEDFileNDTemplateFieldMultiTS { - friend class MEDFileTemplateFieldMultiTS; + friend class MEDFileTemplateFieldMultiTS; public: - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const { return new MEDFileIntFieldMultiTS(*this); } - MEDLOADER_EXPORT MEDFileIntFieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); } - MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileIntFieldMultiTS"); } + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const { return new MEDFileInt32FieldMultiTS(*this); } + MEDLOADER_EXPORT MEDFileInt32FieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); } + MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt32FieldMultiTS"); } private: - ~MEDFileIntFieldMultiTS() { } - MEDFileIntFieldMultiTS() { } - MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateFieldMultiTS(other,shallowCopyOfContent) { } - MEDFileIntFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateFieldMultiTS(fid,loadAll,ms) { } - MEDFileIntFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0):MEDFileNDTemplateFieldMultiTS(fid,fieldName,loadAll,ms,entities) { } + ~MEDFileInt32FieldMultiTS() { } + MEDFileInt32FieldMultiTS() { } + MEDFileInt32FieldMultiTS(const MEDFileInt32FieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateFieldMultiTS(other,shallowCopyOfContent) { } + MEDFileInt32FieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateFieldMultiTS(fid,loadAll,ms) { } + MEDFileInt32FieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0):MEDFileNDTemplateFieldMultiTS(fid,fieldName,loadAll,ms,entities) { } + }; + + /*! + * User class. + */ + class MEDFileInt64FieldMultiTS : public MEDFileNDTemplateFieldMultiTS + { + friend class MEDFileTemplateFieldMultiTS; + public: + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const { return new MEDFileInt64FieldMultiTS(*this); } + MEDLOADER_EXPORT MEDFileInt64FieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); } + MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileInt64FieldMultiTS"); } + private: + ~MEDFileInt64FieldMultiTS() { } + MEDFileInt64FieldMultiTS() { } + MEDFileInt64FieldMultiTS(const MEDFileInt64FieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateFieldMultiTS(other,shallowCopyOfContent) { } + MEDFileInt64FieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateFieldMultiTS(fid,loadAll,ms) { } + MEDFileInt64FieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0):MEDFileNDTemplateFieldMultiTS(fid,fieldName,loadAll,ms,entities) { } }; /*! @@ -422,5 +454,3 @@ namespace MEDCoupling int _nb_iter; }; } - -#endif diff --git a/src/MEDLoader/MEDFileUtilities.cxx b/src/MEDLoader/MEDFileUtilities.cxx index 280963984..ad4004df8 100644 --- a/src/MEDLoader/MEDFileUtilities.cxx +++ b/src/MEDLoader/MEDFileUtilities.cxx @@ -49,18 +49,21 @@ med_access_mode MEDFileUtilities::TraduceWriteMode(int medloaderwritemode) const char *MEDFileUtilities::GetReadableMEDFieldType(med_field_type ft) { static const char medFloat64[]="MED_FLOAT64"; + static const char medFloat32[]="MED_FLOAT32"; static const char medInt32[]="MED_INT32"; static const char medInt64[]="MED_INT64"; switch(ft) { case MED_FLOAT64: return medFloat64; + case MED_FLOAT32: + return medFloat32; case MED_INT32: return medInt32; case MED_INT64: return medInt64; default: - throw INTERP_KERNEL::Exception("Non supported field type ! Should be FLOAT64, INT32 or INT64 !"); + throw INTERP_KERNEL::Exception("Non supported field type ! Should be FLOAT64, FLOAT32, INT32 or INT64 !"); } } diff --git a/src/MEDLoader/MEDLoader.cxx b/src/MEDLoader/MEDLoader.cxx index 4899e483c..687d0bcbf 100644 --- a/src/MEDLoader/MEDLoader.cxx +++ b/src/MEDLoader/MEDLoader.cxx @@ -30,7 +30,7 @@ #include "MEDCouplingMemArray.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldFloat.hxx" -#include "MEDCouplingFieldInt.hxx" +#include "MEDCouplingFieldInt32.hxx" #include "MEDCouplingGaussLocalization.hxx" #include "MEDCouplingTraits.hxx" #include "MCAuto.hxx" @@ -1263,11 +1263,11 @@ MCAuto MEDCoupling::ReadField(const std::string& } } { - MCAuto f1(MEDCoupling::DynamicCast(f)); + MCAuto f1(MEDCoupling::DynamicCast(f)); if(f1.isNotNull()) { - MCAuto ret(f1->field(mesh)); - return MEDCoupling::DynamicCast(ret); + MCAuto ret(f1->field(mesh)); + return MEDCoupling::DynamicCast(ret); } } { @@ -1390,10 +1390,10 @@ namespace MEDCoupling } } { - MCAuto f1(MEDCoupling::DynamicCast(f)); + MCAuto f1(MEDCoupling::DynamicCast(f)); if(f1.isNotNull()) { - MCAuto ret(ReadFieldCellLikeT(f1,type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order)); + MCAuto ret(ReadFieldCellLikeT(f1,type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order)); return ret.retn(); } } @@ -1467,10 +1467,10 @@ MEDCoupling::MEDCouplingField *MEDCoupling::ReadFieldNode(const std::string& fil } } { - MCAuto f1(MEDCoupling::DynamicCast(f)); + MCAuto f1(MEDCoupling::DynamicCast(f)); if(f1.isNotNull()) { - MCAuto ret(ReadFieldNodeT(f1,fileName,meshName,meshDimRelToMax,fieldName,iteration,order)); + MCAuto ret(ReadFieldNodeT(f1,fileName,meshName,meshDimRelToMax,fieldName,iteration,order)); return ret.retn(); } } @@ -1744,7 +1744,7 @@ void MEDCoupling::WriteField(const std::string& fileName, const MEDCoupling::MED } } { - const MEDCoupling::MEDCouplingFieldInt *f1(dynamic_cast(f)); + const MEDCoupling::MEDCouplingFieldInt32 *f1(dynamic_cast(f)); if(f1) { WriteFieldT(fileName,f1,writeFromScratch); @@ -1805,7 +1805,7 @@ void MEDCoupling::WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, return ; } { - const MEDCoupling::MEDCouplingFieldInt *f1(dynamic_cast(f)); + const MEDCoupling::MEDCouplingFieldInt32 *f1(dynamic_cast(f)); if(f1) WriteFieldUsingAlreadyWrittenMeshT(fileName,f1); return ; diff --git a/src/MEDLoader/MEDLoaderTraits.hxx b/src/MEDLoader/MEDLoaderTraits.hxx index 9a997436b..336517e73 100644 --- a/src/MEDLoader/MEDLoaderTraits.hxx +++ b/src/MEDLoader/MEDLoaderTraits.hxx @@ -18,10 +18,10 @@ // // Author : Anthony Geay (EDF R&D) -#ifndef __MEDLOADERTRAITS_HXX__ -#define __MEDLOADERTRAITS_HXX__ +#pragma once #include "MEDLoaderDefines.hxx" +#include "MCType.hxx" namespace MEDCoupling { @@ -33,15 +33,19 @@ namespace MEDCoupling class MEDFileFieldMultiTS; class MEDFileField1TS; - class MEDFileIntFieldMultiTS; - class MEDFileIntField1TS; + class MEDFileInt32FieldMultiTS; + class MEDFileInt64FieldMultiTS; + class MEDFileInt32Field1TS; + class MEDFileInt64Field1TS; class MEDFileFloatFieldMultiTS; class MEDFileFloatField1TS; class MEDFileField1TSWithoutSDA; - class MEDFileIntField1TSWithoutSDA; + class MEDFileInt32Field1TSWithoutSDA; + class MEDFileInt64Field1TSWithoutSDA; class MEDFileFloatField1TSWithoutSDA; class MEDFileFieldMultiTSWithoutSDA; - class MEDFileIntFieldMultiTSWithoutSDA; + class MEDFileInt32FieldMultiTSWithoutSDA; + class MEDFileInt64FieldMultiTSWithoutSDA; class MEDFileFloatFieldMultiTSWithoutSDA; template<> @@ -63,12 +67,21 @@ namespace MEDCoupling }; template<> - struct MEDLOADER_EXPORT MLFieldTraits + struct MEDLOADER_EXPORT MLFieldTraits { - typedef MEDFileIntFieldMultiTSWithoutSDA FMTSWSDAType; - typedef MEDFileIntFieldMultiTS FMTSType; - typedef MEDFileIntField1TS F1TSType; - typedef MEDFileIntField1TSWithoutSDA F1TSWSDAType; + typedef MEDFileInt32FieldMultiTSWithoutSDA FMTSWSDAType; + typedef MEDFileInt32FieldMultiTS FMTSType; + typedef MEDFileInt32Field1TS F1TSType; + typedef MEDFileInt32Field1TSWithoutSDA F1TSWSDAType; + }; + + template<> + struct MEDLOADER_EXPORT MLFieldTraits + { + typedef MEDFileInt64FieldMultiTSWithoutSDA FMTSWSDAType; + typedef MEDFileInt64FieldMultiTS FMTSType; + typedef MEDFileInt64Field1TS F1TSType; + typedef MEDFileInt64Field1TSWithoutSDA F1TSWSDAType; }; template @@ -98,5 +111,3 @@ namespace MEDCoupling static const char ClassName[]; }; } - -#endif diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 062e28200..24f3aedae 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -184,15 +184,25 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileFieldMultiTS::getUndergroundDataArray; %newobject MEDCoupling::MEDFileFieldMultiTS::convertToInt; -%newobject MEDCoupling::MEDFileIntFieldMultiTS::New; -%newobject MEDCoupling::MEDFileIntFieldMultiTS::field; -%newobject MEDCoupling::MEDFileIntFieldMultiTS::LoadSpecificEntities; -%newobject MEDCoupling::MEDFileIntFieldMultiTS::getUndergroundDataArray; -%newobject MEDCoupling::MEDFileIntFieldMultiTS::convertToDouble; -%newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtLevel; -%newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtTopLevel; -%newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel; -%newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtLevelOld; +%newobject MEDCoupling::MEDFileInt32FieldMultiTS::New; +%newobject MEDCoupling::MEDFileInt32FieldMultiTS::field; +%newobject MEDCoupling::MEDFileInt32FieldMultiTS::LoadSpecificEntities; +%newobject MEDCoupling::MEDFileInt32FieldMultiTS::getUndergroundDataArray; +%newobject MEDCoupling::MEDFileInt32FieldMultiTS::convertToDouble; +%newobject MEDCoupling::MEDFileInt32FieldMultiTS::getFieldAtLevel; +%newobject MEDCoupling::MEDFileInt32FieldMultiTS::getFieldAtTopLevel; +%newobject MEDCoupling::MEDFileInt32FieldMultiTS::getFieldOnMeshAtLevel; +%newobject MEDCoupling::MEDFileInt32FieldMultiTS::getFieldAtLevelOld; + +%newobject MEDCoupling::MEDFileInt64FieldMultiTS::New; +%newobject MEDCoupling::MEDFileInt64FieldMultiTS::field; +%newobject MEDCoupling::MEDFileInt64FieldMultiTS::LoadSpecificEntities; +%newobject MEDCoupling::MEDFileInt64FieldMultiTS::getUndergroundDataArray; +%newobject MEDCoupling::MEDFileInt64FieldMultiTS::convertToDouble; +%newobject MEDCoupling::MEDFileInt64FieldMultiTS::getFieldAtLevel; +%newobject MEDCoupling::MEDFileInt64FieldMultiTS::getFieldAtTopLevel; +%newobject MEDCoupling::MEDFileInt64FieldMultiTS::getFieldOnMeshAtLevel; +%newobject MEDCoupling::MEDFileInt64FieldMultiTS::getFieldAtLevelOld; %newobject MEDCoupling::MEDFileFloatFieldMultiTS::New; %newobject MEDCoupling::MEDFileFloatFieldMultiTS::field; @@ -218,14 +228,23 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileField1TS::getUndergroundDataArray; %newobject MEDCoupling::MEDFileField1TS::convertToInt; -%newobject MEDCoupling::MEDFileIntField1TS::New; -%newobject MEDCoupling::MEDFileIntField1TS::field; -%newobject MEDCoupling::MEDFileIntField1TS::getFieldAtLevel; -%newobject MEDCoupling::MEDFileIntField1TS::getFieldAtTopLevel; -%newobject MEDCoupling::MEDFileIntField1TS::getFieldOnMeshAtLevel; -%newobject MEDCoupling::MEDFileIntField1TS::getFieldAtLevelOld; -%newobject MEDCoupling::MEDFileIntField1TS::getUndergroundDataArray; -%newobject MEDCoupling::MEDFileIntField1TS::convertToDouble; +%newobject MEDCoupling::MEDFileInt32Field1TS::New; +%newobject MEDCoupling::MEDFileInt32Field1TS::field; +%newobject MEDCoupling::MEDFileInt32Field1TS::getFieldAtLevel; +%newobject MEDCoupling::MEDFileInt32Field1TS::getFieldAtTopLevel; +%newobject MEDCoupling::MEDFileInt32Field1TS::getFieldOnMeshAtLevel; +%newobject MEDCoupling::MEDFileInt32Field1TS::getFieldAtLevelOld; +%newobject MEDCoupling::MEDFileInt32Field1TS::getUndergroundDataArray; +%newobject MEDCoupling::MEDFileInt32Field1TS::convertToDouble; + +%newobject MEDCoupling::MEDFileInt64Field1TS::New; +%newobject MEDCoupling::MEDFileInt64Field1TS::field; +%newobject MEDCoupling::MEDFileInt64Field1TS::getFieldAtLevel; +%newobject MEDCoupling::MEDFileInt64Field1TS::getFieldAtTopLevel; +%newobject MEDCoupling::MEDFileInt64Field1TS::getFieldOnMeshAtLevel; +%newobject MEDCoupling::MEDFileInt64Field1TS::getFieldAtLevelOld; +%newobject MEDCoupling::MEDFileInt64Field1TS::getUndergroundDataArray; +%newobject MEDCoupling::MEDFileInt64Field1TS::convertToDouble; %newobject MEDCoupling::MEDFileFloatField1TS::New; %newobject MEDCoupling::MEDFileFloatField1TS::field; @@ -305,11 +324,13 @@ using namespace MEDCoupling; %feature("unref") MEDFileFieldLoc "$this->decrRef();" %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();" %feature("unref") MEDFileField1TS "$this->decrRef();" -%feature("unref") MEDFileIntField1TS "$this->decrRef();" +%feature("unref") MEDFileInt32Field1TS "$this->decrRef();" +%feature("unref") MEDFileInt64Field1TS "$this->decrRef();" %feature("unref") MEDFileFloatField1TS "$this->decrRef();" %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();" %feature("unref") MEDFileFieldMultiTS "$this->decrRef();" -%feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();" +%feature("unref") MEDFileInt32FieldMultiTS "$this->decrRef();" +%feature("unref") MEDFileInt64FieldMultiTS "$this->decrRef();" %feature("unref") MEDFileFloatFieldMultiTS "$this->decrRef();" %feature("unref") MEDFileMeshSupports "$this->decrRef();" %feature("unref") MEDFileStructureElements "$this->decrRef();" @@ -2269,7 +2290,7 @@ namespace MEDCoupling static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true); static MEDFileField1TS *New(DataArrayByte *db); static MEDFileField1TS *New(); - MEDCoupling::MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const; + MEDCoupling::MEDFileInt32Field1TS *convertToInt(bool isDeepCpyGlobs=true) const; void copyTimeInfoFrom(MEDCouplingFieldDouble *mcf); MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const; MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const; @@ -2377,51 +2398,51 @@ namespace MEDCoupling } }; - class MEDFileIntField1TS : public MEDFileAnyTypeField1TS + class MEDFileInt32Field1TS : public MEDFileAnyTypeField1TS { public: - static MEDFileIntField1TS *New(); - static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true); - static MEDFileIntField1TS *New(DataArrayByte *db); - static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); - static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true); + static MEDFileInt32Field1TS *New(); + static MEDFileInt32Field1TS *New(const std::string& fileName, bool loadAll=true); + static MEDFileInt32Field1TS *New(DataArrayByte *db); + static MEDFileInt32Field1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); + static MEDFileInt32Field1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true); MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const; // - void setFieldNoProfileSBT(const MEDCouplingFieldInt *field); - void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); - void setFieldProfileFlatly(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); - void copyTimeInfoFrom(MEDCouplingFieldInt *mcf); - MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const; - MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const; - MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const; - MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const; - MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const; - MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; + void setFieldNoProfileSBT(const MEDCouplingFieldInt32 *field); + void setFieldProfile(const MEDCouplingFieldInt32 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); + void setFieldProfileFlatly(const MEDCouplingFieldInt32 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); + void copyTimeInfoFrom(MEDCouplingFieldInt32 *mcf); + MEDCouplingFieldInt32 *field(const MEDFileMesh *mesh) const; + MEDCouplingFieldInt32 *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const; + MEDCouplingFieldInt32 *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const; + MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const; + MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const; + MEDCouplingFieldInt32 *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; %extend { - MEDFileIntField1TS() + MEDFileInt32Field1TS() { - return MEDFileIntField1TS::New(); + return MEDFileInt32Field1TS::New(); } - MEDFileIntField1TS(const std::string& fileName, bool loadAll=true) + MEDFileInt32Field1TS(const std::string& fileName, bool loadAll=true) { - return MEDFileIntField1TS::New(fileName,loadAll); + return MEDFileInt32Field1TS::New(fileName,loadAll); } - MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) + MEDFileInt32Field1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) { - return MEDFileIntField1TS::New(fileName,fieldName,loadAll); + return MEDFileInt32Field1TS::New(fileName,fieldName,loadAll); } - MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) + MEDFileInt32Field1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) { - return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll); + return MEDFileInt32Field1TS::New(fileName,fieldName,iteration,order,loadAll); } - MEDFileIntField1TS(DataArrayByte *db) + MEDFileInt32Field1TS(DataArrayByte *db) { - return MEDFileIntField1TS::New(db); + return MEDFileInt32Field1TS::New(db); } std::string __str__() const @@ -2431,7 +2452,7 @@ namespace MEDCoupling PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const { - return MEDFileField1TS_getFieldWithProfile(self,type,meshDimRelToMax,mesh); + return MEDFileField1TS_getFieldWithProfile(self,type,meshDimRelToMax,mesh); } DataArrayInt32 *getUndergroundDataArray() const @@ -2444,7 +2465,79 @@ namespace MEDCoupling PyObject *getUndergroundDataArrayExt() const { - return MEDFileField1TS_getUndergroundDataArrayExt(self); + return MEDFileField1TS_getUndergroundDataArrayExt(self); + } + } + }; + + class MEDFileInt64Field1TS : public MEDFileAnyTypeField1TS + { + public: + static MEDFileInt64Field1TS *New(); + static MEDFileInt64Field1TS *New(const std::string& fileName, bool loadAll=true); + static MEDFileInt64Field1TS *New(DataArrayByte *db); + static MEDFileInt64Field1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); + static MEDFileInt64Field1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true); + MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const; + // + void setFieldNoProfileSBT(const MEDCouplingFieldInt64 *field); + void setFieldProfile(const MEDCouplingFieldInt64 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); + void setFieldProfileFlatly(const MEDCouplingFieldInt64 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); + void copyTimeInfoFrom(MEDCouplingFieldInt64 *mcf); + MEDCouplingFieldInt64 *field(const MEDFileMesh *mesh) const; + MEDCouplingFieldInt64 *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const; + MEDCouplingFieldInt64 *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const; + MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const; + MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const; + MEDCouplingFieldInt64 *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; + %extend + { + MEDFileInt64Field1TS() + { + return MEDFileInt64Field1TS::New(); + } + + MEDFileInt64Field1TS(const std::string& fileName, bool loadAll=true) + { + return MEDFileInt64Field1TS::New(fileName,loadAll); + } + + MEDFileInt64Field1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) + { + return MEDFileInt64Field1TS::New(fileName,fieldName,loadAll); + } + + MEDFileInt64Field1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) + { + return MEDFileInt64Field1TS::New(fileName,fieldName,iteration,order,loadAll); + } + + MEDFileInt64Field1TS(DataArrayByte *db) + { + return MEDFileInt64Field1TS::New(db); + } + + std::string __str__() const + { + return self->simpleRepr(); + } + + PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const + { + return MEDFileField1TS_getFieldWithProfile(self,type,meshDimRelToMax,mesh); + } + + DataArrayInt64 *getUndergroundDataArray() const + { + DataArrayInt64 *ret=self->getUndergroundDataArray(); + if(ret) + ret->incrRef(); + return ret; + } + + PyObject *getUndergroundDataArrayExt() const + { + return MEDFileField1TS_getUndergroundDataArrayExt(self); } } }; @@ -2909,7 +3002,8 @@ namespace MEDCoupling } }; - class MEDFileIntFieldMultiTS; + class MEDFileInt32FieldMultiTS; + class MEDFileInt64FieldMultiTS; class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS { @@ -2928,7 +3022,7 @@ namespace MEDCoupling // void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field); void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); - MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const; + MEDFileInt32FieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const; %extend { MEDFileFieldMultiTS() @@ -3068,50 +3162,50 @@ namespace MEDCoupling } }; - class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS + class MEDFileInt32FieldMultiTS : public MEDFileAnyTypeFieldMultiTS { public: - static MEDFileIntFieldMultiTS *New(); - static MEDFileIntFieldMultiTS *New(const std::string& fileName, bool loadAll=true); - static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); - static MEDFileIntFieldMultiTS *New(DataArrayByte *db); + static MEDFileInt32FieldMultiTS *New(); + static MEDFileInt32FieldMultiTS *New(const std::string& fileName, bool loadAll=true); + static MEDFileInt32FieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); + static MEDFileInt32FieldMultiTS *New(DataArrayByte *db); // - void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field); - void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); + void appendFieldNoProfileSBT(const MEDCouplingFieldInt32 *field); + void appendFieldProfile(const MEDCouplingFieldInt32 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const; - MEDCouplingFieldInt *field(int iteration, int order, const MEDFileMesh *mesh) const; - MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const; - MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const; - MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const; - MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const; - MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; + MEDCouplingFieldInt32 *field(int iteration, int order, const MEDFileMesh *mesh) const; + MEDCouplingFieldInt32 *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const; + MEDCouplingFieldInt32 *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const; + MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const; + MEDCouplingFieldInt32 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const; + MEDCouplingFieldInt32 *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; %extend { - MEDFileIntFieldMultiTS() + MEDFileInt32FieldMultiTS() { - return MEDFileIntFieldMultiTS::New(); + return MEDFileInt32FieldMultiTS::New(); } - MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll=true) + MEDFileInt32FieldMultiTS(const std::string& fileName, bool loadAll=true) { - return MEDFileIntFieldMultiTS::New(fileName,loadAll); + return MEDFileInt32FieldMultiTS::New(fileName,loadAll); } - MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) + MEDFileInt32FieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) { - return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll); + return MEDFileInt32FieldMultiTS::New(fileName,fieldName,loadAll); } - MEDFileIntFieldMultiTS(DataArrayByte *db) + MEDFileInt32FieldMultiTS(DataArrayByte *db) { - return MEDFileIntFieldMultiTS::New(db); + return MEDFileInt32FieldMultiTS::New(db); } - static MEDFileIntFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true) + static MEDFileInt32FieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true) { std::vector > tmp(convertTimePairIdsFromPy(entities)); std::vector< std::pair > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp)); - return MEDFileIntFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll); + return MEDFileInt32FieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll); } std::string __str__() const @@ -3124,7 +3218,7 @@ namespace MEDCoupling DataArrayIdType *ret1=0; DataArrayInt32 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -3139,6 +3233,77 @@ namespace MEDCoupling } }; + class MEDFileInt64FieldMultiTS : public MEDFileAnyTypeFieldMultiTS + { + public: + static MEDFileInt64FieldMultiTS *New(); + static MEDFileInt64FieldMultiTS *New(const std::string& fileName, bool loadAll=true); + static MEDFileInt64FieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); + static MEDFileInt64FieldMultiTS *New(DataArrayByte *db); + // + void appendFieldNoProfileSBT(const MEDCouplingFieldInt64 *field); + void appendFieldProfile(const MEDCouplingFieldInt64 *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); + MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const; + MEDCouplingFieldInt64 *field(int iteration, int order, const MEDFileMesh *mesh) const; + MEDCouplingFieldInt64 *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const; + MEDCouplingFieldInt64 *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const; + MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const; + MEDCouplingFieldInt64 *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const; + MEDCouplingFieldInt64 *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; + %extend + { + MEDFileInt64FieldMultiTS() + { + return MEDFileInt64FieldMultiTS::New(); + } + + MEDFileInt64FieldMultiTS(const std::string& fileName, bool loadAll=true) + { + return MEDFileInt64FieldMultiTS::New(fileName,loadAll); + } + + MEDFileInt64FieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) + { + return MEDFileInt64FieldMultiTS::New(fileName,fieldName,loadAll); + } + + MEDFileInt64FieldMultiTS(DataArrayByte *db) + { + return MEDFileInt64FieldMultiTS::New(db); + } + + static MEDFileInt64FieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true) + { + std::vector > tmp(convertTimePairIdsFromPy(entities)); + std::vector< std::pair > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp)); + return MEDFileInt64FieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll); + } + + std::string __str__() const + { + return self->simpleRepr(); + } + + PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const + { + DataArrayIdType *ret1=0; + DataArrayInt64 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + return ret; + } + + DataArrayInt64 *getUndergroundDataArray(int iteration, int order) const + { + DataArrayInt64 *ret=self->getUndergroundDataArray(iteration,order); + if(ret) + ret->incrRef(); + return ret; + } + } + }; + class MEDFileFloatFieldMultiTS : public MEDFileAnyTypeFieldMultiTS { public: @@ -4169,4 +4334,12 @@ def exit1TS(self, exctype, exc, tb): pass MEDFileAnyTypeField1TS.__enter__=enter1TS MEDFileAnyTypeField1TS.__exit__=exit1TS +MEDFileIntField1TS = MEDFileInt32Field1TS +MEDFileIntFieldMultiTS = MEDFileInt32FieldMultiTS +if MEDCouplingUse64BitIDs(): + MEDFileIDField1TS = MEDFileInt64Field1TS + MEDFileIDFieldMultiTS = MEDFileInt64FieldMultiTS +else: + MEDFileIDField1TS = MEDFileInt32Field1TS + MEDFileIDFieldMultiTS = MEDFileInt32FieldMultiTS %} diff --git a/src/MEDLoader/Swig/MEDLoaderTest3.py b/src/MEDLoader/Swig/MEDLoaderTest3.py index 8b68a492e..de1a827a6 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -6735,7 +6735,36 @@ class MEDLoaderTest3(unittest.TestCase): def testMeshConvertFromMEDFileGeoType(self): self.assertEqual(MEDFileMesh.ConvertFromMEDFileGeoType(320),NORM_HEXA20) - + + @WriteInTmpDir + def testFieldInt64_0(self): + """ + Small basic test with I/O of field in int64. + """ + fname="Pyfile120.med" + arr = DataArrayDouble([0,1]) + m = MEDCouplingCMesh() ; m.setCoords(arr,arr) ; m.setName("mesh") ; m=m.buildUnstructured() + f = MEDCouplingFieldInt64(ON_CELLS) ; f.setName("field") + v = 1234567890123456 + f.setArray(DataArrayInt64([v])) + f.setMesh(m) + mm = MEDFileUMesh() + mm[0] = m + f1ts = MEDFileInt64Field1TS() + f1ts.setFieldNoProfileSBT(f) + fmts = MEDFileInt64FieldMultiTS() + fmts.pushBackTimeStep(f1ts) + fs = MEDFileFields() + fs.pushField(fmts) + mm.write(fname,2) + fs.write(fname,0) + # + mm = MEDFileMesh.New(fname) + fs = MEDFileFields(fname) + f = fs[0][0].field(mm) + self.assertTrue( isinstance(f,MEDCouplingFieldInt64) ) + self.assertEqual( f.getArray().getIJ(0,0) , v ) + pass if __name__ == "__main__": diff --git a/src/MEDLoader/Swig/MEDLoaderTypemaps.i b/src/MEDLoader/Swig/MEDLoaderTypemaps.i index 00bca60ad..1883c0926 100644 --- a/src/MEDLoader/Swig/MEDLoaderTypemaps.i +++ b/src/MEDLoader/Swig/MEDLoaderTypemaps.i @@ -66,8 +66,10 @@ static PyObject *convertMEDFileField1TS(MEDCoupling::MEDFileAnyTypeField1TS *p, } if(dynamic_cast(p)) ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileField1TS,owner); - if(dynamic_cast(p)) - ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileIntField1TS,owner); + if(dynamic_cast(p)) + ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileInt32Field1TS,owner); + if(dynamic_cast(p)) + ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileInt64Field1TS,owner); if(dynamic_cast(p)) ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileFloatField1TS,owner); if(!ret) @@ -85,8 +87,10 @@ static PyObject *convertMEDFileFieldMultiTS(MEDCoupling::MEDFileAnyTypeFieldMult } if(dynamic_cast(p)) ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileFieldMultiTS,owner); - if(dynamic_cast(p)) - ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileIntFieldMultiTS,owner); + if(dynamic_cast(p)) + ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileInt32FieldMultiTS,owner); + if(dynamic_cast(p)) + ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileInt64FieldMultiTS,owner); if(dynamic_cast(p)) ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileFloatFieldMultiTS,owner); if(!ret)