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

Method write

SRC/handler/DataFileStream.cpp:272–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270}
271
272int
273DataFileStream::write(Vector &data)
274{
275 if (fileOpen == 0 && sendSelfCount >= 0)
276 this->open();
277
278 //
279 // if not parallel, just write the data
280 //
281
282 if (sendSelfCount == 0) {
283 (*this) << data;
284 if (closeOnWrite == true)
285 this->close();
286 return 0;
287 }
288
289 //
290 // otherwise parallel, send the data if not p0
291 //
292
293 if (sendSelfCount < 0) {
294 if (data.Size() != 0) {
295 if ( theChannels[0]->sendVector(0, 0, data) < 0) {
296 return -1;
297 }
298 return 0;
299 } else
300 return 0;
301 }
302
303 //
304 // if p0 recv the data & write it out sorted
305 //
306
307 // recv data
308 for (int i=0; i<=sendSelfCount; i++) {
309
310 int numColumns = (*sizeColumns)(i);
311 double *dataI = theData[i];
312 if (i == 0) {
313 for (int j=0; j<numColumns; j++) {
314 dataI[j] = data(j);
315 }
316 } else {
317 if (numColumns != 0) {
318 Vector *theV = theRemoteData[i];
319 if (theChannels[i-1]->recvVector(0, 0, *theV) < 0) {
320 opserr << "DataFileStream::write - failed to recv data\n";
321 }
322 }
323 }
324 }
325
326 Matrix &printMapping = *mapping;
327
328 // write data
329 if (doCSV == 0) {

Callers 1

DataFileStream.cppFile · 0.45

Calls 5

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

Tested by

no test coverage detected