]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
MEDMEM Industrialization 2008
authoreap <eap@opencascade.com>
Thu, 18 Dec 2008 17:35:21 +0000 (17:35 +0000)
committereap <eap@opencascade.com>
Thu, 18 Dec 2008 17:35:21 +0000 (17:35 +0000)
   protect from negative areas

src/ParaMEDMEM/InterpolationMatrix.cxx
src/ParaMEDMEM/ParaFIELD.cxx

index 9fba6504ad3c98b852c7712b88ef847c5e35ce09..43ab7e4cb720ac598f27975687ea9539659f828c 100644 (file)
@@ -152,7 +152,7 @@ namespace ParaMEDMEM
     //storing the source volumes
     _source_volume.resize(source_size);
     for (int i=0; i<source_size; i++)
-      _source_volume[i] = source_triangle_surf->getValueIJ(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<pair<int,int> >::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;
               }
             }
       }
index 30a533fe61e4f864399f5a6c9bba80f3206418a6..94450a82fce9a673ec2518e92216d1cf618d50d8 100644 (file)
@@ -239,7 +239,7 @@ double ParaFIELD::getVolumeIntegral(int icomp) const
         if ( support->getEntity() != MED_EN::MED_NODE ) {
           FIELD<double>* volume= getSupportVolumes(*support);
           for (int i=0; i<support->getNumberOfElements(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;