bpp-phyl3  3.0.0
PartitionSequenceEvolution.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 
8 
9 using namespace std;
10 using namespace bpp;
11 
12 /******************************************************************************/
13 
14 PartitionSequenceEvolution::PartitionSequenceEvolution(
15  std::shared_ptr<SubstitutionProcessCollection> processColl,
16  std::vector<size_t>& posProc) :
17  MultiProcessSequenceEvolution(processColl, vector<size_t>()),
18  vProc_(),
19  vSize_(0),
20  mProcPos_()
21 {
22  size_t i = 0;
23  for (auto nproc : posProc)
24  {
25  if (!processColl_->hasSubstitutionProcessNumber(nproc))
26  throw BadIntegerException("PartitionSequenceEvolution::PartitionSequenceEvolution : unknown process number ", int(nproc));
27  else
28  {
29  vProc_.push_back(nproc);
30  if (mProcPos_.find(nproc) == mProcPos_.end())
31  mProcPos_[nproc] = vector<size_t>();
32  mProcPos_[nproc].push_back(i++);
33  }
34  }
35 
36  vSize_ = posProc.size();
37 
38  for (auto& it : mProcPos_)
39  {
40  nProc_.push_back(it.first);
41  }
42 }
Partial implementation of multiple processes of sequences.
std::vector< size_t > nProc_
the vector of the substitution process numbers, as they are used in this order.
std::shared_ptr< SubstitutionProcessCollection > processColl_
std::vector< size_t > vProc_
vector of the substitution process numbers along the sequence.
std::map< size_t, std::vector< size_t > > mProcPos_
On the reverse, for each process number, the vector of the sites where it is used.
Defines the basic types of data flow nodes.