Salome HOME
2120a5bac7ff88280d51655b127f6654957ce461
[modules/med.git] / src / MEDCoupling / MEDCouplingAMRAttribute.hxx
1 // Copyright (C) 2007-2014  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, or (at your option) any later version.
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 // Author : Anthony Geay
20
21 #ifndef __MEDCOUPLINGAMRATTRIBUTE_HXX__
22 #define __MEDCOUPLINGAMRATTRIBUTE_HXX__
23
24 #include "MEDCoupling.hxx"
25 #include "MEDCouplingCartesianAMRMesh.hxx"
26
27 namespace ParaMEDMEM
28 {
29   /// @cond INTERNAL
30   class DataArrayDoubleCollection : public RefCountObject
31   {
32   public:
33     static DataArrayDoubleCollection *New(const std::vector< std::pair<std::string,int> >& fieldNames);
34     void allocTuples(int nbOfTuples);
35     void dellocTuples();
36   private:
37     DataArrayDoubleCollection(const std::vector< std::pair<std::string,int> >& fieldNames);
38     std::size_t getHeapMemorySizeWithoutChildren() const;
39     std::vector<const BigMemoryObject *> getDirectChildren() const;
40     static void CheckDiscriminantNames(const std::vector<std::string>& names);
41   private:
42     std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > _arrs;
43   };
44
45   class MEDCouplingGridCollection : public RefCountObject
46   {
47   private:
48     std::size_t getHeapMemorySizeWithoutChildren() const;
49     std::vector<const BigMemoryObject *> getDirectChildren() const;
50   private:
51     std::vector< std::pair<MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > > _map_of_dadc;
52   };
53   /// @endcond
54
55   class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
56   {
57   public:
58     MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string,int> >& fieldNames);
59     //
60     MEDCOUPLING_EXPORT void alloc();
61     MEDCOUPLING_EXPORT void dealloc();
62     MEDCOUPLING_EXPORT bool changeGodFather(MEDCouplingCartesianAMRMesh *gf);
63     //
64     MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
65     MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
66     MEDCOUPLING_EXPORT void updateTime() const;
67   private:
68     MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string,int> >& fieldNames);
69   private:
70     std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> > _levs;
71   };
72 }
73
74 #endif