From: Anthony Geay Date: Wed, 17 May 2017 07:41:21 +0000 (+0200) Subject: OK done. Factorization of code in FieldTemplate remaining X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=99304783df64037c79229b5368d7f1ad26719f5e;p=tools%2Fmedcoupling.git OK done. Factorization of code in FieldTemplate remaining --- diff --git a/src/MEDCoupling/MEDCouplingFieldTemplate.cxx b/src/MEDCoupling/MEDCouplingFieldTemplate.cxx index 362b92a7b..2e432b88a 100644 --- a/src/MEDCoupling/MEDCouplingFieldTemplate.cxx +++ b/src/MEDCoupling/MEDCouplingFieldTemplate.cxx @@ -31,17 +31,32 @@ using namespace MEDCoupling; MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::New(const MEDCouplingFieldDouble& f) { - return new MEDCouplingFieldTemplate(f); + return new MEDCouplingFieldTemplate(f,true); } MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::New(const MEDCouplingFieldFloat& f) { - return new MEDCouplingFieldTemplate(f); + return new MEDCouplingFieldTemplate(f,true); } MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::New(const MEDCouplingFieldInt& f) { - return new MEDCouplingFieldTemplate(f); + return new MEDCouplingFieldTemplate(f,true); +} + +MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::NewWithoutCheck(const MEDCouplingFieldDouble& f) +{ + return new MEDCouplingFieldTemplate(f,false); +} + +MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::NewWithoutCheck(const MEDCouplingFieldFloat& f) +{ + return new MEDCouplingFieldTemplate(f,false); +} + +MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::NewWithoutCheck(const MEDCouplingFieldInt& f) +{ + return new MEDCouplingFieldTemplate(f,false); } /*! @@ -52,22 +67,25 @@ MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::New(TypeOfField type) return new MEDCouplingFieldTemplate(type); } -MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f):MEDCouplingField(f,false) +MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f, bool isChecked):MEDCouplingField(f,false) { forceTimeOfThis(f); - checkConsistencyLight(); + if(isChecked) + checkConsistencyLight(); } -MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f):MEDCouplingField(f,false) +MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f, bool isChecked):MEDCouplingField(f,false) { forceTimeOfThis(f); - checkConsistencyLight(); + if(isChecked) + checkConsistencyLight(); } -MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f):MEDCouplingField(f,false) +MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f, bool isChecked):MEDCouplingField(f,false) { forceTimeOfThis(f); - checkConsistencyLight(); + if(isChecked) + checkConsistencyLight(); } MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(TypeOfField type):MEDCouplingField(type) diff --git a/src/MEDCoupling/MEDCouplingFieldTemplate.hxx b/src/MEDCoupling/MEDCouplingFieldTemplate.hxx index 47ba2bdc6..a12842f51 100644 --- a/src/MEDCoupling/MEDCouplingFieldTemplate.hxx +++ b/src/MEDCoupling/MEDCouplingFieldTemplate.hxx @@ -45,6 +45,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f); MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt& 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 std::string simpleRepr() const; MEDCOUPLING_EXPORT std::string advancedRepr() const; MEDCOUPLING_EXPORT void checkConsistencyLight() const; @@ -59,9 +62,9 @@ namespace MEDCoupling // MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; private: - MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f); - MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f); - MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f); + MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f, bool isChecked=true); + MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f, bool isChecked=true); + MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f, bool isChecked=true); MEDCouplingFieldTemplate(TypeOfField type); MEDCouplingFieldTemplate(const MEDCouplingFieldTemplate& other, bool deepCopy); }; diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 4eaca7d91..ad1abe180 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -7151,7 +7151,7 @@ void MEDFileField1TS::setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) void MEDFileField1TS::setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) { setFileName(""); - MCAuto ft(MEDCouplingFieldTemplate::New(*field)); + MCAuto ft(MEDCouplingFieldTemplate::NewWithoutCheck(*field)); contentNotNull()->setFieldProfile(field->timeDiscrSafe(),ft,field->getArray(),mesh,meshDimRelToMax,profile,*this,*contentNotNull()); } @@ -7278,7 +7278,7 @@ void MEDFileIntField1TS::setFieldNoProfileSBT(const MEDCouplingFieldInt *field) void MEDFileIntField1TS::setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) { setFileName(""); - MCAuto ft(MEDCouplingFieldTemplate::New(*field)); + MCAuto ft(MEDCouplingFieldTemplate::NewWithoutCheck(*field)); contentNotNull()->setFieldProfile(field->timeDiscrSafe(),ft,field->getArray(),mesh,meshDimRelToMax,profile,*this,*contentNotNull()); } @@ -8491,7 +8491,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingF MEDFileAnyTypeField1TSWithoutSDA *objC=createNew1TSWithoutSDAEmptyInstance(); MCAuto obj(objC); { - MCAuto ft(MEDCouplingFieldTemplate::New(*field)); + MCAuto ft(MEDCouplingFieldTemplate::NewWithoutCheck(*field)); objC->setFieldProfile(field->timeDiscrSafe(),ft,arr,mesh,meshDimRelToMax,profile,glob,*this); } copyTinyInfoFrom(field,arr);