1 // Copyright (C) 2007-2019 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
20 #ifndef __MEDFILEJOINT_HXX__
21 #define __MEDFILEJOINT_HXX__
23 #include "MEDLoaderDefines.hxx"
24 #include "MEDFileUtilities.txx"
25 #include "MEDCouplingMemArray.hxx"
28 #include "NormalizedGeometricTypes"
33 * \brief Joint Correspondence enumerates pairs of corresponding entities of a
34 * certain geometrical type in adjacent mesh domains.
35 * Correspondence of nodes is constructed when you specify no cell type,
36 * else Correspondence of cells is constructed.
38 class MEDFileJointCorrespondence : public RefCountObject, public MEDFileWritable
41 MEDLOADER_EXPORT static MEDFileJointCorrespondence *New();
42 MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence); // nodes
43 MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence, // cells
44 INTERP_KERNEL::NormalizedCellType loc_geo_type,
45 INTERP_KERNEL::NormalizedCellType rem_geo_type);
46 MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
47 MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
48 MEDLOADER_EXPORT MEDFileJointCorrespondence *deepCopy() const;
49 MEDLOADER_EXPORT MEDFileJointCorrespondence *shallowCpy() const;
50 MEDLOADER_EXPORT bool isEqual(const MEDFileJointCorrespondence *other) const;
51 MEDLOADER_EXPORT void setIsNodal(bool isNodal) { _is_nodal = isNodal; }
52 MEDLOADER_EXPORT bool getIsNodal() const { return _is_nodal; }
53 MEDLOADER_EXPORT void setLocalGeometryType(INTERP_KERNEL::NormalizedCellType type) { _loc_geo_type=type; }
54 MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const { return _loc_geo_type; }
55 MEDLOADER_EXPORT void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type) { _rem_geo_type=type; }
56 MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const { return _rem_geo_type; }
57 MEDLOADER_EXPORT void setCorrespondence(DataArrayIdType *corr);
58 MEDLOADER_EXPORT const DataArrayIdType *getCorrespondence() const { return _correspondence; }
59 MEDLOADER_EXPORT void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
61 MEDLOADER_EXPORT std::string simpleRepr() const;
62 MEDLOADER_EXPORT void writeLL(med_idt fid, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
64 MEDFileJointCorrespondence();
65 MEDFileJointCorrespondence(DataArrayIdType* correspondence,
67 INTERP_KERNEL::NormalizedCellType loc_geo_type = INTERP_KERNEL::NORM_ERROR,
68 INTERP_KERNEL::NormalizedCellType rem_geo_type = INTERP_KERNEL::NORM_ERROR);
71 INTERP_KERNEL::NormalizedCellType _loc_geo_type;
72 INTERP_KERNEL::NormalizedCellType _rem_geo_type;
73 MCAuto<DataArrayIdType> _correspondence;
77 * \brief Joint of one iteration holds correspondences of entities of all types
79 class MEDFileJointOneStep : public RefCountObject, public MEDFileWritable
82 MEDLOADER_EXPORT static MEDFileJointOneStep *New(int dt=-1, int it=-1);
83 MEDLOADER_EXPORT static MEDFileJointOneStep *New(const std::string& fileName, const std::string& mName, const std::string& jointName, int number=1);
84 MEDLOADER_EXPORT static MEDFileJointOneStep *New(med_idt fid, const std::string& mName, const std::string& jointName, int number=1);
85 MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
86 MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
87 MEDLOADER_EXPORT MEDFileJointOneStep *deepCopy() const;
88 MEDLOADER_EXPORT MEDFileJointOneStep *shallowCpy() const;
89 MEDLOADER_EXPORT bool isEqual(const MEDFileJointOneStep *other) const;
90 MEDLOADER_EXPORT void setOrder(int order) { _order=order; }
91 MEDLOADER_EXPORT int getOrder() const { return _order; }
92 MEDLOADER_EXPORT void setIteration(int it) { _iteration=it; }
93 MEDLOADER_EXPORT int getIteration() const { return _iteration; }
94 MEDLOADER_EXPORT void pushCorrespondence(MEDFileJointCorrespondence* correspondence);
95 MEDLOADER_EXPORT int getNumberOfCorrespondences() const;
96 MEDLOADER_EXPORT MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const;
98 MEDLOADER_EXPORT void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const;
100 MEDLOADER_EXPORT std::string simpleRepr() const;
101 MEDLOADER_EXPORT void writeLL(med_idt fid, const std::string& localMeshName, const std::string& jointName) const;
103 MEDFileJointOneStep();
104 MEDFileJointOneStep(med_idt fid, const std::string& mName, const std::string& jointName, int number);
105 MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType convertGeometryType(med_geometry_type geotype);
110 std::vector<MCAuto<MEDFileJointCorrespondence> > _correspondences;
114 * \brief Joint holds a sequence of joints of different iterations relating to
115 * a pair of mesh domains: a local one and a distant one
117 class MEDFileJoint : public RefCountObject, public MEDFileWritableStandAlone
120 MEDLOADER_EXPORT static MEDFileJoint *New();
121 MEDLOADER_EXPORT static MEDFileJoint *New(const std::string& fileName, const std::string& mName, int num);
122 MEDLOADER_EXPORT static MEDFileJoint *New(med_idt fid, const std::string& mName, int num);
123 MEDLOADER_EXPORT static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum );
124 MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
125 MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
126 MEDLOADER_EXPORT MEDFileJoint *deepCopy() const;
127 MEDLOADER_EXPORT MEDFileJoint *shallowCpy() const;
128 MEDLOADER_EXPORT bool isEqual(const MEDFileJoint *other) const;
129 MEDLOADER_EXPORT void setLocalMeshName(const std::string& name) { _loc_mesh_name=name; }
130 MEDLOADER_EXPORT std::string getLocalMeshName() const { return _loc_mesh_name; }
131 MEDLOADER_EXPORT void setRemoteMeshName(const std::string& name) { _rem_mesh_name=name; }
132 MEDLOADER_EXPORT std::string getRemoteMeshName() const { return _rem_mesh_name; }
133 MEDLOADER_EXPORT void setDescription(const std::string& name) { _desc_name=name; }
134 MEDLOADER_EXPORT std::string getDescription() const { return _desc_name; }
135 MEDLOADER_EXPORT void setJointName(const std::string& name) { _joint_name=name; }
136 MEDLOADER_EXPORT std::string getJointName() const { return _joint_name; }
137 MEDLOADER_EXPORT bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
138 MEDLOADER_EXPORT void setDomainNumber(const int& number) { _domain_number=number; }
139 MEDLOADER_EXPORT int getDomainNumber() const { return _domain_number; }
140 MEDLOADER_EXPORT void pushStep(MEDFileJointOneStep* step);
141 MEDLOADER_EXPORT int getNumberOfSteps() const;
142 MEDLOADER_EXPORT MEDFileJointOneStep *getStepAtPos(int i) const;
144 MEDLOADER_EXPORT void writeLL(med_idt fid) const;
146 MEDLOADER_EXPORT std::string simpleRepr() const;
149 MEDFileJoint(med_idt fid, const std::string& mName, int num);
151 std::string _loc_mesh_name;
152 std::string _joint_name;
153 std::string _desc_name;
155 std::string _rem_mesh_name;
156 std::vector< MCAuto<MEDFileJointOneStep> > _joint;
160 * \brief Joints of a mesh domain relating to all other mesh domains
162 class MEDFileJoints : public RefCountObject, public MEDFileWritableStandAlone
165 MEDLOADER_EXPORT static MEDFileJoints *New();
166 MEDLOADER_EXPORT static MEDFileJoints *New(const std::string& fileName, const std::string& meshName);
167 MEDLOADER_EXPORT static MEDFileJoints *New(med_idt fid, const std::string& meshName);
168 MEDLOADER_EXPORT MEDFileJoints *deepCopy() const;
169 MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
170 MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
171 MEDLOADER_EXPORT std::string simpleRepr() const;
172 MEDLOADER_EXPORT void simpleReprWithoutHeader(std::ostream& oss) const;
173 MEDLOADER_EXPORT void writeLL(med_idt fid) const;
174 MEDLOADER_EXPORT std::string getMeshName() const;
175 MEDLOADER_EXPORT int getNumberOfJoints() const;
176 MEDLOADER_EXPORT MEDFileJoint *getJointAtPos(int i) const;
177 MEDLOADER_EXPORT MEDFileJoint *getJointWithName(const std::string& jname) const;
178 MEDLOADER_EXPORT std::vector<std::string> getJointsNames() const;
179 MEDLOADER_EXPORT bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
181 MEDLOADER_EXPORT void resize(int newSize);
182 MEDLOADER_EXPORT void pushJoint(MEDFileJoint *joint);
183 MEDLOADER_EXPORT void setJointAtPos(int i, MEDFileJoint *joint);
184 MEDLOADER_EXPORT void destroyJointAtPos(int i);
188 MEDFileJoints(med_idt fid, const std::string& meshName);
190 std::vector< MCAuto<MEDFileJoint> > _joints;