Salome HOME
Merge from BR_V5_DEV 16Feb09
[tools/medcoupling.git] / src / ParaMEDMEM / ParaFIELD.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 __PARAFIELD_HXX__
20 #define __PARAFIELD_HXX__
21
22 #include "ComponentTopology.hxx"
23 #include "ParaMESH.hxx"
24 #include "MEDCouplingFieldDouble.hxx"
25 #include "MEDCouplingUMesh.hxx"
26
27 namespace ParaMEDMEM
28 {
29
30   class ParaSUPPORT;
31   class ProcessorGroup;
32
33   class ParaFIELD
34   {
35   public:
36
37     ParaFIELD(TypeOfField type, ParaMESH* mesh, const ComponentTopology& component_topology); 
38
39
40     ParaFIELD(MEDCouplingFieldDouble* field, const ProcessorGroup& group);
41   
42     virtual ~ParaFIELD();
43     void synchronizeTarget( ParaMEDMEM::ParaFIELD* source_field);
44     void synchronizeSource( ParaMEDMEM::ParaFIELD* target_field);
45     MEDCouplingFieldDouble* getField() const { return _field; }
46     Topology* getTopology() const { return _topology; }
47     ParaMESH* getSupport() const  { return _support; }
48     int nbComponents() const { return _component_topology.nbComponents(); }
49     double getVolumeIntegral(int icomp) const;
50     double getL2Norm()const { return -1; }
51   private:
52     MEDCouplingFieldDouble* _field;
53     const  ParaMEDMEM::ComponentTopology& _component_topology;
54     Topology* _topology; 
55
56     ParaMESH* _support;
57     bool _has_field_ownership;
58     bool _has_support_ownership;
59   };
60
61 }
62
63 #endif