1 // Copyright (C) 2007-2021 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Yann Pora (EDF R&D)
21 #include "MEDCouplingFieldInt32.hxx"
22 #include "MEDCouplingFieldInt64.hxx"
23 #include "MEDCouplingFieldT.txx"
24 #include "MEDCouplingFieldDouble.hxx"
25 #include "MEDCouplingFieldFloat.hxx"
26 #include "MEDCouplingFieldTemplate.hxx"
27 #include "MEDCouplingMesh.hxx"
28 #include "MEDCouplingMemArray.txx"
30 using namespace MEDCoupling;
32 template class MEDCoupling::MEDCouplingFieldT<Int32>;
34 MEDCouplingFieldInt32 *MEDCouplingFieldInt32::New(TypeOfField type, TypeOfTimeDiscretization td)
36 return new MEDCouplingFieldInt32(type,td);
39 MEDCouplingFieldInt32 *MEDCouplingFieldInt32::New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td)
41 return new MEDCouplingFieldInt32(ft,td);
44 MEDCouplingFieldInt32::MEDCouplingFieldInt32(TypeOfField type, TypeOfTimeDiscretization td):MEDCouplingFieldT<Int32>(type,MEDCouplingTimeDiscretizationInt32::New(td))
48 MEDCouplingFieldInt32::MEDCouplingFieldInt32(const MEDCouplingFieldInt32& other, bool deepCpy):MEDCouplingFieldT<Int32>(other,deepCpy)
52 MEDCouplingFieldInt32::MEDCouplingFieldInt32(NatureOfField n, MEDCouplingTimeDiscretizationInt32 *td, MEDCouplingFieldDiscretization *type):MEDCouplingFieldT<Int32>(type,n,td)
57 * ** WARINING : This method do not deeply copy neither mesh nor spatial discretization. Only a shallow copy (reference) is done for mesh and spatial discretization ! **
59 MEDCouplingFieldInt32::MEDCouplingFieldInt32(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td):MEDCouplingFieldT<Int32>(ft,MEDCouplingTimeDiscretizationInt32::New(td),false)
63 MEDCouplingFieldInt32 *MEDCouplingFieldInt32::deepCopy() const
65 return cloneWithMesh(true);
68 MEDCouplingFieldInt32 *MEDCouplingFieldInt32::clone(bool recDeepCpy) const
70 return new MEDCouplingFieldInt32(*this,recDeepCpy);
74 typename Traits<U>::FieldType *ConvertToUField(const MEDCouplingFieldInt32 *self)
76 MCAuto<MEDCouplingFieldTemplate> tmp(MEDCouplingFieldTemplate::New(*self));
78 double t0(self->getTime(t1,t2));
79 MCAuto<typename Traits<U>::FieldType > ret(Traits<U>::FieldType::New(*tmp,self->getTimeDiscretization()));
80 ret->setTime(t0,t1,t2);
83 MCAuto<typename Traits<U>::ArrayType> arr(self->getArray()->convertToOtherTypeOfArr<U>());
89 MEDCouplingFieldDouble *MEDCouplingFieldInt32::convertToDblField() const
91 return ConvertToUField<double>(this);
94 MEDCouplingFieldInt64 *MEDCouplingFieldInt32::convertToInt64Field() const
96 return ConvertToUField<Int64>(this);
99 MEDCouplingFieldFloat *MEDCouplingFieldInt32::convertToFloatField() const
101 return ConvertToUField<float>(this);