bool test_feature() { int edata_src[_rank]; int edata_dst[_rank]; for (int i = 1; i < _rank+1; i++) // extent < 1 is not supported { edata_src[i-1] = i+1; printf("src %d %d\n", i, edata_src[i-1]); edata_dst[i-1] = i; printf("dst %d %d\n", i, edata_dst[i-1]); } extent<_rank> esrc(edata_src); extent<_rank> edst(edata_dst); std::vector<_type> data_src(esrc.size()); for (unsigned int i = 0; i < esrc.size(); i++) data_src[i] = (_type)rand(); std::vector<_type> vsrc; std::vector<_type> vdst; { Concurrency::array<_type, _rank> src(esrc, data_src.begin()); Concurrency::array<_type, _rank> dst(edst); src.copy_to(dst); vsrc = src; vdst = dst; if (vdst.size() != vdst.size()) return false; for (size_t i = 0; i < vdst.size(); i++) { if (vdst[i] != vsrc[i]) return false; } } return true; }
void geteos( double *p, double *pion, double *p_cold, double *cs2, double *dedt, double *deidt, double *den, double *emat, double *eion, double *e_cold, double *tmat, double *tion, double *work3, double *work1, double *work2, double teos, double dt, Domain_t *domain, SpeciesFraction_t *specfrac, int ifsource, int ifzstar ) { char *me = "geteos"; int i, ir, n, lenx, clenx ; double ssmin2, fv ; int *cndx, *cnvg, *indx, *rzon ; double *cmf, *fe, *fi, *csave ; int ifmeos ; int *wcnvg = NULL ; Thermo_t ceos ; Thermo_t deos ; Thermo_t weos ; int namix = domain->namix ; int nmixzn = domain->nmixzn ; int mynsrc = domain->nsrc ; int *grdzn = domain->grdzn ; double myflops = 0.0 ; FT_INITIALIZE(me, domain->hash) THERMO_NULL(ceos) ; THERMO_NULL(deos) ; THERMO_NULL(weos) ; ssmin2 = sndmin * sndmin ; if (ifsource == 1) { SourceNew_general( den, domain->vol, "SourceDensity", teos, domain, _SourceEdit_); SourceNew_general( emat, den, "SourceEnergy", teos, domain, _SourceEdit_); SourceNew_temperature( emat, tmat, dedt, den, "SourceElectronTemperature", teos, domain, _SourceNoEdit_); if ( iftion == 1 ) { SourceNew_temperature( eion, tion, deidt, den, "SourceIonTemperature", teos, domain, _SourceNoEdit_); } } if ( (mynsrc > 0) && (ifsource == 1) ) { dsrc( teos, den, domain ) ; esrc( teos, emat, domain ) ; tmsrc( teos, emat, tmat, dedt, eion, tion, deidt, domain ) ; } ifmeos = 0 ; lenx = 0 ; clenx = 0 ; for ( ir = 1 ; ir <= nreg ; ir++ ) { int locneos = reg[ir].numGroups ; int len = domain->rlen[ir] ; lenx = MAX( len, lenx ) ; if ( locneos > 1 ) { clenx = MAX( clenx, (locneos*len) ) ; ifmeos = 1 ; } } fe = MALLOT(double,lenx) ; fi = MALLOT(double,lenx) ; csave = MALLOT(double,lenx) ; weos.p = MALLOT(double,lenx) ; weos.dpdr = MALLOT(double,lenx) ; weos.dpdt = MALLOT(double,lenx) ; weos.dedr = MALLOT(double,lenx) ; weos.dedt = MALLOT(double,lenx) ; weos.den = MALLOT(double,lenx) ; weos.emat = MALLOT(double,lenx) ; weos.tmat = MALLOT(double,lenx) ; weos.cs2 = MALLOT(double,lenx) ; weos.dpde = MALLOT(double,lenx) ; weos.dtde = MALLOT(double,lenx) ; weos.cs = MALLOT(double,lenx) ; weos.work1 = MALLOT(double,lenx) ; weos.work2 = MALLOT(double,lenx) ; weos.p_cold = MALLOT(double,lenx) ; weos.e_cold = MALLOT(double,lenx) ; weos.dtlast = MALLOT(double,lenx) ; wcnvg = MALLOT(int,lenx) ; if ( iftion == 1 ) { weos.pion = MALLOT(double,lenx) ; weos.deidti = MALLOT(double,lenx) ; weos.eion = MALLOT(double,lenx) ; weos.tion = MALLOT(double,lenx) ; }