]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
adding ICoCo interface
authorvbd <vbd>
Fri, 3 Aug 2007 09:28:46 +0000 (09:28 +0000)
committervbd <vbd>
Fri, 3 Aug 2007 09:28:46 +0000 (09:28 +0000)
src/ParaMEDMEM/ICoCo/ICoCoField.hxx [new file with mode: 0644]
src/ParaMEDMEM/ICoCo/ICoCoMEDField.cxx [new file with mode: 0644]
src/ParaMEDMEM/ICoCo/ICoCoMEDField.hxx [new file with mode: 0644]
src/ParaMEDMEM/ICoCo/ICoCoTrioField.hxx [new file with mode: 0644]
src/ParaMEDMEM/ICoCo/Makefile.in [new file with mode: 0644]

diff --git a/src/ParaMEDMEM/ICoCo/ICoCoField.hxx b/src/ParaMEDMEM/ICoCo/ICoCoField.hxx
new file mode 100644 (file)
index 0000000..6911fbf
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef _ICOCOFIELD_HXX_
+#define  _ICOCOFIELD_HXX_
+
+#include <string>
+namespace ICoCo
+{
+class Field
+  {
+  public:
+     Field(){};
+    virtual ~Field(){};
+    void setName(const std::string& name) {_name=name;}
+    std::string getName() {return _name;}
+   
+  private:
+    std::string _name;
+  };
+}
+#endif
diff --git a/src/ParaMEDMEM/ICoCo/ICoCoMEDField.cxx b/src/ParaMEDMEM/ICoCo/ICoCoMEDField.cxx
new file mode 100644 (file)
index 0000000..d24f701
--- /dev/null
@@ -0,0 +1,71 @@
+#include "ICoCoMEDField.hxx"
+#include "ICoCoTrioField.hxx"
+#include "ProcessorGroup.hxx"
+#include "ParaMESH.hxx"
+#include "ParaSUPPORT.hxx"
+#include "ParaFIELD.hxx"
+#include "MEDMEM_Mesh.hxx"
+#include "MEDMEM_Meshing.hxx"
+#include "MEDMEM_Support.hxx"
+#include "MEDMEM_Field.hxx"
+namespace ICoCo
+{
+       MEDField::MEDField(const TrioField& triofield, const ParaMEDMEM::ProcessorGroup& group)
+       {
+               MEDMEM::MESHING* mesh = new MEDMEM::MESHING();
+               string system="CARTESIAN";
+               mesh->setCoordinates(triofield._space_dim,
+                                                                                               triofield._nbnodes,
+                                                                                               triofield._coords,
+                                                                                               system,
+                                                                                               MED_EN::MED_FULL_INTERLACE);
+               mesh->setNumberOfTypes(1, MED_EN::MED_CELL);
+               MED_EN::medGeometryElement elemtype;
+               switch (triofield._mesh_dim)
+                       {
+                       case 2:
+                               switch (triofield._nodes_per_elem)
+                                       {
+                                       case 3:
+                                               elemtype=MED_TRIA3;
+                                               break;
+                                       case 4 : 
+                                               elemtype=MED_QUAD4;
+                                               break;
+                                       default:
+                                               throw MEDMEM::MEDEXCEPTION("incompatible Trio field - wrong nb of nodes per elem");
+                                       }
+                       case 3:
+                               switch (triofield._nodes_per_elem)
+                                       {
+                                       case 4:
+                                               elemtype=MED_TETRA4;
+                                               break;
+                                       case 8 : 
+                                               elemtype=MED_HEXA8;
+                                               break;
+                                       default:
+                                               throw MEDMEM::MEDEXCEPTION("incompatible Trio field - wrong nb of nodes per elem");
+                                       }
+                       default:
+                               throw MEDMEM::MEDEXCEPTION("incompatible Trio field - wrong mesh dimension");
+                       }
+               mesh->setTypes (&elemtype, MED_EN::MED_CELL);
+               mesh->setNumberOfElements(&triofield._nb_elems, MED_EN::MED_CELL);
+               mesh->setConnectivity(triofield._connectivity, MED_EN::MED_CELL, elemtype);
+
+               _mesh=new ParaMEDMEM::ParaMESH(*mesh, group, "support for trio field");
+               ParaMEDMEM::ParaSUPPORT* parasupport=new ParaMEDMEM::ParaSUPPORT(_mesh);
+               ParaMEDMEM::ComponentTopology* comptopo=new ParaMEDMEM::ComponentTopology(triofield._nb_field_components);
+               _field = new ParaMEDMEM::ParaFIELD(parasupport, *comptopo );
+               _field->getField()->setName(triofield._name);
+               _field->getField()->setTime(triofield._time);
+               _field->getField()->setIterationNumber(triofield._itnumber);
+               _field->getField()->setOrderNumber(0);
+               for (int i =0; i<triofield._nb_elems; i++)
+                       for (int j=0; j<triofield._nb_field_components; j++)
+                       {
+                               _field->getField()->setValueIJ(i+1,j+1,triofield._field[i*triofield._nb_field_components+j]);
+                       }
+       }
+};
diff --git a/src/ParaMEDMEM/ICoCo/ICoCoMEDField.hxx b/src/ParaMEDMEM/ICoCo/ICoCoMEDField.hxx
new file mode 100644 (file)
index 0000000..d8dd7a7
--- /dev/null
@@ -0,0 +1,38 @@
+
+#ifndef _ICOCOMEDFIELD_HXX_
+#define _ICOCOMEDFIELD_HXX_
+
+#include <vector>
+#include "ICoCoField.hxx"
+namespace ParaMEDMEM
+{
+       class ParaMESH;
+       class ParaFIELD;
+       class ProcessorGroup;
+}
+namespace MEDMEM
+{
+       class CONNECTZONE;
+}
+namespace ICoCo
+{
+       class TrioField;
+       
+  class MEDField:public Field
+    {
+    public:
+      
+      MEDField(){};
+      MEDField(ParaMEDMEM::ParaMESH* mesh, ParaMEDMEM::ParaFIELD* field): _mesh(mesh), _field(field){};
+                       MEDField(const TrioField&, const ParaMEDMEM::ProcessorGroup& group);
+      ParaMEDMEM::ParaFIELD* getField() const  {return _field;}
+      ParaMEDMEM::ParaMESH* getMesh()const {return _mesh;}
+
+    private:
+      ParaMEDMEM::ParaMESH* _mesh;
+      ParaMEDMEM::ParaFIELD* _field;
+      std::vector<MEDMEM::CONNECTZONE*> _connectzones;
+    };
+};
+
+#endif
diff --git a/src/ParaMEDMEM/ICoCo/ICoCoTrioField.hxx b/src/ParaMEDMEM/ICoCo/ICoCoTrioField.hxx
new file mode 100644 (file)
index 0000000..6b80b48
--- /dev/null
@@ -0,0 +1,29 @@
+#include "Topology.hxx"
+#include "ComponentTopology.hxx"
+#include "ParaMESH.hxx"
+#include "ParaFIELD.hxx"
+#include "MEDMEM_ConnectZone.hxx"
+#include <string>
+namespace ICoCo
+{
+  class TrioField:public Field
+    {
+    public:
+      
+      TrioField();
+
+    public:
+                       int _mesh_dim;
+                       int _space_dim;
+                       int _nbnodes;
+                       int _nodes_per_elem;
+                       int _nb_elems;
+                       int _itnumber;
+                       std::string _name;
+                       double _time;
+                       int* _connectivity;
+                       double* _coords;
+                       int _nb_field_components;
+                       double* _field;
+    };
+};
diff --git a/src/ParaMEDMEM/ICoCo/Makefile.in b/src/ParaMEDMEM/ICoCo/Makefile.in
new file mode 100644 (file)
index 0000000..6815487
--- /dev/null
@@ -0,0 +1,88 @@
+#  MED MEDMEM : MED files in memory
+#
+#  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+#  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+# 
+#  This library is free software; you can redistribute it and/or 
+#  modify it under the terms of the GNU Lesser General Public 
+#  License as published by the Free Software Foundation; either 
+#  version 2.1 of the License. 
+# 
+#  This library is distributed in the hope that it will be useful, 
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+#  Lesser General Public License for more details. 
+# 
+#  You should have received a copy of the GNU Lesser General Public 
+#  License along with this library; if not, write to the Free Software 
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+# 
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+#
+#
+#  File   : Makefile.in
+#  Author : Vincent BERGEAUD (CEA/DEN/DANS/DM2S/SFME/LGLS)
+#  Module : MED
+
+top_srcdir=@top_srcdir@
+top_builddir=../../..
+srcdir=@srcdir@
+VPATH=.:$(srcdir):$(srcdir)/tests
+
+MACHINE=PCLINUX
+
+@COMMENCE@
+
+
+EXPORT_PYSCRIPTS = \
+
+
+EXPORT_HEADERS = \
+ICoCoField.hxx\
+ICoCoMEDField.hxx
+
+# Libraries targets
+
+LIB=libICoCo.la
+
+LIB_SRC = ICoCoMEDField.cxx
+
+
+# Executables targets
+BIN =
+BIN_SRC = 
+BIN_SERVER_IDL = 
+BIN_CLIENT_IDL = 
+
+TEST_PROGS = 
+LDFLAGS+= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome 
+LDFLAGSFORBIN+= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome
+
+CPPFLAGS+=$(MED2_INCLUDES) $(MPI_INCLUDES) $(LAM_INCLUDES) -I/data/tmpawa/vb144235/lam_install/include -I/data/tmpawa/vb144235/fvm/src -DFVM_HAVE_MPI -I$(top_srcdir)/src/ParaMEDMEM  -I$(top_srcdir)/src/MEDMEM
+
+CXXFLAGS+=@CXXTMPDPTHFLAGS@ 
+CPPFLAGS+=$(BOOST_CPPFLAGS)
+#LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) 
+# change motivated by the bug KERNEL4778.
+LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lmed_V2_1 $(STDLIB) -lmedmem  $(MPI_LIBS) $(LAM_LIBS) -L/data/tmpawa/vb144235/lam_install/lib -lmpi -llam -lutil -linterpkernel -lparamed
+
+#LDFLAGSFORBIN+=$(MED2_LIBS) $(HDF5_LIBS)
+# change motivated by the bug KERNEL4778.
+LDFLAGSFORBIN+= -lm $(MED2_LIBS) $(HDF5_LIBS) -lmed_V2_1 -lmedmem   $(BOOST_LIBS) $(MPI_LIBS) $(LAM_LIBS) -L/data/tmpawa/vb144235/lam_install/lib -lmpi -llam -lutil -linterpkernel  -lparamed
+
+ifeq ($(MED_WITH_KERNEL),yes)
+  CPPFLAGS+= ${KERNEL_CXXFLAGS}
+  CXXFLAGS+= ${KERNEL_CXXFLAGS}
+  LDFLAGS+= ${KERNEL_LDFLAGS} -lSALOMELocalTrace 
+  LDFLAGSFORBIN+= ${KERNEL_LDFLAGS} -lSALOMELocalTrace -lSALOMEBasics
+endif
+
+LIBSFORBIN=$(BOOSTLIBS) $(MPI_LIBS) 
+
+LIBS=
+
+# build create_mesh :
+bin: 
+
+@CONCLUDE@