MED fichier
MEDsetFilter.c
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2  *
3  * COPYRIGHT (C) 1999 - 2016 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 <string.h>
23 
28  const med_idt* const memspace,
29  const med_idt* const diskspace,
30  const med_int nentity,
31  const med_int nvaluesperentity,
32  const med_int nconstituentpervalue,
33  const med_int constituentselect,
34  const med_switch_mode switchmode,
35  const med_int filterarraysize,
36  const med_int profilearraysize,
37  const med_storage_mode storagemode,
38  const char* const profilename,
39  med_filter* const filter) {
40 
41  med_err _ret=-1;
42  int _i=0;
43 
44  if ( (*filter).nspaces > 0 ) {
46  ISCRUTE((*filter).nspaces);
47  goto ERROR;
48  }
49 
50  if ( (*filter).memspace[0] > 0 ) {
52  ISCRUTE_id((*filter).memspace[0]);
53  goto ERROR;
54  }
55 
56  if ( (*filter).diskspace[0] > 0 ) {
58  ISCRUTE_id((*filter).diskspace[0]);
59  goto ERROR;
60  }
61 
62  if ( nspaces > MED_MAX_FILTER_SPACES ) {
63  MESSAGE("Impossible de créer un filtre avec un nombre de memspace supérieur à : ");
65  goto ERROR;
66  }
67 
68  /*Le champ filterarray23v30 est uniquement utilisé dans _MEDfilterEntityCr236
69  pour les besoins de _MEDmeshAdvancedRd236, il n'est donc pas intégré
70  à la signature de MEDsetFilter.*/
71  if ( (*filter).filterarray23v30 != NULL ) {
72  MESSAGE("Impossible de créer un filtre avec un tableau filterarray23v30 non desalloué : ");
73  XSCRUTE((void*) (*filter).filterarray23v30);
74  goto ERROR;
75  }
76 
77 
78  (*filter).nspaces = nspaces;
79  for (_i=0; _i < nspaces; ++_i) {
80  (*filter).memspace[_i] = memspace[_i];
81  (*filter).diskspace[_i] = diskspace[_i];
82  }
83  (*filter).nentity = nentity;
84  (*filter).nvaluesperentity = nvaluesperentity;
85  (*filter).nconstituentpervalue = nconstituentpervalue;
86  (*filter).constituentselect = constituentselect;
87  (*filter).switchmode = switchmode;
88  (*filter).filterarraysize = filterarraysize;
89  /*Le champ filterarray23v30 est uniquement utilisé dans _MEDfilterEntityCr236
90  pour les besoins de _MEDmeshAdvancedRd236, il n'est donc pas intégré
91  à la signature de MEDsetFilter.*/
92  (*filter).filterarray23v30 = NULL;
93  (*filter).profilearraysize = profilearraysize;
94  (*filter).storagemode = storagemode;
95  strcpy((*filter).profilename,profilename);
96 
97 
98 /* ISCRUTE((*filter).nspaces ); */
99 /* ISCRUTE((*filter).nentity ); */
100 /* ISCRUTE((*filter).nvaluesperentity ); */
101 /* ISCRUTE((*filter).nconstituentpervalue ); */
102 /* ISCRUTE((*filter).constituentselect ); */
103 /* ISCRUTE((*filter).switchmode ); */
104 /* ISCRUTE((*filter).filterarraysize ); */
105 /* ISCRUTE((*filter).profilearraysize ); */
106 /* ISCRUTE((*filter).storagemode ); */
107 /* SSCRUTE((*filter).profilename ); */
108 
109  _ret = 0;
110 
111  ERROR:
112 
113  return _ret;
114 }
herr_t med_err
Definition: med.h:310
#define MED_ERR_NOTNULL
Definition: med_err.h:33
Filtre de sélection.
Definition: med.h:326
#define MESSAGE(chaine)
Definition: med_utils.h:316
med_switch_mode
Definition: med.h:89
#define ISCRUTE_int(entier)
Definition: med_utils.h:307
#define MED_MAX_FILTER_SPACES
Definition: med.h:320
med_err _MEDsetFilter(const med_int nspaces, const med_idt *const memspace, const med_idt *const diskspace, const med_int nentity, const med_int nvaluesperentity, const med_int nconstituentpervalue, const med_int constituentselect, const med_switch_mode switchmode, const med_int filterarraysize, const med_int profilearraysize, const med_storage_mode storagemode, const char *const profilename, med_filter *const filter)
Definition: MEDsetFilter.c:27
int med_int
Definition: med.h:316
med_storage_mode
Definition: med.h:101
#define ISCRUTE(entier)
Definition: med_utils.h:306
#define ISCRUTE_id(entier)
Definition: med_utils.h:311
#define XSCRUTE(pointeur)
Definition: med_utils.h:312
hid_t med_idt
Definition: med.h:309
#define MED_ERR_FILTER
Definition: med_err.h:92
#define MED_ERR_(rt, r1, r2, r3)
Definition: med_utils.h:158