bool cElHJaArrangt::StdSolFlag(INT aFlag) { ELISE_ASSERT((aFlag>0) && (aFlag <(1<<mNbPl)),"cElHJaArrangt::StdSolFlag"); tBufFacette aBuf; InitFlag(aFlag,aBuf); bool Ok = GetTheSolution(true,aBuf); /* if (OK) { cElHJSol3D * aSol = MakeSol(false); aSol->MakeImages(false); Im2D_U_INT1 aShade = aSol->ImShade(); Im2D_INT1 aLab = aSol->ImLabel(); ELISE_COPY ( aShade.all_pts(), its_to_rgb ( Virgule ( aShade.in(), aLab.in() * 27.9, (aLab.in() >=0) * 200 ) ), mVisu->WG3().orgb() ); delete aSol; } */ // PopStateFac(); return Ok; }
double& FLQuant_pointer::operator()(int _age,int _yr,int _unit, int _season, int _area, int _iter) { if (!InitFlag() || _age <minquant() || _age >maxquant() || _yr <minyr() || _yr >maxyr() || _unit<1 || _unit>nunits() || _season<1 || _season>nseasons() || _area<1 || _area>nareas()) return outofbounds_double; else return (data)[i(_age,_yr,_unit,_season,_area,_iter)]; }
void FLQuant_pointer::Init(SEXP x) { SEXP Quant = GET_SLOT(x, install(".Data")), dims = GET_DIM(Quant), dimnames = GET_DIMNAMES(Quant); data = NUMERIC_POINTER(AS_NUMERIC(Quant)); int dim[6], n = length(dims); dim[0] = INTEGER(dims)[0]; dim[1] = INTEGER(dims)[1]; dim[2] = INTEGER(dims)[2]; dim[3] = INTEGER(dims)[3]; dim[4] = INTEGER(dims)[4]; dim[5] = n>=6 ? INTEGER(dims)[5] : 1; if (((int)dim[0]) < 1 || ((int)dim[1]) < 1 || ((int)dim[2]) < 1 || ((int)dim[3]) < 1 || ((int)dim[4]) < 1 || ((int)dim[5]) < 1) { UNPROTECT(1); return; } minquant() = 0; minyr() = 0; maxquant() = (int)dim[0] -1; maxyr() = (int)dim[1] -1; nunits() = (int)dim[2]; nseasons() = (int)dim[3]; nareas() = (int)dim[4]; niters() = (int)dim[5]; if (dimnames != R_NilValue) if (TYPEOF(dimnames) == VECSXP) { int t = 0; const char *c; if (n >= 1 && INTEGER(dims)[0] >= 1) { c = CHAR(STRING_ELT(VECTOR_ELT(dimnames, 0), 0)); //check that name is not a text string for (int i=0; i<=(signed)strlen(c); i++) if (isalpha(c[i])) t=1; if (t !=1) t = atoi(c); minquant() += t; maxquant() += t; } if (n >= 2 && INTEGER(dims)[1] >= 1) { t = 0; c = CHAR(STRING_ELT(VECTOR_ELT(dimnames, 1), 0)); //check that name is not a text string for (int i=0; i<=(signed)strlen(c); i++) if (isalpha(c[i])) t=1; if (t !=1) t = atoi(c); minyr() += t; maxyr() += t; } } InitFlag() = true; UNPROTECT(1); }
FLQuant_pointer::FLQuant_pointer(void) { InitFlag() = false; }