X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNEL%2FInterpolationCC.txx;h=954fdd74e3d6bc225cdb67cb06bdfc3eebd20991;hb=1b746b38f3cdeae6654a9501f37fde5e56e59288;hp=ecbd29210173c3130d4567cfa0cbca0b632d01da;hpb=9727e779d56acece98be02cdccd0f99cc5ef0fa2;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNEL/InterpolationCC.txx b/src/INTERP_KERNEL/InterpolationCC.txx index ecbd29210..954fdd74e 100644 --- a/src/INTERP_KERNEL/InterpolationCC.txx +++ b/src/INTERP_KERNEL/InterpolationCC.txx @@ -1,4 +1,4 @@ -// Copyright (C) 2009-2019 OPEN CASCADE +// Copyright (C) 2009-2024 OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -63,8 +63,8 @@ namespace INTERP_KERNEL * \brief Fills the matrix by precomputed cell interferences along axes * \param inter_of_axis - cell/cell interferences along each axis * \param result - matrix to fill in - * \param src_nb_cells[] - nb of cells along each of axes in the source mesh - * \param tgt_nb_cells[] - nb of cells along each of axes in the target mesh + * \param src_nb_cells - nb of cells along each of axes in the source mesh + * \param tgt_nb_cells - nb of cells along each of axes in the target mesh * \param src_i_cell - source cell number accumulated by previous axes * \param tgt_i_cell - target cell number accumulated by previous axes * \param src_prev_area - factor by which this axis icreases cell number @@ -74,15 +74,15 @@ namespace INTERP_KERNEL */ //================================================================================ - template + template void fillMatrix(const std::list< Interference > inter_of_axis[dim], MatrixType& result, - const int src_nb_cells[dim], - const int tgt_nb_cells[dim], - const int src_i_cell = 0, - const int tgt_i_cell = 0, - const int src_prev_area = 1, - const int tgt_prev_area = 1, + const ConnType src_nb_cells[dim], + const ConnType tgt_nb_cells[dim], + const ConnType src_i_cell = 0, + const ConnType tgt_i_cell = 0, + const ConnType src_prev_area = 1, + const ConnType tgt_prev_area = 1, const int axis = 0, const double prev_value = 1.0) { @@ -92,29 +92,29 @@ namespace INTERP_KERNEL { for ( TIntIterator i = inter_of_axis[axis].begin(); i != inter_of_axis[axis].end(); ++i ) { - double value = i->_length * prev_value; - int src_i = i->_src_index * src_prev_area + src_i_cell; - int tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell; + double value = i->_length * prev_value; + ConnType src_i = i->_src_index * src_prev_area + src_i_cell; + ConnType tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell; result[ tgt_i ].insert( std::make_pair( _TMI( src_i ), value )); } } else { - int src_prev_area_next = src_prev_area * src_nb_cells[ axis ]; - int tgt_prev_area_next = tgt_prev_area * tgt_nb_cells[ axis ]; + ConnType src_prev_area_next = src_prev_area * src_nb_cells[ axis ]; + ConnType tgt_prev_area_next = tgt_prev_area * tgt_nb_cells[ axis ]; for ( TIntIterator i = inter_of_axis[axis].begin(); i != inter_of_axis[axis].end(); ++i ) { - double value = i->_length * prev_value; - int src_i = i->_src_index * src_prev_area + src_i_cell; - int tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell; + double value = i->_length * prev_value; + ConnType src_i = i->_src_index * src_prev_area + src_i_cell; + ConnType tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell; // call for the next axis - fillMatrix(inter_of_axis, result, - src_nb_cells, tgt_nb_cells, src_i, tgt_i, - src_prev_area_next, tgt_prev_area_next, - axis+1, value ); + fillMatrix(inter_of_axis, result, + src_nb_cells, tgt_nb_cells, src_i, tgt_i, + src_prev_area_next, tgt_prev_area_next, + axis+1, value ); } } } @@ -141,7 +141,7 @@ namespace INTERP_KERNEL //================================================================================ template - int InterpolationCC::interpolateMeshes(const MyMeshType& src_mesh, + typename MyMeshType::MyConnType InterpolationCC::interpolateMeshes(const MyMeshType& src_mesh, const MyMeshType& tgt_mesh, MatrixType& result, const char * method) @@ -152,7 +152,8 @@ namespace INTERP_KERNEL // create empty maps for all target elements result.resize( tgt_mesh.getNumberOfElements() ); - const int ret = src_mesh.getNumberOfElements(); + typedef typename MyMeshType::MyConnType ConnType; + const ConnType ret = src_mesh.getNumberOfElements(); const double eps = getPrecision(); const int dim = MyMeshType::MY_MESHDIM; @@ -160,14 +161,15 @@ namespace INTERP_KERNEL const double* src_coords[ dim ]; const double* tgt_coords[ dim ]; - int src_nb_cells[ dim ]; - int tgt_nb_cells[ dim ]; + ConnType src_nb_cells[ dim ]; + ConnType tgt_nb_cells[ dim ]; for ( int j = 0; j < dim; ++j ) { - src_coords[ j ] = src_mesh.getCoordsAlongAxis( _TMI( j )); - tgt_coords[ j ] = tgt_mesh.getCoordsAlongAxis( _TMI( j )); - src_nb_cells[ j ] = src_mesh.nbCellsAlongAxis( _TMI( j )); - tgt_nb_cells[ j ] = tgt_mesh.nbCellsAlongAxis( _TMI( j )); + int axis = static_cast( _TMI( j )); + src_coords[ j ] = src_mesh.getCoordsAlongAxis( axis ); + tgt_coords[ j ] = tgt_mesh.getCoordsAlongAxis( axis ); + src_nb_cells[ j ] = src_mesh.nbCellsAlongAxis( axis ); + tgt_nb_cells[ j ] = tgt_mesh.nbCellsAlongAxis( axis ); } // ============================================ @@ -235,15 +237,15 @@ namespace INTERP_KERNEL switch ( dim ) { case 3: - fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); + fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); break; case 2: - fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); + fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); break; case 1: - fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); + fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); break; }