Exemplo n.º 1
0
 int SerializeConfigIo::loadGroups(Serializable::IArchive& ar,
                                   GroupDistributor<N>& distributor) 
 {
    int nGroup = 0;  // Total number of groups in archive
    if (domain().isMaster()) {  
       ar >> nGroup;
       Group<N>* groupPtr;
       distributor.setup();
       for (int i = 0; i < nGroup; ++i) {
          groupPtr = distributor.newPtr();
          ar >> *groupPtr;
          distributor.add();
       }
       // Send any groups not sent previously.
       distributor.send();
    } else { // If I am not the master processor
Exemplo n.º 2
0
 void LammpsConfigIo::readGroups(std::ifstream& file, 
                const char* sectionLabel, int nGroup,
                GroupDistributor<N>& distributor) 
 {
    if (domain().isMaster()) {  
       file >> Label(sectionLabel);
       Group<N>* groupPtr;
       int i, j, k;
       distributor.setup();
       for (i = 0; i < nGroup; ++i) {
          groupPtr = distributor.newPtr();
          file >> k;
          groupPtr->setId(k-1);
          file >> k;
          groupPtr->setTypeId(k-1);
          for (j = 0; j < N; ++j) {
             file >> k;
             groupPtr->setAtomId(j, k-1);
          }
          distributor.add();
       }
       // Send any groups not sent previously.
       distributor.send();
    } else { // If I am not the master processor