//True if successful. bool setupFS(){ struct mbr* masterBoot = (struct mbr*)malloc(sizeof(struct mbr)); hdReadAbs(masterBoot, 0, sizeof(struct mbr)); //Read the MBR from abs sector 1. fbWrite("e", GREEN, BLACK); if(!((masterBoot->signature)[0] == 0x55 && (masterBoot->signature)[1] == 0xAA)){ fbWrite(hts((unsigned int)masterBoot), RED, BLACK); fbWrite(" Invalid MBR!\n", RED, BLACK); free(masterBoot); return false; } unsigned char part = (multiboot->boot).part1; if(!(multiboot->flags & 0x1) || part > 4){ //Retrieve root device. loopf(); //temp. } struct mbrEntry entry = (masterBoot->entries)[part]; partStart = entry.lba; partEnd = partStart + entry.sectors; struct superblock* sb = (struct superblock*)malloc(sizeof(struct superblock)); hdRead(sb, 2, sizeof(struct superblock)); //Read the superblock from offset 1024 bytes, which is 2 in LBA. if(!(sb->signature == 0xEF53)){ fbWrite("Invalid Superblock!\n", RED, BLACK); free(masterBoot); free(sb); return false; } free(masterBoot); free(sb); return true; }
void Field<2>::multiplyInto (typename Tensor<ad_type, 2>::type& f_incr) const { MultiplyWork<ad_type> w(f_.dimension(2)); loopf(cell, 0) loopf(qp, 1) multiplyIntoImpl(f_, f_incr, cell, qp, w); }
void Field<2>::addTo (typename Tensor<ad_type, 2>::type& f_incr, const std::size_t cell, const std::size_t qp) const { loopf(i0, 2) loopf(i1, 3) f_incr(cell,qp,i0,i1) += f_(cell,qp,i0,i1); }
void Field<1>::addTo (typename Tensor<ad_type, 1>::type& f_incr, const std::size_t cell, const std::size_t qp) const { loopf(i0, 2) f_incr(cell,qp,i0) += f_(cell,qp,i0); }
void Field<2>::addTo (typename Tensor<ad_type, 2>::type& f_incr) const { loopf(cell, 0) loopf(qp, 1) loopf(i0, 2) loopf(i1, 3) f_incr(cell,qp,i0,i1) += f_(cell,qp,i0,i1); }
void Field<1>::addTo (typename Tensor<ad_type, 1>::type& f_incr) const { loopf(cell, 0) loopf(qp, 1) loopf(i0, 2) f_incr(cell,qp,i0) += f_(cell,qp,i0); }
void Field<0>::addTo (typename Tensor<ad_type, 0>::type& f_incr) const { loopf(cell, 0) loopf(qp, 1) f_incr(cell,qp) += f_(cell,qp); }