Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/med.git] / src / ParaMEDMEM / DEC.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
2 //
3 //  This library is free software; you can redistribute it and/or
4 //  modify it under the terms of the GNU Lesser General Public
5 //  License as published by the Free Software Foundation; either
6 //  version 2.1 of the License.
7 //
8 //  This library is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 //  Lesser General Public License for more details.
12 //
13 //  You should have received a copy of the GNU Lesser General Public
14 //  License along with this library; if not, write to the Free Software
15 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #ifndef __DEC_HXX__
20 #define __DEC_HXX__
21
22 #include "MEDCouplingFieldDouble.hxx"
23 #include "NormalizedUnstructuredMesh.hxx"
24 #include "DECOptions.hxx"
25
26 namespace ICoCo
27 {
28   class Field;
29 }
30
31 namespace ParaMEDMEM
32 {
33   class ProcessorGroup;
34   class ParaFIELD;
35   class CommInterface;
36   class DEC : public DECOptions
37   {
38   public:
39     DEC():_local_field(0) { }
40     DEC(ProcessorGroup& source_group, ProcessorGroup& target_group); 
41     void attachLocalField( MEDCouplingFieldDouble* field);
42     void attachLocalField(const ParaFIELD* field);
43     void attachLocalField(const ICoCo::Field* field);
44     
45     virtual void prepareSourceDE()=0;
46     virtual void prepareTargetDE()=0;
47     virtual void recvData()=0;
48     virtual void sendData()=0;
49     virtual void synchronize()=0;
50     virtual ~DEC();
51     virtual void computeProcGroup() { }
52     void renormalizeTargetField();
53   protected:
54     void compareFieldAndMethod() const throw(INTERP_KERNEL::Exception);
55   protected:
56     const ParaFIELD* _local_field;
57     //! Processor group representing the union of target and source processors
58     ProcessorGroup* _union_group;
59     ProcessorGroup* _source_group;
60     ProcessorGroup* _target_group;
61     
62     const CommInterface* _comm_interface;
63     bool _owns_field;
64   private:
65     ICoCo::Field* _icoco_field;
66   };
67 }
68
69 #endif