MED fichier: Fichier source de MEDfilterBlockOfEntityCr.c

MED fichier

- Documentation MED
- Guides d'utilisation
- Guides de référence

MEDfilterBlockOfEntityCr.c
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2 *
3 * COPYRIGHT (C) 1999 - 2019 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
50 med_err MEDfilterBlockOfEntityCr(const med_idt fid,
51 const med_int nentity,
52 const med_int nvaluesperentity,
53 const med_int nconstituentpervalue,
54 const med_int constituentselect,
55 const med_switch_mode switchmode,
56 const med_storage_mode storagemode,
57 const char * const profilename,
58 const med_size start,
59 const med_size stride,
60 const med_size count,
61 const med_size blocksize,
62 const med_size lastblocksize,
63 med_filter* const filter) {
64
65
66 med_int _profilearraysize=0,_maxentitynum=0;
67 med_err _ret=-1;
68 med_size _start=start-1;
69
70 NOFINALBLANK(profilename,ERROR);
71
72 if ( start == 0) {
73 MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,"");
74 ISCRUTE_size(start);
75 goto ERROR;
76 }
77
78 _maxentitynum=_start+(count-1)*(stride);
79
80 if ( strlen(profilename) ) {
81 _profilearraysize = MEDprofileSizeByName(fid,profilename);
82 if ( _maxentitynum > _profilearraysize ) {
83 MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_GSIZE_MSG);ISCRUTE(_maxentitynum);
84 SSCRUTE(profilename);ISCRUTE(_profilearraysize);
85 ISCRUTE_size(start);ISCRUTE_size(stride);ISCRUTE_size(count);ISCRUTE_size(blocksize);
86 goto ERROR;
87 }
88 }
89
90 /* Verify constituentselect is between [0, nconstituentpervalue] ( 0 is MED_ALL_CONSTITUENT ) */
91 if ( constituentselect > nconstituentpervalue) {
92 MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_VALUE_MSG);ISCRUTE(constituentselect);
93 ISCRUTE(nconstituentpervalue);
94 goto ERROR;
95 }
96
97 switch(switchmode) {
98 case MED_FULL_INTERLACE :
99
100
101 switch(storagemode) { /* switch Interlace */
102 case MED_GLOBAL_STMODE :
103
104 if ( _MEDfilterBlockOfEntityFullIGlobalCr(fid,nentity,nvaluesperentity,nconstituentpervalue,constituentselect,
105 storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
106 MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
107 MESSAGE("MED_FULL_INTERLACE, MED_GLOBAL_STMODE");
108 goto ERROR;
109 }
110 break;
111 case MED_COMPACT_STMODE :
112 if ( _MEDfilterBlockOfEntityFullICompactCr(fid,nentity,nvaluesperentity,nconstituentpervalue,constituentselect,
113 storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
114 MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
115 MESSAGE("MED_FULL_INTERLACE, MED_COMPACT_STMODE");
116 goto ERROR;
117 }
118 break;
119 default:
120 MED_ERR_(_ret,MED_ERR_INIT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
121 MESSAGE("MED_UNDEF_STMODE");
122 MESSAGE("MED_FULL_INTERLACE");
123 SSCRUTE(profilename);
124 ISCRUTE_int(storagemode);
125 ISCRUTE(_profilearraysize);
126 goto ERROR;
127 break;
128 }
129
130 break;
131 case MED_NO_INTERLACE :
132
133 switch(storagemode) {
134
135 case MED_GLOBAL_STMODE :
136
137 if ( _MEDfilterBlockOfEntityNoIGlobalCr(fid,nentity,nvaluesperentity,nconstituentpervalue,constituentselect,
138 storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
139 MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
140 MESSAGE("MED_NO_INTERLACE, MED_GLOBAL_STMODE");
141 goto ERROR;
142 }
143 break;
144
145 case MED_COMPACT_STMODE :
146 if ( _MEDfilterBlockOfEntityNoICompactCr(fid,nentity,nvaluesperentity,nconstituentpervalue,constituentselect,
147 storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
148 MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
149 MESSAGE("MED_NO_INTERLACE, MED_COMPACT_STMODE");
150 goto ERROR;
151 }
152 break;
153
154 default:
155 MED_ERR_(_ret,MED_ERR_INIT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
156 MESSAGE("MED_UNDEF_STMODE");
157 MESSAGE("MED_NO_INTERLACE");
158 SSCRUTE(profilename);
159 ISCRUTE_int(storagemode);
160 ISCRUTE(_profilearraysize);
161 goto ERROR;
162 break;
163 }
164
165 break;
166
167 default:
168 MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_INTERLACINGMODE,MED_ERR_VALUE_MSG);
169 ISCRUTE_int(switchmode);
170 goto ERROR;
171 }
172
173 _ret = 0;
174
175 ERROR:
176
177 /* if ( _memspace ) if ( (_ret = H5Sclose(_memspace)) < 0) { */
178 /* MESSAGE("Impossible de fermer le memspace : "); */
179 /* ISCRUTE(_memspace); _ret = -1; */
180 /* } */
181
182 return _ret;
183 }
med_filter
Filtre de sélection.
Definition: med.h:350
med_err
herr_t med_err
Definition: med.h:327
NOFINALBLANK
#define NOFINALBLANK(chaine, label)
Definition: med_utils.h:304
MED_ERR_VALUE_MSG
#define MED_ERR_VALUE_MSG
Definition: med_err.h:179
MED_ERR_
#define MED_ERR_(rt, r1, r2, r3)
Definition: med_utils.h:158
MED_FULL_INTERLACE
Definition: med.h:94
ISCRUTE_size
#define ISCRUTE_size(entier)
Definition: med_utils.h:310
med_switch_mode
med_switch_mode
Definition: med.h:94
MED_GLOBAL_STMODE
Definition: med.h:107
med_size
hsize_t med_size
Definition: med.h:324
MED_NO_INTERLACE
Definition: med.h:96
MED_ERR_SELECT
#define MED_ERR_SELECT
Definition: med_err.h:29
_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)
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
MESSAGE
#define MESSAGE(chaine)
Definition: med_utils.h:316
ISCRUTE_int
#define ISCRUTE_int(entier)
Definition: med_utils.h:307
MED_COMPACT_STMODE
Definition: med.h:108
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:50
_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_int
int med_int
Definition: med.h:337
MED_ERR_MODE_MSG
#define MED_ERR_MODE_MSG
Definition: med_err.h:185
med_config.h
ISCRUTE
#define ISCRUTE(entier)
Definition: med_utils.h:306
MED_ERR_INTERLACINGMODE
#define MED_ERR_INTERLACINGMODE
Definition: med_err.h:101
med_storage_mode
med_storage_mode
Definition: med.h:106
MED_ERR_RANGE
#define MED_ERR_RANGE
Definition: med_err.h:31
med_idt
hid_t med_idt
Definition: med.h:326
_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)
_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)
med_outils.h
med.h
MED_ERR_INIT
#define MED_ERR_INIT
Definition: med_err.h:30
MED_ERR_GSIZE_MSG
#define MED_ERR_GSIZE_MSG
Definition: med_err.h:181
SSCRUTE
#define SSCRUTE(chaine)
Definition: med_utils.h:315
MED_ERR_FILTER
#define MED_ERR_FILTER
Definition: med_err.h:92