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/
20 %module libMEDMEM_Swig
25 #include "MEDMEM_CellModel.hxx"
26 #include "MEDMEM_GenDriver.hxx"
27 #include "MEDMEM_MedMeshDriver.hxx"
28 #include "MEDMEM_GibiMeshDriver.hxx"
29 #include "MEDMEM_PorflowMeshDriver.hxx"
30 #include "MEDMEM_Connectivity.hxx"
31 #include "MEDMEM_Group.hxx"
32 #include "MEDMEM_SkyLineArray.hxx"
33 #include "MEDMEM_Coordinate.hxx"
34 #include "MEDMEM_Array.hxx"
35 #include "MEDMEM_Mesh.hxx"
36 #include "MEDMEM_define.hxx"
37 #include "MEDMEM_Exception.hxx"
38 #include "MEDMEM_STRING.hxx"
39 #include "MEDMEM_DriversDef.hxx"
40 #include "MEDMEM_MedFieldDriver.hxx"
41 #include "MEDMEM_Support.hxx"
42 #include "MEDMEM_Family.hxx"
43 #include "MEDMEM_Med.hxx"
44 #include "MEDMEM_Unit.hxx"
45 #include "MEDMEM_Field.hxx"
46 #include "MEDMEM_FieldConvert.hxx"
47 #include "MEDMEM_MedMedDriver.hxx"
48 #include "MEDMEM_Grid.hxx"
49 #include "MEDMEM_Meshing.hxx"
50 #include "MEDMEM_DriverFactory.hxx"
51 #include "MEDMEM_GaussLocalization.hxx"
52 #include "MEDMEM_ArrayInterface.hxx"
53 #include "MEDMEM_SWIG_Templates.hxx"
55 using namespace MEDMEM;
56 using namespace MED_EN;
58 /* typedef FIELD <double, FullInterlace> FIELDDOUBLEFULLINTERLACE;*/
59 /* typedef FIELD <int, FullInterlace> FIELDINTFULLINTERLACE;*/
60 typedef FIELD <double, FullInterlace> FIELDDOUBLE;
61 typedef FIELD <int, FullInterlace> FIELDINT;
62 typedef FIELD <double, NoInterlace> FIELDDOUBLENOINTERLACE;
63 typedef FIELD <int, NoInterlace> FIELDINTNOINTERLACE;
68 SWIG needs these typedefs to wrap FIELDDOUBLE*, for ex., to something like
69 <C++ FIELD<double> instance at _d0709808_p_FIELDDOUBLE>, not to
70 <SWIG Object at _d0709808_p_FIELDDOUBLE> which has no attributes
73 /*typedef FIELD <double, FullInterlace> FIELDDOUBLEFULLINTERLACE;*/
74 /*typedef FIELD <int, FullInterlace> FIELDINTFULLINTERLACE;*/
75 typedef FIELD <double, FullInterlace> FIELDDOUBLE;
76 typedef FIELD <int, FullInterlace> FIELDINT;
77 typedef FIELD <double, NoInterlace> FIELDDOUBLENOINTERLACE;
78 typedef FIELD <int, NoInterlace> FIELDINTNOINTERLACE;
81 %include "my_typemap.i"
83 %typecheck(SWIG_TYPECHECK_POINTER) double *, const double *,
84 const double * const, int *, const int *, const int * const, string *,
85 const string *, const string * const, medGeometryElement *,
86 const medGeometryElement *, const medGeometryElement * const
92 mapping between stl string and python string
95 %include "std_string.i"
99 managing C++ exception in the Python API
108 catch(MEDEXCEPTION& exception)
110 PyErr_SetString(PyExc_RuntimeError,exception.what());
116 managing the use of operator= of any class by renaming it assign()
117 because assignment can't be overloaded in python.
119 In python, you would then use
124 %rename(assign) *::operator=;
127 typemap for vector<FAMILY *> C++ object
130 %typemap(python,in) vector< FAMILY * >, const vector< FAMILY * >
132 /* typemap in for vector<FAMILY *> */
133 /* Check if is a list */
135 if (PyList_Check($input)) {
136 int size = PyList_Size($input);
137 $1 = vector<FAMILY *>(size);
139 for (int i=0; i < size; i++)
141 PyObject * tmp = PyList_GetItem($input,i);
144 int err = SWIG_ConvertPtr(tmp, (void **) &f, $descriptor(FAMILY *),
145 SWIG_POINTER_EXCEPTION);
149 char * message = "Error in typemap(python,in) for vector<FAMILY *> each component should be a FAMILY pointer";
150 PyErr_SetString(PyExc_RuntimeError, message);
153 // mpv: for compatibility with SWIG 1.3.24 SwigValueWrapper
160 PyErr_SetString(PyExc_TypeError,"not a list");
165 %typemap(python,out) vector< FAMILY * >
167 /* typemap out for vector<FAMILY *> */
168 int size = $1.size();
169 $result = PyList_New(size);
171 for (int i=0;i<size;i++)
173 // mpv: for compatibility with SWIG 1.3.24 SwigValueWrapper
174 //PyObject * tmp = SWIG_NewPointerObj($1[i],$descriptor(FAMILY *),0);
175 PyObject * tmp = SWIG_NewPointerObj($1.at(i),$descriptor(FAMILY *),0);
177 PyList_SetItem($result,i,tmp);
182 typemap for vector<SUPPORT *> C++ object
185 %typemap(python,in) vector< SUPPORT * >, const vector< SUPPORT * >
187 /* typemap in for vector<SUPPORT *> */
188 /* Check if is a list */
190 if (PyList_Check($input)) {
191 int size = PyList_Size($input);
192 $1 = vector<SUPPORT *>(size);
194 for (int i=0; i < size; i++)
196 PyObject * tmp = PyList_GetItem($input,i);
199 int err = SWIG_ConvertPtr(tmp, (void **) &s, $descriptor(SUPPORT *),
200 SWIG_POINTER_EXCEPTION);
204 char * message = "Error in typemap(python,in) for vector<SUPPORT *> each component should be a SUPPORT pointer";
205 PyErr_SetString(PyExc_RuntimeError, message);
208 // mpv: for compatibility with SWIG 1.3.24 SwigValueWrapper
215 PyErr_SetString(PyExc_TypeError,"not a list");
220 %typemap(python,out) vector< SUPPORT * >
222 /* typemap out for vector<SUPPORT *> */
223 int size = $1.size();
224 $result = PyList_New(size);
226 for (int i=0;i<size;i++)
228 // mpv: for compatibility with SWIG 1.3.24 SwigValueWrapper
229 //PyObject * tmp = SWIG_NewPointerObj($1[i],$descriptor(SUPPORT *),0);
230 PyObject * tmp = SWIG_NewPointerObj($1.at(i),$descriptor(SUPPORT *),0);
232 PyList_SetItem($result,i,tmp);
237 %typemap(python,in) vector< FIELD< double > * >, const vector< FIELD< double > * >
239 /* typemap in for vector<FIELD<double> *> */
240 /* Check if is a list */
242 if (PyList_Check($input)) {
243 int size = PyList_Size($input);
246 for (int i=0; i < size; i++)
248 PyObject * tmp = PyList_GetItem($input,i);
251 int err = SWIG_ConvertPtr(tmp, (void **) &s, $descriptor(FIELD<double> *),
252 SWIG_POINTER_EXCEPTION);
256 char * message = "Error in typemap(python,in) for vector<FIELD<double> *> each component should be a SUPPORT pointer";
257 PyErr_SetString(PyExc_RuntimeError, message);
261 // mpv: for compatibility with SWIG 1.3.24 SwigValueWrapper
268 PyErr_SetString(PyExc_TypeError,"not a list");
273 %typemap(python,out) vector< FIELD< double > * >
275 /* typemap out for vector<FIELD<double> *> */
276 int size = $1.size();
277 $result = PyList_New(size);
279 for (int i=0;i<size;i++)
281 // mpv: for compatibility with SWIG 1.3.24 SwigValueWrapper
282 //PyObject * tmp = SWIG_NewPointerObj($1[i],$descriptor(FIELD<double> *),0);
283 PyObject * tmp = SWIG_NewPointerObj($1.at(i),$descriptor(FIELD<double> *),0);
285 PyList_SetItem($result,i,tmp);
289 %typemap(python,in) vector< FIELD< int > * >, const vector< FIELD< int > * >
291 /* typemap in for vector<FIELD<int> *> */
292 /* Check if is a list */
294 if (PyList_Check($input)) {
295 int size = PyList_Size($input);
298 for (int i=0; i < size; i++)
300 PyObject * tmp = PyList_GetItem($input,i);
303 int err = SWIG_ConvertPtr(tmp, (void **) &s, $descriptor(FIELD<int> *),
304 SWIG_POINTER_EXCEPTION);
308 char * message = "Error in typemap(python,in) for vector<FIELD<int> *> each component should be a SUPPORT pointer";
309 PyErr_SetString(PyExc_RuntimeError, message);
313 // mpv: for compatibility with SWIG 1.3.24 SwigValueWrapper
320 PyErr_SetString(PyExc_TypeError,"not a list");
325 %typemap(python,out) vector< FIELD< int > * >
327 /* typemap out for vector<FIELD<int> *> */
328 int size = $1.size();
329 $result = PyList_New(size);
331 for (int i=0;i<size;i++)
333 // mpv: for compatibility with SWIG 1.3.24 SwigValueWrapper
334 //PyObject * tmp = SWIG_NewPointerObj($1[i],$descriptor(FIELD<int> *),0);
335 PyObject * tmp = SWIG_NewPointerObj($1.at(i),$descriptor(FIELD<int> *),0);
337 PyList_SetItem($result,i,tmp);
343 typemap in for PyObject * fonction Python wrapping of a
344 double or int fonction pointeur
347 %typemap(python,in) PyObject * double_function, PyObject * integer_function
349 /* typemap in for double or integer callable fonction pointeur */
350 /* Check if it is a callable fonction pointer */
352 if(PyCallable_Check($input) == 0)
354 char * message = "Error in typemap(python,in) for double or integer callable fonction pointeur : the argument should be a callable object";
355 PyErr_SetString(PyExc_RuntimeError, message);
363 MACRO converting C++ MEDMEM::FIELD_ pointer into a PyObject pointer rightly
364 casted following its value type (int or double) and its interlacing mode
365 (FullInterlace or NoInterlace) by calling the function SWIG_NewPointer with
366 the appropriate $descriptor(...)
369 %define TYPEMAP_OUTPUT_FIELDT(myField)
371 FIELD_ *arg1=myField;
372 PyObject *myResult=NULL;
375 FIELD<double> *try1=dynamic_cast<FIELD<double> *>(arg1);
377 myResult = SWIG_NewPointerObj((void *) try1, $descriptor(FIELD<double, FullInterlace> *), 0);
380 FIELD<int> *try2=dynamic_cast<FIELD<int> *>(arg1);
382 myResult = SWIG_NewPointerObj((void *) try2, $descriptor(FIELD<int, FullInterlace> *), 0);
385 FIELD<double, NoInterlace> *try3=dynamic_cast<FIELD<double, NoInterlace> *>(arg1);
387 myResult = SWIG_NewPointerObj((void *) try3, $descriptor(FIELD<double, NoInterlace> *), 0);
390 FIELD<int, NoInterlace> *try4=dynamic_cast<FIELD<int, NoInterlace> *>(arg1);
392 myResult = SWIG_NewPointerObj((void *) try4, $descriptor(FIELD<int, NoInterlace> *), 0);
395 myResult = SWIG_NewPointerObj((void *) arg1, $descriptor(FIELD_ *), 0);
406 MACRO to transforme a C++ deque<string> object into a proper Python List
409 %define TYPEMAP_OUTPUT_DEQUE_STRING(myDeque)
411 PyObject *py_list = PyList_New(myDeque.size());
412 deque<string>::iterator iter4;
414 for(iter4=myDeque.begin();iter4!=myDeque.end();iter4++,i4++)
416 PyList_SetItem(py_list, i4, PyString_FromString((*iter4).c_str()));
423 MACRO converting C array <arrayvar> of length <size> into a PyList
424 by calling type_converter() for each array element.
425 It reports error in <method> in failure case
428 %define TYPEMAP_OUTPUT_ARRAY(arrayvar, size, type_converter, method)
430 PyObject *py_list = PyList_New(size);
431 for (int i=0; i < size; i++)
433 int err = PyList_SetItem(py_list, i, type_converter( arrayvar[ i ]));
436 char * message = "Error in " #method;
437 PyErr_SetString(PyExc_RuntimeError, message);
442 PyObject * result = Py_BuildValue("O", py_list);
449 Helper function to be used as type_converter in TYPEMAP_OUTPUT_ARRAY
453 PyObject *PyString_FromStdString(const std::string &str)
455 return PyString_FromString(str.c_str());
461 enum of the C++ MED used in the Python API
464 typedef enum {MED_CARTESIAN, MED_POLAR, MED_BODY_FITTED} med_grid_type;
466 typedef enum {MED_FULL_INTERLACE, MED_NO_INTERLACE} medModeSwitch;
468 typedef enum {MED_LECT, MED_ECRI, MED_REMP} med_mode_acces;
470 typedef enum {ASCENDING=7,DESCENDING=77} med_sort_direc;
472 typedef enum {MED_CELL, MED_FACE, MED_EDGE, MED_NODE,
473 MED_ALL_ENTITIES} medEntityMesh;
475 typedef enum {MED_NONE=0, MED_POINT1=1, MED_SEG2=102, MED_SEG3=103,
476 MED_TRIA3=203, MED_QUAD4=204, MED_TRIA6=206, MED_QUAD8=208,
477 MED_TETRA4=304, MED_PYRA5=305, MED_PENTA6=306,
478 MED_HEXA8=308, MED_TETRA10=310, MED_PYRA13=313,
479 MED_PENTA15=315, MED_HEXA20=320, MED_POLYGON = 400, MED_POLYHEDRA = 500,
480 MED_ALL_ELEMENTS=999} medGeometryElement;
482 typedef enum {MED_NODAL, MED_DESCENDING} medConnectivity ;
484 typedef enum {MED_DRIVER=0, GIBI_DRIVER=1, PORFLOW_DRIVER = 2, VTK_DRIVER=254,
485 NO_DRIVER=255, ASCII_DRIVER = 3} driverTypes;
487 typedef enum {MED_REEL64=6, MED_INT32=24, MED_INT64=26} med_type_champ;
489 typedef struct { int dt; int it; } DT_IT_;
491 typedef enum {V21 = 26, V22 = 75} medFileVersion;
493 medFileVersion getMedFileVersionForWriting();
495 void setMedFileVersionForWriting(medFileVersion version);
498 medFileVersion getMedFileVersionForWriting()
500 return (medFileVersion) DRIVERFACTORY::getMedFileVersionForWriting();
503 void setMedFileVersionForWriting(medFileVersion version)
505 DRIVERFACTORY::setMedFileVersionForWriting((medFileVersion) version);
521 %typecheck(SWIG_TYPECHECK_POINTER) vector< SUPPORT * >, const vector< SUPPORT * >
527 Class et methodes du MED++ que l'on utilise dans l'API Python
535 CELLMODEL(medGeometryElement t);
537 CELLMODEL(const CELLMODEL &m);
539 int getNumberOfVertexes();
541 int getNumberOfNodes();
545 medGeometryElement getType();
547 int getNumberOfConstituents(int dim);
549 int getNodeConstituent(int dim,int num,int nodes_index);
551 medGeometryElement getConstituentType(int dim,int num);
553 int getNumberOfConstituentsType();
555 std::string getName() const;
560 %newobject __str__();
561 const char* __str__()
564 mess << "Python Printing CELLMODEL : " << *self << endl;
565 return strdup(mess.str().c_str());
575 SUPPORT(const SUPPORT & m);
579 void update ( void );
581 MESH * getMesh() const;
583 std::string getMeshName() const;
585 void setMesh(MESH * Mesh) const;
587 medEntityMesh getEntity() const;
589 void setEntity(medEntityMesh Entity);
591 bool isOnAllElements() const;
593 void setAll(bool All);
595 int getNumberOfTypes() const;
597 void setNumberOfGeometricType(int NumberOfGeometricType);
599 int getNumberOfElements(medGeometryElement GeometricType) const;
601 void setGeometricType(medGeometryElement *GeometricType);
603 void setNumberOfElements(int *NumberOfElements);
605 void setTotalNumberOfElements(int TotalNumberOfElements);
607 void getBoundaryElements();
609 void setNumber(const int * index, const int* value);
611 bool deepCompare(const SUPPORT &support) const;
613 SUPPORT(MESH* Mesh, std::string Name="", medEntityMesh Entity=MED_CELL);
615 void setpartial(std::string Description, int NumberOfGeometricType,
616 int TotalNumberOfElements, medGeometryElement *GeometricType,
617 int *NumberOfElements, int *NumberValue);
619 std::string getName() const;
621 void setName(std::string Name);
623 std::string getDescription();
625 void setDescription(std::string Description);
628 %newobject __str__();
629 const char* __str__()
632 mess << "Python Printing SUPPORT : " << *self << endl;
633 char * tmp = const_cast <char *> (mess.str().c_str());
634 char * returned = strdup(tmp);
638 PyObject * getTypes()
640 const medGeometryElement * types = self->getTypes();
641 int size = self->getNumberOfTypes();
642 TYPEMAP_OUTPUT_ARRAY(types, size, PyInt_FromLong, SUPPORT::getTypes);
645 PyObject * getNumber(medGeometryElement GeometricType)
647 const int * number = self->getNumber(GeometricType);
648 int size = self->getNumberOfElements(GeometricType);
649 TYPEMAP_OUTPUT_ARRAY(number, size, PyInt_FromLong,
653 PyObject * getNumberIndex()
655 const int * numberindex = self->getNumberIndex();
656 int size = (self->getNumberOfElements(MED_ALL_ELEMENTS))+1;
657 TYPEMAP_OUTPUT_ARRAY(numberindex, size, PyInt_FromLong,
658 SUPPORT::getNumberIndex);
661 %newobject getComplement() const;
662 SUPPORT *getComplement() const
664 return self->getComplement();
667 %newobject substract(const SUPPORT& other) const;
668 SUPPORT *substract(const SUPPORT& other) const
670 return self->substract(other);
673 %newobject getBoundaryElements(medEntityMesh Entity) const;
674 SUPPORT *getBoundaryElements(medEntityMesh Entity) const
676 return self->getBoundaryElements(Entity);
681 class FAMILY : public SUPPORT
686 FAMILY(const FAMILY & m);
690 FAMILY & operator=(const FAMILY &fam);
692 void setIdentifier(int Identifier);
694 void setNumberOfAttributes(int NumberOfAttribute);
696 void setAttributesIdentifiers(int * AttributeIdentifier);
698 void setAttributesValues(int * AttributeValue);
700 void setAttributesDescriptions(string * AttributeDescription);
702 void setNumberOfGroups(int NumberOfGroups);
704 void setGroupsNames(string * GroupName);
706 int getIdentifier() const;
708 int getNumberOfAttributes() const;
710 int getNumberOfGroups() const;
712 FAMILY(MESH* Mesh, int Identifier, std::string Name, int NumberOfAttribute,
713 int *AttributeIdentifier, int *AttributeValue,
714 std::string AttributeDescription, int NumberOfGroup,
715 std::string GroupName, int * MEDArrayNodeFamily,
716 int ** MEDArrayCellFamily, int ** MEDArrayFaceFamily,
717 int ** MEDArrayEdgeFamily);
719 std::string getAttributeDescription(int i);
721 std::string getGroupName(int i);
724 %newobject __str__();
725 const char* __str__()
728 mess << "Python Printing Family : " << *self << endl;
729 return strdup(mess.str().c_str());
732 PyObject * getAttributesIdentifiers()
734 const int * attributesids = self->getAttributesIdentifiers();
735 int size = self->getNumberOfAttributes();
736 TYPEMAP_OUTPUT_ARRAY(attributesids,size,PyInt_FromLong,
737 FAMILY::getAttributesIdentifiers);
740 PyObject * getAttributesValues()
742 const int * attributesvals = self->getAttributesValues();
743 int size = self->getNumberOfAttributes();
744 TYPEMAP_OUTPUT_ARRAY(attributesvals,size,PyInt_FromLong,
745 FAMILY::getAttributesValues);
753 FIELD_(const SUPPORT * Support, const int NumberOfComponents);
757 void rmDriver(int index=0);
759 void setIterationNumber (int IterationNumber);
760 int getIterationNumber() const;
762 void setTime(double Time);
763 double getTime() const;
765 void setOrderNumber (int OrderNumber);
766 int getOrderNumber() const;
768 med_type_champ getValueType() ;
770 medModeSwitch getInterlacingType();
772 SUPPORT * getSupport();
773 void setSupport(SUPPORT * support);
775 void setNumberOfComponents(int NumberOfComponents);
776 int getNumberOfComponents() const;
778 void setNumberOfValues(int NumberOfValues);
779 int getNumberOfValues() const;
781 std::string getName() const;
783 std::string getDescription() const;
785 std::string getComponentName(int i) const;
787 std::string getComponentDescription(int i) const;
789 std::string getMEDComponentUnit(int i) const;
791 void setName(std::string Name);
793 void setComponentName(int i, std::string ComponentName);
795 void setMEDComponentUnit(int i, std::string MEDComponentUnit);
797 void setDescription(std::string Description);
799 void setComponentDescription(int i, std::string ComponentDescription);
801 int addDriver(driverTypes driverType,
802 const std::string& fileName="Default File Name.med",
803 const std::string& driverName="Default Field Name",
804 med_mode_acces access=MED_REMP);
807 %newobject getSupportAndOwner();
808 SUPPORT * getSupportAndOwner()
810 return (SUPPORT *)self->getSupport();
816 Class FIELD has now two template parameters T1 is a double or an int
817 INTERLACING_TAG is FullInterlace or NoInterlace
820 template<class T1, class INTERLACING_TAG> class FIELD : public FIELD_
825 FIELD(const SUPPORT * Support, const int NumberOfComponents);
829 FIELD(const FIELD & m);
831 FIELD(const SUPPORT * Support, driverTypes driverType,
832 const std::string& fileName, const std::string& fieldName,
833 const int iterationNumber, const int orderNumber);
835 FIELD(driverTypes driverType, const std::string& fileName,
836 const std::string& fieldName, const int iterationNumber,
837 const int orderNumber);
839 void read(int index=0);
841 T1 getValueIJ(int i,int j) const;
843 void setValue(T1* value);
845 void setRow( int i, T1 * value);
847 void setColumn( int i, T1 * value);
849 void setValueIJ(int i, int j, T1 value);
851 void allocValue(const int NumberOfComponents);
855 void applyLin(T1 a, T1 n);
857 void applyPow(T1 scalar);
863 double normL2(int component,const FIELD<double, FullInterlace> *
864 p_field_volume=NULL) const;
866 double normL2(const FIELD<double, FullInterlace> *
867 p_field_volume=NULL) const;
869 double normL1(int component, const FIELD<double, FullInterlace> *
870 p_field_volume=NULL) const;
872 double normL1(const FIELD<double, FullInterlace> *
873 p_field_volume=NULL) const;
875 void write(int index=0, const std::string& driverName="");
877 void writeAppend(int index=0, const std::string& driverName="");
879 bool getGaussPresence();
881 GAUSS_LOCALIZATION<INTERLACING_TAG> * getGaussLocalizationPtr(MED_EN::medGeometryElement geomElement);
884 PyObject * applyPyFunc( PyObject * func )
886 MESSAGE("Appel de applyPyFunc");
887 if (!PyCallable_Check(func)) {
888 PyErr_SetString(PyExc_TypeError, "FIELD.applyPyFunc prend en argument une fonction");
892 int nComp=self->getNumberOfComponents();
893 int nVal=self->getNumberOfValues();
894 for (int i=1; i!=nVal+1; ++i)
895 for ( int j=1 ;j!=nComp+1 ;++j )
897 self->setValueIJ(i,j, Binding<T1>::Functor( func, self->getValueIJ(i,j) ) );
900 PyObject * result = Binding<double>::Traducer(nComp*nVal);
904 %newobject __add__(const FIELD<T1, INTERLACING_TAG> & );
905 FIELD<T1, INTERLACING_TAG> * __add__(const FIELD<T1, INTERLACING_TAG> & m)
907 MESSAGE("operator + : Creation of the addition of two FIELDs");
909 FIELD<T1, INTERLACING_TAG>* result =
910 FIELD<T1, INTERLACING_TAG>::add( *(FIELD<T1, INTERLACING_TAG>*)self ,
911 (FIELD<T1, INTERLACING_TAG>&)m );
912 return (FIELD<T1, INTERLACING_TAG>*) result;
915 %newobject __sub__(const FIELD<T1, INTERLACING_TAG> & );
916 FIELD<T1, INTERLACING_TAG> * __sub__(const FIELD<T1, INTERLACING_TAG> & m)
918 MESSAGE("operator - : Creation of the substraction of two FIELDs");
919 FIELD<T1, INTERLACING_TAG>* result =
920 FIELD<T1, INTERLACING_TAG>::sub( *(FIELD<T1, INTERLACING_TAG>*)self ,
921 (FIELD<T1, INTERLACING_TAG>&)m );
922 return (FIELD<T1, INTERLACING_TAG>*) result;
925 %newobject __mul__(const FIELD<T1, INTERLACING_TAG> & );
926 FIELD<T1, INTERLACING_TAG> * __mul__(const FIELD<T1, INTERLACING_TAG> & m)
928 MESSAGE("operator * : Creation of the multiplication of two FIELDs");
929 FIELD<T1, INTERLACING_TAG>* result =
930 FIELD<T1, INTERLACING_TAG>::mul( *(FIELD<T1, INTERLACING_TAG>*)self ,
931 (FIELD<T1, INTERLACING_TAG>&)m );
932 return (FIELD<T1, INTERLACING_TAG>*) result;
935 %newobject __div__(const FIELD<T1, INTERLACING_TAG> & );
936 FIELD<T1, INTERLACING_TAG> * __div__(const FIELD<T1, INTERLACING_TAG> & m)
938 MESSAGE("operator / : Creation of the division of two FIELDs");
939 FIELD<T1, INTERLACING_TAG>* result =
940 FIELD<T1, INTERLACING_TAG>::div( *(FIELD<T1, INTERLACING_TAG>*)self ,
941 (FIELD<T1, INTERLACING_TAG>&)m );
942 return (FIELD<T1, INTERLACING_TAG>*) result;
945 %newobject addDeep(const FIELD<T1, INTERLACING_TAG> & );
946 FIELD<T1, INTERLACING_TAG> * addDeep(const FIELD<T1, INTERLACING_TAG> & m)
948 MESSAGE("operator + : Creation of the addition of two FIELDINTs");
949 FIELD<T1, INTERLACING_TAG>* result =
950 FIELD<T1, INTERLACING_TAG>::addDeep( *(FIELD<T1, INTERLACING_TAG>*)self ,
951 (FIELD<T1, INTERLACING_TAG>&)m );
952 return (FIELD<T1, INTERLACING_TAG>*) result;
955 %newobject subDeep(const FIELD<T1, INTERLACING_TAG> & );
956 FIELD<T1, INTERLACING_TAG> * subDeep(const FIELD<T1, INTERLACING_TAG> & m)
958 MESSAGE("operator - : Creation of the substraction of two FIELDs");
959 FIELD<T1, INTERLACING_TAG>* result =
960 FIELD<T1, INTERLACING_TAG>::subDeep( *(FIELD<T1, INTERLACING_TAG>*)self ,
961 (FIELD<T1, INTERLACING_TAG>&)m );
962 return (FIELD<T1, INTERLACING_TAG>*) result;
965 %newobject mulDeep(const FIELD<T1, INTERLACING_TAG> & );
966 FIELD<T1, INTERLACING_TAG> * mulDeep(const FIELD<T1, INTERLACING_TAG> & m)
968 MESSAGE("operator * : Creation of the multiplication of two FIELDs");
969 FIELD<T1, INTERLACING_TAG>* result =
970 FIELD<T1, INTERLACING_TAG>::mulDeep( *(FIELD<T1, INTERLACING_TAG>*)self ,
971 (FIELD<T1, INTERLACING_TAG>&)m );
972 return (FIELD<T1, INTERLACING_TAG>*) result;
975 %newobject divDeep(const FIELD<T1, INTERLACING_TAG> & );
976 FIELD<T1, INTERLACING_TAG> * divDeep(const FIELD<T1, INTERLACING_TAG> & m)
978 MESSAGE("operator / : Creation of the division of two FIELDs");
979 FIELD<T1, INTERLACING_TAG>* result =
980 FIELD<T1, INTERLACING_TAG>::divDeep( *(FIELD<T1, INTERLACING_TAG>*)self ,
981 (FIELD<T1, INTERLACING_TAG>&)m );
982 return (FIELD<T1, INTERLACING_TAG>*) result;
985 PyObject * getValue()
987 int size = (self->getNumberOfComponents())*
988 ((self->getSupport())->getNumberOfElements(MED_ALL_ELEMENTS));
990 const T1 * value = self->getValue();
992 TYPEMAP_OUTPUT_ARRAY(value, size, Binding< T1 >::Traducer,
996 // this method replaces getValueI() in FullInterlace mode
997 /* %newobject getRow(int );*/
998 PyObject * getRow(int index)
1000 int size = self->getNumberOfComponents();
1002 const T1 * value = self->getRow(index);
1004 TYPEMAP_OUTPUT_ARRAY(value, size, Binding< T1 >::Traducer,
1008 // this method replaces getValueI() in NoInterlace mode
1009 /*%newobject getColum(int );*/
1010 PyObject * getColumn(int index)
1012 int size = (self->getSupport())->getNumberOfElements(MED_ALL_ELEMENTS);
1014 const T1 * value = self->getColumn(index);
1016 TYPEMAP_OUTPUT_ARRAY(value, size, Binding< T1 >::Traducer,
1021 %newobject getValueI(int );
1022 PyObject * getValueI(int index)
1024 int size = self->getNumberOfComponents();
1026 medModeSwitch Mode = self->getInterlacingType();
1028 if ( Mode == MED_NO_INTERLACE ) size = (self->getSupport())->getNumberOfElements(MED_ALL_ELEMENTS);
1030 const T1 * value = self->getValueI(index);
1032 TYPEMAP_OUTPUT_ARRAY(value, size, Binding< T1 >::Traducer,
1037 void allocValue2(int NumberOfComponents, int LengthValue)
1039 self->allocValue(NumberOfComponents, LengthValue);
1042 %newobject extract(const SUPPORT *subSupport);
1043 FIELD<T1, INTERLACING_TAG> *extract(const SUPPORT *subSupport)
1045 FIELD<T1, INTERLACING_TAG>* result=self->extract(subSupport);
1046 return (FIELD<T1, INTERLACING_TAG> *)result;
1051 /*%template(FIELDDOUBLEFULLINTERLACE) FIELD<double, FullInterlace>;*/
1052 %template(FIELDDOUBLE) FIELD<double, FullInterlace>;
1053 %template(FIELDDOUBLENOINTERLACE) FIELD<double, NoInterlace>;
1054 /*%template(FIELDINTFULLINTERLACE) FIELD<int, FullInterlace>;*/
1055 %template(FIELDINT) FIELD<int, FullInterlace>;
1056 %template(FIELDINTNOINTERLACE) FIELD<int, NoInterlace>;
1058 class GROUP : public SUPPORT
1065 void setNumberOfFamilies(int numberOfFamilies);
1066 void setFamilies(vector< FAMILY * > Family);
1068 int getNumberOfFamilies() const ;
1069 vector< FAMILY * > getFamilies() const ;
1070 FAMILY * getFamily(int i) const ;
1080 void rmDriver(int index=0);
1082 void read(int index=0);
1084 int getSpaceDimension();
1086 int getMeshDimension();
1088 int getNumberOfNodes();
1092 const double getCoordinate(int Number, int Axis);
1094 int getNumberOfTypes(medEntityMesh Entity);
1096 void calculateConnectivity(medModeSwitch Mode,medConnectivity ConnectivityType,medEntityMesh Entity);
1098 int getNumberOfElements(medEntityMesh Entity,medGeometryElement Type);
1100 int getNumberOfFamilies(medEntityMesh Entity);
1102 int getElementNumber(medConnectivity ConnectivityType, medEntityMesh Entity, medGeometryElement Type, int * connectivity);
1104 CELLMODEL * getCellsTypes(medEntityMesh Entity);
1106 FAMILY* getFamily(medEntityMesh Entity,int i);
1108 int getNumberOfGroups(medEntityMesh Entity);
1110 GROUP * getGroup(medEntityMesh Entity,int i);
1112 medGeometryElement getElementType(medEntityMesh Entity,int Number);
1114 int getElementContainingPoint(const double *coord);
1116 int getNumberOfTypesWithPoly(medEntityMesh Entity);
1118 int getNumberOfPolygons();
1120 int getNumberOfPolyhedronFaces();
1122 int getNumberOfPolyhedron();
1124 int getNumberOfElementsWithPoly(medEntityMesh Entity,
1125 medGeometryElement Type);
1127 bool existPolygonsConnectivity(medConnectivity ConnectivityType,
1128 medEntityMesh Entity);
1130 bool existPolyhedronConnectivity(medConnectivity ConnectivityType,
1131 medEntityMesh Entity);
1133 medGeometryElement getElementTypeWithPoly(medEntityMesh Entity,int Number);
1135 std::string getName() const;
1138 %newobject getBoundaryElements(medEntityMesh );
1139 SUPPORT * getBoundaryElements(medEntityMesh Entity)
1141 return self->getBoundaryElements(Entity);
1144 %newobject getSkin(const SUPPORT * );
1145 SUPPORT * getSkin(const SUPPORT * Support3D)
1147 return self->getSkin(Support3D);
1150 %newobject mergeSupports(const vector< SUPPORT * > );
1151 SUPPORT * mergeSupports(const vector< SUPPORT * > Supports)
1153 return self->mergeSupports(Supports);
1156 %newobject intersectSupports(const vector< SUPPORT * > );
1157 SUPPORT * intersectSupports(const vector< SUPPORT * > Supports)
1159 return self->intersectSupports(Supports);
1162 %newobject mergeFieldsDouble(const vector< FIELD<double>* > others);
1163 FIELD<double, FullInterlace> * mergeFieldsDouble(const vector< FIELD<double>* > others)
1165 return (FIELD<double, FullInterlace> *)self->mergeFields<double>(others);
1168 %newobject mergeFieldsInt(const vector< FIELD<int>* > others);
1169 FIELD<int, FullInterlace> * mergeFieldsInt(const vector< FIELD<int>* > others)
1171 return (FIELD<int, FullInterlace> *)self->mergeFields<int>(others);
1174 CELLMODEL getCellType(medEntityMesh Entity,int i)
1176 return self->getCellsTypes(Entity)[i];
1179 MESH (driverTypes driverType, char * fileName, char * meshName)
1181 return new MESH(driverType, string(fileName), string(meshName));
1184 int addDriver(driverTypes driverType,
1185 char * fileName="Default File Name.med",
1186 char * driverName="Default Mesh Name",
1187 med_mode_acces access=MED_REMP)
1189 return self->addDriver(driverType,string(fileName),
1190 string(driverName),access);
1193 void write(int index=0, char * driverName="")
1195 self->write(index, string(driverName));
1198 void setName(char * name)
1200 self->setName(string(name));
1203 %newobject getCoordinatesSystem();
1204 const char * getCoordinatesSystem()
1206 string tmp_str = self->getCoordinatesSystem();
1207 char * tmp = new char[strlen(tmp_str.c_str())+1];
1208 strcpy(tmp,tmp_str.c_str());
1212 %newobject __str__();
1213 const char* __str__()
1216 mess << "Python Printing MESH : " << *self << endl;
1217 return strdup(mess.str().c_str());
1220 %newobject getCoordinateName(int );
1221 const char * getCoordinateName(int i)
1223 string tmp_str = self->getCoordinatesNames()[i];
1224 char * tmp = new char[strlen(tmp_str.c_str())+1];
1225 strcpy(tmp,tmp_str.c_str());
1229 %newobject getCoordinateUnit(int );
1230 const char * getCoordinateUnit(int i)
1232 string tmp_str = self->getCoordinatesUnits()[i];
1233 char * tmp = new char[strlen(tmp_str.c_str())+1];
1234 strcpy(tmp,tmp_str.c_str());
1238 PyObject * getCoordinatesNames()
1240 const string * array = self->getCoordinatesNames();
1241 int size = self->getSpaceDimension();
1242 TYPEMAP_OUTPUT_ARRAY(array, size, PyString_FromStdString,
1243 MESH::getCoordinatesNames);
1246 PyObject * getCoordinatesUnits()
1248 const string * array = self->getCoordinatesUnits();
1249 int size = self->getSpaceDimension();
1250 TYPEMAP_OUTPUT_ARRAY(array, size, PyString_FromStdString,
1251 MESH::getCoordinatesUnits);
1254 PyObject * getCoordinates(medModeSwitch Mode)
1256 const double * array = self->getCoordinates(Mode);
1257 int size = (self->getSpaceDimension())*(self->getNumberOfNodes());
1258 TYPEMAP_OUTPUT_ARRAY(array, size, PyFloat_FromDouble,
1259 MESH::getCoordinates);
1262 PyObject * getTypes(medEntityMesh Entity)
1264 const medGeometryElement * types = self->getTypes(Entity);
1265 int size = self->getNumberOfTypes(Entity);
1266 TYPEMAP_OUTPUT_ARRAY(types, size, PyInt_FromLong, MESH::getTypes);
1269 PyObject * getConnectivity(medModeSwitch Mode,
1270 medConnectivity ConnectivityType,
1271 medEntityMesh Entity,
1272 medGeometryElement Type)
1274 const int * connectivity = self->getConnectivity(Mode,ConnectivityType,
1276 int size = self->getConnectivityLength(Mode,ConnectivityType,Entity,Type);
1277 TYPEMAP_OUTPUT_ARRAY(connectivity, size, PyInt_FromLong,
1278 MESH::getConnectivity );
1281 PyObject * getConnectivityIndex(medConnectivity ConnectivityType,
1282 medEntityMesh Entity)
1284 const int * connectivity_index =
1285 self->getConnectivityIndex(ConnectivityType,Entity);
1286 int size = (self->getNumberOfElements(Entity,MED_ALL_ELEMENTS))+1;
1287 TYPEMAP_OUTPUT_ARRAY(connectivity_index,size,PyInt_FromLong,
1288 MESH::getConnectivityIndex);
1291 PyObject * getReverseConnectivity(medConnectivity ConnectivityType,
1292 medEntityMesh Entity=MED_CELL)
1294 const int * reverseconnectivity =
1295 self->getReverseConnectivity(ConnectivityType,Entity);
1296 int size = self->getReverseConnectivityLength(ConnectivityType,Entity);
1297 TYPEMAP_OUTPUT_ARRAY(reverseconnectivity, size, PyInt_FromLong,
1298 MESH::getReverseConnectivity);
1301 PyObject * getReverseConnectivityIndex(medConnectivity ConnectivityType,
1302 medEntityMesh Entity=MED_CELL)
1304 const int * reverseconnectivity_index =
1305 self->getReverseConnectivityIndex(ConnectivityType,Entity);
1306 int size=self->getReverseConnectivityIndexLength(ConnectivityType,Entity);
1307 TYPEMAP_OUTPUT_ARRAY(reverseconnectivity_index,size, PyInt_FromLong,
1308 MESH::getReverseConnectivityIndex);
1311 PyObject * getGlobalNumberingIndex(medEntityMesh Entity)
1313 const int * numberingIndex = self->getGlobalNumberingIndex(Entity);
1314 int nbOfTypes = self->getNumberOfTypes(Entity);
1315 int size = nbOfTypes+1;
1316 TYPEMAP_OUTPUT_ARRAY(numberingIndex, size, PyInt_FromLong,
1317 MESH::getGlobalNumberingIndex);
1320 PyObject * getPolygonsConnectivity(medConnectivity ConnectivityType,
1321 medEntityMesh Entity)
1323 const int * array = self->getPolygonsConnectivity(ConnectivityType,Entity);
1324 int size = self->getPolygonsConnectivityLength(ConnectivityType, Entity);
1325 TYPEMAP_OUTPUT_ARRAY(array, size, PyInt_FromLong,
1326 MESH::getPolygonsConnectivity);
1329 PyObject * getPolygonsConnectivityIndex(medConnectivity ConnectivityType,
1330 medEntityMesh Entity)
1332 const int * array = self->getPolygonsConnectivityIndex(ConnectivityType,Entity);
1333 int size = self->getNumberOfPolygons() + 1;
1334 TYPEMAP_OUTPUT_ARRAY(array, size, PyInt_FromLong,
1335 MESH::getPolygonsConnectivity);
1338 PyObject * getPolyhedronConnectivity(medConnectivity ConnectivityType)
1340 const int * array = self->getPolyhedronConnectivity(ConnectivityType);
1341 int size = self->getPolyhedronConnectivityLength(ConnectivityType);
1342 TYPEMAP_OUTPUT_ARRAY(array, size, PyInt_FromLong,
1343 MESH::getPolygonsConnectivity);
1346 PyObject * getPolyhedronIndex(medConnectivity ConnectivityType)
1348 const int * array = self->getPolyhedronIndex(ConnectivityType);
1349 int size = self->getNumberOfPolyhedron() + 1;
1350 TYPEMAP_OUTPUT_ARRAY(array, size, PyInt_FromLong,
1351 MESH::getPolyhedronIndex);
1354 PyObject * getPolyhedronFacesIndex()
1356 const int * array = self->getPolyhedronFacesIndex();
1357 int size = self->getNumberOfPolyhedronFaces() + 1;
1358 TYPEMAP_OUTPUT_ARRAY(array, size, PyInt_FromLong,
1359 MESH::getPolyhedronFacesIndex);
1362 PyObject * getTypesWithPoly(medEntityMesh Entity)
1364 medGeometryElement * array = self->getTypesWithPoly(Entity);
1365 int size = self->getNumberOfTypesWithPoly(Entity);
1366 TYPEMAP_OUTPUT_ARRAY(array, size, PyInt_FromLong,
1367 MESH::getTypesWithPoly);
1372 %newobject getVolume(const SUPPORT * );
1373 FIELD<double, FullInterlace> * getVolume(const SUPPORT * Support)
1375 return (FIELD<double, FullInterlace> *) self->getVolume(Support);
1378 %newobject getArea(const SUPPORT * );
1379 FIELD<double, FullInterlace> * getArea(const SUPPORT * Support)
1381 return (FIELD<double, FullInterlace> *) self->getArea(Support);
1384 %newobject getLength(const SUPPORT * );
1385 FIELD<double, FullInterlace> * getLength(const SUPPORT * Support)
1387 return (FIELD<double, FullInterlace> *) self->getLength(Support);
1390 %newobject getNormal(const SUPPORT * );
1391 FIELD<double, FullInterlace> * getNormal(const SUPPORT * Support)
1393 return (FIELD<double, FullInterlace> *) self->getNormal(Support);
1396 %newobject getBarycenter(const SUPPORT * );
1397 FIELD<double, FullInterlace> * getBarycenter(const SUPPORT * Support)
1399 return (FIELD<double, FullInterlace> *) self->getBarycenter(Support);
1404 class MESHING: public MESH
1410 void setSpaceDimension (const int SpaceDimension) ;
1412 void setMeshDimension (const int MeshDimension) ;
1414 void setNumberOfNodes (const int NumberOfNodes) ;
1416 void setNumberOfTypes (const int NumberOfTypes,
1417 const medEntityMesh Entity) ;
1419 void setTypes (const medGeometryElement * Types,
1420 const medEntityMesh Entity) ;
1422 void setNumberOfElements (const int * NumberOfElements,
1423 const medEntityMesh Entity) ;
1425 void setConnectivity (const int * Connectivity,
1426 const medEntityMesh Entity,
1427 const medGeometryElement Type) ;
1429 void setConnectivities (const int * ConnectivityIndex,
1430 const int * ConnectivityValue,
1431 const medConnectivity ConnectivityType,
1432 const medEntityMesh Entity) ;
1434 void addGroup (const GROUP & Group) ;
1436 void setPolygonsConnectivity (const int * ConnectivityIndex,
1437 const int * ConnectivityValue,
1439 const medEntityMesh Entity);
1441 void setPolyhedraConnectivity (const int * PolyhedronIndex,
1442 const int * FacesIndex,
1445 const MED_EN::medEntityMesh Entity);
1448 void setCoordinates(const int SpaceDimension, const int NumberOfNodes,
1449 const double * Coordinates, const char * System,
1450 const medModeSwitch Mode)
1452 self->setCoordinates(SpaceDimension, NumberOfNodes, Coordinates,
1453 string(System), Mode);
1456 void setCoordinatesSystem(const char * System)
1458 self->setCoordinatesSystem(string(System));
1461 void setCoordinateName (const char * name, const int i)
1463 self->setCoordinateName(string(name), i);
1466 void setCoordinateUnit (const char* unit, const int i)
1468 self->setCoordinateUnit (string(unit), i) ;
1473 class GRID : public MESH
1478 GRID(const GRID &m);
1482 int getNodeNumber(const int i, const int j=0, const int k=0) const ;
1484 int getCellNumber(const int i, const int j=0, const int k=0) const ;
1486 int getEdgeNumber(const int Axis, const int i, const int j=0, const int k=0) const ;
1488 int getFaceNumber(const int Axis, const int i, const int j=0, const int k=0) const ;
1490 med_grid_type getGridType();
1492 int getArrayLength( const int Axis );
1494 const double getArrayValue (const int Axis, const int i);
1496 void setGridType(med_grid_type gridType);
1499 GRID(driverTypes driverType, const char * fileName="", const char * meshName="")
1501 return new GRID(driverType, string(fileName), string(meshName));
1504 PyObject * getEntityPosition(const medEntityMesh Entity, const int Number)
1507 int i=0, size = self->getSpaceDimension();
1511 self->getCellPosition(Number, ijk[0], ijk[1], ijk[2]);
1514 self->getNodePosition(Number, ijk[0], ijk[1], ijk[2]);
1517 self->getFacePosition(Number, Axis, ijk[0], ijk[1], ijk[2]);
1522 self->getEdgePosition(Number, Axis, ijk[0], ijk[1], ijk[2]);
1527 char * message = "Error in GRID::getEntityPosition: wrong Entity";
1528 PyErr_SetString(PyExc_RuntimeError, message);
1531 PyObject *py_list = PyList_New( size );
1532 for (; i < size; ++i)
1534 int err = PyList_SetItem(py_list, i,
1535 Py_BuildValue("i", ijk[j++]));
1538 char * message = "Error in GRID::getNodePosition";
1539 PyErr_SetString(PyExc_RuntimeError, message);
1543 if (Entity == MED_FACE || Entity == MED_EDGE)
1544 PyList_SetItem(py_list, 0, Py_BuildValue("i", Axis));
1546 PyObject * result = Py_BuildValue("O", py_list);
1560 void rmDriver (int index=0);
1562 int getNumberOfMeshes ( void ) const;
1564 int getNumberOfFields ( void ) const;
1566 void updateSupport () ;
1568 void write (int index=0);
1570 void read (int index=0);
1572 void addField ( FIELD_ * const ptrField );
1574 void addMesh ( MESH * const ptrMesh );
1577 MED(driverTypes driverType, char * fileName)
1579 return new MED(driverType,string(fileName));
1582 int addDriver(driverTypes driverType,
1583 char * fileName="Default File Name.med",
1584 med_mode_acces access=MED_REMP)
1586 return self->addDriver(driverType,string(fileName),access);
1589 PyObject *getMeshNames()
1591 deque<string> list_string = self->getMeshNames();
1592 TYPEMAP_OUTPUT_DEQUE_STRING(list_string);
1595 %newobject getMeshName(int );
1596 const char * getMeshName(int i)
1598 deque<string> list_string = self->getMeshNames();
1599 char * tmp = new char[strlen(list_string[i].c_str())+1];
1600 strcpy(tmp,list_string[i].c_str());
1604 PyObject *getFieldNames()
1606 deque<string> list_string = self->getFieldNames();
1607 TYPEMAP_OUTPUT_DEQUE_STRING(list_string);
1610 %newobject getFieldName(int );
1611 const char * getFieldName(int i)
1613 deque<string> list_string = self->getFieldNames();
1614 char * tmp = new char[strlen(list_string[i].c_str())+1];
1615 strcpy(tmp,list_string[i].c_str());
1619 MESH * getMesh(char * meshName)
1621 MESH * myMesh = self->getMesh(string(meshName));
1625 int getFieldNumberOfIteration(char * fieldName)
1627 deque<DT_IT_> list_dtit =
1628 self->getFieldIteration(string(fieldName));
1629 return list_dtit.size();
1632 DT_IT_ getFieldIteration(char * fieldName, int i)
1634 deque<DT_IT_> list_dtit =
1635 self->getFieldIteration(string(fieldName));
1636 return list_dtit[i];
1639 FIELD_ * getField(char * fieldName, int dt, int it)
1641 return self->getField(string(fieldName),dt,it);
1644 PyObject *getFieldT(char * fieldName, int dt, int it)
1646 FIELD_ *ret=self->getField(string(fieldName),dt,it);
1647 TYPEMAP_OUTPUT_FIELDT(ret);
1650 FIELD_ * getField2(char * fieldName,double time, int it=0)
1652 return self->getField2(string(fieldName),time,it);
1655 SUPPORT * getSupport(char * meshName, medEntityMesh entity)
1657 return self->getSupport(string(meshName),entity);
1663 API de MED_MED_[RDONLY,WRONLY,RDWR]_DRIVER
1666 class MED_MED_RDONLY_DRIVER
1672 void read ( void ) ;
1673 void readFileStruct ( void ) ;
1675 virtual ~MED_MED_RDONLY_DRIVER();
1678 MED_MED_RDONLY_DRIVER(char * fileName, MED * ptrMed)
1680 return new MED_MED_RDONLY_DRIVER(string(fileName), ptrMed);
1683 %newobject __str__();
1684 const char* __str__()
1687 mess << "Python Printing MED_MED_RDONLY_DRIVER : " << *self << endl;
1688 return strdup(mess.str().c_str());
1693 class MED_MED_WRONLY_DRIVER
1699 void write ( void ) const ;
1700 void writeFrom ( void ) const ;
1702 virtual ~MED_MED_WRONLY_DRIVER();
1705 MED_MED_WRONLY_DRIVER(char * fileName, MED * ptrMed)
1707 return new MED_MED_WRONLY_DRIVER(string(fileName), ptrMed);
1710 %newobject __str__();
1711 const char* __str__()
1714 mess << "Python Printing MED_MED_WRONLY_DRIVER : " << *self << endl;
1715 return strdup(mess.str().c_str());
1720 class MED_MED_RDWR_DRIVER : public virtual MED_MED_RDONLY_DRIVER,
1721 public virtual MED_MED_WRONLY_DRIVER
1727 void write ( void ) const ;
1728 void writeFrom ( void ) const ;
1729 void read ( void ) ;
1730 void readFileStruct ( void ) ;
1732 ~MED_MED_RDWR_DRIVER();
1735 MED_MED_RDWR_DRIVER(char * fileName, MED * ptrMed)
1737 return new MED_MED_RDWR_DRIVER(string(fileName), ptrMed);
1740 %newobject __str__();
1741 const char* __str__()
1744 mess << "Python Printing MED_MED_RDWR_DRIVER : " << *self << endl;
1745 return strdup(mess.str().c_str());
1751 API de GIBI_MESH_[RDONLY,WRONLY,RDWR]_DRIVER
1754 class GIBI_MESH_RDONLY_DRIVER
1757 GIBI_MESH_RDONLY_DRIVER() ;
1759 GIBI_MESH_RDONLY_DRIVER(const GIBI_MESH_RDONLY_DRIVER & driver) ;
1761 ~GIBI_MESH_RDONLY_DRIVER() ;
1772 GIBI_MESH_RDONLY_DRIVER(char * fileName, MESH * ptrMesh)
1774 return new GIBI_MESH_RDONLY_DRIVER(string(fileName), ptrMesh) ;
1777 %newobject __str__();
1778 const char* __str__()
1781 mess << "Python Printing GIBI_MESH_RDONLY_DRIVER : " << *self << endl;
1782 return strdup(mess.str().c_str());
1785 void setMeshName(char * meshName)
1787 self->setMeshName(string(meshName));
1790 %newobject getMeshName();
1791 char * getMeshName()
1793 string tmp_str = self->getMeshName();
1794 char * tmp = new char[strlen(tmp_str.c_str()) + 1];
1795 strcpy(tmp,tmp_str.c_str());
1801 class GIBI_MESH_WRONLY_DRIVER
1804 GIBI_MESH_WRONLY_DRIVER() ;
1806 GIBI_MESH_WRONLY_DRIVER(const GIBI_MESH_WRONLY_DRIVER & driver) ;
1808 ~GIBI_MESH_WRONLY_DRIVER() ;
1819 GIBI_MESH_WRONLY_DRIVER(char * fileName, MESH * ptrMesh)
1821 return new GIBI_MESH_WRONLY_DRIVER(string(fileName), ptrMesh) ;
1824 %newobject __str__();
1825 const char* __str__()
1828 mess << "Python Printing GIBI_MESH_WRONLY_DRIVER : " << *self << endl;
1829 return strdup(mess.str().c_str());
1832 void setMeshName(char * meshName)
1834 self->setMeshName(string(meshName));
1837 %newobject getMeshName();
1838 char * getMeshName()
1840 string tmp_str = self->getMeshName();
1841 char * tmp = new char[strlen(tmp_str.c_str()) + 1];
1842 strcpy(tmp,tmp_str.c_str());
1848 class GIBI_MESH_RDWR_DRIVER : public virtual GIBI_MESH_RDONLY_DRIVER,
1849 public virtual GIBI_MESH_WRONLY_DRIVER
1852 GIBI_MESH_RDWR_DRIVER() ;
1854 GIBI_MESH_RDWR_DRIVER(const GIBI_MESH_RDWR_DRIVER & driver) ;
1856 ~GIBI_MESH_RDWR_DRIVER() ;
1867 GIBI_MESH_RDWR_DRIVER(char * fileName, MESH * ptrMesh)
1869 return new GIBI_MESH_RDWR_DRIVER(string(fileName), ptrMesh) ;
1872 %newobject __str__();
1873 const char* __str__()
1876 mess << "Python Printing GIBI_MESH_RDWR_DRIVER : " << *self << endl;
1877 return strdup(mess.str().c_str());
1880 void setMeshName(char * meshName)
1882 self->setMeshName(string(meshName));
1885 %newobject getMeshName();
1886 char * getMeshName()
1888 string tmp_str = self->getMeshName();
1889 char * tmp = new char[strlen(tmp_str.c_str()) + 1];
1890 strcpy(tmp,tmp_str.c_str());
1896 class GIBI_MED_RDONLY_DRIVER
1899 GIBI_MED_RDONLY_DRIVER() ;
1901 GIBI_MED_RDONLY_DRIVER(const GIBI_MED_RDONLY_DRIVER & driver) ;
1903 ~GIBI_MED_RDONLY_DRIVER() ;
1914 GIBI_MED_RDONLY_DRIVER(char * fileName, MED * ptrMed)
1916 return new GIBI_MED_RDONLY_DRIVER(string(fileName), ptrMed) ;
1919 %newobject __str__();
1920 const char* __str__()
1923 mess << "Python Printing GIBI_MED_RDONLY_DRIVER : " << *self << endl;
1924 return strdup(mess.str().c_str());
1930 class GIBI_MED_WRONLY_DRIVER
1933 GIBI_MED_WRONLY_DRIVER() ;
1935 GIBI_MED_WRONLY_DRIVER(const GIBI_MED_WRONLY_DRIVER & driver) ;
1937 ~GIBI_MED_WRONLY_DRIVER() ;
1948 GIBI_MED_WRONLY_DRIVER(char * fileName, MED * ptrMed, MESH * ptrMesh)
1950 return new GIBI_MED_WRONLY_DRIVER(string(fileName), ptrMed, ptrMesh) ;
1953 %newobject __str__();
1954 const char* __str__()
1957 mess << "Python Printing GIBI_MED_WRONLY_DRIVER : " << *self << endl;
1958 return strdup(mess.str().c_str());
1965 API de PORFLOW_MESH_[RDONLY,WRONLY,RDWR]_DRIVER
1968 class PORFLOW_MESH_RDONLY_DRIVER
1971 PORFLOW_MESH_RDONLY_DRIVER() ;
1973 PORFLOW_MESH_RDONLY_DRIVER(const PORFLOW_MESH_RDONLY_DRIVER & driver) ;
1975 ~PORFLOW_MESH_RDONLY_DRIVER() ;
1986 PORFLOW_MESH_RDONLY_DRIVER(char * fileName, MESH * ptrMesh)
1988 return new PORFLOW_MESH_RDONLY_DRIVER(string(fileName), ptrMesh) ;
1991 %newobject __str__();
1992 const char* __str__()
1995 mess << "Python Printing PORFLOW_MESH_RDONLY_DRIVER : " << *self << endl;
1996 return strdup(mess.str().c_str());
1999 void setMeshName(char * meshName)
2001 self->setMeshName(string(meshName));
2004 %newobject getMeshName();
2005 char * getMeshName()
2007 string tmp_str = self->getMeshName();
2008 char * tmp = new char[strlen(tmp_str.c_str()) + 1];
2009 strcpy(tmp,tmp_str.c_str());
2015 class PORFLOW_MESH_WRONLY_DRIVER
2018 PORFLOW_MESH_WRONLY_DRIVER() ;
2020 PORFLOW_MESH_WRONLY_DRIVER(const PORFLOW_MESH_WRONLY_DRIVER & driver) ;
2022 ~PORFLOW_MESH_WRONLY_DRIVER() ;
2033 PORFLOW_MESH_WRONLY_DRIVER(char * fileName, MESH * ptrMesh)
2035 return new PORFLOW_MESH_WRONLY_DRIVER(string(fileName), ptrMesh) ;
2038 %newobject __str__();
2039 const char* __str__()
2042 mess << "Python Printing PORFLOW_MESH_WRONLY_DRIVER : " << *self << endl;
2043 return strdup(mess.str().c_str());
2046 void setMeshName(char * meshName)
2048 self->setMeshName(string(meshName));
2051 %newobject getMeshName();
2052 char * getMeshName()
2054 string tmp_str = self->getMeshName();
2055 char * tmp = new char[strlen(tmp_str.c_str()) + 1];
2056 strcpy(tmp,tmp_str.c_str());
2062 class PORFLOW_MESH_RDWR_DRIVER : public virtual PORFLOW_MESH_RDONLY_DRIVER,
2063 public virtual PORFLOW_MESH_WRONLY_DRIVER
2066 PORFLOW_MESH_RDWR_DRIVER() ;
2068 PORFLOW_MESH_RDWR_DRIVER(const PORFLOW_MESH_RDWR_DRIVER & driver) ;
2070 ~PORFLOW_MESH_RDWR_DRIVER() ;
2081 PORFLOW_MESH_RDWR_DRIVER(char * fileName, MESH * ptrMesh)
2083 return new PORFLOW_MESH_RDWR_DRIVER(string(fileName), ptrMesh) ;
2086 %newobject __str__();
2087 const char* __str__()
2090 mess << "Python Printing PORFLOW_MESH_RDWR_DRIVER : " << *self << endl;
2091 return strdup(mess.str().c_str());
2094 void setMeshName(char * meshName)
2096 self->setMeshName(string(meshName));
2099 %newobject getMeshName();
2100 char * getMeshName()
2102 string tmp_str = self->getMeshName();
2103 char * tmp = new char[strlen(tmp_str.c_str()) + 1];
2104 strcpy(tmp,tmp_str.c_str());
2111 API de MED_MESH_[RDONLY,WRONLY,RDWR]_DRIVER
2114 class MED_MESH_RDONLY_DRIVER
2118 ~MED_MESH_RDONLY_DRIVER();
2124 void write( void ) ;
2126 void read ( void ) ;
2129 MED_MESH_RDONLY_DRIVER(char * fileName, MESH * ptrMesh)
2131 return new MED_MESH_RDONLY_DRIVER(string(fileName), ptrMesh);
2134 %newobject __str__();
2135 const char* __str__()
2138 mess << "Python Printing MED_MESH_RDONLY_DRIVER : " << *self << endl;
2139 return strdup(mess.str().c_str());
2142 void setMeshName(char * meshName)
2144 self->setMeshName(string(meshName));
2147 %newobject getMeshName();
2148 char * getMeshName()
2150 string tmp_str = self->getMeshName();
2151 char * tmp = new char[strlen(tmp_str.c_str()) + 1];
2152 strcpy(tmp,tmp_str.c_str());
2158 class MED_MESH_WRONLY_DRIVER
2161 ~MED_MESH_WRONLY_DRIVER();
2163 void write( void ) const ;
2165 void read ( void ) ;
2172 MED_MESH_WRONLY_DRIVER(char * fileName, MESH * ptrMesh)
2174 return new MED_MESH_WRONLY_DRIVER(string(fileName), ptrMesh);
2177 %newobject __str__();
2178 const char* __str__()
2181 mess << "Python Printing MED_MESH_WRONLY_DRIVER : " << *self << endl;
2182 return strdup(mess.str().c_str());
2185 void setMeshName(char * meshName)
2187 self->setMeshName(string(meshName));
2190 %newobject getMeshName();
2191 char * getMeshName()
2193 string tmp_str = self->getMeshName();
2194 char * tmp = new char[strlen(tmp_str.c_str()) + 1];
2195 strcpy(tmp,tmp_str.c_str());
2201 class MED_MESH_RDWR_DRIVER : public virtual MED_MESH_RDONLY_DRIVER,
2202 public virtual MED_MESH_WRONLY_DRIVER
2206 ~MED_MESH_RDWR_DRIVER();
2208 void write(void) const ;
2217 MED_MESH_RDWR_DRIVER(char * fileName, MESH * ptrMesh)
2219 return new MED_MESH_RDWR_DRIVER(string(fileName), ptrMesh);
2222 %newobject __str__();
2223 const char* __str__()
2226 mess << "Python Printing MED_MESH_RDWR_DRIVER : " << *self << endl;
2227 return strdup(mess.str().c_str());
2230 void setMeshName(char * meshName)
2232 self->setMeshName(string(meshName));
2235 %newobject getMeshName();
2236 char * getMeshName()
2238 string tmp_str = self->getMeshName();
2239 char * tmp = new char[strlen(tmp_str.c_str()) + 1];
2240 strcpy(tmp,tmp_str.c_str());
2247 API de MED_FIELD_[RDONLY,WRONLY,RDWR]_DRIVER
2250 template< class T1 >
2251 class MED_FIELD_RDONLY_DRIVER
2255 ~MED_FIELD_RDONLY_DRIVER();
2261 void write( void ) const ;
2263 void read ( void ) ;
2266 MED_FIELD_RDONLY_DRIVER(char * fileName, FIELD<T1, FullInterlace > * ptrField)
2268 return new MED_FIELD_RDONLY_DRIVER< T1 >(string(fileName), ptrField);
2271 %newobject __str__();
2272 const char* __str__()
2275 mess << "Python Printing MED_FIELD_RDONLY_DRIVER : " << *self << endl;
2276 return strdup(mess.str().c_str());
2279 void setFieldName(char * fieldName)
2281 self->setFieldName(string(fieldName));
2284 %newobject getFieldName();
2285 char * getFieldName()
2287 string tmp_str = self->getFieldName();
2288 char * tmp = new char[strlen(tmp_str.c_str()) + 1];
2289 strcpy(tmp,tmp_str.c_str());
2294 %template ( MED_FIELDDOUBLE_RDONLY_DRIVER ) MED_FIELD_RDONLY_DRIVER< double >;
2295 %template ( MED_FIELDINT_RDONLY_DRIVER ) MED_FIELD_RDONLY_DRIVER< int >;
2298 template < class T1 >
2299 class MED_FIELD_WRONLY_DRIVER
2303 ~MED_FIELD_WRONLY_DRIVER();
2309 void write( void ) const ;
2311 void read ( void ) ;
2314 MED_FIELD_WRONLY_DRIVER(char * fileName, FIELD<T1, FullInterlace> * ptrField)
2316 return new MED_FIELD_WRONLY_DRIVER< T1 >(string(fileName), ptrField);
2319 %newobject __str__();
2320 const char* __str__()
2323 mess << "Python Printing MED_FIELD_WRONLY_DRIVER : " << *self << endl;
2324 return strdup(mess.str().c_str());
2327 void setFieldName(char * fieldName)
2329 self->setFieldName(string(fieldName));
2332 %newobject getFieldName();
2333 char * getFieldName()
2335 string tmp_str = self->getFieldName();
2336 char * tmp = new char[strlen(tmp_str.c_str()) + 1];
2337 strcpy(tmp,tmp_str.c_str());
2342 %template ( MED_FIELDDOUBLE_WRONLY_DRIVER ) MED_FIELD_WRONLY_DRIVER< double >;
2343 %template ( MED_FIELDINT_WRONLY_DRIVER ) MED_FIELD_WRONLY_DRIVER< int >;
2346 template< class T1 >
2347 class MED_FIELD_RDWR_DRIVER : public virtual MED_FIELD_RDONLY_DRIVER< T1 >, public virtual MED_FIELD_WRONLY_DRIVER< T1 >
2351 ~MED_FIELD_RDWR_DRIVER();
2357 void write( void ) const ;
2359 void read ( void ) ;
2362 MED_FIELD_RDWR_DRIVER(char * fileName, FIELD<T1, FullInterlace> * ptrField)
2364 return new MED_FIELD_RDWR_DRIVER< T1 >(string(fileName), ptrField);
2367 %newobject __str__();
2368 const char* __str__()
2371 mess << "Python Printing MED_FIELD_RDWR_DRIVER : " << *self << endl;
2372 return strdup(mess.str().c_str());
2375 void setFieldName(char * fieldName)
2377 self->setFieldName(string(fieldName));
2380 %newobject getFieldName();
2381 char * getFieldName()
2383 string tmp_str = self->getFieldName();
2384 char * tmp = new char[strlen(tmp_str.c_str()) + 1];
2385 strcpy(tmp,tmp_str.c_str());
2390 %template ( MED_FIELDDOUBLE_RDWR_DRIVER ) MED_FIELD_RDWR_DRIVER< double >;
2391 %template ( MED_FIELDINT_RDWR_DRIVER ) MED_FIELD_RDWR_DRIVER< int >;
2394 template< class T1 >
2395 class ASCII_FIELD_DRIVER {
2397 ~ASCII_FIELD_DRIVER();
2403 void write( void ) const ;
2407 ASCII_FIELD_DRIVER(const char *fileName, FIELD<T1, FullInterlace> * ptrField, med_sort_direc direction, const char *priority)
2409 return new ASCII_FIELD_DRIVER<T1>(string(fileName), ptrField, (MED_EN::med_sort_direc)direction, priority);
2414 %template (ASCII_FIELDDOUBLE_DRIVER) ASCII_FIELD_DRIVER< double >;
2415 %template (ASCII_FIELDINT_DRIVER) ASCII_FIELD_DRIVER< int >;
2421 template <class INTERLACING_TAG> class GAUSS_LOCALIZATION
2425 GAUSS_LOCALIZATION();
2427 ~GAUSS_LOCALIZATION();
2429 std::string getName() const ;
2431 medGeometryElement getType() const ;
2433 int getNbGauss() const ;
2435 medModeSwitch getInterlacingType() const;
2438 GAUSS_LOCALIZATION<INTERLACING_TAG>(char * locName,
2439 const medGeometryElement
2442 const double * cooRef,
2443 const double * cooGauss,
2446 return new GAUSS_LOCALIZATION<INTERLACING_TAG>(string(locName),
2447 typeGeo, nGauss, cooRef,
2451 %newobject __str__();
2452 const char* __str__()
2455 mess << "Python Printing GAUSS_LOCALIZATION : " << *self << endl;
2456 return strdup(mess.str().c_str());
2459 PyObject * getRefCoo () const
2461 typedef MEDMEM_ArrayInterface<double,INTERLACING_TAG,NoGauss>::Array ArrayNoGauss;
2463 ArrayNoGauss cooRef = self->getRefCoo();
2464 int size = cooRef.getArraySize();
2465 double * cooRefPtr = cooRef.getPtr();
2466 TYPEMAP_OUTPUT_ARRAY(cooRefPtr, size, PyFloat_FromDouble,
2467 GAUSS_LOCALIZATION::getRefCoo);
2470 PyObject * getGsCoo () const
2472 typedef MEDMEM_ArrayInterface<double,INTERLACING_TAG,NoGauss>::Array ArrayNoGauss;
2473 ArrayNoGauss cooGauss = self->getGsCoo();
2474 int size = cooGauss.getArraySize();
2475 double * cooGaussPtr = cooGauss.getPtr();
2476 TYPEMAP_OUTPUT_ARRAY(cooGaussPtr, size, PyFloat_FromDouble,
2477 GAUSS_LOCALIZATION::getGsCoo);
2480 PyObject * getWeight () const
2482 vector<double> wg = self->getWeight();
2483 int size = wg.size();
2484 double * wgPtr = new double [size];
2485 for (int index = 0; index<size; index++)
2486 wgPtr[index] = wg[index];
2487 TYPEMAP_OUTPUT_ARRAY(wgPtr, size, PyFloat_FromDouble,
2488 GAUSS_LOCALIZATION::getWeight);
2494 %template (GAUSS_LOCALIZATION_FULL) GAUSS_LOCALIZATION<FullInterlace> ;
2495 %template (GAUSS_LOCALIZATION_NO) GAUSS_LOCALIZATION<NoInterlace> ;
2498 template <class T, class INTERLACING_TAG>
2499 FIELD<T, INTERLACING_TAG> * createFieldScalarProduct(FIELD<T, INTERLACING_TAG> * field1,
2500 FIELD<T, INTERLACING_TAG> * field2)
2502 return (FIELD<T, INTERLACING_TAG> *)
2503 FIELD<T, INTERLACING_TAG>::scalarProduct((FIELD<T, INTERLACING_TAG>)*field1,
2504 (FIELD<T, INTERLACING_TAG>)*field2);
2507 template <class T, class INTERLACING_TAG>
2508 FIELD<T, INTERLACING_TAG> * createFieldScalarProductDeep(FIELD<T, INTERLACING_TAG> * field1,
2509 FIELD<T, INTERLACING_TAG> * field2)
2511 return (FIELD<T, INTERLACING_TAG>*) FIELD<T, INTERLACING_TAG>::scalarProduct((FIELD<T, INTERLACING_TAG>)*field1,
2512 (FIELD<T, INTERLACING_TAG>)*field2, true);
2515 template<class T, class INTERLACING_TAG>
2516 FIELD<T, INTERLACING_TAG> * createTypedFieldFromField(FIELD_ * field)
2518 MESSAGE("createTypedFieldFromField : Constructor (for Python API) FIELD<T> with parameter FIELD_");
2519 MESSAGE("Its returns a proper cast of the input pointer :: FIELD_ --> FIELD<T>");
2520 return (FIELD<T, INTERLACING_TAG> *) field;
2523 template <class T> FIELD<T, FullInterlace> *
2524 createTypedFieldConvertFullInterlace(const FIELD<T, NoInterlace> & field )
2526 return FieldConvert(field);
2529 template <class T> FIELD<T, NoInterlace> *
2530 createTypedFieldConvertNoInterlace(const FIELD<T, FullInterlace> & field )
2532 return FieldConvert(field);
2536 template<class T, class INTERLACING_TAG> FIELD<T, INTERLACING_TAG> * createTypedFieldFromField(FIELD_ * field);
2537 %template ( createFieldDoubleFromField ) createTypedFieldFromField < double, FullInterlace>;
2538 %template ( createFieldIntFromField ) createTypedFieldFromField < int, FullInterlace >;
2539 %template ( createFieldDoubleNoInterlaceFromField ) createTypedFieldFromField < double, NoInterlace>;
2540 %template ( createFieldIntNoInterlaceFromField ) createTypedFieldFromField < int, NoInterlace >;
2542 template <class T, class INTERLACING_TAG> FIELD<T, INTERLACING_TAG> * createFieldScalarProduct(FIELD<T, INTERLACING_TAG> * field1, FIELD<T, INTERLACING_TAG> * field2);
2543 %newobject createFieldDoubleScalarProduct ;
2544 %newobject createFieldIntScalarProduct ;
2545 %newobject createFieldDoubleNoInterlaceScalarProduct ;
2546 %newobject createFieldIntNoInterlaceScalarProduct ;
2547 %template ( createFieldDoubleScalarProduct ) createFieldScalarProduct < double, FullInterlace >;
2548 %template ( createFieldIntScalarProduct ) createFieldScalarProduct < int, FullInterlace >;
2549 %template ( createFieldDoubleNoInterlaceScalarProduct ) createFieldScalarProduct < double, NoInterlace >;
2550 %template ( createFieldIntNoInterlaceScalarProduct ) createFieldScalarProduct < int, NoInterlace >;
2552 template <class T, class INTERLACING_TAG> FIELD<T, INTERLACING_TAG> * createFieldScalarProductDeep(FIELD<T, INTERLACING_TAG> * field1, FIELD<T, INTERLACING_TAG> * field2);
2553 %newobject createFieldDoubleScalarProductDeep ;
2554 %newobject createFieldIntScalarProductDeep ;
2555 %newobject createFieldDoubleNoInterlaceScalarProductDeep ;
2556 %newobject createFieldIntNoInterlaceScalarProductDeep ;
2557 %template ( createFieldDoubleScalarProductDeep ) createFieldScalarProductDeep < double, FullInterlace >;
2558 %template ( createFieldIntScalarProductDeep ) createFieldScalarProductDeep < int, FullInterlace >;
2559 %template ( createFieldDoubleNoInterlaceScalarProductDeep ) createFieldScalarProductDeep < double, NoInterlace >;
2560 %template ( createFieldIntNoInterlaceScalarProductDeep ) createFieldScalarProductDeep < int, NoInterlace >;
2562 template<class T, class INTERLACING_TAG> FIELD<T, INTERLACING_TAG> * createFieldFromAnalytic(SUPPORT * Support, int NumberOfComponents, PyObject * double_function);
2564 template <class T> FIELD<T, FullInterlace> * createTypedFieldConvertFullInterlace(const FIELD<T, NoInterlace> & field );
2566 %template (createFieldDoubleConvertFullInterlace) createTypedFieldConvertFullInterlace<double>;
2568 %template (createFieldIntConvertFullInterlace) createTypedFieldConvertFullInterlace<int>;
2570 template <class T> FIELD<T, NoInterlace> * createTypedFieldConvertNoInterlace(const FIELD<T, FullInterlace> & field );
2572 %template (createFieldDoubleConvertNoInterlace) createTypedFieldConvertNoInterlace<double>;
2574 %template (createFieldIntConvertNoInterlace) createTypedFieldConvertNoInterlace<int>;
2576 %newobject createFieldDoubleConvertFullInterlace ;
2577 %newobject createFieldIntConvertFullInterlace ;
2579 %newobject createFieldDoubleConvertNoInterlace ;
2580 %newobject createFieldIntConvertNoInterlace ;
2582 GRID * createGridFromMesh( MESH * aMesh );
2585 GRID * createGridFromMesh( MESH * aMesh )
2587 MESSAGE("createGridFromMesh : Constructor (for Python API) GRID with parameter MESH *");
2588 MESSAGE("Its returns a proper cast of the input pointer :: MESH --> GRID");
2590 if (aMesh->getIsAGrid())
2591 return (GRID *) aMesh;
2593 char * message = "Error in GRID(mesh): mesh is not a grid";
2594 PyErr_SetString(PyExc_RuntimeError, message);
2598 template<class T, class INTERLACING_TAG>
2599 FIELD<T, INTERLACING_TAG> * createFieldFromAnalytic(SUPPORT * Support,
2600 int NumberOfComponents,
2601 PyObject * double_function)
2603 MESSAGE("createFieldFromAnalytic : Constructor (for Python API) FIELD from an analytic fonction");
2605 FIELD<T, INTERLACING_TAG> * fieldAnalytic =
2606 new FIELD<T, INTERLACING_TAG>(Support, NumberOfComponents);
2608 MyFunction<T>::_pyFunc=double_function;
2609 MyFunction<T>::_nbOfComponent=NumberOfComponents;
2610 MyFunction<T>::_spaceDim=Support->getMesh()->getSpaceDimension();
2611 fieldAnalytic->fillFromAnalytic(MyFunction<T>::EvalPy2Cpp);
2612 return fieldAnalytic;
2616 %template (createFieldDoubleFromAnalytic) createFieldFromAnalytic<double, FullInterlace>;
2617 %template (createFieldIntFromAnalytic) createFieldFromAnalytic<int, FullInterlace>;
2618 %template (createFieldDoubleNoInterlaceFromAnalytic) createFieldFromAnalytic<double, NoInterlace>;
2619 %template (createFieldIntNoInterlaceFromAnalytic) createFieldFromAnalytic<int, NoInterlace>;