| 801 | |
| 802 | |
| 803 | int |
| 804 | FileDatastore::sendVector(int dataTag, int commitTag, |
| 805 | const Vector &theVector, |
| 806 | ChannelAddress *theAddress) |
| 807 | { |
| 808 | |
| 809 | if (currentCommitTag != commitTag) |
| 810 | this->resetFilePointers(); |
| 811 | |
| 812 | currentCommitTag = commitTag; |
| 813 | |
| 814 | FileDatastoreOutputFile *theFileStruct; |
| 815 | |
| 816 | // |
| 817 | // next we see if we already have this file; |
| 818 | // if not we need to create data structure & open it |
| 819 | // if we have data structure, need to check file is opened (we close in a commit) |
| 820 | // |
| 821 | |
| 822 | // we first ensure that the Matrix is not too big |
| 823 | int vectSize = theVector.Size(); |
| 824 | int stepSize = sizeof(int) + vectSize*sizeof(double); |
| 825 | |
| 826 | theVectFilesIter = theVectFiles.find(vectSize); |
| 827 | if (theVectFilesIter == theVectFiles.end()) { |
| 828 | |
| 829 | // we first check if we need to resize send buffer |
| 830 | if (vectSize > currentMaxDouble) { |
| 831 | if (this->resizeDouble(vectSize) < 0) { |
| 832 | opserr << "FileDatastore::sendVector() - failed in resizeInt()\n"; |
| 833 | return -1; |
| 834 | } |
| 835 | } |
| 836 | |
| 837 | char *fileName = new char[strlen(dataBase)+21]; |
| 838 | theFileStruct = new FileDatastoreOutputFile; |
| 839 | |
| 840 | if (fileName == 0 || theFileStruct == 0) { |
| 841 | opserr << "FileDatastore::sendVector() - out of memory\n"; |
| 842 | return -1; |
| 843 | } |
| 844 | |
| 845 | static char intName[20]; |
| 846 | strcpy(fileName, dataBase); |
| 847 | sprintf(intName,"%d.%d",vectSize,commitTag); |
| 848 | strcat(fileName,".VECs."); |
| 849 | strcat(fileName,intName); |
| 850 | |
| 851 | if (this->openFile(fileName, theFileStruct, stepSize) < 0) { |
| 852 | opserr << "FileDatastore::sendVector() - could not open file\n"; |
| 853 | delete [] fileName; |
| 854 | return -1; |
| 855 | } else |
| 856 | theVectFiles.insert(MAP_FILES_TYPE(vectSize, theFileStruct)); |
| 857 | |
| 858 | delete [] fileName; |
| 859 | |
| 860 | } else { |
nothing calls this directly
no test coverage detected