From 7c577d2427f5da44e068092c20b20d49848c59fd Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 18 Dec 2008 17:35:21 +0000 Subject: [PATCH] MEDMEM Industrialization 2008 protect from negative areas --- src/ParaMEDMEM/InterpolationMatrix.cxx | 20 +++++++++++++++++--- src/ParaMEDMEM/ParaFIELD.cxx | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/ParaMEDMEM/InterpolationMatrix.cxx b/src/ParaMEDMEM/InterpolationMatrix.cxx index 9fba6504a..43ab7e4cb 100644 --- a/src/ParaMEDMEM/InterpolationMatrix.cxx +++ b/src/ParaMEDMEM/InterpolationMatrix.cxx @@ -152,7 +152,7 @@ namespace ParaMEDMEM //storing the source volumes _source_volume.resize(source_size); for (int i=0; igetValueIJ(i+1,1); + _source_volume[i] = fabs(source_triangle_surf->getValueIJ(i+1,1)); //loop over the elements to build the interpolation //matrix structures @@ -165,7 +165,7 @@ namespace ParaMEDMEM iter++) { //surface of the target triangle - double surf = target_triangle_surf->getValueIJ(iter->first,1); + double surf = fabs(target_triangle_surf->getValueIJ(iter->first,1)); //locating the (iproc, itriangle) pair in the list of columns vector >::iterator iter2 = @@ -201,7 +201,7 @@ namespace ParaMEDMEM else { // barycenter of intersection of cells ielem and iter->first - double* bary_centre = surfaces.getBaryCentre( ielem, iter->first ); + double* bary_centre = surfaces.findBaryCentre( ielem, iter->first ); // coordinates of a source cell const int* cell_conn = src_conn + nbNodesPerCell * ielem; for ( int i = 0; i < nbNodesPerCell; ++i, ++cell_conn ) @@ -213,6 +213,13 @@ namespace ParaMEDMEM _coeffs[ielem].push_back(make_pair(col_id, &coef_values.back() )); for ( int j = 1; j < bary_coords.size(); ++j ) coef_values.push_back(iter->second * bary_coords[j]); + +// cout << _source_group.myRank() << "| int area: "<< iter->second << endl; +// cout << "bary_centre: " << bary_centre[0] << ", " << bary_centre[1] << ", " +// << bary_centre[0] << ") " << endl << "bary_coords: "; +// for ( int j = 0; j < bary_coords.size(); ++j ) +// cout << bary_coords[j] << " "; +// cout << endl; } } } @@ -290,6 +297,9 @@ namespace ParaMEDMEM { double coeff_row = field.getValueIJ(cell_conn[ival],icomp+1); target_value[(colid-1)*nbcomp+icomp]+=value[ival]*coeff_row; +// cout << _source_group.myRank() << ": row " << irow << ", colid: " << colid +// << " -- coeff_row: " << coeff_row +// << ", value: " << value[ival] << endl; } } } @@ -307,6 +317,10 @@ namespace ParaMEDMEM { double coeff_row = field.getValueIJK(irow+1,icomp+1,ival+1); target_value[(colid-1)*nbcomp+icomp]+=value[ival]*coeff_row; +// cout << _source_group.myRank() << ": row " << irow << ", colid: " << colid +// << ", ival: " << ival +// << " -- coeff_row: " << coeff_row +// << ", value: " << value[ival] << endl; } } } diff --git a/src/ParaMEDMEM/ParaFIELD.cxx b/src/ParaMEDMEM/ParaFIELD.cxx index 30a533fe6..94450a82f 100644 --- a/src/ParaMEDMEM/ParaFIELD.cxx +++ b/src/ParaMEDMEM/ParaFIELD.cxx @@ -239,7 +239,7 @@ double ParaFIELD::getVolumeIntegral(int icomp) const if ( support->getEntity() != MED_EN::MED_NODE ) { FIELD* volume= getSupportVolumes(*support); for (int i=0; igetNumberOfElements(MED_EN::MED_ALL_ELEMENTS); i++) - integral+=_field->getValueIJ(i+1,icomp)*volume->getValueIJ(i+1,1); + integral+=_field->getValueIJ(i+1,icomp)*fabs(volume->getValueIJ(i+1,1)); delete volume; } double total=0.0; -- 2.39.2