bool LLViewerParcelOverlay::encroachesOnUnowned(const std::vector<LLBBox>& boxes) const { // boxes are expected to already be axis aligned for (U32 i = 0; i < boxes.size(); ++i) { LLVector3 min = boxes[i].getMinAgent(); LLVector3 max = boxes[i].getMaxAgent(); S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); S32 top = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); S32 bottom = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); for (S32 row = top; row <= bottom; row++) { for (S32 column = left; column <= right; column++) { U8 type = ownership(row, column); if ((PARCEL_SELF != type)) { return true; } } } } return false; }
BOOL LLViewerParcelOverlay::isOwnedOther(const LLVector3& pos) const { S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS); S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS); U8 overlay = ownership(row, column); return (PARCEL_OWNED == overlay || PARCEL_FOR_SALE == overlay); }
int main(int argc, const char* argv[]) { // insert code here... std::cout << "Hello, World!\n"; int v{}; std::cout << "v is " << v << std::endl; foo f; std::cout << "f is " << f.v << std::endl; bar b{2}; std::cout << "b is " << b.v << std::endl; constexpr static int num = 10; static_assert(0x2 == 2, "foobar"); //static_assert(0x2 == 0x20, "barfoo"); structDeclarations(); libthing(); inheritance(); with_type<Bodyless>(5); ctors(); ownership(); static_func_wrapping(); return 0; }
int main(int argc, char * const argv[]) { u8 *buf; off_t fp; int ok=0; if(sizeof(u8)!=1 || sizeof(u32)!=4) { fprintf(stderr, "%s: compiler incompatibility\n", argv[0]); exit(255); } /* Set default option values */ opt.devmem=DEFAULT_MEM_DEV; opt.flags=0; if(parse_command_line(argc, argv)<0) exit(2); if(opt.flags & FLAG_HELP) { print_help(); return 0; } if(opt.flags & FLAG_VERSION) { printf("%s\n", VERSION); return 0; } if((buf=mem_chunk(0xE0000, 0x20000, opt.devmem))==NULL) exit(1); for(fp=0; !ok && fp<=0x1FFF0; fp+=16) { u8 *p=buf+fp; if(memcmp((char *)p, "32OS", 4)==0) { off_t len=p[4]*10+5; if(fp+len-1<=0x1FFFF) { u32 base; if((base=decode(p))) { ok=1; ownership(base, argv[0], opt.devmem); } } } } free(buf); return 0; }
void StructuredGrid2D::init(Size nCellsI, Size nCellsJ, Scalar lx, Scalar ly, int nbuff) { auto dim = computeBlockDims(false); _comm->printf("Grid partitioning dimensions (%d,%d).\n", (int)dim[0], (int)dim[1]); std::vector<int> ownership(nCellsI * nCellsJ); std::array<Size, 2> irange = {0, 0}, jrange = {0, 0}; std::array<Size, 2> irangeLocal = {0, 0}, jrangeLocal = {0, 0}; Size qi = nCellsI / dim[0]; Size ri = nCellsI % dim[0]; Size qj = nCellsJ / dim[1]; Size rj = nCellsJ % dim[1]; for(auto blockJ = 0, proc = 0; blockJ < dim[1]; ++blockJ) for(auto blockI = 0; blockI < dim[0]; ++blockI, ++proc) { irange[0] = blockI * qi + std::min(ri, (Size)blockI); irange[1] = irange[0] + qi + (ri > blockI ? 1 : 0); jrange[0] = blockJ * qj + std::min(rj, (Size)blockJ); jrange[1] = jrange[0] + qj + (rj > blockJ ? 1 : 0); for(auto j = jrange[0]; j < jrange[1]; ++j) for(auto i = irange[0]; i < irange[1]; ++i) ownership[j * nCellsI + i] = proc; if(proc == _comm->rank()) { irangeLocal[0] = std::max((int)irange[0] - nbuff, 0); irangeLocal[1] = std::min((int)irange[1] + nbuff, (int)nCellsI); jrangeLocal[0] = std::max((int)jrange[0] - nbuff, 0); jrangeLocal[1] = std::min((int)jrange[1] + nbuff, (int)nCellsJ); } } std::vector<int> localOwnership; std::vector<Label> localGlobalIds; for(auto j = jrangeLocal[0]; j < jrangeLocal[1]; ++j) for(auto i = irangeLocal[0]; i < irangeLocal[1]; ++i) { localGlobalIds.emplace_back(j * nCellsI + i); localOwnership.emplace_back(ownership[localGlobalIds.back()]); } Scalar dx = lx / nCellsI; Scalar dy = ly / nCellsJ; auto xb = std::make_pair(dx * irangeLocal[0], dx * irangeLocal[1]); auto yb = std::make_pair(dy * jrangeLocal[0], dy * jrangeLocal[1]); init(irangeLocal[1] - irangeLocal[0], jrangeLocal[1] - jrangeLocal[0], xb, yb); initParallel(localOwnership, localGlobalIds); }
U8 LLViewerParcelOverlay::ownership( const LLVector3& pos) const { S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS); S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS); return ownership(row, column); }
BOOL LLViewerParcelOverlay::isOwnedGroup(const LLVector3& pos) const { S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS); S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS); return (PARCEL_GROUP == ownership(row, column)); }