00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <med.h>
00020 #include <med_config.h>
00021 #include <med_outils.h>
00022 #include <hdf5.h>
00023 #include <string.h>
00024
00050 med_err MEDfilterBlockOfEntityCr(const med_idt fid,
00051 const med_int nbofentity,
00052 const med_int nbofvaluesperentity,
00053 const med_int nbofconstituentpervalue,
00054 const med_int constituentselect,
00055 const med_switch_mode switchmode,
00056 const med_storage_mode storagemode,
00057 const char * const profilename,
00058 const med_size start,
00059 const med_size stride,
00060 const med_size count,
00061 const med_size blocksize,
00062 const med_size lastblocksize,
00063 med_filter* const filter) {
00064
00065
00066 med_int _profilearraysize=0,_maxentitynum=0;
00067 med_err _ret=-1;
00068 med_size _start=start-1;
00069
00070
00071 NOFINALBLANK(profilename,ERROR);
00072
00073 if ( start == 0) {
00074 MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,"");
00075 ISCRUTE_size(start);
00076 goto ERROR;
00077 }
00078
00079 _maxentitynum=_start+(count-1)*(stride);
00080
00081 if ( strlen(profilename) ) {
00082 _profilearraysize = MEDprofileSizeByName(fid,profilename);
00083 if ( _maxentitynum > _profilearraysize ) {
00084 MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_GSIZE_MSG);ISCRUTE(_maxentitynum);
00085 SSCRUTE(profilename);ISCRUTE(_profilearraysize);
00086 ISCRUTE_size(start);ISCRUTE_size(stride);ISCRUTE_size(count);ISCRUTE_size(blocksize);
00087 goto ERROR;
00088 }
00089 }
00090
00091
00092 if ( constituentselect > nbofconstituentpervalue) {
00093 MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_FILTER,MED_ERR_VALUE_MSG);ISCRUTE(constituentselect);
00094 ISCRUTE(nbofconstituentpervalue);
00095 goto ERROR;
00096 }
00097
00098 switch(switchmode) {
00099 case MED_FULL_INTERLACE :
00100
00101
00102 switch(storagemode) {
00103 case MED_GLOBAL_PFLMODE :
00104
00105 if ( _MEDfilterBlockOfEntityFullIGlobalCr(fid,nbofentity,nbofvaluesperentity,nbofconstituentpervalue,constituentselect,
00106 storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
00107 MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00108 MESSAGE("MED_FULL_INTERLACE, MED_GLOBAL_PFLMODE");
00109 goto ERROR;
00110 }
00111 break;
00112 case MED_COMPACT_PFLMODE :
00113 if ( _MEDfilterBlockOfEntityFullICompactCr(fid,nbofentity,nbofvaluesperentity,nbofconstituentpervalue,constituentselect,
00114 storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
00115 MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00116 MESSAGE("MED_FULL_INTERLACE, MED_COMPACT_PFLMODE");
00117 goto ERROR;
00118 }
00119 break;
00120 default:
00121 MED_ERR_(_ret,MED_ERR_INIT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00122 MESSAGE("MED_UNDEF_PFLMODE");
00123 MESSAGE("MED_FULL_INTERLACE");
00124 SSCRUTE(profilename);
00125 ISCRUTE_int(storagemode);
00126 ISCRUTE(_profilearraysize);
00127 goto ERROR;
00128 break;
00129 }
00130
00131 break;
00132 case MED_NO_INTERLACE :
00133
00134 switch(storagemode) {
00135
00136 case MED_GLOBAL_PFLMODE :
00137
00138 if ( _MEDfilterBlockOfEntityNoIGlobalCr(fid,nbofentity,nbofvaluesperentity,nbofconstituentpervalue,constituentselect,
00139 storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
00140 MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00141 MESSAGE("MED_NO_INTERLACE, MED_GLOBAL_PFLMODE");
00142 goto ERROR;
00143 }
00144 break;
00145
00146 case MED_COMPACT_PFLMODE :
00147 if ( _MEDfilterBlockOfEntityNoICompactCr(fid,nbofentity,nbofvaluesperentity,nbofconstituentpervalue,constituentselect,
00148 storagemode,profilename,start,stride,count,blocksize,lastblocksize,filter) < 0 ) {
00149 MED_ERR_(_ret,MED_ERR_SELECT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00150 MESSAGE("MED_NO_INTERLACE, MED_COMPACT_PFLMODE");
00151 goto ERROR;
00152 }
00153 break;
00154
00155 default:
00156 MED_ERR_(_ret,MED_ERR_INIT,MED_ERR_FILTER,MED_ERR_MODE_MSG);
00157 MESSAGE("MED_UNDEF_PFLMODE");
00158 MESSAGE("MED_NO_INTERLACE");
00159 SSCRUTE(profilename);
00160 ISCRUTE_int(storagemode);
00161 ISCRUTE(_profilearraysize);
00162 goto ERROR;
00163 break;
00164 }
00165
00166 break;
00167
00168 default:
00169 MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_INTERLACINGMODE,MED_ERR_VALUE_MSG);
00170 ISCRUTE_int(switchmode);
00171 goto ERROR;
00172 }
00173
00174 _ret = 0;
00175
00176 ERROR:
00177
00178
00179
00180
00181
00182
00183 return _ret;
00184 }