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

Method recvVector

SRC/database/FileDatastore.cpp:964–1093  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

962}
963
964int
965FileDatastore::recvVector(int dataTag, int commitTag,
966 Vector &theVector,
967 ChannelAddress *theAddress)
968{
969
970 if (currentCommitTag != commitTag)
971 this->resetFilePointers();
972
973 currentCommitTag = commitTag;
974
975 FileDatastoreOutputFile *theFileStruct;
976
977 //
978 // next we see if we already have this file;
979 // if not we need to create data structure & open it
980 // if we have data structure, need to check file is opened (we close in a commit)
981 //
982
983 // we first check Vector not too big
984 int vectSize = theVector.Size();
985 int stepSize = sizeof(int) + vectSize*sizeof(double);
986
987 theVectFilesIter = theVectFiles.find(vectSize);
988 if (theVectFilesIter == theVectFiles.end()) {
989
990 // we first check if we need to resize recv buffer
991 if (vectSize > currentMaxDouble) {
992 if (this->resizeDouble(vectSize) < 0) {
993 opserr << "FileDatastore::recvVectrix() - failed in resizeDouble()\n";
994 return -1;
995 }
996 }
997
998 char *fileName = new char[strlen(dataBase)+21];
999 theFileStruct = new FileDatastoreOutputFile;
1000
1001 if (fileName == 0 || theFileStruct == 0) {
1002 opserr << "FileDatastore::recvVectrix() - out of memory\n";
1003 return -1;
1004 }
1005
1006 static char intName[20];
1007 strcpy(fileName, dataBase);
1008 sprintf(intName,"%d.%d",vectSize,commitTag);
1009 strcat(fileName,".VECs.");
1010 strcat(fileName,intName);
1011
1012 if (this->openFile(fileName, theFileStruct, stepSize) < 0) {
1013 opserr << "FileDatastore::recvVectrix() - could not open file\n";
1014 delete [] fileName;
1015 return -1;
1016 } else
1017 theVectFiles.insert(MAP_FILES_TYPE(vectSize, theFileStruct));
1018
1019 delete [] fileName;
1020
1021 } else {

Callers

nothing calls this directly

Calls 6

resetFilePointersMethod · 0.95
resizeDoubleMethod · 0.95
openFileMethod · 0.95
SizeMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected