| 113 | } |
| 114 | |
| 115 | void |
| 116 | IArrayBox::readFrom (std::istream& is) |
| 117 | { |
| 118 | std::string type; |
| 119 | is >> type; |
| 120 | if (type != "IFAB") { |
| 121 | amrex::Error(std::string("IArrayBox::readFrom: IFAB is expected, but instead we have ") |
| 122 | +type); |
| 123 | } |
| 124 | |
| 125 | IntDescriptor data_descriptor; |
| 126 | is >> data_descriptor; |
| 127 | |
| 128 | Box tmp_box; |
| 129 | int tmp_ncomp; |
| 130 | is >> tmp_box; |
| 131 | is >> tmp_ncomp; |
| 132 | AMREX_ASSERT(tmp_ncomp >= 0 && tmp_ncomp < std::numeric_limits<int>::max()); |
| 133 | is.ignore(99999, '\n'); |
| 134 | |
| 135 | if (this->box() != tmp_box || this->nComp() != tmp_ncomp) { |
| 136 | this->resize(tmp_box, tmp_ncomp); |
| 137 | } |
| 138 | |
| 139 | #ifdef AMREX_USE_GPU |
| 140 | if (this->arena()->isManaged() || this->arena()->isDevice()) { |
| 141 | IArrayBox hostfab(this->box(), this->nComp(), The_Pinned_Arena()); |
| 142 | ifabio->read(is, hostfab, data_descriptor); |
| 143 | Gpu::htod_memcpy_async(this->dataPtr(), hostfab.dataPtr(), |
| 144 | hostfab.size()*sizeof(IArrayBox::value_type)); |
| 145 | Gpu::streamSynchronize(); |
| 146 | } else |
| 147 | #endif |
| 148 | { |
| 149 | ifabio->read(is, *this, data_descriptor); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | void |
| 154 | IFABio::write_header (std::ostream& os, const IArrayBox& fab, int nvar) |
nothing calls this directly
no test coverage detected