Loading include/SimulationController.h +1 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ public: void exportConcentrationNumMolecules(double _reactionTime) const; void exportReactionsCount(double _reactionTime) const; void exportPolymers(std::string _prefixFilename, double _reactionTime, bool _binaryExport, bool _writeHeader); void exportPolymerSegments(std::string _filename, int _speciesID, double _molPolymerSegments); void exportLabeledPolymers(std::string _prefixFilename, int _id1, int _id2, uint64_t _filter, double _reactionTime, bool _writeHeader); protected: Loading include/simulation.h +1 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ public: void updateMCRates(); bool exportPolymerSpecies(int _id, const std::string& _filename, FileTypePolymerSpecies _fileType, const kineticModel* _mcPolymerModel) const; bool exportPolymers(int _id, const std::string& _filename, const kineticModel* _mcPolymerModel, uint64_t _numPolymerSegments); const MnMw exportPolymersCLD(const std::string& _filename, const kineticModel* _mcPolymerModel) const; const MnMw exportPolymersCLDHompolymerization(const std::string& _filename, const kineticModel* _mcPolymerModel) const; bool exportPolymersBinary(const std::string& _filename, const kineticModel* _mcPolymerModel) const; Loading src/SimulationController.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -463,6 +463,11 @@ void SimulationController::exportPolymers(std::string _prefixFilename, double _r kMC->exportPolymersCLD(simulationParameter.outputdir + "/" + "Polymers." + to_string(_reactionTime), currentModel); } } void SimulationController::exportPolymerSegments(std::string _filename, int _speciesID, double _molPolymerSegments) { uint64_t numPolymerSegments = currentState->getNumMolecules(_molPolymerSegments); kMC->exportPolymers(_speciesID, _filename, currentModel, numPolymerSegments); } void SimulationController::exportLabeledPolymers(std::string _prefixFilename, int _id1, int _id2, uint64_t _filter, double _reactionTime, bool _writeHeader) { string filename = simulationParameter.outputdir + "/" + _prefixFilename + "Polymers." + to_string(_reactionTime); string filenameFilter = simulationParameter.outputdir + "/" + _prefixFilename + "PolymersFilter." + to_string(_reactionTime); Loading src/simulation.cpp +37 −0 Original line number Diff line number Diff line Loading @@ -703,6 +703,43 @@ bool Simulation::exportPolymerSpecies(int _id, const std::string& _filename, Fil } return false; } bool Simulation::exportPolymers(int _id, const std::string& _filename, const kineticModel* _mcPolymerModel, uint64_t _numPolymerSegments) { int indexMacro = 0; for (auto& elem : macromolSpecies) { if (elem->getID() == _id) { string filenamebin = _filename; ofstream binfile(filenamebin, ofstream::out | ofstream::binary); uint64_t numPolymerSegmentsLeft = _numPolymerSegments; vector<Polymer*> polymerForExport; do { Polymer* p = elem->popPolymerForTransfer(_id); uint64_t numMonomersAll = 0; if (p != nullptr) { for (size_t i = 0; i < solidsContentBalance.solidsContentMoleculeCounter.size(); i++) { uint64_t numMonomers = p->getM(int(i)); uint64_t& currentCount = solidsContentBalance.solidsContentMoleculeCounter[i] -= numMonomers; numMonomersAll += numMonomers; } } polymerForExport.push_back(elem->popPolymerForTransfer(_id)); if (numPolymerSegmentsLeft < numMonomersAll) { numPolymerSegmentsLeft = 0; } else { numPolymerSegmentsLeft -= numMonomersAll; } } while (numPolymerSegmentsLeft > 0); size_t numPolymers = polymerForExport.size(); binfile.write((const char*)&numPolymers, sizeof(size_t)); for (size_t i = 0; i < polymerForExport.size(); i++) { polymerForExport.at(i)->exportPolymer(&binfile); } return true; } ++indexMacro; } return false; } const MnMw Simulation::exportPolymersCLDHompolymerization(const string& _filename, const kineticModel* _mcPolymerModel) const { const vector<speciesObject> speciesObjects = _mcPolymerModel->getSpecies(); vector<string> monomerName; Loading Loading
include/SimulationController.h +1 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ public: void exportConcentrationNumMolecules(double _reactionTime) const; void exportReactionsCount(double _reactionTime) const; void exportPolymers(std::string _prefixFilename, double _reactionTime, bool _binaryExport, bool _writeHeader); void exportPolymerSegments(std::string _filename, int _speciesID, double _molPolymerSegments); void exportLabeledPolymers(std::string _prefixFilename, int _id1, int _id2, uint64_t _filter, double _reactionTime, bool _writeHeader); protected: Loading
include/simulation.h +1 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ public: void updateMCRates(); bool exportPolymerSpecies(int _id, const std::string& _filename, FileTypePolymerSpecies _fileType, const kineticModel* _mcPolymerModel) const; bool exportPolymers(int _id, const std::string& _filename, const kineticModel* _mcPolymerModel, uint64_t _numPolymerSegments); const MnMw exportPolymersCLD(const std::string& _filename, const kineticModel* _mcPolymerModel) const; const MnMw exportPolymersCLDHompolymerization(const std::string& _filename, const kineticModel* _mcPolymerModel) const; bool exportPolymersBinary(const std::string& _filename, const kineticModel* _mcPolymerModel) const; Loading
src/SimulationController.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -463,6 +463,11 @@ void SimulationController::exportPolymers(std::string _prefixFilename, double _r kMC->exportPolymersCLD(simulationParameter.outputdir + "/" + "Polymers." + to_string(_reactionTime), currentModel); } } void SimulationController::exportPolymerSegments(std::string _filename, int _speciesID, double _molPolymerSegments) { uint64_t numPolymerSegments = currentState->getNumMolecules(_molPolymerSegments); kMC->exportPolymers(_speciesID, _filename, currentModel, numPolymerSegments); } void SimulationController::exportLabeledPolymers(std::string _prefixFilename, int _id1, int _id2, uint64_t _filter, double _reactionTime, bool _writeHeader) { string filename = simulationParameter.outputdir + "/" + _prefixFilename + "Polymers." + to_string(_reactionTime); string filenameFilter = simulationParameter.outputdir + "/" + _prefixFilename + "PolymersFilter." + to_string(_reactionTime); Loading
src/simulation.cpp +37 −0 Original line number Diff line number Diff line Loading @@ -703,6 +703,43 @@ bool Simulation::exportPolymerSpecies(int _id, const std::string& _filename, Fil } return false; } bool Simulation::exportPolymers(int _id, const std::string& _filename, const kineticModel* _mcPolymerModel, uint64_t _numPolymerSegments) { int indexMacro = 0; for (auto& elem : macromolSpecies) { if (elem->getID() == _id) { string filenamebin = _filename; ofstream binfile(filenamebin, ofstream::out | ofstream::binary); uint64_t numPolymerSegmentsLeft = _numPolymerSegments; vector<Polymer*> polymerForExport; do { Polymer* p = elem->popPolymerForTransfer(_id); uint64_t numMonomersAll = 0; if (p != nullptr) { for (size_t i = 0; i < solidsContentBalance.solidsContentMoleculeCounter.size(); i++) { uint64_t numMonomers = p->getM(int(i)); uint64_t& currentCount = solidsContentBalance.solidsContentMoleculeCounter[i] -= numMonomers; numMonomersAll += numMonomers; } } polymerForExport.push_back(elem->popPolymerForTransfer(_id)); if (numPolymerSegmentsLeft < numMonomersAll) { numPolymerSegmentsLeft = 0; } else { numPolymerSegmentsLeft -= numMonomersAll; } } while (numPolymerSegmentsLeft > 0); size_t numPolymers = polymerForExport.size(); binfile.write((const char*)&numPolymers, sizeof(size_t)); for (size_t i = 0; i < polymerForExport.size(); i++) { polymerForExport.at(i)->exportPolymer(&binfile); } return true; } ++indexMacro; } return false; } const MnMw Simulation::exportPolymersCLDHompolymerization(const string& _filename, const kineticModel* _mcPolymerModel) const { const vector<speciesObject> speciesObjects = _mcPolymerModel->getSpecies(); vector<string> monomerName; Loading