1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/
21 #include "MEDMEM_Mesh.hxx"
22 #include "MEDMEM_Field.hxx"
24 using namespace MEDMEM;
25 using namespace MED_EN ;
27 int main (int argc, char ** argv) {
29 const string MedFile = "pointe.med" ;
30 const string MeshName = "maa1" ;
31 const string FieldName = "fieldcelldoublevector" ;
34 MESH * myMesh = new MESH(MED_DRIVER,MedFile,MeshName) ;
38 // we need a support :
39 SUPPORT * mySupport = new SUPPORT(myMesh,"Support on all Cells",MED_CELL);
40 FIELD<double> myField(mySupport,MED_DRIVER,MedFile,FieldName) ;
44 // How many components
45 int NumberOfCompoennts = myField.getNumberOfComponents() ;
47 const string * ComponentsNames = myField.getComponentsNames();
48 const string * ComponentsDescriptions = myField.getComponentsDescriptions();
49 const string * ComponentsUnits = myField.getMEDComponentsUnits();
51 for(int i=0;i<NumberOfCompoennts; i++) {
52 cout << "Component " << i << " :" <<endl ;
53 cout << " - name : " << ComponentsNames[i] << endl ;
54 cout << " - description : " << ComponentsDescriptions[i] << endl ;
55 cout << " - unit : " << ComponentsUnits[i] << endl ;
59 int IterationNumber = myField.getIterationNumber() ; // negative mean undefined
60 int OrderNumber = myField.getOrderNumber() ;
61 // internal iteration at this time iteration, negative mean undefined
62 double Time = myField.getTime() ;
64 cout << "Iteration " << IterationNumber << " at time " << Time <<
65 " (and order number " << OrderNumber << ")" << endl ;
68 int NumberOfValue = mySupport->getNumberOfElements(MED_ALL_ELEMENTS);
70 const double * Value = myField.getValue(MED_FULL_INTERLACE);
71 for(int i=0; i<NumberOfValue; i++) {
72 for(int j=0; j<NumberOfCompoennts; j++)
73 cout << Value[i*NumberOfCompoennts+j] << " " ;