/*! \page RemapperClasses The REMAPPER class. \section InterpKerHighLevUsage High-level usage The simplest way of using the \ref interptools in sequential mode is to use the class \c ParaMEDMEM::MEDCouplingRemapper . This class fulfills \c HXX2SALOME rules and may be used in YACS coupling graphs. - If you intend to use \ref MEDCoupling data structure, ParaMEDMEM::MEDCouplingRemapper class should be used : \code ... const char sourceFileName[]="source.med"; MEDCouplingFieldDouble *sourceField=MEDLoader::ReadFieldCell(sourceFileName,"Source_Mesh",0,"Density",/*iteration*/0,/*order*/0); const char targetFileName[]="target.med"; MEDCouplingUMesh *med_target_mesh=MEDLoader::ReadUMeshFromFile(targetFileName,"Target_Mesh",0); // sourceField->setNature(ConservativeVolumic);//Specify which formula to use in case of non overlapping meshes MEDCouplingRemapper remapper; remapper.setPrecision(1e-12); remapper.setIntersectionType(INTERP_KERNEL::Triangulation); remapper.prepare(sourceField->getMesh(),med_target_mesh,"P0P0"); MEDCouplingFieldDouble *targetField=remapper.transferField(sourceField,/*default_value*/4.57);//Any target cell not intercepted by any source cell will have value set to 4.57. ... // clean-up targetField->decrRef(); sourceField->decrRef(); med_target_mesh->decrRef(); \endcode (Note that the same API can be used with \ref medmem field instead of \ref medcoupling fields using another remapper class \ref medmemremapper.) \section InterpKerMidLevUsage Middle-level usage This mode is the mode that needs the minimum of prerequisites (algorithms and the datastructure you intend to use). On the other hand it is needed to specify precisely nature of interpolator. As consequence of the genericity of the interpolators, they are usable only by instanciating an underlying \ref InterpKerMeshType "mesh" and \ref InterpKerMatrixType "matrix" data structure fulfilling some requirements. The two following examples show how to use interpolator at this level. - The simplest way to use the interpolator with \ref medcoupling datastruture is illustrated in the following example. \code ... MEDCouplingUMesh *med_source_mesh=MEDLoader::ReadUMeshFromFile("source.med","Source_mesh",0); MEDCouplingUMesh *med_target_mesh=MEDLoader::ReadUMeshFromFile("target.med","Target_mesh",0); MEDCouplingNormalizedUnstructuredMesh<2,2> wrap_source_mesh(med_source_mesh); MEDCouplingNormalizedUnstructuredMesh<2,2> wrap_target_mesh(med_target_mesh); // Go for interpolation... INTERP_KERNEL::Interpolation2D myInterpolator; myInterpolator.setPrecision(1e-7); myInterpolator.setIntersectionType(INTERP_KERNEL::Geometric2D); std::vector > resultMatrix; INTERP_KERNEL::Matrix resultMatrix2; // here the interpolation is performed twice for this code to illustrate the possibility of storing data the interpolation matrix in 2 different data structures. myInterpolator.interpolateMeshes(wrap_source_mesh,wrap_target_mesh,resultMatrix,"P0P0"); myInterpolator.interpolateMeshes(wrap_source_mesh,wrap_target_mesh,resultMatrix2,"P0P0"); //Ok resultMatrix and resultMatrix2 contain matrix now ... \endcode - Same with VTK datastructure : \code ... vtkXMLUnstructuredGridReader *readerSource=vtkXMLUnstructuredGridReader::New(); readerSource->SetFileName("source.vtu"); vtkUnstructuredGrid *vtk_source_mesh=readerSource->GetOutput(); readerSource->Update(); vtkXMLUnstructuredGridReader *readerTarget=vtkXMLUnstructuredGridReader::New(); readerTarget->SetFileName("target.vtu"); vtkUnstructuredGrid *vtk_target_mesh=readerTarget->GetOutput(); readerTarget->Update(); // Ok at this point we have our mesh in VTK format. // Go to wrap vtk_source_mesh and vtk_target_mesh. VTKNormalizedUnstructuredMesh<2> wrap_source_mesh(vtk_source_mesh); VTKNormalizedUnstructuredMesh<2> wrap_target_mesh(vtk_target_mesh); // Go for interpolation... INTERP_KERNEL::Interpolation2D myInterpolator; //optionnal call to parametrize your interpolation. First precision, tracelevel, intersector wanted. myInterpolator.setOptions(1e-7,0,Geometric2D); INTERP_KERNEL::Matrix resultMatrix; myInterpolator.interpolateMeshes(wrap_source_mesh,wrap_target_mesh,resultMatrix,"P0P0"); //Ok let's multiply resultMatrix by source field to interpolate to target field. resultMatrix.multiply(...) //clean-up readerSource->Delete(); readerTarget->Delete(); ... \endcode */