}
}
else
- throw Exception("Invalid method choosed must be in \"P0P0\".");
+ throw Exception("Invalid method chosen must be in \"P0P0\".");
// create empty maps for all source elements
matrix.resize(intersector->getNumberOfRowsOfResMatrix());
}
}
else
- throw Exception("Invalid method choosed must be in \"P0P0\", \"P0P1\", \"P1P0\" or \"P1P1\".");
+ throw Exception("Invalid method chosen must be in \"P0P0\", \"P0P1\", \"P1P0\" or \"P1P1\".");
// create empty maps for all source elements
result.resize(intersector->getNumberOfRowsOfResMatrix());
{ intersector=new PointLocator3DIntersectorP1P1<MyMeshType,MatrixType>(targetMesh, srcMesh, getPrecision());
}
else
- throw Exception("Invalid method choosed must be in \"P0P0\", \"P0P1\", \"P1P0\" or \"P1P1\".");
+ throw Exception("Invalid method chosen must be in \"P0P0\", \"P0P1\", \"P1P0\" or \"P1P1\".");
// create empty maps for all source elements
result.resize(intersector->getNumberOfRowsOfResMatrix());
}
else if(srcMeshDim==3 && trgMeshDim==2 && srcSpaceDim==3)
{
- MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh);
- MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh);
- INTERP_KERNEL::Interpolation2D3D interpolation(*this);
- std::vector<std::map<int,double> > matrixTmp;
- std::string revMethod(BuildMethodFrom(trgMeth,srcMeth));
- nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod);
- ReverseMatrix(matrixTmp,nbCols,_matrix);
- nbCols=matrixTmp.size();
- INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
- if(!duplicateFaces.empty())
+ if(getIntersectionType()==INTERP_KERNEL::PointLocator)
{
- std::ostringstream oss; oss << "An unexpected situation happend ! For the following 2D Cells are part of edges shared by 3D cells :\n";
- for(std::map<int,std::set<int> >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++)
+ MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh);
+ MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh);
+ INTERP_KERNEL::Interpolation3D interpolation(*this);
+ nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method);
+ }
+ else
+ {
+ MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh);
+ MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh);
+ INTERP_KERNEL::Interpolation2D3D interpolation(*this);
+ std::vector<std::map<int,double> > matrixTmp;
+ std::string revMethod(BuildMethodFrom(trgMeth,srcMeth));
+ nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod);
+ ReverseMatrix(matrixTmp,nbCols,_matrix);
+ nbCols=matrixTmp.size();
+ INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
+ if(!duplicateFaces.empty())
{
- oss << "2D Cell #" << (*it).first << " is part of common face of following 3D cells ids : ";
- std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator<int>(oss," "));
- oss << std::endl;
+ std::ostringstream oss; oss << "An unexpected situation happend ! For the following 2D Cells are part of edges shared by 3D cells :\n";
+ for(std::map<int,std::set<int> >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++)
+ {
+ oss << "2D Cell #" << (*it).first << " is part of common face of following 3D cells ids : ";
+ std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator<int>(oss," "));
+ oss << std::endl;
+ }
}
}
}
self.assertEqual(rem.getCrudeMatrix(), [{}, {}])
pass
+ def testPointLocator3DTo2D(self):
+ """Target mesh has spaceDim==3 and meshDim==2. Source has spaceDim==3 and meshDim==3. Here we are on pointlocator alg.
+ The test evaluates on each nodes of target mesh the bary coor into source mesh."""
+ src=MEDCouplingCMesh()
+ arr=DataArrayDouble([0,1,2])
+ src.setCoords(arr,arr,arr)
+ src=src.buildUnstructured()
+ src.simplexize(PLANAR_FACE_5)
+ fsrc=MEDCouplingFieldDouble(ON_NODES) ; fsrc.setMesh(src)
+ fsrc.setArray(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]))
+ #
+ trg=MEDCouplingCMesh()
+ arr=DataArrayDouble([0,1])
+ trg.setCoords(arr,arr)
+ trg=trg.buildUnstructured()
+ trg.changeSpaceDimension(3,0.)
+ trg.translate([0.5,0.5,0.5])
+ #
+ arrTrg=fsrc.getValueOnMulti(trg.getCoords())
+ ftrg=MEDCouplingFieldDouble(ON_NODES)
+ ftrg.setMesh(trg)
+ ftrg.setArray(arrTrg)
+ ftrg.checkConsistencyLight()
+ ftrg.setNature(IntensiveMaximum)
+ #
+ fsrc.setNature(IntensiveMaximum)
+ remap=MEDCouplingRemapper()
+ remap.setIntersectionType(PointLocator)
+ self.assertEqual(remap.prepare(src,trg,"P1P1"),1)
+ ftrg2=remap.transferField(fsrc,1e300)
+ self.assertTrue(ftrg.isEqual(ftrg2,1e-12,1e-12))
+ pass
+
def testExtrudedOnDiffZLev1(self):
"""Non regression bug : This test is base on P0P0 ExtrudedExtruded. This test checks that if the input meshes are not based on a same plane // OXY the interpolation works"""
arrX=DataArrayDouble([0,1]) ; arrY=DataArrayDouble([0,1]) ; arrZ=DataArrayDouble([0,1,2])