1 #LyX 1.1 created this file. For more info see http://www.lyx.org/
6 %%\usepackage[french]{babel}
7 %\usepackage[T1]{fontenc}
9 %\usepackage[dvips]{graphicx}
10 %\usepackage{fancyhdr}
13 \usepackage[dvips,all,light]{draftcopy}
17 % ____________________________________________________________________________
20 % |____________________________________________________________________________|
22 \draftcopyName{Projet}{200}
24 \setlength{\oddsidemargin}{0cm}
25 \setlength{\marginparsep}{0cm}
26 \setlength{\marginparwidth}{0cm}
28 \setlength{\textwidth}{15cm}
30 \setlength{\topmargin}{0cm}
31 \setlength{\headheight}{0cm}
32 \setlength{\headsep}{0cm}
34 \setlength{\textheight}{23cm}
36 % ____________________________________________________________________________
38 % | COMMANDES UTILISATEUR |
39 % |____________________________________________________________________________|
41 \newcommand{\method}[1]{method \mbox{\textbf{#1}}}
43 \newcommand{\myref}[1]{\ref{#1}, page \pageref{#1}}
45 \newcommand{\fileCxx}[1]{
46 \subsection{Full C++ example~: }
51 \newcommand{\filePython}[1]{
52 \subsection{Full Python example~: }
57 % ____________________________________________________________________________
60 % |____________________________________________________________________________|
62 \title{User's Guide Of Med Memory}
63 \author{Patrick GOLDBRONN \and Eric Fayolle \and Nadir Bouhamou}
65 % ____________________________________________________________________________
67 % | DEBUT DU DOCUMENT |
68 % |____________________________________________________________________________|
81 \paperorientation portrait
84 \paragraph_separation skip
86 \quotes_language english
90 \paperpagestyle default
110 \begin_inset LatexCommand \tableofcontents{}
120 All numbering begin at one (take care of array index !) ;
123 When you get a C type array with a
128 method, you must not replace some value of it.
129 Access is in read only.
130 Other use may product an impredicable result.
131 To modify a such array use method
139 Difference between local and global number\SpecialChar ~
140 : when we talk about an element
142 \begin_inset Formula \( i^{th} \)
146 \begin_inset Formula \( i^{th} \)
149 in quadrangles array\SpecialChar ~
150 : local numbering) or
151 \begin_inset Formula \( j^{th} \)
155 \begin_inset Formula \( j^{th} \)
158 in all elements array\SpecialChar ~
160 This two numbering are equivalent only if we have one geometric type.
163 How to use MESH object
169 We could get some general information about a MESH object such as\SpecialChar ~
186 method{getDescription}
191 the space dimension (
195 method{getSpaceDimension}
204 method{getMeshDimension}
213 fileCxx{MESHgeneral.cxx}
216 filePython{MESHgeneral.py}
219 Information about nodes
222 I want to get the number of nodes\SpecialChar ~
227 method{getNumberOfNodes}
233 I want to get the coordinates components names\SpecialChar ~
238 method{getCoordinatesNames}
240 which return a string array (one string for each space dimension)
243 I want to get the coordinates components units\SpecialChar ~
248 method{getCoordinatesUnits}
250 which return a string array (one string for each space dimension)
253 I want to get the coordinates system\SpecialChar ~
258 method{getCoordinatesSystem}
260 which return a string (
282 I want to get the nodes coordinates\SpecialChar ~
287 method{getCoordinates}
289 which return a pointer to the coordinates array where values are interlace
293 Warning\SpecialChar ~
298 When we get coordinates in
302 verb+MED_NO_INTERLACE+
304 mode, we get an array where values are ordered like (
308 verb+X1,X2,X..., Y1,Y..., Z1,Z...+
314 When we get coordinates in
318 verb+MED_FULL_INTERLACE+
320 mode, we get an array where values are ordered like (
324 verb+X1,Y1,Z1, X2,Y2,Z2, ...+
331 I want to get one particular value of coordinate\SpecialChar ~
336 method{getCoordinate}
338 which return the value of
339 \begin_inset Formula \( i^{th} \)
343 \begin_inset Formula \( j^{th} \)
353 fileCxx{MESHcoordinates.cxx}
356 filePython{MESHcoordinates.py}
359 Information about cells
362 I want to get the number of geometric type for a mesh entity\SpecialChar ~
367 method{getNumberOfTypes}
373 C++ Example\SpecialChar ~
381 verb+int NumberOfCellsTypes = myMesh.getNumberOfTypes(MED_CELL);+
385 I want to get all geometric type for a mesh entity\SpecialChar ~
396 verb+medGeometryElement+
398 (to use directly in others methods) or
402 method{getCellsTypes}
410 (to ask mode information\SpecialChar ~
417 C++ Example\SpecialChar ~
425 verb+medGeometryElement * Types = myMesh.getTypes(MED_CELL);+
432 verb+CELLMODEL * CellsTypes = myMesh.getCellsTypes(MED_CELL);+
435 (each arrays are size
439 verb+NumberOfCellsTypes+
445 I want to get the number of cells\SpecialChar ~
450 method{getNumberOfElements}
452 which return this information.
453 You must give the mesh entity (
477 ) and a geometric type of this entity.
483 C++ Example\SpecialChar ~
491 verb+int NumberOfTriangle = myMesh.getNumberOfElements(MED_FACE,MED_TRIA3);+
498 verb+int NumberOfFace = myMesh.getNumberOfElements(MED_FACE,MED_ALL_ELEMENT);+
502 I want to get the geometric type of one element\SpecialChar ~
507 method{getElementType}
513 verb+medGeometryElement+
521 C++ Example\SpecialChar ~
529 verb+medGeometryElement myType = myMesh.getElementType(MED_FACE,10);+
536 verb+medGeometryElement+
539 \begin_inset Formula \( 10^{th} \)
546 I want to get a connectivity\SpecialChar ~
551 method{getConnectivity}
553 which return an array with connectivity values.
558 \begin_inset LatexCommand \label{getConnectivity}
567 C++ Example\SpecialChar ~
577 int NumberOfTetrahedron = myMesh.getNumberOfElements(MED_CELL,MED_TETRA4);
579 int * TetrahedronConnectivity =
581 myMesh.getConnectivity(MED_FULL_ENTERLACE,
593 verb+TetrahedronConnectivity+
595 contain nodal connectivity of tetrahedron in mesh.
596 It is arranged in full enterlace mode and its size is
600 verb+NumberOfTetrahedron x 4+
605 If you want to get connectivity of all elements (with
609 verb+Type=MED_ALL_ELEMENTS+
611 ), you must use the index array (return by
615 method{getConnectivityIndex}
617 ) to get connectivity for each elements (see example
621 myref{MESHconnectivities.cxx}
627 I want to get an element number from a connectivity\SpecialChar ~
632 method{getElementNumber}
634 which return the global number of a given connectivity.
640 C++ Example\SpecialChar ~
648 verb+int * myElementConnectivity = {2,10,12,14};+
655 verb+int myNumber = myMesh.getElementNumber(MED_NODAL,MED_CELL,myElementConnectiv
664 fileCxx{MESHconnectivities.cxx}
667 filePyhton{MESHconnectivities.py}
670 How to use SUPPORT object
673 Create a SUPPORT object
677 \begin_inset LatexCommand \label{CreateSupport}
684 To create a SUPPORT object, you must give :
687 a reference to a MESH object
693 on which mesh entity it apply to
698 C++ example\SpecialChar ~
706 verb+SUPPORT mySupport(myMesh,''support sur toute les faces'',MED_FACE)
709 By default, this support is defined on all element of the given entity.
712 If you want a restricted SUPPORT, you must add manualy information about
713 what do you want\SpecialChar ~
717 is not on all elements\SpecialChar ~
722 verb+mySupport.setAll(false);+
725 on how many geometric type\SpecialChar ~
732 verb+mySupport.setNumberOfGeometricType(myNumberOfGeometricType);+
735 on which geometric type\SpecialChar ~
742 verb+mySupport.setGeometricType(myGeometricType);+
745 Temporary : the Gauss point number for each geometric type\SpecialChar ~
752 verb+mySupport.setNumberOfGaussPoint(myNumberOfGaussPoint);+
755 the number of elements for each geometric type\SpecialChar ~
762 verb+mySupport.setNumberOfEntities(myNumberOfEntities);+
765 the total number of elements\SpecialChar ~
772 verb+mySupport.setTotalNumberOfEntities(myTotalNumberOfEntities);+
775 the array which contains elements for each geometric type\SpecialChar ~
782 verb+mySupport.setNumber(myNumber);+
791 which set all you need.
797 You could get all basic information (as you set them in
818 verb+getDescription()+
839 verb+isOnAllElements()+
846 verb+getNumberOfTypes()+
860 verb+getNumberOfGaussPoint()+
867 verb+getNumberOfGaussPoint(myGeometricType)+
874 verb+getGeometricTypeNumber()+
881 verb+getNumberOfElements(myGeometricType)+
888 verb+getNumber(myGeometricType)+
895 verb+getNumberIndex()+
898 For details about this methods, see the reference manual
899 \begin_inset LatexCommand \ref{RefManual}
916 method{getNumberIndex}
922 method{getConnectivity}
928 method{getConnectivityIndex}
934 myref{getConnectivity}
937 There is another particular method to blend another SUPPORT object into
949 SUPPORT myOtherSupport ;
953 mySupport.blending(myOtherSupport) ;
966 contain now all elements defined originally in it, more those defined in
976 Case of FAMILY object
993 thebibliography{biblio}
997 Reference Manual\SpecialChar ~
1000 http://www-drn2.cea.fr/MED/MEDMEM/DOC/html/index.html
1006 The generic driver mecanism gives users the possibility to write/read the
1007 content of an object according to a specified file format.
1008 The semantic remains the same whatever the object is (MESH, FIELD, MED).
1009 By the way it allows using several file formats for writting an object.
1015 Invoking a driver at creation object time
1018 This is the simplest way of invoking a driver.
1019 The driver parameters are given to the constructor of the object.
1020 Except for the MED object, this way of invoking a driver assume you know
1021 exactly the name of the MESH/FIELD you want read from a file <fileName>
1022 of type <driverType>.
1025 ex 1.1 : For a FIELD object, invoking FIELD<double> myField(MED_DRIVER,fileName,f
1026 ieldName) create a FIELD object and a driver which loads the mesh <fieldName>
1027 from the MED file <fileName> (Not implemented yet !).
1030 ex 1.2 : To remove the default driver previously created myField->rmDriver();
1033 ex 2 : For a MESH object, invoking MESH myMesh(MED_DRIVER,fileName,meshName)
1034 create a MESH object and a driver which loads the mesh <meshName> from
1035 the MED file <fileName>.
1038 ex 3 : For a MED object, invoking MED myMed(MED_DRIVER,fileName) create
1039 a MED object to explore the MED file <fileName>.
1042 rem 1 : ex1 is equivalent to
1043 \begin_inset LatexCommand \ref{sec:invoking_a_driver_from_the_std_drv_method}
1050 rem 2 : Since the driver has read the object, the associated file is closed.
1051 You can reread the object with the default driver by calling the read()
1052 method : myObject.read().
1059 fileCxx{MEDMEM_InvokingDriverAtObjectCreationTime.cxx}
1062 Invoking a driver from the standard driver method of an object
1063 \begin_inset LatexCommand \label{sec:invoking_a_driver_from_the_std_drv_method}
1070 This way of invoking a driver give the possiblility to add several drivers
1071 to an exiting object.
1074 ex1 : First we create a FIELD without any driver FIELD<double>\SpecialChar ~
1076 myField1\SpecialChar ~
1080 <double>; then we add a driver with int myDriver1 = myField1->addDriver(driverTy
1081 pe1, fileName1, fieldName1); for reading <fieldName1> from file <fileName1>
1082 with myField1->read(myDriver1);
1085 ex2 : We add a new driver of type <driverType2> int myDriver2 = myField1->addDri
1086 ver(driverType2, fileName2,fieldName2); in order to write myField1 in file
1087 <fileName2> with <fieldName2> name using command myField1->write(myDriver2);
1090 rem 1 : Files are openned then closed each time you call read() or write()
1094 rem 2 : If you use more than a driver you need to keep the driver handlers
1102 fileCxx{MEDMEM_InvokingDriverFromStandardObjectMethod.cxx}
1105 Invoking a driver and attaching it to an existing object
1108 The methods exposed in the two previous sections always create drivers in
1109 read/write access mode.
1110 Another way of creating a driver is to create a driver with a specific
1114 ex1 : First we create a FIELD without any driver FIELD<double>\SpecialChar ~
1116 myField1\SpecialChar ~
1119 FIELD<double>(); then we create a read-only driver MED_FIELD_RDONLY_DRIVER<doub
1121 myRdOnlyDriver(fileName1,myField1); and attached it to myField1.
1122 Finally you must set the fieldName1 you want to acess in fileName1 with
1123 myRdOnlyDriver->setFieldName(fieldName1); in order to read the field with
1124 myRdOnlyDriver->open(); myRdOnlyDriver->read();
1127 Don't forget to close the file with myRdOnlyDriver->close().
1130 ToDo : By now when you create such specific drivers, the object doesn't
1131 know anything about it.
1139 fileCxx{MEDMEM_InvokingDriverByAttachingItToAnObject.cxx}
1142 Using the MED driver
1145 The MED object provides the ability of :
1148 Obtainning a reference on the whole structure contained in a file.
1151 Obtainning the list of all the Meshes/Fields names contained in a file.
1154 Obtainning a Mesh/Field reference using a name.
1157 Writting a whole set of independent objects with a simple command.
1164 In this first use case the user wants to explore the meshes & fields containned
1165 within a file <filename> of type given by the <drivertype> parameter.
1168 ex 1 : Calling MED * myMed = new MED(driverType1, fileName1); create a MED
1169 object which open fileName1, read all MESHes/FIELDs relations then close
1174 This is equivalent to MED\SpecialChar ~
1179 MED(); myDriver\SpecialChar ~
1181 myMed->addDriver(driverType1,
1182 fileName1); myMed->readFileStruct(myDriver);
1185 ex 2 : To get the list of meshNames from a MED object, first ask the object
1186 how many meshes it had by calling int numberOfMeshes\SpecialChar ~
1188 myMed->getNumberOfMeshes()
1189 ; then get the list with myMeshNames\SpecialChar ~
1191 new string[getMeshNames]; myMed->getMeshNam
1196 Note you can also use the deque<string> getMeshNames() method.
1200 ex 3 : To get a list of fieldNames from a MED object, first ask the object
1201 how many fields it had by calling int numberOfFields\SpecialChar ~
1203 myMed->getNumberOfFields()
1204 ; then get the list with myFieldNames\SpecialChar ~
1206 new string[getFieldNames]; myMed->getField
1207 Names(myFieldNames).
1210 ex 4 :To get a particular MESH use MESH * myMesh1 = myMED->getMesh(myMeshNames[0
1214 ex 5 :To get a particular FIELD you first need to know what (time step,
1215 iteration number) list is used by calling deque<DT_IT_>\SpecialChar ~
1216 myField1DtIt\SpecialChar ~
1219 ieldIteration(FieldName[0]) ; then you can ask for getting a specific FIELD
1220 with FIELD\SpecialChar ~
1222 myField1\SpecialChar ~
1224 myMED->getField(myFieldNames[0],myField1DtIt[0].dt,myField1D
1228 ex2 : To write the whole content of a MED object first add a driver myDriver2\SpecialChar ~
1231 Med.addDriver(driverType2,\SpecialChar ~
1232 fileName2); then ask for writing the object myMed->writ
1233 e(myDriver2); (not implemented yet !)
1236 You can remove the driver with myMed->rmDriver(myDriver2);
1239 rem 1 : It is possible to use multiple drivers to read a set of FIELDs /
1240 MESHes from various file formats and writing the whole set through a specific
1241 write.(not implemented yet !)
1242 \layout Subsubsection
1244 Adding existing MESHes/FIELDs objects
1247 Not yet implemented.