Skip to content

Commit

Permalink
Do the same to splitting functions
Browse files Browse the repository at this point in the history
  • Loading branch information
niclaurenti committed Apr 17, 2024
1 parent 4964260 commit e4a9607
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
18 changes: 9 additions & 9 deletions inc/adani/SplittingFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ class SplittingFunction : public AbstractSplittingFunction {
char GetEntry2() const { return entry2_; };

private:
int order_;
char entry1_;
char entry2_;
const int order_;
const char entry1_;
const char entry2_;

double (SplittingFunction::*reg_)(double, int) const;
double (SplittingFunction::*sing_)(double, int) const;
Expand Down Expand Up @@ -169,12 +169,12 @@ class ConvolutedSplittingFunctions : public AbstractSplittingFunction {
char GetEntry4() const { return entry4_; };

private:
int order1_;
char entry1_;
char entry2_;
int order2_;
char entry3_;
char entry4_;
const int order1_;
const char entry1_;
const char entry2_;
const int order2_;
const char entry3_;
const char entry4_;

double (ConvolutedSplittingFunctions::*reg_)(double, int) const;

Expand Down
13 changes: 2 additions & 11 deletions src/SplittingFunction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,25 @@ AbstractSplittingFunction::~AbstractSplittingFunction(){};
SplittingFunction::SplittingFunction(
const int &order, const char &entry1, const char &entry2
)
: AbstractSplittingFunction() {
: AbstractSplittingFunction(), order_(order), entry1_(entry1), entry2_(entry2) {

// check order
if (order != 0 && order != 1) {
cout << "Error: order must be 0 or 1. Got " << order << endl;
exit(-1);
}
order_ = order;

// check entry1
if (entry1 != 'g' && entry1 != 'q') {
cout << "Error: entry1 must be g or q. Got " << entry1 << endl;
exit(-1);
}
entry1_ = entry1;

// check entry2
if (entry2 != 'g' && entry2 != 'q') {
cout << "Error: entry2 must be g or q. Got " << entry2 << endl;
exit(-1);
}
entry2_ = entry2;

SetFunctions();
}
Expand Down Expand Up @@ -187,49 +184,43 @@ ConvolutedSplittingFunctions::ConvolutedSplittingFunctions(
const int &order1, const char &entry1, const char &entry2,
const int &order2, const char &entry3, const char &entry4
)
: AbstractSplittingFunction() {
: AbstractSplittingFunction() , order1_(order1), entry1_(entry1), entry2_(entry2), order2_(order2), entry3_(entry3), entry4_(entry4){

// check order
if (order1 != 0 && order1 != 1) {
cout << "Error: order1 must be 0 or 1. Got " << order1 << endl;
exit(-1);
}
order1_ = order1;

// check order
if (order2 != 0 && order2 != 1) {
cout << "Error: order2 must be 0 or 1. Got " << order2 << endl;
exit(-1);
}
order2_ = order2;

// check entry1
if (entry1 != 'g' && entry1 != 'q') {
cout << "Error: entry1 must be g or q. Got " << entry1 << endl;
exit(-1);
}
entry1_ = entry1;

// check entry2
if (entry2 != 'g' && entry2 != 'q') {
cout << "Error: entry2 must be g or q. Got " << entry2 << endl;
exit(-1);
}
entry2_ = entry2;

// check entry3
if (entry3 != 'g' && entry3 != 'q') {
cout << "Error: entry3 must be g or q. Got " << entry3 << endl;
exit(-1);
}
entry3_ = entry3;

// check entry4
if (entry4 != 'g' && entry4 != 'q') {
cout << "Error: entry3 must be g or q. Got " << entry4 << endl;
exit(-1);
}
entry4_ = entry4;

SetFunctions();
}
Expand Down

0 comments on commit e4a9607

Please sign in to comment.