LCOV - code coverage report
Current view: top level - core - ExchangePatterns.cpp (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 5 25 20.0 %
Date: 2019-08-13 10:15:31 Functions: 2 7 28.6 %

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2012-2019 The plumed team
       3             :    (see the PEOPLE file at the root of the distribution for a list of names)
       4             : 
       5             :    See http://www.plumed.org for more information.
       6             : 
       7             :    This file is part of plumed, version 2.
       8             : 
       9             :    plumed is free software: you can redistribute it and/or modify
      10             :    it under the terms of the GNU Lesser General Public License as published by
      11             :    the Free Software Foundation, either version 3 of the License, or
      12             :    (at your option) any later version.
      13             : 
      14             :    plumed is distributed in the hope that it will be useful,
      15             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      16             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17             :    GNU Lesser General Public License for more details.
      18             : 
      19             :    You should have received a copy of the GNU Lesser General Public License
      20             :    along with plumed.  If not, see <http://www.gnu.org/licenses/>.
      21             : +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
      22             : #include "ExchangePatterns.h"
      23             : #include "tools/Random.h"
      24             : 
      25             : using namespace std;
      26             : 
      27             : namespace PLMD {
      28             : 
      29        2726 : ExchangePatterns::ExchangePatterns():
      30             :   PatternFlag(NONE),
      31        5452 :   NumberOfReplicas(1)
      32        2726 : {}
      33             : 
      34        2726 : ExchangePatterns::~ExchangePatterns() {
      35        2726 : }
      36             : 
      37           0 : void ExchangePatterns::setNofR(const int nrepl) {
      38           0 :   NumberOfReplicas=nrepl;
      39           0 : }
      40             : 
      41           0 : void ExchangePatterns::setFlag(const int flag) {
      42           0 :   PatternFlag=flag;
      43           0 : }
      44             : 
      45           0 : void ExchangePatterns::getFlag(int &flag) {
      46           0 :   flag=PatternFlag;
      47           0 : }
      48             : 
      49           0 : void ExchangePatterns::setSeed(const int seed)
      50             : {
      51           0 :   random.setSeed(seed);
      52           0 : }
      53             : 
      54           0 : void ExchangePatterns::getList(int *ind)
      55             : {
      56           0 :   switch(PatternFlag)
      57             :   {
      58             :   case RANDOM:
      59           0 :     for(int i=0; i<NumberOfReplicas; i++) {
      60             :       int stat=1;
      61           0 :       while(stat) {
      62             :         stat=0;
      63           0 :         ind[i] = (int) (random.U01()*NumberOfReplicas);
      64           0 :         for(int j=0; j<i; j++) if(ind[i]==ind[j]) stat=1;
      65             :       }
      66             :     }
      67             :     break;
      68             :   case NEIGHBOR:
      69           0 :     for(int i=0; i<NumberOfReplicas; i++) ind[i]=i;
      70             :     break;
      71             :   }
      72           0 : }
      73             : 
      74             : }

Generated by: LCOV version 1.14