1 // Copyright (C) 2007-2015 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.hxx"
25 #include "MEDCouplingMemArray.hxx"
26 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
31 * \brief Joint Correspondence enumerates pairs of corresponding entities of a
32 * certain geometrical type in adjacent mesh domains.
33 * Correspondence of nodes is constructed when you specify no cell type,
34 * else Correspondence of cells is constructed.
36 class MEDFileJointCorrespondence : public RefCountObject, public MEDFileWritable
39 MEDLOADER_EXPORT static MEDFileJointCorrespondence *New();
40 MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayInt* correspondence); // nodes
41 MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayInt* correspondence, // cells
42 INTERP_KERNEL::NormalizedCellType loc_geo_type,
43 INTERP_KERNEL::NormalizedCellType rem_geo_type);
44 MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
45 MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
46 MEDLOADER_EXPORT MEDFileJointCorrespondence *deepCpy() const;
47 MEDLOADER_EXPORT MEDFileJointCorrespondence *shallowCpy() const;
48 MEDLOADER_EXPORT bool isEqual(const MEDFileJointCorrespondence *other) const;
49 MEDLOADER_EXPORT void setIsNodal(bool isNodal) { _is_nodal = isNodal; }
50 MEDLOADER_EXPORT bool getIsNodal() const { return _is_nodal; }
51 MEDLOADER_EXPORT void setLocalGeometryType(INTERP_KERNEL::NormalizedCellType type) { _loc_geo_type=type; }
52 MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const { return _loc_geo_type; }
53 MEDLOADER_EXPORT void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type) { _rem_geo_type=type; }
54 MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const { return _rem_geo_type; }
55 MEDLOADER_EXPORT void setCorrespondence(DataArrayInt *corr);
56 MEDLOADER_EXPORT const DataArrayInt *getCorrespondence() const { return _correspondence; }
57 MEDLOADER_EXPORT void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
59 MEDLOADER_EXPORT std::string simpleRepr() const;
60 MEDLOADER_EXPORT void writeLL(med_idt fid, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
62 MEDFileJointCorrespondence();
63 MEDFileJointCorrespondence(DataArrayInt* correspondence,
65 INTERP_KERNEL::NormalizedCellType loc_geo_type = INTERP_KERNEL::NORM_ERROR,
66 INTERP_KERNEL::NormalizedCellType rem_geo_type = INTERP_KERNEL::NORM_ERROR);
69 INTERP_KERNEL::NormalizedCellType _loc_geo_type;
70 INTERP_KERNEL::NormalizedCellType _rem_geo_type;
71 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _correspondence;
75 * \brief Joint of one iteration holds correspondences of entities of all types
77 class MEDFileJointOneStep : public RefCountObject, public MEDFileWritable
80 MEDLOADER_EXPORT static MEDFileJointOneStep *New(int dt=-1, int it=-1);
81 MEDLOADER_EXPORT static MEDFileJointOneStep *New(const std::string& fileName, const std::string& mName, const std::string& jointName, int number=1);
82 MEDLOADER_EXPORT static MEDFileJointOneStep *New(med_idt fid, const std::string& mName, const std::string& jointName, int number=1);
83 MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
84 MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
85 MEDLOADER_EXPORT MEDFileJointOneStep *deepCpy() const;
86 MEDLOADER_EXPORT MEDFileJointOneStep *shallowCpy() const;
87 MEDLOADER_EXPORT bool isEqual(const MEDFileJointOneStep *other) const;
88 MEDLOADER_EXPORT void setOrder(int order) { _order=order; }
89 MEDLOADER_EXPORT int getOrder() const { return _order; }
90 MEDLOADER_EXPORT void setIteration(int it) { _iteration=it; }
91 MEDLOADER_EXPORT int getIteration() const { return _iteration; }
92 MEDLOADER_EXPORT void pushCorrespondence(MEDFileJointCorrespondence* correspondence);
93 MEDLOADER_EXPORT int getNumberOfCorrespondences() const;
94 MEDLOADER_EXPORT MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const;
96 MEDLOADER_EXPORT void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const;
98 MEDLOADER_EXPORT std::string simpleRepr() const;
99 MEDLOADER_EXPORT void writeLL(med_idt fid, const std::string& localMeshName, const std::string& jointName) const;
101 MEDFileJointOneStep();
102 MEDFileJointOneStep(med_idt fid, const std::string& mName, const std::string& jointName, int number);
103 MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType convertGeometryType(med_geometry_type geotype);
108 std::vector<MEDCouplingAutoRefCountObjectPtr<MEDFileJointCorrespondence> > _correspondences;
112 * \brief Joint holds a sequence of joints of different iterations relating to
113 * a pair of mesh domains: a local one and a distant one
115 class MEDFileJoint : public RefCountObject, public MEDFileWritable
118 MEDLOADER_EXPORT static MEDFileJoint *New();
119 MEDLOADER_EXPORT static MEDFileJoint *New(const std::string& fileName, const std::string& mName, int num);
120 MEDLOADER_EXPORT static MEDFileJoint *New(med_idt fid, const std::string& mName, int num);
121 MEDLOADER_EXPORT static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum );
122 MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
123 MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
124 MEDLOADER_EXPORT MEDFileJoint *deepCpy() const;
125 MEDLOADER_EXPORT MEDFileJoint *shallowCpy() const;
126 MEDLOADER_EXPORT bool isEqual(const MEDFileJoint *other) const;
127 MEDLOADER_EXPORT void setLocalMeshName(const std::string& name) { _loc_mesh_name=name; }
128 MEDLOADER_EXPORT std::string getLocalMeshName() const { return _loc_mesh_name; }
129 MEDLOADER_EXPORT void setRemoteMeshName(const std::string& name) { _rem_mesh_name=name; }
130 MEDLOADER_EXPORT std::string getRemoteMeshName() const { return _rem_mesh_name; }
131 MEDLOADER_EXPORT void setDescription(const std::string& name) { _desc_name=name; }
132 MEDLOADER_EXPORT std::string getDescription() const { return _desc_name; }
133 MEDLOADER_EXPORT void setJointName(const std::string& name) { _joint_name=name; }
134 MEDLOADER_EXPORT std::string getJointName() const { return _joint_name; }
135 MEDLOADER_EXPORT bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
136 MEDLOADER_EXPORT void setDomainNumber(const int& number) { _domain_number=number; }
137 MEDLOADER_EXPORT int getDomainNumber() const { return _domain_number; }
138 MEDLOADER_EXPORT void pushStep(MEDFileJointOneStep* step);
139 MEDLOADER_EXPORT int getNumberOfSteps() const;
140 MEDLOADER_EXPORT MEDFileJointOneStep *getStepAtPos(int i) const;
142 MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const;
143 MEDLOADER_EXPORT void write(med_idt fid) const;
145 MEDLOADER_EXPORT std::string simpleRepr() const;
148 MEDFileJoint(med_idt fid, const std::string& mName, int num);
150 std::string _loc_mesh_name;
151 std::string _joint_name;
152 std::string _desc_name;
154 std::string _rem_mesh_name;
155 std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJointOneStep> > _joint;
159 * \brief Joints of a mesh domain relating to all other mesh domains
161 class MEDFileJoints : public RefCountObject, public MEDFileWritable
164 MEDLOADER_EXPORT static MEDFileJoints *New();
165 MEDLOADER_EXPORT static MEDFileJoints *New(const std::string& fileName, const std::string& meshName);
166 MEDLOADER_EXPORT static MEDFileJoints *New(med_idt fid, const std::string& meshName);
167 MEDLOADER_EXPORT MEDFileJoints *deepCpy() const;
168 MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
169 MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
170 MEDLOADER_EXPORT std::string simpleRepr() const;
171 MEDLOADER_EXPORT void simpleReprWithoutHeader(std::ostream& oss) const;
172 MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const;
173 MEDLOADER_EXPORT void write(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< MEDCouplingAutoRefCountObjectPtr<MEDFileJoint> > _joints;