Salome HOME
MEDMEM suppression
[modules/med.git] / doc / MEDMEM / FIELDgeneral.cxx
index 120cef911c249d28546252317aec71a68898054e..265ef8a30a5cfba3df18812ae73e2147a659a894 100644 (file)
@@ -1,8 +1,31 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
 using namespace std;
 #include "MEDMEM_Mesh.hxx"
 #include "MEDMEM_Field.hxx"
 
 using namespace MEDMEM;
+using namespace MED_EN ;
 
 int main (int argc, char ** argv) {
 
@@ -16,7 +39,7 @@ int main (int argc, char ** argv) {
 
   /* read FIELD */
   // we need a support :
-  SUPPORT * mySupport = new SUPPORT(myMesh,"Support on all Cells",MED_CELL);
+  const SUPPORT * mySupport = myMesh->getSupportOnAll(MED_CELL);
   FIELD<double> myField(mySupport,MED_DRIVER,MedFile,FieldName) ;
   //  myField.read() ;
 
@@ -47,15 +70,14 @@ int main (int argc, char ** argv) {
   // How many Value :
   int NumberOfValue = mySupport->getNumberOfElements(MED_ALL_ELEMENTS);
   // Value
-  const double * Value = myField.getValue(MED_FULL_INTERLACE);
+  const double * Value = myField.getValue();
   for(int i=0; i<NumberOfValue; i++) {
     for(int j=0; j<NumberOfCompoennts; j++)
       cout << Value[i*NumberOfCompoennts+j] << " " ;
     cout << endl ;
   }
 
-  delete mySupport;
-  delete myMesh;
+  myMesh->removeReference();
 
   return 0 ;
 }