From: ageay Date: Thu, 15 Apr 2010 07:55:15 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: V5_1_main_FINAL~129 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=01ecf99e9113adc7ddb218f9cad3e0d029193b89;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx index 760f50320..dccf9b346 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx @@ -325,6 +325,24 @@ int MEDCouplingExtrudedMesh::findCorrespCellByNodalConn(const std::vector& throw INTERP_KERNEL::Exception(ostr.str().c_str()); } +/*! + * This method is callable on 1Dmeshes (meshDim==1 && spaceDim==3) returned by MEDCouplingExtrudedMesh::getMesh1D typically. + * These 1Dmeshes (meshDim==1 && spaceDim==3) have a special semantic because these meshes do not specify a static location but a translation along a path. + * This method checks that 'm1' and 'm2' are compatible, if not an exception is thrown. In case these meshes ('m1' and 'm2') are compatible 2 corresponding meshes + * are created ('m1r' and 'm2r') that can be used for interpolation. + * @param m1 input mesh with meshDim==1 and spaceDim==3 + * @param m2 input mesh with meshDim==1 and spaceDim==3 + * @param m1r output mesh with ref count equal to 1 with meshDim==1 and spaceDim==2 + * @param m2r output mesh with ref count equal to 1 with meshDim==1 and spaceDim==2 + * @throw in case that m1 and m2 are not compatible each other. + */ +void MEDCouplingExtrudedMesh::project1DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, + MEDCouplingUMesh *&m1r, MEDCouplingUMesh *&m2r) throw(INTERP_KERNEL::Exception) +{ + m1r=0; + m2r=0; +} + void MEDCouplingExtrudedMesh::rotate(const double *center, const double *vector, double angle) { _mesh2D->rotate(center,vector,angle); diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx index ee5f0d9ba..f60dea159 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx @@ -56,6 +56,8 @@ namespace ParaMEDMEM int getCellContainingPoint(const double *pos, double eps) const; static int findCorrespCellByNodalConn(const std::vector& nodalConnec, const int *revNodalPtr, const int *revNodalIndxPtr) throw(INTERP_KERNEL::Exception); + static void project1DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, + MEDCouplingUMesh *&m1r, MEDCouplingUMesh *&m2r) throw(INTERP_KERNEL::Exception); void rotate(const double *center, const double *vector, double angle); void translate(const double *vector); MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; diff --git a/src/MEDCoupling/MEDCouplingRemapper.cxx b/src/MEDCoupling/MEDCouplingRemapper.cxx index b5e198dce..4a21b5c21 100644 --- a/src/MEDCoupling/MEDCouplingRemapper.cxx +++ b/src/MEDCoupling/MEDCouplingRemapper.cxx @@ -20,8 +20,10 @@ #include "MEDCouplingMemArray.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldDiscretization.hxx" +#include "MEDCouplingExtrudedMesh.hxx" #include "MEDCouplingNormalizedUnstructuredMesh.txx" +#include "Interpolation2DCurve.txx" #include "Interpolation2D.txx" #include "Interpolation3D.txx" #include "Interpolation3DSurf.txx" @@ -285,7 +287,33 @@ int MEDCouplingRemapper::prepareUU(const char *method) int MEDCouplingRemapper::prepareEE(const char *method) { - return 0; + MEDCouplingExtrudedMesh *src_mesh=(MEDCouplingExtrudedMesh *)_src_mesh; + MEDCouplingExtrudedMesh *target_mesh=(MEDCouplingExtrudedMesh *)_target_mesh; + std::string methC(method); + if(methC!="P0P0") + throw INTERP_KERNEL::Exception("Only P0P0 method implemented for Extruded/Extruded meshes !"); + INTERP_KERNEL::Interpolation::checkAndSplitInterpolationMethod(method,_src_method,_target_method); + MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src_mesh->getMesh2D()); + MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh->getMesh2D()); + INTERP_KERNEL::Interpolation2D interpolation(*this); + std::vector > matrix2D; + int nbCols2D=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,matrix2D,method); + MEDCouplingUMesh *s1D,*t1D; + MEDCouplingExtrudedMesh::project1DMeshes(src_mesh->getMesh1D(),target_mesh->getMesh1D(),s1D,t1D); + MEDCouplingNormalizedUnstructuredMesh<2,1> s1DWrapper(s1D); + MEDCouplingNormalizedUnstructuredMesh<2,1> t1DWrapper(t1D); + std::vector > matrix1D; + int nbCols1D=interpolation.interpolateMeshes(s1DWrapper,t1DWrapper,matrix1D,method); + INTERP_KERNEL::Interpolation2DCurve myInterpolator; + // + _matrix.resize(matrix2D.size()*matrix1D.size()); + // + _deno_multiply.clear(); + _deno_multiply.resize(_matrix.size()); + _deno_reverse_multiply.clear(); + _deno_reverse_multiply.resize(nbCols2D*nbCols1D); + declareAsNew(); + return 1; } void MEDCouplingRemapper::updateTime()