81 |
Data u2=Data(u,getFunctionSpace()); |
Data u2=Data(u,getFunctionSpace()); |
82 |
copyInitialValue(u2); |
copyInitialValue(u2); |
83 |
} |
} |
84 |
void AbstractTransportProblem::insertConstraint(Data& source, Data& q, Data& r) const |
void AbstractTransportProblem::insertConstraint(Data& source, Data& q, Data& r, const double factor) const |
85 |
{ |
{ |
86 |
|
if (factor <= 0.) |
87 |
|
throw TransportProblemException("Error - weighting factor must be positive."); |
88 |
source.expand(); |
source.expand(); |
89 |
if (isEmpty()) |
if (isEmpty()) |
90 |
throw TransportProblemException("Error - transport problem is empty."); |
throw TransportProblemException("Error - transport problem is empty."); |
99 |
|
|
100 |
if (r.isEmpty()) { |
if (r.isEmpty()) { |
101 |
Data r2=Data(0.,q.getDataPointShape(),getFunctionSpace()); |
Data r2=Data(0.,q.getDataPointShape(),getFunctionSpace()); |
102 |
copyConstraint(source,q2,r2); |
copyConstraint(source,q2,r2, factor); |
103 |
} else { |
} else { |
104 |
if (((getBlockSize()==1) && (r.getDataPointRank()>0)) || (r.getDataPointRank()>1)) |
if (((getBlockSize()==1) && (r.getDataPointRank()>0)) || (r.getDataPointRank()>1)) |
105 |
throw TransportProblemException("Error - illegal rank of constraint value."); |
throw TransportProblemException("Error - illegal rank of constraint value."); |
106 |
if (r.getDataPointSize()!=getBlockSize()) |
if (r.getDataPointSize()!=getBlockSize()) |
107 |
throw TransportProblemException("Error - block size of transport problem and constraint value don't match."); |
throw TransportProblemException("Error - block size of transport problem and constraint value don't match."); |
108 |
Data r2=Data(r,getFunctionSpace()); |
Data r2=Data(r,getFunctionSpace()); |
109 |
copyConstraint(source,q2,r2); |
copyConstraint(source,q2,r2, factor); |
110 |
} |
} |
111 |
} |
} |
112 |
|
|
113 |
void AbstractTransportProblem::copyConstraint(Data& source, Data& q, Data& r) const |
void AbstractTransportProblem::copyConstraint(Data& source, Data& q, Data& r, const double factor) const |
114 |
{ |
{ |
115 |
throw TransportProblemException("Error - copyConstraint is not available"); |
throw TransportProblemException("Error - copyConstraint is not available"); |
116 |
} |
} |