1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay
21 #ifndef __MEDCOUPLINGAMRATTRIBUTE_HXX__
22 #define __MEDCOUPLINGAMRATTRIBUTE_HXX__
24 #include "MEDCoupling.hxx"
25 #include "MEDCouplingCartesianAMRMesh.hxx"
30 class DataArrayDoubleCollection : public RefCountObject, public TimeLabel
33 static DataArrayDoubleCollection *New(const std::vector< std::pair<std::string,int> >& fieldNames);
34 void allocTuples(int nbOfTuples);
36 void spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames);
37 std::vector<DataArrayDouble *> retrieveFields() const;
38 const DataArrayDouble *getFieldWithName(const std::string& name) const;
39 static void SynchronizeFineToCoarse(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *fine, DataArrayDoubleCollection *coarse);
40 static void SynchronizeCoarseToFine(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine);
41 static void SynchronizeFineEachOther(int patchId, int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, const std::vector<const MEDCouplingCartesianAMRMeshGen *>& children, const std::vector<DataArrayDoubleCollection *>& fieldsOnFine);
42 static void SynchronizeCoarseToFineOnlyInGhostZone(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine);
44 DataArrayDoubleCollection(const std::vector< std::pair<std::string,int> >& fieldNames);
45 std::size_t getHeapMemorySizeWithoutChildren() const;
46 std::vector<const BigMemoryObject *> getDirectChildren() const;
47 void updateTime() const;
48 static void CheckDiscriminantNames(const std::vector<std::string>& names);
50 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > _arrs;
53 class MEDCouplingGridCollection : public RefCountObject, public TimeLabel
56 static MEDCouplingGridCollection *New(const std::vector<const MEDCouplingCartesianAMRMeshGen *>& ms, const std::vector< std::pair<std::string,int> >& fieldNames);
57 void alloc(int ghostLev);
59 void spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames);
60 bool presenceOf(const MEDCouplingCartesianAMRMeshGen *m, int& pos) const;
61 const DataArrayDoubleCollection& retrieveFieldsAt(int pos) const;
62 static void SynchronizeFineToCoarse(int ghostLev, const MEDCouplingGridCollection *fine, const MEDCouplingGridCollection *coarse);
63 static void SynchronizeCoarseToFine(int ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine);
64 void synchronizeFineEachOther(int ghostLev) const;
65 static void SynchronizeCoarseToFineOnlyInGhostZone(int ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine);
66 void fillIfInTheProgenyOf(const std::string& fieldName, const MEDCouplingCartesianAMRMeshGen *head, std::vector<const DataArrayDouble *>& recurseArrs) const;
68 MEDCouplingGridCollection(const std::vector<const MEDCouplingCartesianAMRMeshGen *>& ms, const std::vector< std::pair<std::string,int> >& fieldNames);
69 std::size_t getHeapMemorySizeWithoutChildren() const;
70 std::vector<const BigMemoryObject *> getDirectChildren() const;
71 void updateTime() const;
73 std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > > _map_of_dadc;
78 class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel
81 MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string,int> >& fieldNames);
82 MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string, std::vector<std::string> > >& fieldNames);
83 MEDCOUPLING_EXPORT void spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames);
84 MEDCOUPLING_EXPORT std::vector<DataArrayDouble *> retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const;
85 MEDCOUPLING_EXPORT const DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
86 MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(int ghostLev, MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
87 MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildCellFieldOnWithGhost(int ghostLev, MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const;
89 MEDCOUPLING_EXPORT void synchronizeFineToCoarse(int ghostLev);
90 MEDCOUPLING_EXPORT void synchronizeCoarseToFine(int ghostLev);
91 MEDCOUPLING_EXPORT void synchronizeCoarseToFineOnlyInGhostZone(int ghostLev);
92 MEDCOUPLING_EXPORT void synchronizeFineEachOtherInGhostZone(int ghostLev);
93 MEDCOUPLING_EXPORT void alloc(int ghostLev);
94 MEDCOUPLING_EXPORT void dealloc();
95 MEDCOUPLING_EXPORT bool changeGodFather(MEDCouplingCartesianAMRMesh *gf);
97 MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
98 MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
99 MEDCOUPLING_EXPORT void updateTime() const;
101 MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string,int> >& fieldNames);
103 std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> > _levs;