X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParaMEDMEM%2FOverlapInterpolationMatrix.cxx;h=6fdc35ff7e28c25e95ec03e84eb8a2e87e2f5a9c;hb=7e632de173a3f7701ed288471c5de2bc0f55dbc3;hp=95b7e1b942198468d5772c6397dd6fa94270c63a;hpb=6f841c1f16f8b9d0b7ba50cf000ade240b2484b2;p=tools%2Fmedcoupling.git diff --git a/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx b/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx index 95b7e1b94..6fdc35ff7 100644 --- a/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx +++ b/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D +// Copyright (C) 2007-2016 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 @@ -29,7 +29,7 @@ #include "Interpolation2D.txx" #include "Interpolation3DSurf.hxx" #include "Interpolation3D.txx" -#include "Interpolation3D2D.txx" +#include "Interpolation2D3D.txx" #include "Interpolation2D1D.txx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingNormalizedUnstructuredMesh.txx" @@ -42,20 +42,21 @@ using namespace std; -namespace ParaMEDMEM +namespace MEDCoupling { OverlapInterpolationMatrix::OverlapInterpolationMatrix(ParaFIELD *source_field, ParaFIELD *target_field, const ProcessorGroup& group, const DECOptions& dec_options, - const INTERP_KERNEL::InterpolationOptions& i_opt): + const INTERP_KERNEL::InterpolationOptions& i_opt, + const OverlapElementLocator & locator): INTERP_KERNEL::InterpolationOptions(i_opt), DECOptions(dec_options), _source_field(source_field), _target_field(target_field), _source_support(source_field->getSupport()->getCellMesh()), _target_support(target_field->getSupport()->getCellMesh()), - _mapping(group), + _mapping(group, locator), _group(group) { } @@ -76,12 +77,14 @@ namespace ParaMEDMEM // TODO? Merge with MEDCouplingRemapper::prepareInterpKernelOnlyUU() ? /**! + * Local run (on this proc) of the sequential interpolation algorithm. + * * @param srcIds is null if the source mesh is on the local proc * @param trgIds is null if the source mesh is on the local proc * * One of the 2 is necessarily null (the two can be null together) */ - void OverlapInterpolationMatrix::addContribution(const MEDCouplingPointSet *src, const DataArrayInt *srcIds, const std::string& srcMeth, int srcProcId, + void OverlapInterpolationMatrix::computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayInt *srcIds, const std::string& srcMeth, int srcProcId, const MEDCouplingPointSet *trg, const DataArrayInt *trgIds, const std::string& trgMeth, int trgProcId) { std::string interpMethod(srcMeth); @@ -144,7 +147,7 @@ namespace ParaMEDMEM MEDCouplingNormalizedUnstructuredMesh<3,3> target_wrapper(trgC); MEDCouplingNormalizedUnstructuredMesh<3,3> source_wrapper(srcC); - INTERP_KERNEL::Interpolation3D2D interpolator (*this); + INTERP_KERNEL::Interpolation2D3D interpolator (*this); colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,sparse_matrix_part,interpMethod); } else if ( src->getMeshDimension() == 3 && trg->getMeshDimension() == 2 @@ -153,7 +156,7 @@ namespace ParaMEDMEM MEDCouplingNormalizedUnstructuredMesh<3,3> target_wrapper(trgC); MEDCouplingNormalizedUnstructuredMesh<3,3> source_wrapper(srcC); - INTERP_KERNEL::Interpolation3D2D interpolator (*this); + INTERP_KERNEL::Interpolation2D3D interpolator (*this); vector matrixTranspose; colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,sparse_matrix_part,interpMethod);//not a bug target in source. TransposeMatrix(matrixTranspose,colSize,sparse_matrix_part); @@ -240,7 +243,6 @@ namespace ParaMEDMEM _mapping.addContributionST(sparse_matrix_part,srcIds,srcProcId,trgIds,trgProcId); } - /*! * 'procsToSendField' gives the list of procs field data has to be sent to. * See OverlapElementLocator::computeBoundingBoxesAndTodoList() @@ -253,17 +255,34 @@ namespace ParaMEDMEM _mapping.prepare(procsToSendField,0); } - void OverlapInterpolationMatrix::computeDeno() + void OverlapInterpolationMatrix::computeSurfacesAndDeno() { - if(_target_field->getField()->getNature()==ConservativeVolumic) + if(_target_field->getField()->getNature()==IntensiveMaximum) _mapping.computeDenoConservativeVolumic(_target_field->getField()->getNumberOfTuplesExpected()); else - throw INTERP_KERNEL::Exception("Policy Not implemented yet : only ConservativeVolumic defined !"); + throw INTERP_KERNEL::Exception("OverlapDEC: Policy not implemented yet: only IntensiveMaximum!"); +// { +// if(_target_field->getField()->getNature()==IntensiveConservation) +// { +// MCAuto f; +// int orient = getOrientation(); // From InterpolationOptions inheritance +// if(orient == 2) // absolute areas +// f = _target_support->getMeasureField(true); +// else +// if(orient == 0) // relative areas +// f = _target_support->getMeasureField(false); +// else +// throw INTERP_KERNEL::Exception("OverlapDEC: orientation policy not impl. yet!"); +// _mapping.computeDenoRevIntegral(*f->getArray()); +// } +// else +// throw INTERP_KERNEL::Exception("OverlapDEC: Policy not implemented yet: only IntensiveMaximum and IntensiveConservation defined!"); +// } } - void OverlapInterpolationMatrix::multiply() + void OverlapInterpolationMatrix::multiply(double default_val) { - _mapping.multiply(_source_field->getField(),_target_field->getField()); + _mapping.multiply(_source_field->getField(),_target_field->getField(), default_val); } void OverlapInterpolationMatrix::transposeMultiply() @@ -271,11 +290,6 @@ namespace ParaMEDMEM _mapping.transposeMultiply(_target_field->getField(),_source_field->getField()); } -// bool OverlapInterpolationMatrix::isSurfaceComputationNeeded(const std::string& method) const -// { -// return method=="P0"; -// } - void OverlapInterpolationMatrix::TransposeMatrix(const std::vector& matIn, int nbColsMatIn, std::vector& matOut) {