X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingRemapper.hxx;h=8af3b052fca833128a03c22cac74dcb23a70efe6;hb=8f2a28585bcf231a8f976f36b7fb1d2eed8801c2;hp=b09539ec405af3653dedee3f876729613d9028ab;hpb=10f37bf6f33a762626d7f1093b2f5450c1688667;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingRemapper.hxx b/src/MEDCoupling/MEDCouplingRemapper.hxx index b09539ec4..8af3b052f 100644 --- a/src/MEDCoupling/MEDCouplingRemapper.hxx +++ b/src/MEDCoupling/MEDCouplingRemapper.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// 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. +// 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 @@ -16,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// Author : Anthony Geay (CEA/DEN) #ifndef __PARAMEDMEM_MEDCOUPLINGREMAPPER_HXX__ #define __PARAMEDMEM_MEDCOUPLINGREMAPPER_HXX__ @@ -24,69 +25,103 @@ #include "MEDCouplingTimeLabel.hxx" #include "InterpolationOptions.hxx" #include "MEDCouplingNatureOfField.hxx" +#include "MCType.hxx" +#include "MCAuto.hxx" + #include "InterpKernelException.hxx" #include #include -namespace ParaMEDMEM +namespace MEDCoupling { class MEDCouplingMesh; - class MEDCouplingUMesh; class MEDCouplingFieldDouble; class MEDCouplingFieldTemplate; } -namespace ParaMEDMEM +namespace MEDCoupling { + typedef enum + { + IK_ONLY_PREFERED = 0, + NOT_IK_ONLY_PREFERED = 1, + IK_ONLY_FORCED = 2, + NOT_IK_ONLY_FORCED =3 + } InterpolationMatrixPolicy; + class MEDCouplingRemapper : public TimeLabel, public INTERP_KERNEL::InterpolationOptions { public: MEDCOUPLINGREMAPPER_EXPORT MEDCouplingRemapper(); MEDCOUPLINGREMAPPER_EXPORT ~MEDCouplingRemapper(); - MEDCOUPLINGREMAPPER_EXPORT int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method) throw(INTERP_KERNEL::Exception); - MEDCOUPLINGREMAPPER_EXPORT int prepareEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target) throw(INTERP_KERNEL::Exception); - MEDCOUPLINGREMAPPER_EXPORT void transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception); - MEDCOUPLINGREMAPPER_EXPORT void partialTransfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField) throw(INTERP_KERNEL::Exception); - MEDCOUPLINGREMAPPER_EXPORT void reverseTransfer(MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception); - MEDCOUPLINGREMAPPER_EXPORT MEDCouplingFieldDouble *transferField(const MEDCouplingFieldDouble *srcField, double dftValue) throw(INTERP_KERNEL::Exception); - MEDCOUPLINGREMAPPER_EXPORT MEDCouplingFieldDouble *reverseTransferField(const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception); + MEDCOUPLINGREMAPPER_EXPORT int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method); + MEDCOUPLINGREMAPPER_EXPORT int prepareEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target); + MEDCOUPLINGREMAPPER_EXPORT void setCrudeMatrix(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, const std::vector >& m); + MEDCOUPLINGREMAPPER_EXPORT void setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, const std::vector >& m); + MEDCOUPLINGREMAPPER_EXPORT void transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue); + MEDCOUPLINGREMAPPER_EXPORT void partialTransfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField); + MEDCOUPLINGREMAPPER_EXPORT void reverseTransfer(MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *targetField, double dftValue); + MEDCOUPLINGREMAPPER_EXPORT MEDCouplingFieldDouble *transferField(const MEDCouplingFieldDouble *srcField, double dftValue); + MEDCOUPLINGREMAPPER_EXPORT MEDCouplingFieldDouble *reverseTransferField(const MEDCouplingFieldDouble *targetField, double dftValue); MEDCOUPLINGREMAPPER_EXPORT bool setOptionInt(const std::string& key, int value); MEDCOUPLINGREMAPPER_EXPORT bool setOptionDouble(const std::string& key, double value); MEDCOUPLINGREMAPPER_EXPORT bool setOptionString(const std::string& key, const std::string& value); + MEDCOUPLINGREMAPPER_EXPORT int getInterpolationMatrixPolicy() const; + MEDCOUPLINGREMAPPER_EXPORT void setInterpolationMatrixPolicy(int newInterpMatPol); + // + MEDCOUPLINGREMAPPER_EXPORT int nullifiedTinyCoeffInCrudeMatrixAbs(double maxValAbs); + MEDCOUPLINGREMAPPER_EXPORT int nullifiedTinyCoeffInCrudeMatrix(double scaleFactor); + MEDCOUPLINGREMAPPER_EXPORT double getMaxValueInCrudeMatrix() const; public: - MEDCOUPLINGREMAPPER_EXPORT const std::vector >& getCrudeMatrix() const; - MEDCOUPLINGREMAPPER_EXPORT static void PrintMatrix(const std::vector >& m); + MEDCOUPLINGREMAPPER_EXPORT const std::vector >& getCrudeMatrix() const; + MEDCOUPLINGREMAPPER_EXPORT mcIdType getNumberOfColsOfMatrix() const; + MEDCOUPLINGREMAPPER_EXPORT static void PrintMatrix(const std::vector >& m); + MEDCOUPLINGREMAPPER_EXPORT static std::string BuildMethodFrom(const std::string& meth1, const std::string& meth2); + MEDCOUPLINGREMAPPER_EXPORT void BuildFieldTemplatesFrom(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, MCAuto& src, MCAuto& target); private: - int prepareUU(const char *method) throw(INTERP_KERNEL::Exception); - int prepareEE(const char *method) throw(INTERP_KERNEL::Exception); + int prepareInterpKernelOnly(); + int prepareInterpKernelOnlyUU(); + int prepareInterpKernelOnlyEE(); + int prepareInterpKernelOnlyUC(); + int prepareInterpKernelOnlyCU(); + int prepareInterpKernelOnlyCC(); + // + int prepareNotInterpKernelOnly(); + int prepareNotInterpKernelOnlyGaussGauss(); + // + static int CheckInterpolationMethodManageableByNotOnlyInterpKernel(const std::string& method); + // + bool isInterpKernelOnlyOrNotOnly() const; void updateTime() const; + void checkPrepare() const; + std::string checkAndGiveInterpolationMethodStr(std::string& srcMeth, std::string& trgMeth) const; void releaseData(bool matrixSuppression); - void transferUnderground(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, bool isDftVal, double dftValue) throw(INTERP_KERNEL::Exception); + void restartUsing(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target); + void transferUnderground(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, bool isDftVal, double dftValue); void computeDeno(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField); - void computeDenoFromScratch(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField) throw(INTERP_KERNEL::Exception); + void computeDenoFromScratch(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField); void computeProduct(const double *inputPointer, int inputNbOfCompo, bool isDftVal, double dftValue, double *resPointer); void computeReverseProduct(const double *inputPointer, int inputNbOfCompo, double dftValue, double *resPointer); - void buildFinalInterpolationMatrixByConvolution(const std::vector< std::map >& m1D, - const std::vector< std::map >& m2D, - const int *corrCellIdSrc, int nbOf2DCellsSrc, int nbOf1DCellsSrc, - const int *corrCellIdTrg); - static void reverseMatrix(const std::vector >& matIn, int nbColsMatIn, - std::vector >& matOut); - static void computeRowSumAndColSum(const std::vector >& matrixDeno, - std::vector >& deno, std::vector >& denoReverse); - static void computeColSumAndRowSum(const std::vector >& matrixDeno, - std::vector >& deno, std::vector >& denoReverse); + void buildFinalInterpolationMatrixByConvolution(const std::vector< std::map >& m1D, + const std::vector< std::map >& m2D, + const mcIdType *corrCellIdSrc, mcIdType nbOf2DCellsSrc, mcIdType nbOf1DCellsSrc, + const mcIdType *corrCellIdTrg); + static void ReverseMatrix(const std::vector >& matIn, mcIdType nbColsMatIn, + std::vector >& matOut); + static void ComputeRowSumAndColSum(const std::vector >& matrixDeno, + std::vector >& deno, std::vector >& denoReverse); + static void ComputeColSumAndRowSum(const std::vector >& matrixDeno, + std::vector >& deno, std::vector >& denoReverse); private: - MEDCouplingMesh *_src_mesh; - MEDCouplingMesh *_target_mesh; - std::string _src_method; - std::string _target_method; + MCAuto _src_ft; + MCAuto _target_ft; + InterpolationMatrixPolicy _interp_matrix_pol; NatureOfField _nature_of_deno; unsigned int _time_deno_update; - std::vector > _matrix; - std::vector > _deno_multiply; - std::vector > _deno_reverse_multiply; + std::vector > _matrix; + std::vector > _deno_multiply; + std::vector > _deno_reverse_multiply; }; }