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

Method write

SRC/handler/DataFileStreamAdd.cpp:269–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 5

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

Tested by

no test coverage detected