MED fichier

MEDfilterBlockOfEntityCr.c
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2 *
3 * COPYRIGHT (C) 1999 - 2021 EDF R&D, CEA/DEN
4 * MED is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * MED is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with MED. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18
19 #include <med.h>
20 #include <med_config.h>
21 #include <med_outils.h>
22 #include <hdf5.h>
23 #include <string.h>
24
52 med_err MEDfilterBlockOfEntityCr(const med_idt fid,
53 const med_int nentity,
54 const med_int nvaluesperentity,
55 const med_int nconstituentpervalue,
56 const med_int constituentselect,
57 const med_switch_mode switchmode,
58 const med_storage_mode storagemode,
59 const char * const profilename,
60 const med_size start,
61 const med_size stride,
62 const med_size count,
63 const med_size blocksize,
64 const med_size lastblocksize,
65 med_filter* const filter) {
66
67
68 med_int _profilearraysize=0,_maxentitynum=0;
69 med_err _ret=-1;
70 med_size _start=start-1;
71
72 NOFINALBLANK(profilename,ERROR);
73
74 if ( start == 0) {
75 MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,"");
76 ISCRUTE_size(start);
77 goto ERROR;
78 }
79
80 _maxentitynum=_start+(count-1)*(stride);
81
82 if ( strlen(profilename) ) {
83 _profilearraysize = MEDprofileSizeByName(fid,profilename);
84 if ( _maxentitynum > _profilearraysize ) {
85 MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_GSIZE_MSG);ISCRUTE(_maxentitynum);
86 SSCRUTE(profilename);ISCRUTE(_profilearraysize);
87 ISCRUTE_size(start);ISCRUTE_size(stride);ISCRUTE_size(count);ISCRUTE_size(blocksize);
88 goto ERROR;
89 }
90 }
91
92 /* Verify constituentselect is between [0, nconstituentpervalue] ( 0 is MED_ALL_CONSTITUENT ) */
93 if ( constituentselect > nconstituentpervalue) {
94 MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_VALUE_MSG);ISCRUTE(constituentselect);
95 ISCRUTE(nconstituentpervalue);
96 goto ERROR;
97 }
98
99 switch(switchmode) {
100 case MED_FULL_INTERLACE :
101
102
103 switch(storagemode) { /* switch Interlace */
104 case MED_GLOBAL_STMODE :
105
106 if ( _MEDfilterBlockOfEntityFullIGlobalCr(fid,nentity,nvaluesperentity,nconstituentpervalue,constituentselect,
107 storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
108 MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
109 MESSAGE("MED_FULL_INTERLACE, MED_GLOBAL_STMODE");
110 goto ERROR;
111 }
112 break;
113 case MED_COMPACT_STMODE :
114 if ( _MEDfilterBlockOfEntityFullICompactCr(fid,nentity,nvaluesperentity,nconstituentpervalue,constituentselect,
115 storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
116 MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
117 MESSAGE("MED_FULL_INTERLACE, MED_COMPACT_STMODE");
118 goto ERROR;
119 }
120 break;
121 default:
122 MED_ERR_(_ret,MED_ERR_INIT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
123 MESSAGE("MED_UNDEF_STMODE");
124 MESSAGE("MED_FULL_INTERLACE");
125 SSCRUTE(profilename);
126 ISCRUTE_int(storagemode);
127 ISCRUTE(_profilearraysize);
128 goto ERROR;
129 break;
130 }
131
132 break;
133 case MED_NO_INTERLACE :
134
135 switch(storagemode) {
136
137 case MED_GLOBAL_STMODE :
138
139 if ( _MEDfilterBlockOfEntityNoIGlobalCr(fid,nentity,nvaluesperentity,nconstituentpervalue,constituentselect,
140 storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
141 MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
142 MESSAGE("MED_NO_INTERLACE, MED_GLOBAL_STMODE");
143 goto ERROR;
144 }
145 break;
146
147 case MED_COMPACT_STMODE :
148 if ( _MEDfilterBlockOfEntityNoICompactCr(fid,nentity,nvaluesperentity,nconstituentpervalue,constituentselect,
149 storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
150 MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
151 MESSAGE("MED_NO_INTERLACE, MED_COMPACT_STMODE");
152 goto ERROR;
153 }
154 break;
155
156 default:
157 MED_ERR_(_ret,MED_ERR_INIT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
158 MESSAGE("MED_UNDEF_STMODE");
159 MESSAGE("MED_NO_INTERLACE");
160 SSCRUTE(profilename);
161 ISCRUTE_int(storagemode);
162 ISCRUTE(_profilearraysize);
163 goto ERROR;
164 break;
165 }
166
167 break;
168
169 default:
170 MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_INTERLACINGMODE,MED_ERR_VALUE_MSG);
171 ISCRUTE_int(switchmode);
172 goto ERROR;
173 }
174
175 _ret = 0;
176
177 ERROR:
178
179 /* if ( _memspace ) if ( (_ret = H5Sclose(_memspace)) < 0) { */
180 /* MESSAGE("Impossible de fermer le memspace : "); */
181 /* ISCRUTE(_memspace); _ret = -1; */
182 /* } */
183
184 return _ret;
185 }
MED_FULL_INTERLACE
Definition: med.h:96
med_filter
Filtre de sélection.
Definition: med.h:355
ISCRUTE_int
#define ISCRUTE_int(entier)
Definition: med_utils.h:314
med_size
hsize_t med_size
Definition: med.h:329
med_idt
hid_t med_idt
Definition: med.h:331
MED_ERR_
#define MED_ERR_(rt, r1, r2, r3)
Definition: med_utils.h:160
MED_ERR_MODE_MSG
#define MED_ERR_MODE_MSG
Definition: med_err.h:190
med_err
herr_t med_err
Definition: med.h:332
MEDfilterBlockOfEntityCr
med_err MEDfilterBlockOfEntityCr(const med_idt fid, const med_int nentity, const med_int nvaluesperentity, const med_int nconstituentpervalue, const med_int constituentselect, const med_switch_mode switchmode, const med_storage_mode storagemode, const char *const profilename, const med_size start, const med_size stride, const med_size count, const med_size blocksize, const med_size lastblocksize, med_filter *const filter)
Crée un filtre en selectionnant par blocs les entités pour lesquelles on veut lire/écrire des valeurs...
Definition: MEDfilterBlockOfEntityCr.c:52
MED_ERR_VALUE_MSG
#define MED_ERR_VALUE_MSG
Definition: med_err.h:184
MED_ERR_FILTER
#define MED_ERR_FILTER
Definition: med_err.h:93
MESSAGE
#define MESSAGE(chaine)
Definition: med_utils.h:324
_MEDfilterBlockOfEntityFullIGlobalCr
MEDC_EXPORT med_err _MEDfilterBlockOfEntityFullIGlobalCr(const med_idt fid, const med_int nentity, const med_int nvaluesperentity, const med_int nconstituentpervalue, const med_int constituentselect, const med_storage_mode storagemode, const char *const profilename, const med_size start, const med_size stride, const med_size count, const med_size blocksize, const med_size lastblocksize, med_filter *const filter)
med_int
int med_int
Definition: med.h:342
med.h
ISCRUTE
#define ISCRUTE(entier)
Definition: med_utils.h:313
MED_ERR_INTERLACINGMODE
#define MED_ERR_INTERLACINGMODE
Definition: med_err.h:102
_MEDfilterBlockOfEntityNoICompactCr
MEDC_EXPORT med_err _MEDfilterBlockOfEntityNoICompactCr(const med_idt fid, const med_int nentity, const med_int nvaluesperentity, const med_int nconstituentpervalue, const med_int constituentselect, const med_storage_mode storagemode, const char *const profilename, const med_size start, const med_size stride, const med_size count, const med_size blocksize, const med_size lastblocksize, med_filter *const filter)
MEDprofileSizeByName
MEDC_EXPORT med_int MEDprofileSizeByName(const med_idt fid, const char *const profilename)
Cette routine permet de lire la taille d'un profil dont on connait le nom.
Definition: MEDprofileSizeByName.c:37
_MEDfilterBlockOfEntityFullICompactCr
MEDC_EXPORT med_err _MEDfilterBlockOfEntityFullICompactCr(const med_idt fid, const med_int nentity, const med_int nvaluesperentity, const med_int nconstituentpervalue, const med_int constituentselect, const med_storage_mode storagemode, const char *const profilename, const med_size start, const med_size stride, const med_size count, const med_size blocksize, const med_size lastblocksize, med_filter *const filter)
SSCRUTE
#define SSCRUTE(chaine)
Definition: med_utils.h:323
MED_GLOBAL_STMODE
Definition: med.h:109
med_switch_mode
med_switch_mode
Definition: med.h:96
med_outils.h
med_config.h
_MEDfilterBlockOfEntityNoIGlobalCr
MEDC_EXPORT med_err _MEDfilterBlockOfEntityNoIGlobalCr(const med_idt fid, const med_int nentity, const med_int nvaluesperentity, const med_int nconstituentpervalue, const med_int constituentselect, const med_storage_mode storagemode, const char *const profilename, const med_size start, const med_size stride, const med_size count, const med_size blocksize, const med_size lastblocksize, med_filter *const filter)
MED_COMPACT_STMODE
Definition: med.h:110
MED_NO_INTERLACE
Definition: med.h:98
ISCRUTE_size
#define ISCRUTE_size(entier)
Definition: med_utils.h:318
MED_ERR_RANGE
#define MED_ERR_RANGE
Definition: med_err.h:34
MED_ERR_GSIZE_MSG
#define MED_ERR_GSIZE_MSG
Definition: med_err.h:186
NOFINALBLANK
#define NOFINALBLANK(chaine, label)
Definition: med_utils.h:311
med_storage_mode
med_storage_mode
Definition: med.h:108
MED_ERR_INIT
#define MED_ERR_INIT
Definition: med_err.h:33
MED_ERR_SELECT
#define MED_ERR_SELECT
Definition: med_err.h:32