From: Anthony GEAY Date: Wed, 23 Sep 2020 18:59:20 +0000 (+0200) Subject: WIP X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=07c72fb4a567e09ff84d468390b9be01a8a6dfd9;p=tools%2Fmedcoupling.git WIP --- diff --git a/src/MEDCoupling/CMakeLists.txt b/src/MEDCoupling/CMakeLists.txt index b5783acad..2be1c384c 100644 --- a/src/MEDCoupling/CMakeLists.txt +++ b/src/MEDCoupling/CMakeLists.txt @@ -43,7 +43,7 @@ SET(medcoupling_SOURCES MEDCouplingField.cxx MEDCouplingFieldFloat.cxx MEDCouplingFieldDouble.cxx - MEDCouplingFieldInt.cxx + MEDCouplingFieldInt32.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..21400ed2a --- /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,MEDCouplingTimeDiscretizationInt::New(td)) +{ +} + +MEDCouplingFieldInt32::MEDCouplingFieldInt32(const MEDCouplingFieldInt32& other, bool deepCpy):MEDCouplingFieldT(other,deepCpy) +{ +} + +MEDCouplingFieldInt32::MEDCouplingFieldInt32(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 ! ** + */ +MEDCouplingFieldInt32::MEDCouplingFieldInt32(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td):MEDCouplingFieldT(ft,MEDCouplingTimeDiscretizationInt::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..1c2da92a9 --- /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, MEDCouplingTimeDiscretizationInt *td, MEDCouplingFieldDiscretization *type); + MEDCouplingFieldInt32(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td); + ~MEDCouplingFieldInt32() { } + }; +} diff --git a/src/MEDCoupling/MEDCouplingFieldTemplate.cxx b/src/MEDCoupling/MEDCouplingFieldTemplate.cxx index 4c10da495..c2af5884a 100644 --- a/src/MEDCoupling/MEDCouplingFieldTemplate.cxx +++ b/src/MEDCoupling/MEDCouplingFieldTemplate.cxx @@ -20,7 +20,7 @@ #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingMesh.hxx" -#include "MEDCouplingFieldInt.hxx" +#include "MEDCouplingFieldInt32.hxx" #include "MEDCouplingFieldFloat.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldDiscretization.hxx" @@ -39,7 +39,7 @@ 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); } @@ -54,7 +54,7 @@ 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); } @@ -97,7 +97,7 @@ 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) diff --git a/src/MEDCoupling/MEDCouplingFieldTemplate.hxx b/src/MEDCoupling/MEDCouplingFieldTemplate.hxx index 118e1dab1..74b032c68 100644 --- a/src/MEDCoupling/MEDCouplingFieldTemplate.hxx +++ b/src/MEDCoupling/MEDCouplingFieldTemplate.hxx @@ -18,14 +18,13 @@ // // 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 MEDCouplingFieldFloat; class MEDCouplingFieldDouble; /*! @@ -43,11 +42,11 @@ 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(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 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 +67,8 @@ 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(TypeOfField type); MEDCouplingFieldTemplate(const MEDCouplingFieldTemplate& other, bool deepCopy); }; } - -#endif diff --git a/src/MEDCoupling/MEDCouplingTraits.hxx b/src/MEDCoupling/MEDCouplingTraits.hxx index 806c58efa..05da709f7 100644 --- a/src/MEDCoupling/MEDCouplingTraits.hxx +++ b/src/MEDCoupling/MEDCouplingTraits.hxx @@ -41,7 +41,7 @@ namespace MEDCoupling class DataArrayInt64; class MEDCouplingFieldDouble; class MEDCouplingFieldFloat; - class MEDCouplingFieldInt; + class MEDCouplingFieldInt32; 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; };