From ffdef130a5a36893d8e58d538884e79413975c7a Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Thu, 8 Feb 2018 17:38:01 +0100 Subject: [PATCH] Missing wrap of appendFieldProfileFlatly --- src/MEDCoupling/MEDCoupling1GTUMesh.cxx | 4 +- src/MEDCoupling/MEDCoupling1GTUMesh.hxx | 2 +- .../MEDCouplingMappedExtrudedMesh.cxx | 2 +- .../MEDCouplingMappedExtrudedMesh.hxx | 2 +- src/MEDCoupling/MEDCouplingMesh.hxx | 2 +- src/MEDCoupling/MEDCouplingStructuredMesh.cxx | 4 +- src/MEDCoupling/MEDCouplingStructuredMesh.hxx | 2 +- src/MEDCoupling/MEDCouplingUMesh.cxx | 4 +- src/MEDCoupling/MEDCouplingUMesh.hxx | 2 +- src/MEDCoupling_Swig/MEDCouplingCommon.i | 4 +- src/MEDLoader/MEDFileField.txx | 43 ++++++++++++++++--- src/MEDLoader/MEDFileField1TS.cxx | 6 ++- src/MEDLoader/MEDFileField1TS.hxx | 4 +- src/MEDLoader/MEDFileFieldMultiTS.cxx | 14 +++--- src/MEDLoader/MEDFileFieldMultiTS.hxx | 4 +- src/MEDLoader/Swig/MEDLoaderCommon.i | 3 ++ 16 files changed, 70 insertions(+), 32 deletions(-) diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx index b4862d76e..93b403949 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx @@ -178,7 +178,7 @@ std::vector MEDCoupling1GTUMesh::getDistributionOfTypes() const * - After \a code contains [NORM_...,nbCells,0], \a idsInPflPerType [[0,1]] and \a idsPerType is [[1,2]]
*/ -void MEDCoupling1GTUMesh::splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType) const +void MEDCoupling1GTUMesh::splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller) const { if(!profile) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::splitProfilePerType : input profile is NULL !"); @@ -188,7 +188,7 @@ void MEDCoupling1GTUMesh::splitProfilePerType(const DataArrayInt *profile, std:: code.resize(3); idsInPflPerType.resize(1); code[0]=(int)getCellModelEnum(); code[1]=nbTuples; idsInPflPerType.resize(1); - if(profile->isIota(nbOfCells)) + if(smartPflKiller && profile->isIota(nbOfCells)) { code[2]=-1; idsInPflPerType[0]=const_cast(profile); idsInPflPerType[0]->incrRef(); diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.hxx b/src/MEDCoupling/MEDCoupling1GTUMesh.hxx index d2f73c1b8..b69f9b130 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.hxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.hxx @@ -46,7 +46,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(std::size_t cellId) const; MEDCOUPLING_EXPORT std::set getAllGeoTypes() const; MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType) const; + MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const; MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; MEDCOUPLING_EXPORT void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const; MEDCOUPLING_EXPORT std::string getVTKDataSetType() const; diff --git a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx index 72e3af513..b20e45461 100644 --- a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx @@ -709,7 +709,7 @@ DataArrayInt *MEDCouplingMappedExtrudedMesh::checkTypeConsistencyAndContig(const throw INTERP_KERNEL::Exception("Not implemented yet !"); } -void MEDCouplingMappedExtrudedMesh::splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType) const +void MEDCouplingMappedExtrudedMesh::splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller) const { throw INTERP_KERNEL::Exception("Not implemented yet !"); } diff --git a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx index a3025954c..593b2eef1 100644 --- a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx @@ -92,7 +92,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void scale(const double *point, double factor); MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType) const; + MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const; MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const int *start, const int *end) const; MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const; MEDCOUPLING_EXPORT DataArrayInt *simplexize(int policy); diff --git a/src/MEDCoupling/MEDCouplingMesh.hxx b/src/MEDCoupling/MEDCouplingMesh.hxx index 32bd86391..a45a41749 100644 --- a/src/MEDCoupling/MEDCouplingMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMesh.hxx @@ -109,7 +109,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const = 0; MEDCOUPLING_EXPORT virtual std::vector getDistributionOfTypes() const = 0; MEDCOUPLING_EXPORT virtual DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const = 0; - MEDCOUPLING_EXPORT virtual void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType) const = 0; + MEDCOUPLING_EXPORT virtual void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const = 0; MEDCOUPLING_EXPORT virtual void getBoundingBox(double *bbox) const = 0; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const = 0; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const = 0; diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx index f423c03c9..a6b9706fd 100644 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx @@ -310,7 +310,7 @@ DataArrayInt *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std * - After \a code contains [NORM_...,nbCells,0], \a idsInPflPerType [[0,1]] and \a idsPerType is [[1,2]]
*/ -void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType) const +void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller) const { if(!profile || !profile->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::splitProfilePerType : input profile is NULL or not allocated !"); @@ -321,7 +321,7 @@ void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayInt *profile, code.resize(3); idsInPflPerType.resize(1); code[0]=(int)getTypeOfCell(0); code[1]=nbOfCells; idsInPflPerType.resize(1); - if(profile->isIota(nbOfCells)) + if(smartPflKiller && profile->isIota(nbOfCells)) { code[2]=-1; idsInPflPerType[0]=profile->deepCopy(); diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.hxx b/src/MEDCoupling/MEDCouplingStructuredMesh.hxx index 72857d6c8..2184b052c 100644 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.hxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.hxx @@ -49,7 +49,7 @@ namespace MEDCoupling //tools MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType) const; + MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const; MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *build1SGTUnstructured() const; MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const; MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const int *start, const int *end) const; diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 1bb16f76b..ee7493009 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -5681,7 +5681,7 @@ DataArrayInt *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector< * This vector can be empty in case of all geometric type cells are fully covered in ascending in the given input \a profile. * \throw if \a profile has not exactly one component. It throws too, if \a profile contains some values not in [0,getNumberOfCells()) or if \a this is not fully defined */ -void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType) const +void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller) const { if(!profile) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitProfilePerType : input profile is NULL !"); @@ -5723,7 +5723,7 @@ void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vec code[3*i]=(int)types[castId]; code[3*i+1]=tmp3->getNumberOfTuples(); MCAuto tmp4=rankInsideCast->selectByTupleId(tmp3->begin(),tmp3->begin()+tmp3->getNumberOfTuples()); - if(!tmp4->isIota(typeRangeVals[castId+1]-typeRangeVals[castId])) + if(!smartPflKiller || !tmp4->isIota(typeRangeVals[castId+1]-typeRangeVals[castId])) { tmp4->copyStringInfoFrom(*profile); idsPerType2.push_back(tmp4); diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index fec5af450..a565f217a 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -205,7 +205,7 @@ namespace MEDCoupling //utilities for MED File RW MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType) const; + MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const; MEDCOUPLING_EXPORT MEDCouplingUMesh *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh, DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *&revDesc, DataArrayInt *&revDescIndx, DataArrayInt *& nM1LevMeshIds, DataArrayInt *&meshnM1Old2New) const; MEDCOUPLING_EXPORT DataArrayInt *sortCellsInMEDFileFrmt(); MEDCOUPLING_EXPORT bool checkConsecutiveCellTypes() const; diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 65e671dda..71d441ee4 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -964,12 +964,12 @@ namespace MEDCoupling return self->checkTypeConsistencyAndContig(code,idsPerType); } - PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception) + PyObject *splitProfilePerType(const DataArrayInt *profile, bool smartPflKiller=true) const throw(INTERP_KERNEL::Exception) { std::vector code; std::vector idsInPflPerType; std::vector idsPerType; - self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType); + self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller); PyObject *ret=PyTuple_New(3); // if(code.size()%3!=0) diff --git a/src/MEDLoader/MEDFileField.txx b/src/MEDLoader/MEDFileField.txx index f0070f5de..42e3edad3 100644 --- a/src/MEDLoader/MEDFileField.txx +++ b/src/MEDLoader/MEDFileField.txx @@ -682,16 +682,32 @@ namespace MEDCoupling * \throw If the data array of \a this is already allocated but has different number of * components than \a field. * \throw If elements in \a mesh are not in the order suitable for writing to the MED file. - * \sa setFieldNoProfileSBT() + * \sa setFieldNoProfileSBT, setFieldProfileFlatly */ template void MEDFileTemplateField1TS::setFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) + { + setFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,true); + } + + /*! + * Same as setFieldProfile except that here profile will be created un + * \sa setFieldProfile + */ + template + void setFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) + { + setFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,false); + } + + template + void MEDFileTemplateField1TS::setFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller) { setFileName(""); MCAuto ft(MEDCouplingFieldTemplate::NewWithoutCheck(*field)); - contentNotNull()->setFieldProfile(field->timeDiscrSafe(),ft,field->getArray(),mesh,meshDimRelToMax,profile,*this,*contentNotNull()); + contentNotNull()->setFieldProfile(field->timeDiscrSafe(),ft,field->getArray(),mesh,meshDimRelToMax,profile,*this,*contentNotNull(),smartPflKiller); } - + /*! * Return an extraction of \a this using \a extractDef map to specify the extraction. * The keys of \a extractDef is level relative to max ext of \a mm mesh. @@ -1222,18 +1238,33 @@ namespace MEDCoupling * \throw If the data array of \a this is already allocated but has different number of * components than \a field. * \throw If elements in \a mesh are not in the order suitable for writing to the MED file. - * \sa setFieldNoProfileSBT() + * \sa setFieldNoProfileSBT, appendFieldProfileFlatly */ template void MEDFileTemplateFieldMultiTS::appendFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) + { + appendFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,true); + } + + /*! + * same as appendFieldProfile except that here profile is created unconditionaly + */ + template + void MEDFileTemplateFieldMultiTS::appendFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) + { + appendFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,false); + } + + template + void MEDFileTemplateFieldMultiTS::appendFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller) { const typename Traits::ArrayType *arr(NULL); if(field) arr=field->getArray(); MCAuto field2(MEDFileTemplateField1TS::ToFieldTemplateWithTime(field)); - contentNotNull()->appendFieldProfile(field2,arr,mesh,meshDimRelToMax,profile,*this); + contentNotNull()->appendFieldProfile(field2,arr,mesh,meshDimRelToMax,profile,*this,smartPflKiller); } - + template const typename MLFieldTraits::FMTSWSDAType *MEDFileTemplateFieldMultiTS::contentNotNull() const { diff --git a/src/MEDLoader/MEDFileField1TS.cxx b/src/MEDLoader/MEDFileField1TS.cxx index 004c178c5..3e04c813e 100644 --- a/src/MEDLoader/MEDFileField1TS.cxx +++ b/src/MEDLoader/MEDFileField1TS.cxx @@ -861,6 +861,8 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldNoProfileSBT(const TimeHolder *th * \param [in] profile - ids of mesh entities on which corresponding field values lie. * \param [in,out] glob - the global data where profiles and localization present in * \a field, if any, are added. + * \param [in] nasc - the name scope used to assign names. Depends on the caller on the top call stack + * \param [in] smartPflKiller - specifies if this method tries at most to avoid profiles * \throw If either \a field or \a mesh or \a profile has an empty name. * \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh. * \throw If the data array of \a field is not set. @@ -869,7 +871,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldNoProfileSBT(const TimeHolder *th * \throw If elements in \a mesh are not in the order suitable for writing to the MED file. * \sa setFieldNoProfileSBT() */ -void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) +void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller) { if(!field) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input field is null !"); @@ -882,7 +884,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, con MCAuto m(mesh->getMeshAtLevel(meshDimRelToMax)); if(type!=ON_NODES) { - m->splitProfilePerType(profile,code,idsInPflPerType,idsPerType); + m->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller); std::vector< MCAuto > idsInPflPerType2(idsInPflPerType.size()); std::copy(idsInPflPerType.begin(),idsInPflPerType.end(),idsInPflPerType2.begin()); std::vector< MCAuto > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin()); std::vector idsPerType3(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType3.begin()); diff --git a/src/MEDLoader/MEDFileField1TS.hxx b/src/MEDLoader/MEDFileField1TS.hxx index 54f75f887..5f0a85f05 100644 --- a/src/MEDLoader/MEDFileField1TS.hxx +++ b/src/MEDLoader/MEDFileField1TS.hxx @@ -87,7 +87,7 @@ namespace MEDCoupling MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT int copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr); MEDLOADER_EXPORT void setFieldNoProfileSBT(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); - MEDLOADER_EXPORT void setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); + MEDLOADER_EXPORT void setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller=true); MEDLOADER_EXPORT virtual void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const; MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *deepCopy() const = 0; MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const = 0; @@ -365,6 +365,7 @@ namespace MEDCoupling MEDLOADER_EXPORT typename Traits::FieldType *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; MEDLOADER_EXPORT void setFieldNoProfileSBT(const typename Traits::FieldType *field); MEDLOADER_EXPORT void setFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + MEDLOADER_EXPORT void setFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); MEDLOADER_EXPORT typename MLFieldTraits::F1TSType *extractPartImpl(const std::map >& extractDef, MEDFileMesh *mm) const; MEDLOADER_EXPORT MEDFileAnyTypeField1TS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); } protected: @@ -376,6 +377,7 @@ namespace MEDCoupling MEDFileTemplateField1TS(const typename MLFieldTraits::F1TSWSDAType& other, bool shallowCopyOfContent):MEDFileAnyTypeField1TS(other,shallowCopyOfContent) { } const typename MLFieldTraits::F1TSWSDAType *contentNotNull() const; typename MLFieldTraits::F1TSWSDAType *contentNotNull(); + void setFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller); }; /*! diff --git a/src/MEDLoader/MEDFileFieldMultiTS.cxx b/src/MEDLoader/MEDFileFieldMultiTS.cxx index 7630fc4c9..34dde39ad 100644 --- a/src/MEDLoader/MEDFileFieldMultiTS.cxx +++ b/src/MEDLoader/MEDFileFieldMultiTS.cxx @@ -1040,30 +1040,28 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT(const MEDCoup throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !"); if(!_time_steps.empty()) checkCoherencyOfTinyInfo(field,arr); - MEDFileAnyTypeField1TSWithoutSDA *objC(createNew1TSWithoutSDAEmptyInstance()); - MCAuto obj(objC); + MCAuto obj(createNew1TSWithoutSDAEmptyInstance()); { MCAuto ft(MEDCouplingFieldTemplate::New(*field)); - objC->setFieldNoProfileSBT(field->timeDiscrSafe(),ft,arr,glob,*this); + obj->setFieldNoProfileSBT(field->timeDiscrSafe(),ft,arr,glob,*this); } copyTinyInfoFrom(field,arr); _time_steps.push_back(obj); } -void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob) +void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller) { if(!field) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !"); if(!_time_steps.empty()) checkCoherencyOfTinyInfo(field,arr); - MEDFileAnyTypeField1TSWithoutSDA *objC=createNew1TSWithoutSDAEmptyInstance(); - MCAuto obj(objC); + MCAuto obj(createNew1TSWithoutSDAEmptyInstance()); { MCAuto ft(MEDCouplingFieldTemplate::NewWithoutCheck(*field)); - objC->setFieldProfile(field->timeDiscrSafe(),ft,arr,mesh,meshDimRelToMax,profile,glob,*this); + obj->setFieldProfile(field->timeDiscrSafe(),ft,arr,mesh,meshDimRelToMax,profile,glob,*this,smartPflKiller); } copyTinyInfoFrom(field,arr); - setMeshName(objC->getMeshName()); + setMeshName(obj->getMeshName()); _time_steps.push_back(obj); } diff --git a/src/MEDLoader/MEDFileFieldMultiTS.hxx b/src/MEDLoader/MEDFileFieldMultiTS.hxx index 40a9e08a9..6a812dc16 100644 --- a/src/MEDLoader/MEDFileFieldMultiTS.hxx +++ b/src/MEDLoader/MEDFileFieldMultiTS.hxx @@ -85,7 +85,7 @@ namespace MEDCoupling MEDLOADER_EXPORT void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const; MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector& levs) const; MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob); - MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob); + MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller); MEDLOADER_EXPORT std::vector< std::vector< std::pair > > getFieldSplitedByType(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 std::vector< std::vector > getTypesOfFieldAvailable() const; MEDLOADER_EXPORT DataArray *getUndergroundDataArray(int iteration, int order) const; @@ -312,6 +312,7 @@ namespace MEDCoupling // MEDLOADER_EXPORT void appendFieldNoProfileSBT(const typename Traits::FieldType *field); MEDLOADER_EXPORT void appendFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + MEDLOADER_EXPORT void appendFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); // MEDLOADER_EXPORT typename MLFieldTraits::F1TSType *getTimeStepAtPos(int pos) const; MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArray(int iteration, int order) const; @@ -321,6 +322,7 @@ namespace MEDCoupling protected: const typename MLFieldTraits::FMTSWSDAType *contentNotNull() const; typename MLFieldTraits::FMTSWSDAType *contentNotNull(); + void appendFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller); protected: ~MEDFileTemplateFieldMultiTS() { } MEDFileTemplateFieldMultiTS(); diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index ac5c2cbda..78821d92b 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -2233,6 +2233,7 @@ namespace MEDCoupling // void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception); void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception); + void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception); void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception); void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception); %extend @@ -2341,6 +2342,7 @@ namespace MEDCoupling // void setFieldNoProfileSBT(const MEDCouplingFieldInt *field) throw(INTERP_KERNEL::Exception); void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception); + void setFieldProfileFlatly(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception); void copyTimeInfoFrom(MEDCouplingFieldInt *mcf) throw(INTERP_KERNEL::Exception); MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception); @@ -2412,6 +2414,7 @@ namespace MEDCoupling // void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field) throw(INTERP_KERNEL::Exception); void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception); + void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception); void copyTimeInfoFrom(MEDCouplingFieldFloat *mcf) throw(INTERP_KERNEL::Exception); MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception); -- 2.39.2