| 122 | */ |
| 123 | |
| 124 | int cVectorProcessor::dataProcessorCustomFinalise() |
| 125 | { |
| 126 | if (namesAreSet_) |
| 127 | return 1; |
| 128 | |
| 129 | int i; |
| 130 | Nfi = reader_->getLevelNf(); |
| 131 | if (!processArrayFields) { |
| 132 | if (!preserveFieldNames) { |
| 133 | Nfi=1; // this has to be one... setupNamesForField must be called only once with nEl=number of elements! |
| 134 | // if we need to call setupNames... for each field to preserve the input names, but then call processVector only once (where??) |
| 135 | // then we need a separate option for preserveFieldNames.. etc. |
| 136 | } |
| 137 | Ni = reader_->getLevelN(); // number of elements |
| 138 | } |
| 139 | |
| 140 | fNi = (long*)calloc(1, sizeof(long)*Nfi); // input |
| 141 | fNo = (long*)calloc(1, sizeof(long)*Nfi); // output (Nfo <= Nfi, always!) |
| 142 | |
| 143 | fconf = (int *)malloc(sizeof(int)*Nfi); |
| 144 | fconfInv = (int *)malloc(sizeof(int)*Nfi); |
| 145 | confBs = (long *)calloc(1,sizeof(long)*Nfi); |
| 146 | |
| 147 | if (processArrayFields == 2) { |
| 148 | //only works for: Nfo = Nfi ! |
| 149 | bufTransposeInput_ = (FLOAT_DMEM *)calloc(1, sizeof(FLOAT_DMEM) * Nfi); |
| 150 | bufTransposeOutput_ = (FLOAT_DMEM *)calloc(1, sizeof(FLOAT_DMEM) * Nfi); |
| 151 | } |
| 152 | |
| 153 | if (!processArrayFields) { |
| 154 | |
| 155 | int __N=0; |
| 156 | //const char *tmp = reader->getFieldName(0,&__N); |
| 157 | fconf[0] = -1; |
| 158 | addFconf(Ni,0); |
| 159 | |
| 160 | if (!namesAreSet_) fNo[0] = setupNewNames(Ni); |
| 161 | |
| 162 | if (!namesAreSet_) { |
| 163 | fNo[0] = 0; |
| 164 | //SMILE_IMSG(1,"XXXX array Nfi=%i Ni=%i\n",Nfi,Ni); |
| 165 | i=0; |
| 166 | //TODO: still a problem here: output names are only 1st field + appended name, instead we want the names to be input name + appended bit... (example: cVectorOperation with processArrayFields=0) |
| 167 | // NOTE: for vectorTransform an co. we need to preserve the individual names (other components might not... or want to have setupNamesForField only called once? Check!! |
| 168 | int myN = 1; |
| 169 | if (preserveFieldNames) { |
| 170 | myN = Nfi; |
| 171 | } |
| 172 | //for (i=0; i<Nfi; i++) { // OK, changed Nfi to 1 on this line.. hope this breaks nothing else.. ( TODO::: this is NOT OK... why do we run this for each input field?? (names...?) ) |
| 173 | for (i=0; i<myN; i++) { // OK, changed Nfi to 1 on this line.. hope this breaks nothing else.. ( TODO::: this is NOT OK... why do we run this for each input field?? (names...?) ) |
| 174 | int arrNameOffset=0; |
| 175 | const char *tmp = reader_->getFieldName(i,&__N,&arrNameOffset); |
| 176 | int myN2 = Ni; |
| 177 | if (preserveFieldNames) { |
| 178 | myN2 = __N; |
| 179 | } |
| 180 | long nOut = setupNamesForField(i,tmp,myN2); |
| 181 | if (nOut==__N) { |
nothing calls this directly
no test coverage detected