From a62d5ed34658857bb0d8f98889278c13ffc46c22 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 5 Dec 2005 16:27:38 +0000 Subject: [PATCH] This commit was generated by cvs2git to create branch 'BR2-D5-38-2003'. Cherrypick from master 2005-12-05 16:27:34 UTC smh 'Copyrights update': INSTALL bin/VERSION doc/MEDMEM/FIELDcreate.cxx doc/MEDMEM/FIELDgeneral.cxx doc/MEDMEM/MEDMEM_InvokingDriverAtObjectCreationTime.cxx doc/MEDMEM/MEDMEM_InvokingDriverByAttachingItToAnObject.cxx doc/MEDMEM/MEDMEM_InvokingDriverFromStandardObjectMethod.cxx doc/MEDMEM/MEDMEM_MedAddingAnExistingObject.cxx doc/MEDMEM/MESHINGexample.cxx doc/MEDMEM/MESHconnectivities.cxx doc/MEDMEM/MESHcoordinates.cxx doc/MEDMEM/MESHgeneral.cxx idl/Compo1Py.idl idl/MED.idl idl/MED_Gen.idl resources/MEDCatalog.xml src/INTERPOLATION/MEDMEM_Interpolation.hxx src/INTERPOLATION/MEDMEM_InterpolationHighLevelObjects.hxx src/INTERPOLATION/MEDMEM_InterpolationTools.hxx src/INTERPOLATION/MEDMEM_Mapping.hxx src/INTERPOLATION/MEDMEM_MappingTools.hxx src/INTERPOLATION/MEDMEM_WrapperCells.hxx src/INTERPOLATION/MEDMEM_WrapperConnectivity.hxx src/INTERPOLATION/MEDMEM_WrapperField.hxx src/INTERPOLATION/MEDMEM_WrapperMesh.hxx src/INTERPOLATION/MEDMEM_WrapperNodes.hxx src/INTERPOLATION/MEDMEM_dTree.hxx src/INTERPOLATION/MEDMEM_dTreeSommet.hxx src/INTERPOLATION/UseCaseInterpolationts.cxx src/INTERPOLATION/UseCaseInterpolationwots.cxx src/INTERPOLATION/UseCaseMapping.cxx src/INTERPOLATION/UseCaseWrapper_Maillage.cxx src/INTERPOLATION/UseCasedTree.cxx src/INTERPOLATION/test_MEDMEM_Interpolation.cxx src/INTERPOLATION/test_MEDMEM_InterpolationFlipBack.cxx src/INTERPOLATION/test_MEDMEM_InterpolationFromMesh_toMesh.cxx src/INTERPOLATION/test_MEDMEM_InterpolationRecopieMaillage.cxx src/INTERPOLATION/test_MEDMEM_InterpolationSansRecopieMaillage.cxx src/INTERPOLATION/test_MEDMEM_InterpolationTimeStep.cxx src/MED/Med_Gen_i.cxx src/MED/Med_Gen_i.hxx src/MEDGUI/MedGUI.cxx src/MEDGUI/MedGUI_Selection.cxx src/MEDGUI/MedGUI_Selection.h src/MEDMEM/MEDMEM_Array.hxx src/MEDMEM/MEDMEM_AsciiFieldDriver.hxx src/MEDMEM/MEDMEM_CellModel.cxx src/MEDMEM/MEDMEM_CellModel.hxx src/MEDMEM/MEDMEM_Compatibility21_22.hxx src/MEDMEM/MEDMEM_Connectivity.cxx src/MEDMEM/MEDMEM_Connectivity.hxx src/MEDMEM/MEDMEM_Coordinate.cxx src/MEDMEM/MEDMEM_Coordinate.hxx src/MEDMEM/MEDMEM_DriverFactory.cxx src/MEDMEM/MEDMEM_DriverFactory.hxx src/MEDMEM/MEDMEM_DriverTools.cxx src/MEDMEM/MEDMEM_DriverTools.hxx src/MEDMEM/MEDMEM_DriversDef.cxx src/MEDMEM/MEDMEM_DriversDef.hxx src/MEDMEM/MEDMEM_Exception.cxx src/MEDMEM/MEDMEM_Exception.hxx src/MEDMEM/MEDMEM_Family.cxx src/MEDMEM/MEDMEM_Family.hxx src/MEDMEM/MEDMEM_Field.cxx src/MEDMEM/MEDMEM_Field.hxx src/MEDMEM/MEDMEM_Formulae.hxx src/MEDMEM/MEDMEM_GenDriver.cxx src/MEDMEM/MEDMEM_GenDriver.hxx src/MEDMEM/MEDMEM_GibiMeshDriver.cxx src/MEDMEM/MEDMEM_GibiMeshDriver.hxx src/MEDMEM/MEDMEM_Grid.cxx src/MEDMEM/MEDMEM_Grid.hxx src/MEDMEM/MEDMEM_Group.cxx src/MEDMEM/MEDMEM_Group.hxx src/MEDMEM/MEDMEM_Init.cxx src/MEDMEM/MEDMEM_Med.cxx src/MEDMEM/MEDMEM_Med.hxx src/MEDMEM/MEDMEM_MedFieldDriver.hxx src/MEDMEM/MEDMEM_MedFieldDriver21.hxx src/MEDMEM/MEDMEM_MedFieldDriver22.hxx src/MEDMEM/MEDMEM_MedMedDriver.cxx src/MEDMEM/MEDMEM_MedMedDriver.hxx src/MEDMEM/MEDMEM_MedMedDriver21.cxx src/MEDMEM/MEDMEM_MedMedDriver21.hxx src/MEDMEM/MEDMEM_MedMedDriver22.cxx src/MEDMEM/MEDMEM_MedMedDriver22.hxx src/MEDMEM/MEDMEM_MedMeshDriver.cxx src/MEDMEM/MEDMEM_MedMeshDriver.hxx src/MEDMEM/MEDMEM_MedMeshDriver21.cxx src/MEDMEM/MEDMEM_MedMeshDriver21.hxx src/MEDMEM/MEDMEM_MedMeshDriver22.cxx src/MEDMEM/MEDMEM_MedMeshDriver22.hxx src/MEDMEM/MEDMEM_MedVersion.cxx src/MEDMEM/MEDMEM_MedVersion.hxx src/MEDMEM/MEDMEM_Mesh.cxx src/MEDMEM/MEDMEM_Mesh.hxx src/MEDMEM/MEDMEM_Meshing.cxx src/MEDMEM/MEDMEM_Meshing.hxx src/MEDMEM/MEDMEM_ModulusArray.hxx src/MEDMEM/MEDMEM_PointerOf.hxx src/MEDMEM/MEDMEM_PolyhedronArray.cxx src/MEDMEM/MEDMEM_PolyhedronArray.hxx src/MEDMEM/MEDMEM_PorflowMeshDriver.cxx src/MEDMEM/MEDMEM_PorflowMeshDriver.hxx src/MEDMEM/MEDMEM_RCBase.hxx src/MEDMEM/MEDMEM_STRING.hxx src/MEDMEM/MEDMEM_SkyLineArray.cxx src/MEDMEM/MEDMEM_SkyLineArray.hxx src/MEDMEM/MEDMEM_Support.cxx src/MEDMEM/MEDMEM_Support.hxx src/MEDMEM/MEDMEM_TypeMeshDriver.cxx src/MEDMEM/MEDMEM_TypeMeshDriver.hxx src/MEDMEM/MEDMEM_Unit.cxx src/MEDMEM/MEDMEM_Unit.hxx src/MEDMEM/MEDMEM_Utilities.hxx src/MEDMEM/MEDMEM_VtkFieldDriver.hxx src/MEDMEM/MEDMEM_VtkMedDriver.cxx src/MEDMEM/MEDMEM_VtkMedDriver.hxx src/MEDMEM/MEDMEM_VtkMeshDriver.cxx src/MEDMEM/MEDMEM_VtkMeshDriver.hxx src/MEDMEM/MEDMEM_define.hxx src/MEDMEM/MEDMEM_medimport_src.cxx src/MEDMEM/MEDMEM_medimport_src.hxx src/MEDMEM/duplicateMED.cxx src/MEDMEM/duplicateMEDMESH.cxx src/MEDMEM/med2_1_To_med2_2.cxx src/MEDMEM/med2vtk.cxx src/MEDMEM/med_test.cxx src/MEDMEM/test_MEDMEM_Array.cxx src/MEDMEM/test_MEDMEM_CellModel.cxx src/MEDMEM/test_MEDMEM_Meshing.cxx src/MEDMEM/test_MEDMEM_MeshingPoly.cxx src/MEDMEM/test_MEDMEM_Meshing_poly.cxx src/MEDMEM/test_MEDMEM_ModulusArray.cxx src/MEDMEM/test_MEDMEM_PolyConnectivity.cxx src/MEDMEM/test_MEDMEM_PolyDriverMedMeshRead.cxx src/MEDMEM/test_MEDMEM_PolyDriverMedMeshWrite.cxx src/MEDMEM/test_MEDMEM_PolyhedronArray.cxx src/MEDMEM/test_MEDMEM_SkyLineArray.cxx src/MEDMEM/test_MEDMEM_poly3D.cxx src/MEDMEM/test_affect_medarray.cxx src/MEDMEM/test_copie_connectivity.cxx src/MEDMEM/test_copie_coordinate.cxx src/MEDMEM/test_copie_family.cxx src/MEDMEM/test_copie_fieldT.cxx src/MEDMEM/test_copie_field_.cxx src/MEDMEM/test_copie_group.cxx src/MEDMEM/test_copie_medarray.cxx src/MEDMEM/test_copie_mesh.cxx src/MEDMEM/test_copie_support.cxx src/MEDMEM/test_gibi_driver.cxx src/MEDMEM/test_grid.cxx src/MEDMEM/test_operation_fielddouble.cxx src/MEDMEM/test_operation_fieldint.cxx src/MEDMEM/test_porflow_driver.cxx src/MEDMEM_I/MEDMEM_Family_i.cxx src/MEDMEM_I/MEDMEM_Family_i.hxx src/MEDMEM_I/MEDMEM_FieldDouble_i.cxx src/MEDMEM_I/MEDMEM_FieldDouble_i.hxx src/MEDMEM_I/MEDMEM_FieldInt_i.cxx src/MEDMEM_I/MEDMEM_FieldInt_i.hxx src/MEDMEM_I/MEDMEM_Field_i.cxx src/MEDMEM_I/MEDMEM_Field_i.hxx src/MEDMEM_I/MEDMEM_Group_i.cxx src/MEDMEM_I/MEDMEM_Group_i.hxx src/MEDMEM_I/MEDMEM_Med_i.cxx src/MEDMEM_I/MEDMEM_Med_i.hxx src/MEDMEM_I/MEDMEM_Mesh_i.cxx src/MEDMEM_I/MEDMEM_Mesh_i.hxx src/MEDMEM_I/MEDMEM_Support_i.cxx src/MEDMEM_I/MEDMEM_Support_i.hxx src/MEDMEM_I/MEDMEM_convert.cxx src/MEDMEM_I/MEDMEM_convert.hxx src/MEDMEM_SWIG/MEDMEM_SWIG_Templates.hxx src/MEDMEM_SWIG/libMEDMEM_Swig.i src/MEDMEM_SWIG/my_typemap.i src/MedClient/src/CONNECTIVITYClient.cxx src/MedClient/src/CONNECTIVITYClient.hxx src/MedClient/src/COORDINATEClient.cxx src/MedClient/src/COORDINATEClient.hxx src/MedClient/src/FAMILYClient.cxx src/MedClient/src/FAMILYClient.hxx src/MedClient/src/FIELDClient.cxx src/MedClient/src/FIELDClient.hxx src/MedClient/src/FIELDDOUBLEClient.cxx src/MedClient/src/FIELDDOUBLEClient.hxx src/MedClient/src/FIELDINTClient.cxx src/MedClient/src/FIELDINTClient.hxx src/MedClient/src/GROUPClient.cxx src/MedClient/src/GROUPClient.hxx src/MedClient/src/MESHClient.cxx src/MedClient/src/MESHClient.hxx src/MedClient/src/MemorySpy.cxx src/MedClient/src/MemorySpy.hxx src/MedClient/src/SUPPORTClient.cxx src/MedClient/src/SUPPORTClient.hxx src/MedClient/src/TESTMEDCLIENT_Gen.idl src/MedClient/src/TESTMEDCLIENT_Gen_i.cxx src/MedClient/src/TESTMEDCLIENT_Gen_i.hxx src/MedClient/src/UtilClient.hxx src/MedClient/src/libMEDClient.i src/MedClient/test/test1/Compo1Py.idl src/MedClient/test/test2/Compo2.cxx src/MedClient/test/test2/Compo2.hxx src/MedClient/test/test2/libCompo2.i src/MedCorba_Swig/batchmode_medcorba_test1.py src/MedCorba_Swig/libMedCorba_Swig.i --- doc/MEDMEM/FIELDcreate.cxx | 86 ++++++ doc/MEDMEM/FIELDgeneral.cxx | 81 +++++ ...MEM_InvokingDriverAtObjectCreationTime.cxx | 53 ++++ ..._InvokingDriverByAttachingItToAnObject.cxx | 105 +++++++ ...InvokingDriverFromStandardObjectMethod.cxx | 67 +++++ .../MEDMEM_MedAddingAnExistingObject.cxx | 56 ++++ doc/MEDMEM/MESHINGexample.cxx | 277 ++++++++++++++++++ doc/MEDMEM/MESHconnectivities.cxx | 154 ++++++++++ doc/MEDMEM/MESHcoordinates.cxx | 63 ++++ doc/MEDMEM/MESHgeneral.cxx | 49 ++++ 10 files changed, 991 insertions(+) create mode 100644 doc/MEDMEM/FIELDcreate.cxx create mode 100644 doc/MEDMEM/FIELDgeneral.cxx create mode 100644 doc/MEDMEM/MEDMEM_InvokingDriverAtObjectCreationTime.cxx create mode 100644 doc/MEDMEM/MEDMEM_InvokingDriverByAttachingItToAnObject.cxx create mode 100644 doc/MEDMEM/MEDMEM_InvokingDriverFromStandardObjectMethod.cxx create mode 100644 doc/MEDMEM/MEDMEM_MedAddingAnExistingObject.cxx create mode 100644 doc/MEDMEM/MESHINGexample.cxx create mode 100644 doc/MEDMEM/MESHconnectivities.cxx create mode 100644 doc/MEDMEM/MESHcoordinates.cxx create mode 100644 doc/MEDMEM/MESHgeneral.cxx diff --git a/doc/MEDMEM/FIELDcreate.cxx b/doc/MEDMEM/FIELDcreate.cxx new file mode 100644 index 000000000..ca0706467 --- /dev/null +++ b/doc/MEDMEM/FIELDcreate.cxx @@ -0,0 +1,86 @@ +// Copyright (C) 2005 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/ +// +using namespace std; +#include "MEDMEM_Mesh.hxx" +#include "MEDMEM_Field.hxx" + +using namespace MEDMEM; +using namespace MED_EN ; + +int main (int argc, char ** argv) { + + const string MedFile = "pointe.med" ; + const string MeshName = "maa1" ; + + /* read MESH */ + MESH * myMesh = new MESH(MED_DRIVER,MedFile,MeshName) ; + // myMesh->read() ; + + // we need a support : + SUPPORT * mySupport = new SUPPORT(myMesh,"Support on all CELLs",MED_CELL); + + /* create FIELD on mySupport, with 3 components */ + int NumberOfCompoennts = 3 ; + FIELD myField(mySupport,NumberOfCompoennts) ; + const string FieldName = "fieldcelldouble" ; + myField.setName(FieldName) ; + + // Components information + string * ComponentsNames = new string[NumberOfCompoennts] ; + ComponentsNames[0] = "Vx" ; + ComponentsNames[1] = "Vy" ; + ComponentsNames[2] = "Vz" ; + myField.setComponentsNames(ComponentsNames) ; + + string * ComponentsDescriptions = new string[NumberOfCompoennts] ; + ComponentsDescriptions[0] = "vitesse selon x" ; + ComponentsDescriptions[1] = "vitesse selon y" ; + ComponentsDescriptions[2] = "vitesse selon z" ; + myField.setComponentsDescriptions(ComponentsDescriptions) ; + + string * ComponentsUnits = new string[NumberOfCompoennts] ; + ComponentsUnits[0] = "m.s-1" ; + ComponentsUnits[1] = "m.s-1" ; + ComponentsUnits[2] = "m.s-1" ; + myField.setMEDComponentsUnits(ComponentsUnits) ; + + // Iteration information : + int IterationNumber = 10 ; // set value to MED_NOPDT if undefined (default) + myField.setIterationNumber(IterationNumber) ; + + int OrderNumber = 1 ; // set value to MED_NONOR if undefined (default) + myField.setOrderNumber(OrderNumber) ; + + double Time = 3.435678 ; // in second + myField.setTime(Time) ; + + // Value : + int NumberOfValue = mySupport->getNumberOfElements(MED_ALL_ELEMENTS); + for(int i=1; i<=NumberOfValue; i++) // i^th element + for (int j=1; j<=NumberOfCompoennts; j++) { // j^th component + double myValue = (i+j) * 0.1 ; + myField.setValueIJ(i,j,myValue); + } + + // save this new field + int id = myField.addDriver(MED_DRIVER) ; + + return 0 ; +} diff --git a/doc/MEDMEM/FIELDgeneral.cxx b/doc/MEDMEM/FIELDgeneral.cxx new file mode 100644 index 000000000..1d37145ac --- /dev/null +++ b/doc/MEDMEM/FIELDgeneral.cxx @@ -0,0 +1,81 @@ +// Copyright (C) 2005 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/ +// +using namespace std; +#include "MEDMEM_Mesh.hxx" +#include "MEDMEM_Field.hxx" + +using namespace MEDMEM; +using namespace MED_EN ; + +int main (int argc, char ** argv) { + + const string MedFile = "pointe.med" ; + const string MeshName = "maa1" ; + const string FieldName = "fieldcelldoublevector" ; + + /* read MESH */ + MESH * myMesh = new MESH(MED_DRIVER,MedFile,MeshName) ; + // myMesh->read() ; + + /* read FIELD */ + // we need a support : + SUPPORT * mySupport = new SUPPORT(myMesh,"Support on all Cells",MED_CELL); + FIELD myField(mySupport,MED_DRIVER,MedFile,FieldName) ; + // myField.read() ; + + /* what in Field ? */ + // How many components + int NumberOfCompoennts = myField.getNumberOfComponents() ; + + const string * ComponentsNames = myField.getComponentsNames(); + const string * ComponentsDescriptions = myField.getComponentsDescriptions(); + const string * ComponentsUnits = myField.getMEDComponentsUnits(); + + for(int i=0;igetNumberOfElements(MED_ALL_ELEMENTS); + // Value + const double * Value = myField.getValue(MED_FULL_INTERLACE); + for(int i=0; i myField (MED_DRIVER,fileName,fieldName); + MESH myMesh (MED_DRIVER,fileName,meshName); + MED myMed (MED_DRIVER,fileName); + + // Test removal of drivers + //myField.rmDriver(); + myMesh.rmDriver (); + myMed.rmDriver (); + + } catch (MEDEXCEPTION& ex){ + MESSAGE(ex.what()) ; + } +} diff --git a/doc/MEDMEM/MEDMEM_InvokingDriverByAttachingItToAnObject.cxx b/doc/MEDMEM/MEDMEM_InvokingDriverByAttachingItToAnObject.cxx new file mode 100644 index 000000000..d02b07c74 --- /dev/null +++ b/doc/MEDMEM/MEDMEM_InvokingDriverByAttachingItToAnObject.cxx @@ -0,0 +1,105 @@ +// Copyright (C) 2005 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/ +// +#include "MEDMEM_Exception.hxx" +#include "MEDMEM_define.hxx" + +#include "MEDMEM_Field.hxx" +#include "MEDMEM_Mesh.hxx" +#include "MEDMEM_Med.hxx" +#include "MEDMEM_MedMedDriver.hxx" +#include "MEDMEM_MedMeshDriver.hxx" + +using namespace MEDMEM ; +using namespace MED_EN ; + +main () { + + const char * fileName = "pointe.med"; + const char * fileName2 = "Field&MeshGeneratedPointe.med"; + const char * fileName3 = "MedGeneratedPointe.med"; + const char * fieldName = "fieldcelldouble"; + const char * meshName = "maa1"; + + try { + // Test creation of drivers from the standard driver method of an object + { + FIELD * myField = new FIELD(); + MED_FIELD_RDONLY_DRIVER myRdOnlyDriver(fileName,myField); + myRdOnlyDriver.setFieldName(fieldName); + myRdOnlyDriver.open(); + //This test failed due to inadequate Support implementation + // myRdOnlyDriver.read(); + // try { myRdOnlyDriver.write(); } catch (MEDEXCEPTION& ex) + // { MESSAGE(ex.what()); } + MED_FIELD_WRONLY_DRIVER myWrOnlyDriver(fileName2,myField); + myWrOnlyDriver.open(); + //This test failed due to inadequate Support implementation + // myWrOnlyDriver.write(); + // try myWrOnlyDriver.read(); catch (MEDEXCEPTION& ex) + // { MESSAGE(ex.what()); } + myRdOnlyDriver.close(); + myWrOnlyDriver.close(); + delete myField; + } + + { + MESH * myMesh = new MESH(); + MED_MESH_RDONLY_DRIVER myRdOnlyDriver(fileName,myMesh); + myRdOnlyDriver.setMeshName(meshName); + myRdOnlyDriver.open(); + myRdOnlyDriver.read(); + myRdOnlyDriver.close(); + // try { myRdOnlyDriver.write(); } catch (MEDEXCEPTION& ex) + // { MESSAGE(ex.what()); } + MED_MESH_WRONLY_DRIVER myWrOnlyDriver(fileName2,myMesh); + myWrOnlyDriver.setMeshName(meshName); + myWrOnlyDriver.open(); + myWrOnlyDriver.write(); + // try myWrOnlyDriver.read(); catch (MEDEXCEPTION& ex) + // { MESSAGE(ex.what()); } + // myRdOnlyDriver.close(); + //While we use H5close() in the MESH/FIELD drivers, the next + //line will fail, because all files are previously closed ! + myWrOnlyDriver.close(); + delete myMesh; + } + + { + MED * myMed = new MED(); + MED_MED_RDONLY_DRIVER myRdOnlyDriver(fileName,myMed); + myRdOnlyDriver.open(); + myRdOnlyDriver.readFileStruct(); + myRdOnlyDriver.close(); + myMed->updateSupport(); // DOIT ETRE SUPPRIMEE + // myRdOnlyDriver.read(); + // try { myRdOnlyDriver.write(); } catch (MEDEXCEPTION& ex) + // { MESSAGE(ex.what()); } + //MED_MED_WRONLY_DRIVER myWrOnlyDriver(fileName3,myMed); + //myWrOnlyDriver.open(); + //myWrOnlyDriver.write(); // Not implemented yet. + //myWrOnlyDriver.close(); + delete myMed; + } + + } catch (MEDEXCEPTION& ex){ + cout << "MAIN BLOCK EXCEPTION" << endl; + MESSAGE(ex.what()) ; + } +} diff --git a/doc/MEDMEM/MEDMEM_InvokingDriverFromStandardObjectMethod.cxx b/doc/MEDMEM/MEDMEM_InvokingDriverFromStandardObjectMethod.cxx new file mode 100644 index 000000000..0465c695b --- /dev/null +++ b/doc/MEDMEM/MEDMEM_InvokingDriverFromStandardObjectMethod.cxx @@ -0,0 +1,67 @@ +// Copyright (C) 2005 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/ +// +#include "MEDMEM_Exception.hxx" +#include "MEDMEM_define.hxx" + +#include "MEDMEM_Field.hxx" +#include "MEDMEM_Mesh.hxx" +#include "MEDMEM_Med.hxx" + +using namespace MEDMEM ; +using namespace MED_EN ; + +main () { + + const char * fileName = "pointe.med"; + const char * fileName2 = "fieldCellDoubleOfpointe.med"; + const char * fieldName = "fieldcelldouble"; + const char * meshName = "maa1"; + + try { + // Test creation of drivers from the standard driver method of an object + FIELD * myField = new FIELD(); + int myDriver1 = myField->addDriver(MED_DRIVER, fileName, fieldName); + //myField->read(); + //This test failed due to inadequate Support implementation + myField->rmDriver(); // TESTER LA VALIDITE DE myDriver2 !!!! + + int myDriver2 = myField->addDriver(MED_DRIVER, fileName2, fieldName); + //myField->write(myDriver2); + //This test failed due to inadequate Support implementation + myField->rmDriver(myDriver2); + + MESH * myMesh = new MESH(); + int myDriver3 = myMesh->addDriver(MED_DRIVER, fileName, meshName); + myMesh->read(); + myMesh->rmDriver(); + + MED * myMed = new MED(); + int myDriver4 = myMed->addDriver(MED_DRIVER, fileName); + myMed->readFileStruct(); + myMed->rmDriver(); + + delete myField; + delete myMesh; + delete myMed; + + } catch (MEDEXCEPTION& ex){ + MESSAGE(ex.what()) ; + } +} diff --git a/doc/MEDMEM/MEDMEM_MedAddingAnExistingObject.cxx b/doc/MEDMEM/MEDMEM_MedAddingAnExistingObject.cxx new file mode 100644 index 000000000..fad6b8b39 --- /dev/null +++ b/doc/MEDMEM/MEDMEM_MedAddingAnExistingObject.cxx @@ -0,0 +1,56 @@ +// Copyright (C) 2005 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/ +// +#include "MEDMEM_Exception.hxx" +#include "MEDMEM_define.hxx" + +#include "MEDMEM_Field.hxx" +#include "MEDMEM_Mesh.hxx" +#include "MEDMEM_Med.hxx" + +main () { + + const char * fileName = "pointe.med"; + const char * fileName2 = "Field&MeshGeneratedPointe.med"; + const char * fileName3 = "MedGeneratedPointe.med"; + const char * fieldName1 = "fieldcelldouble"; + const char * fieldName2 = "fieldcelldoublebis"; + const char * meshName1 = "maa1"; + const char * meshName2 = "maa1bis"; + + try { + + // FAIRE LE TEST AVEC LES CHAMPS AUSSI !. + + MESH myMesh(MED_DRIVER,fileName,meshName1); + myMesh.setName(meshName2); + myMesh.rmDriver(); + + MED myMed(MED_DRIVER,fileName); + myMed.read(); + myMed.addMesh(&myMesh); + int myMedDriver = myMed.addDriver(MED_DRIVER,fileName3); + myMed.write(myMedDriver); + + // FAIRE LE TEST AVEC LES CHAMPS AUSSI !. + + } catch (MEDEXCEPTION& ex){ + MESSAGE(ex.what()) ; + } +} diff --git a/doc/MEDMEM/MESHINGexample.cxx b/doc/MEDMEM/MESHINGexample.cxx new file mode 100644 index 000000000..36ef5a7c9 --- /dev/null +++ b/doc/MEDMEM/MESHINGexample.cxx @@ -0,0 +1,277 @@ +// Copyright (C) 2005 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/ +// +#include "MEDMEM_Meshing.hxx" +#include "MEDMEM_Group.hxx" + +using namespace MEDMEM ; +using namespace MED_EN ; + +using namespace std; + +int main (int argc, char ** argv) { + + // filename to save the generated MESH + string filename = "meshing.med" ; + + MESHING myMeshing ; + myMeshing.setName("meshing") ; + + // define coordinates + + int SpaceDimension = 3 ; + int NumberOfNodes = 19 ; + double Coordinates[57] = { + 0.0, 0.0, 0.0, + 0.0, 0.0, 1.0, + 2.0, 0.0, 1.0, + 0.0, 2.0, 1.0, + -2.0, 0.0, 1.0, + 0.0, -2.0, 1.0, + 1.0, 1.0, 2.0, + -1.0, 1.0, 2.0, + -1.0, -1.0, 2.0, + 1.0, -1.0, 2.0, + 1.0, 1.0, 3.0, + -1.0, 1.0, 3.0, + -1.0, -1.0, 3.0, + 1.0, -1.0, 3.0, + 1.0, 1.0, 4.0, + -1.0, 1.0, 4.0, + -1.0, -1.0, 4.0, + 1.0, -1.0, 4.0, + 0.0, 0.0, 5.0 + }; + + myMeshing.setCoordinates(SpaceDimension,NumberOfNodes,Coordinates,"CARTESIAN",MED_FULL_INTERLACE); + + string Names[3] = { "X","Y","Z" } ; + myMeshing.setCoordinatesNames(Names); + + string Units[3] = { "cm","cm","cm" } ; + myMeshing.setCoordinatesUnits(Units) ; + + // define conectivities + + // cell part + + const int NumberOfTypes = 3 ; + medGeometryElement Types[NumberOfTypes] = {MED_TETRA4,MED_PYRA5,MED_HEXA8} ; + const int NumberOfElements[NumberOfTypes] = {12,2,2} ; + + myMeshing.setNumberOfTypes(NumberOfTypes,MED_CELL); + myMeshing.setTypes(Types,MED_CELL); + myMeshing.setNumberOfElements(NumberOfElements,MED_CELL); + + const int sizeTetra = 12*4 ; + int ConnectivityTetra[sizeTetra]= + { + 1,2,3,6, + 1,2,4,3, + 1,2,5,4, + 1,2,6,5, + 2,7,4,3, + 2,8,5,4, + 2,9,6,5, + 2,10,3,6, + 2,7,3,10, + 2,8,4,7, + 2,9,5,8, + 2,10,6,9 + }; + + myMeshing.setConnectivity(ConnectivityTetra,MED_CELL,MED_TETRA4); + + int ConnectivityPyra[2*5]= + { + 7,8,9,10,2, + 15,18,17,16,19 + }; + + myMeshing.setConnectivity(ConnectivityPyra,MED_CELL,MED_PYRA5); + + int ConnectivityHexa[2*8]= + { + 11,12,13,14,7,8,9,10, + 15,16,17,18,11,12,13,14 + }; + + myMeshing.setConnectivity(ConnectivityHexa,MED_CELL,MED_HEXA8); + + // face part + + const int NumberOfFacesTypes = 2 ; + medGeometryElement FacesTypes[NumberOfFacesTypes] = {MED_TRIA3,MED_QUAD4} ; + const int NumberOfFacesElements[NumberOfFacesTypes] = {4,4} ; + + myMeshing.setNumberOfTypes(NumberOfFacesTypes,MED_FACE); + myMeshing.setTypes(FacesTypes,MED_FACE); + myMeshing.setNumberOfElements(NumberOfFacesElements,MED_FACE); + + const int sizeTria = 3*4 ; + int ConnectivityTria[sizeTria]= + { + 1,4,3, + 1,5,4, + 1,6,5, + 1,3,6 + }; + + myMeshing.setConnectivity(ConnectivityTria,MED_FACE,MED_TRIA3); + + int ConnectivityQua[4*4]= + { + 7,8,9,10, + 11,12,13,14, + 11,7,8,12, + 12,8,9,13 + }; + + myMeshing.setConnectivity(ConnectivityQua,MED_FACE,MED_QUAD4); + + // edge part + + // not yet implemented : if set, results are unpredictable. + + // Some groups : + + // Node : + { + GROUP myGroup ; + myGroup.setName("SomeNodes"); + myGroup.setMesh(&myMeshing); + myGroup.setEntity(MED_NODE); + myGroup.setNumberOfGeometricType(1); + medGeometryElement myTypes[1] = {MED_NONE}; + myGroup.setGeometricType(myTypes); + const int myNumberOfElements[1] = {4} ; + myGroup.setNumberOfElements(myNumberOfElements); + const int index[1+1] = {1,5} ; + const int value[4]= { 1,4,5,7} ; + myGroup.setNumber(index,value); + + myMeshing.addGroup(myGroup); + } + { + GROUP myGroup ; + myGroup.setName("OtherNodes"); + myGroup.setMesh(&myMeshing); + myGroup.setEntity(MED_NODE); + myGroup.setNumberOfGeometricType(1); + medGeometryElement myTypes[1] = {MED_NONE}; + myGroup.setGeometricType(myTypes); + const int myNumberOfElements[1] = {3} ; + myGroup.setNumberOfElements(myNumberOfElements); + const int index[1+1] = {1,4} ; + const int value[3]= { 2,3,6} ; + myGroup.setNumber(index,value); + + myMeshing.addGroup(myGroup); + } + + // Cell : + { + GROUP myGroup ; + myGroup.setName("SomeCells"); + myGroup.setMesh(&myMeshing); + myGroup.setEntity(MED_CELL); + myGroup.setNumberOfGeometricType(3); + medGeometryElement myTypes[3] = {MED_TETRA4,MED_PYRA5,MED_HEXA8}; + myGroup.setGeometricType(myTypes); + const int myNumberOfElements[3] = {4,1,2} ; + myGroup.setNumberOfElements(myNumberOfElements); + const int index[3+1] = {1,5,6,8} ; + const int value[4+1+2]= + { + 2,7,8,12, + 13, + 15,16 + }; + myGroup.setNumber(index,value); + + myMeshing.addGroup(myGroup); + } + { + GROUP myGroup ; + myGroup.setName("OtherCells"); + myGroup.setMesh(&myMeshing); + myGroup.setEntity(MED_CELL); + myGroup.setNumberOfGeometricType(2); + medGeometryElement myTypes[] = {MED_TETRA4,MED_PYRA5}; + myGroup.setGeometricType(myTypes); + const int myNumberOfElements[] = {4,1} ; + myGroup.setNumberOfElements(myNumberOfElements); + const int index[3+1] = {1,5,6} ; + const int value[4+1]= + { + 3,4,5,9, + 14 + }; + myGroup.setNumber(index,value); + + myMeshing.addGroup(myGroup); + } + + // Face : + { + GROUP myGroup ; + myGroup.setName("SomeFaces"); + myGroup.setMesh(&myMeshing); + myGroup.setEntity(MED_FACE); + myGroup.setNumberOfGeometricType(2); + medGeometryElement myTypes[2] = {MED_TRIA3,MED_QUAD4}; + myGroup.setGeometricType(myTypes); + const int myNumberOfElements[2] = {2,3} ; + myGroup.setNumberOfElements(myNumberOfElements); + const int index[2+1] = {1,3,6} ; + const int value[2+3]= + { + 2,4, + 5,6,8 + } ; + myGroup.setNumber(index,value); + + myMeshing.addGroup(myGroup); + } + { + GROUP myGroup ; + myGroup.setName("OtherFaces"); + myGroup.setMesh(&myMeshing); + myGroup.setEntity(MED_FACE); + myGroup.setNumberOfGeometricType(1); + medGeometryElement myTypes[1] = {MED_TRIA3}; + myGroup.setGeometricType(myTypes); + const int myNumberOfElements[1] = {2} ; + myGroup.setNumberOfElements(myNumberOfElements); + const int index[1+1] = {1,3} ; + const int value[2]= + { + 1,3 + } ; + myGroup.setNumber(index,value); + + myMeshing.addGroup(myGroup); + } + + // all rigtht, we save it ! + + int id = myMeshing.addDriver(MED_DRIVER,filename,myMeshing.getName()); + myMeshing.write(id) ; + +} diff --git a/doc/MEDMEM/MESHconnectivities.cxx b/doc/MEDMEM/MESHconnectivities.cxx new file mode 100644 index 000000000..b36510db7 --- /dev/null +++ b/doc/MEDMEM/MESHconnectivities.cxx @@ -0,0 +1,154 @@ +// Copyright (C) 2005 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/ +// +#include "MEDMEM_Mesh.hxx" +#include "MEDMEM_CellModel.hxx" + +using namespace MEDMEM ; +using namespace MED_EN ; + +int main (int argc, char ** argv) { + + const string MedFile = "pointe.med" ; + const string MeshName = "maa1" ; + MESH myMesh(MED_DRIVER,MedFile,MeshName) ; + myMesh.read() ; + + cout << "Mesh name : " << myMesh.getName() << endl << endl ; + + // we get all type for cell entity : + int NumberOfTypes = myMesh.getNumberOfTypes(MED_CELL) ; + const CELLMODEL * Types = myMesh.getCellsTypes(MED_CELL) ; + + cout << "Show Connectivity (Nodal) :" << endl ; + // this example use access with a specified medGeometryElement through + // CELLMODEL class + for (int i=0; i