MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / readFrom

Method readFrom

Src/Base/AMReX_IArrayBox.cpp:115–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115void
116IArrayBox::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
153void
154IFABio::write_header (std::ostream& os, const IArrayBox& fab, int nvar)

Callers

nothing calls this directly

Calls 12

resizeMethod · 0.95
The_Pinned_ArenaFunction · 0.85
htod_memcpy_asyncFunction · 0.85
streamSynchronizeFunction · 0.85
boxMethod · 0.45
nCompMethod · 0.45
isManagedMethod · 0.45
arenaMethod · 0.45
isDeviceMethod · 0.45
readMethod · 0.45
dataPtrMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected