PRISMS-PF  v2.1
setTimeStepList.cc
Go to the documentation of this file.
1 #include "../../include/userInputParameters.h"
2 
3 template <int dim>
4 std::vector<unsigned int> userInputParameters<dim>::setTimeStepList(const std::string outputSpacingType, unsigned int numberOfOutputs,
5  const std::vector<unsigned int> & userGivenTimeStepList)
6 {
7  std::vector<unsigned int> timeStepList;
8 
9  if (numberOfOutputs > 0) {
10  if (outputSpacingType == "EQUAL_SPACING"){
11  if (numberOfOutputs > totalIncrements)
12  numberOfOutputs = totalIncrements;
13 
14  for (unsigned int iter = 0; iter <= totalIncrements; iter += totalIncrements/numberOfOutputs){
15  timeStepList.push_back(iter);
16  }
17  }
18  else if (outputSpacingType == "LOG_SPACING"){
19  timeStepList.push_back(0);
20  for (unsigned int output = 1; output <= numberOfOutputs; output++){
21  timeStepList.push_back(round(std::pow(10,double(output)/double(numberOfOutputs)*std::log10(totalIncrements))));
22  }
23  }
24  else if (outputSpacingType == "N_PER_DECADE"){
25  timeStepList.push_back(0);
26  timeStepList.push_back(1);
27  for (unsigned int iter = 2; iter <= totalIncrements; iter++){
28  int decade = std::ceil(std::log10(iter));
29  int step_size = (std::pow(10,decade))/numberOfOutputs;
30  if (iter%step_size == 0){
31  timeStepList.push_back(iter);
32  }
33 
34  }
35  }
36  else if (outputSpacingType == "LIST"){
37  timeStepList = userGivenTimeStepList;
38  }
39  }
40  else {
41  timeStepList.push_back(totalIncrements+1);
42  }
43 
44  return timeStepList;
45 }
46 
47 // Template instantiations
48 #include "../../include/userInputParameters_template_instantiations.h"
std::vector< unsigned int > setTimeStepList(const std::string outputSpacingType, unsigned int numberOfOutputs, const std::vector< unsigned int > &userGivenTimeStepList)