MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / write

Method write

DEVELOPER/core/BinaryFileStream.cpp:231–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229}
230
231int
232BinaryFileStream::write(Vector &data)
233{
234 if (fileOpen == 0)
235 this->open();
236
237 //
238 // if not parallel, just write the data
239 //
240
241 if (sendSelfCount == 0) {
242 (*this) << data;
243 return 0;
244 }
245
246 //
247 // otherwise parallel, send the data if not p0
248 //
249
250 if (sendSelfCount < 0) {
251 if (data.Size() != 0) {
252 return theChannels[0]->sendVector(0, 0, data);
253 } else
254 return 0;
255 }
256
257 //
258 // if p0 recv the data & write it out sorted
259 //
260
261 // recv data
262 for (int i=0; i<=sendSelfCount; i++) {
263 int numColumns = (*sizeColumns)(i);
264 double *dataI = theData[i];
265 if (i == 0) {
266 for (int j=0; j<numColumns; j++) {
267 dataI[j] = data(j);
268 }
269 } else {
270 if (numColumns != 0) {
271 theChannels[i-1]->recvVector(0, 0, *(theRemoteData[i]));
272 }
273 }
274 }
275
276 Matrix &printMapping = *mapping;
277
278 // write data
279 for (int i=0; i<maxCount+1; i++) {
280 int fileID = (int)printMapping(0,i);
281 int startLoc = (int)printMapping(1,i);
282 int numData = (int)printMapping(2,i);
283 double *data = theData[fileID];
284 // for (int j=0; j<numData; j++)
285 theFile.write((char *)(&data[startLoc]), 8*numData);
286 }
287 theFile << "\n";
288

Callers 2

textToBinaryFunction · 0.45

Calls 4

openMethod · 0.95
SizeMethod · 0.45
sendVectorMethod · 0.45
recvVectorMethod · 0.45

Tested by

no test coverage detected