bpp-phyl3  3.0.0
GivenDataSubstitutionProcessSequenceSimulator.cpp
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
6 
7 // From bpp-seq:
9 
10 using namespace bpp;
11 using namespace std;
12 
13 /******************************************************************************/
14 
16  size_t numberOfSites) const
17 {
18  if (numberOfSites > calcul_->getNumberOfSites())
19  throw BadIntegerException("GivenDataSubstitutionProcessSequenceSimulator::simulate. Too many sites to simulate.", (int)numberOfSites);
20 
21  auto seqNames = vSiteSim_[0]->getSequenceNames();
22  auto sites = make_unique<VectorSiteContainer>(seqNames, getAlphabet());
23  sites->setSequenceNames(seqNames, true);
24 
25  for (size_t j = 0; j < numberOfSites; j++)
26  {
27  auto site = vSiteSim_[calcul_->getRootArrayPosition(j)]->simulateSite();
28  site->setCoordinate(static_cast<int>(j));
29  sites->addSite(site);
30  }
31  return sites;
32 }
33 
34 /******************************************************************************/
Defines the basic types of data flow nodes.